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 may vary con­tin­u­ous­ly. We will use sim­ple notes (no sound-object) and no Csound instru­ments file so that all scores may be eas­i­ly con­vert­ed to sound files using the “default.orc” orches­tra file sup­plied with BP3.

Consider the fol­low­ing gram­mar with a metronome set­ting of 60 beats/mn:

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”

Instruction _pitchcont in the begin­ning instructs the inter­preter to inter­po­late pitch­bend val­ues in the whole sequence. This process may be inter­rupt­ed by _pitchstep.

Instruction _pitchrange(200) indi­cates that the pitch may vary between -200 and +200 units, respec­tive­ly mapped to MIDI stan­dard val­ues 0 and +16383 (both log­a­rith­mic). This is the range required by “default.orc” in which inter­vals are mea­sured in cents. There are 1200 cents in one octave. Thus, _pitchbend(100) would raise the fol­low­ing note by a semitone.

Note ‘C5’ is not assigned a pitch­bend val­ue. Default “0” val­ue will be assigned. Notes ‘D5’ and ‘E5’ are pre­ced­ed with _pitchbend(0) assign­ing a “0” val­ue. All pitch­bend vari­a­tions are assigned dur­ing the pro­lon­ga­tion of ‘D5’. How will it be tak­en care of?

The MIDI out­put is decep­tive. Such pitch­bend 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 into account all parameters:

“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, read doc­u­men­ta­tion) labeled 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” des­ig­nates the GEN rou­tine that Csound will use for its inter­po­la­tion (read 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. Values 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 this same way by Bol Processor when pro­duc­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­ter defined in the Csound instru­ments file. See for exam­ple Sarasvati Vina.

Note

There is a workaround for play­ing the same piece with 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 adding a line of silences ‘-‘ put at the right places to receive pitch­bend mod­i­fi­ca­tions. Since 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.