QUICK-REF - CsoundManual - Top of this section - Previous - Contents - Index - Next 

A Beginning Tutorial

More about the Orchestra

Suppose we next wished to introduce a small vibrato, whose rate is 1/50 the frequency of the note (i.e. A440 is to have a vibrato rate of 8.8 Hz.). To do this we will generate a control signal using a second oscillator, then add this signal to the basic frequency derived from p5. This might result in the instrument
instr     1

     kamp line      0, p3, 10000
     kvib oscil     2.75, cpspch(p5)/50, 1
     a1   oscil     kamp, cpspch(p5)+kvib, 1
          out       a1
          endin
Here there are two control signals, one controlling the amplitude and the other modifying the basic pitch of the audio oscillator. For small vibratos, this instrument is quite practical; however it does contain a misconception worth noting. This scheme has added a sine wave deviation to the cps value of an audio oscillator. The value 2.75 determines the width of vibrato in cps, and will cause an A440 to be modified about one-tenth of one semitone in each direction (1/160 of the frequency in cps). In reality, a cps deviation produces a different musical interval above than it does below. To see this, consider an exaggerated deviation of 220 cps, which would extend a perfect 5th above A440 but a whole octave below. To be more correct, we should first convert p5 into a true decimal octave (not cps), so that an interval deviation above is equivalent to that below. In general, pitch modification is best done in true octave units rather than pitch-class or cps units, and there exists a group of pitch converters to make this task easier. The modified instrument would be
          instr     1
     ioct =         octpch(p5)
     kamp line      0, p3, 10000
     kvib oscil     1/120, cpspch(p5)/50, 1
     asig oscil     kamp, cpsoct(ioct+kvib), 1
          out       asig
          endin
This instrument is seen to use a third type of orchestra variable, an i-variable. The variable ioct receives its value at an initialization pass through the instrument, and does not change during the lifespan of this note. There may be many such init time calculations in an instrument. As each note in a score is encountered, the event space is allocated and the instrument is initialized by a special pre-performance pass. i-variables receive their values at this time, and any other expressions involving just constants and i-variables are evaluated. At this time also, modules such as line will set up their target values (such as beginning and end points of the line), and units such as oscil will do phase setup and other bookkeeping in preparation for performance. A full description of init-time and performance-time activities, however, must be deferred to a general consideration of the orchestra syntax.
 

QUICK-REF - CsoundManual - Top of this section - Previous - Contents - Index - Next 
HTML Csound Manual - © Jean Piché & Peter J. Nix, 1994-97