Continuous parameters in Csound scores

The fol­low­ing are sim­ple exam­ples explain­ing the design of Csound scores con­tain­ing instruc­tions to con­trol para­me­ters that can vary con­tin­u­ous­ly. We will use sim­ple notes (no sound-object) and no Csound instru­ment file, so that all scores can eas­i­ly con­vert­ed into sound files using the "default.orc" orches­tra file sup­plied with BP3.

Consider the fol­low­ing gram­mar 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 graph­ic dis­play does not show pitch­bend controls:

Pianoroll and object dis­play of "C5 D5 E5"

The _pitchcont instruc­tion at the begin­ning instructs the inter­preter to inter­po­late pitch­bend val­ues through­out whole sequence. This process can be inter­rupt­ed with _pitchstep.

The _pitchrange(200) instruc­tion indi­cates that the pitch may vary between -200 and +200 units, which are mapped to the MIDI stan­dard val­ues 0 and +16383 (both log­a­rith­mic). This is the range required by "default.orc", which counts inter­vals in cents. There are 1200 cents in an octave. So, _pitchbend(100) would raise the fol­low­ing note by one semitone.

Note: No pitch­bend val­ue is assigned to 'C5'. The default val­ue is '0'. Notes 'D5' and 'E5' are pre­ced­ed by _pitchbend(0), which assigns a '0' val­ue. All pitch­bend vari­a­tions are assigned dur­ing the pro­lon­ga­tion of 'D5'. How is this done?

The MIDI out­put is decep­tive. Pitchbend assign­ments are not tak­en into account in this format:

"C5 D5 E5" in the MIDI output

However, the Csound out­put has tak­en all para­me­ters into account:

"C5 D5 E5" (with pitch­bend assign­ments) in the Csound output

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 doc­u­men­ta­tion) labelled f101 has been cre­at­ed by Bol Processor and insert­ed above 'D5' to spec­i­fy vari­a­tions of the pitch­bend para­me­ter. This table is called by the 10th argu­ment of line 'D5'. Arguments 8 and 9 con­tain the start and end val­ues of pitch­bend accord­ing to "default.orc". These are 0 for all three notes.

The sec­ond argu­ment of the table is the dura­tion of its valid­i­ty, here 1.000 sec­onds. The third argu­ment (256) is its size — always a pow­er of 2. The fourth argu­ment "-7" spec­i­fies the GEN rou­tine that Csound will use for its inter­po­la­tion (see doc­u­men­ta­tion). By default, GEN07 (lin­ear inter­po­la­tion) is used.

Numbers high­light­ed in red indi­cate the val­ues of pitch­bend dur­ing the vari­a­tion: 0, 120, -150, 0. Numbers in black indi­cate the time inter­vals between two val­ues. Note that 102 + 51 + 103 = 256.

All con­tin­u­ous para­me­ters are han­dled in the same way by the Bol Processor when cre­at­ing Csound scores. This includes stan­dard MIDI con­trols (vol­ume, pres­sure, mod­u­la­tion, panoram­ic, pitch­bend) and any addi­tion­al para­me­ters defined in the Csound instru­ment file. See for exam­ple the page Sarasvati Vina.

Note

There is a workaround for play­ing the same piece with the cor­rect pitch­bend 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 poly­met­ric struc­ture, with a line of silences '-' placed in the right places to receive pitch­bend mod­i­fi­ca­tions. As pitch­bend mod­i­fies all sounds on the cur­rent MIDI chan­nel it will also mod­i­fy 'D5' dur­ing its pro­lon­ga­tion. The fol­low­ing is a MIDI ren­der­ing on PianoTeq — at a high­er speed, so that 'D5' remains audible:

C5 D5 E5 in the MIDI for­mat with pitch­bend effects on D5

Leave a Reply

Your email address will not be published. Required fields are marked *