The following are simple examples explaining the design of Csound scores containing instructions to control parameters that can vary continuously. We will use simple notes (no sound-object) and no Csound instrument file, so that all scores can easily converted into sound files using the "default.orc" orchestra file supplied with BP3.
Consider the following grammar with the metronome set to 60 beats per minute:
S --> _pitchcont _pitchrange(200) C5 _pitchbend(0) D5 _ _pitchbend(120) _ _pitchbend(-150) _ _ _pitchbend(0) E5
The graphic display does not show pitchbend controls:
The _pitchcont instruction at the beginning instructs the interpreter to interpolate pitchbend values throughout whole sequence. This process can be interrupted with _pitchstep.
The _pitchrange(200) instruction indicates that the pitch may vary between -200 and +200 units, which are mapped to the MIDI standard values 0 and +16383 (both logarithmic). This is the range required by "default.orc", which counts intervals in cents. There are 1200 cents in an octave. So, _pitchbend(100) would raise the following note by one semitone.
Note: No pitchbend value is assigned to 'C5'. The default value is '0'. Notes 'D5' and 'E5' are preceded by _pitchbend(0), which assigns a '0' value. All pitchbend variations are assigned during the prolongation of 'D5'. How is this done?
The MIDI output is deceptive. Pitchbend assignments are not taken into account in this format:
However, the Csound output has taken all parameters into account:
How does Csound process this phrase? Let us look at the Csound score:
t 0.000 60.000
i1 0.000 1.000 9.00 90.000 90.000 0.000 0.000 0.000 0.000 ; C5
f101 1.000 256 -7 0.000 102 120.000 51 -150.000 103 0.000
i1 1.000 5.000 9.02 90.000 90.000 0.000 0.000 0.000 101.000 ; D5
i1 6.000 1.000 9.04 90.000 90.000 0.000 0.000 0.000 0.000 ; E5
s
e
A table (Function Table Statement, see documentation) labelled f101 has been created by Bol Processor and inserted above 'D5' to specify variations of the pitchbend parameter. This table is called by the 10th argument of line 'D5'. Arguments 8 and 9 contain the start and end values of pitchbend according to "default.orc". These are 0 for all three notes.
The second argument of the table is the duration of its validity, here 1.000 seconds. The third argument (256) is its size — always a power of 2. The fourth argument "-7" specifies the GEN routine that Csound will use for its interpolation (see documentation). By default, GEN07 (linear interpolation) is used.
Numbers highlighted in red indicate the values of pitchbend during the variation: 0, 120, -150, 0. Numbers in black indicate the time intervals between two values. Note that 102 + 51 + 103 = 256.
All continuous parameters are handled in the same way by the Bol Processor when creating Csound scores. This includes standard MIDI controls (volume, pressure, modulation, panoramic, pitchbend) and any additional parameters defined in the Csound instrument file. See for example the page Sarasvati Vina.
Note
There is a workaround for playing the same piece with the correct pitchbend changes in MIDI. Change the rule to:
S --> _pitchcont _pitchrange(200) {C5 D5 _ _ _ _ E5, - _pitchbend(0) - _ _pitchbend(120) - _pitchbend(-150) - _ _pitchbend(0) -}
This is the same piece in a polymetric structure, with a line of silences '-' placed in the right places to receive pitchbend modifications. As pitchbend modifies all sounds on the current MIDI channel it will also modify 'D5' during its prolongation. The following is a MIDI rendering on PianoTeq — at a higher speed, so that 'D5' remains audible: