Csound as a patch bay
By now, you should be getting a sense of what Csound is capable of doing. One of the reasons why it is such a powerful tool for sound synthesis is that it is so versatile. Any opcode is capable of using other opcodes in its parameters. This section will cover some of the more basic sound modification tools and effects processors one can design with this software.
Enveloping/shaping a sound
One of the keys to designing interesting sounds is to give it some kind of shape. All sounds occurring in nature have an inherent attack and decay, and designed sounds should follow that rule. Enveloping a sound creates a rise and decay
The function linen can be used to create a simple linear envelope. Its usage in the orchestra file looks like this:
iamp = Desired
amplitude at the highest point
idur = Total duration of the amplitude envelope, in seconds or beats. Usually equal to p3.
irise = Attack time (in seconds or beats)
idecay = Decay time (in seconds or beats)
By applying an envelope to this simple sound:
that sound will have a natural rise and fall. Additionally, one can shape the frequency (or any other element of the sound) by using linear or exponential envelope shaping opcodes:
|kenv||linen||p4,||p3/4,||p3,||p3/4||;linear envelope for amplitude|
|kgliss||linseg||p5,||p3/2,||p5/2,||p3/2,||p5||;gliss to 1/2 frequency and back|
|asig||oscil||kenv,||kgliss,||1||;kgliss becomes the oscil's frequency|
For more information on the linear and exponential envelope shaping opcodes, consult the Csound reference manual. The most useful envelope-shaping opcodes are the following:
line, expon: single ascending or descending shape, linear or exponential
linseg, expseg: allows for multiple cases of ascending or descending motion
5d. Chorusing and vibrato
Chorusing effects happen when you play back two or three copies of a sound, each copy at a slightly different frequency than the other. This effect "fattens" up a sound, making it fuller and more pronounced in a mix. Adding a chorusing effect in Csound is as simple as creating three (or more) separate oscillators, each just slightly out of tune with each other, as in the following orchestra code:
|iamp||=||p4 / 3||;with 3 oscillators, you need to divide|
|ifreq||=||cpspch(p5)||;cpspch() = freqency in oct.note form|
|asig2||oscil||iamp,||(ifreq*1.003),||1||;detuned slightly higher|
|asig3||oscil||iamp,||(ifreq*.997),||1||;detuned slightly lower|
|asigmix||=||asig1 +||asig2 +||asig3||;add the signals together...|
|out||asigmix||;...and send it to the output|
The cpspch(p5)statement simply means translate the frequency from pch form (O.nn, where O is the octave and nn is the note number, starting with C and moving up chromatically) into cps form (Hz)
One can also easily add vibrato, a slow and slight wavering of the sound's frequency which adds warmth and richness to the sound. This is done by adding a second oscillator to the main audio signal:
|asig||oscil||iamp,||ifreq + kvib,||1|
5e. Panning and using multiple output channels
So far we have sent sounds to a single output. Csound is capable of sending sounds to stereo, quadraphonic, octaphonic, or other sets of speaker outputs. The nchnls setting in the orchestra header needs to be set to the number of outputs (1, 2, 4, ...), and each instrument needs an out statement that reflects the number of channels used. The different output statements are:
out - Monophonic output.
outs - Stereo output. There must be two variables following this statement. The composer can specify individual outputs by using outs1 and outs2 (for left and right, respectively).
outq - Quadraphonic output - requires four statements. Can specify individual outputs with outq1, outq2, etc...
outo - Octaphonic output - requires eight statements.
5f. Adding reverb
Reverberation in Csound is done globally, which introduces the concept of the global variable. This topic is covered as one of Richard Boulanger's TOOTorials, seen here. There will be an explanation and example here in the future.
This topic will be covered in the future.
5h. Crossfading and spectral fusion
With proper use of the linseg opcode, one can create an instrument by fusing together distinct signal-generating opcodes.
Return to Table of Contents.