Checking the Csound output

A Csound orchestra file named "BP2test.orc" is supplied. It works with any Csound score produced by BP2 in the absence of a Csound instrument description file (-cs.<name> file).

Below is the listing of the default orchestra file.

; This is a simple orchestra file for BP2's default Csound score output
; It follows the new specfications handled by BP2 version 2.7.2 and above.
; (See "Csound tables")

; It contains one single instrument: an oscillator using wave-table 1
; Argument p2 is the start date, p3 the duration (as per the standard)
; Argument p4 is the pitch in octave point pitch-class format
; Volume (range 0..127) is supplied by performance control _volume()
; to arguments p5 (beginning value) and p6 (end value), or via the table
; whose index is supplied by p7.
; Pitchbend is supplied in cents to arguments p8 (beginning value)
; and p9 (end value), or via the table whose index is supplied by p10.

sr = 22050
kr = 2205
ksmps = 10
nchnls = 1

instr 1

ik1 = 32767. / 127.
ik2 = log(2.) / 1200.

ifvol = p7
ifcents = p10

kvol line p5, p3, p6
if (ifvol <= 0) goto volumelin
ilenvol = ftlen(ifvol)
kndxvol line 0, p3, ilenvol
kvol tablei kndxvol, ifvol

volumelin: kcents line p8, p3, p9
if (ifcents <= 0) goto pitchbendlin
ilencents = ftlen(ifcents)
kndxcents line 0, p3, ilencents
kcents tablei kndxcents, ifcents

pitchbendlin: kpitch = cpspch(p4) * exp(kcents * ik2)
kamp = kvol * ik1

a1 oscil kamp, kpitch, 1
out a1

This code should not look esoteric to Csound users. The unique instrument in this orchestra is an oscillator controlled in volume by arguments 5 and 6 (start and end respectively) and in pitch by argument p4 (octave point pitch-class format). Pitchbend corrections are given in cents by arguments 8 and 9 (start and end respectively). In addition, arguments 7 and 10 may contain the references of function tables when complicated variations are described.

We are confident that Csound users will pick up the idea and develop their own instruments taking advantage of BP2 features such as panoramic control, and any additional control they think useful. We hope that convincing examples will be shared between users.

Type cmd-n ("New Project") to flush the current Csound orchestra description and use the default instrument exclusively. Then load "-da.Csoundtest" in the "Data" window.

_volumecont _pitchcont _pitchrange(200) _volume(30) C5 _volume(127) D5 _pitchbend(100) E5 F5 _pitchbend(0)

Select this item and type cmd-p ("Play selection"). Save the resulting score as "BP2test.sco":

; Csound score

f1 0 256 10 1 ; This table may be changed

t 0.000 60.000
i1 0.000 1.000 9.00 30.000 127.000 0.000 0.000 0.000 0.000 ; C5
i1 1.000 1.000 9.02 127.000 127.000 0.000 0.000 0.000 0.000 ; D5
i1 2.000 1.000 9.04 127.000 127.000 0.000 100.000 50.000 0.000 ; E5
i1 3.000 1.000 9.05 127.000 127.000 0.000 50.000 0.000 0.000 ; F5
; this score was created by Bol Processor BP2 (version BP2.7.2)

To close the score file, type cmd-option space (window "Settings") and uncheck "Write csound scores". Now you may open the score with Csound. (If the computer does not have enough memory, first quit BP2.)

Tell Csound to create a sound file using "BP2test.orc" and "BP2test.sco". Listen to the result. (Nothing great. It just works.)

If you are not happy with the buzz you may try to change the waveform in table 1, as explained in §17.6. Apart from being extremely dull, a sine-wave oscillator may yield weird results when several notes are superimposed. Since BP2 provides Csound with events timed within 1ms accuracy, phasing effects modify considerably the perceived balance of mixed sounds.

Beware of computation overflows occuring at the time Csound processes the score file. These are displayed at computation time. It is wise to use _volume(x) with a proper value of 'x' in range 0..127 so that saturation is avoided. A simple method consists in dividing the maximum volume (127) by the estimated number of simultaneous voices, and use the result as a maximum volume for each voice. Use control parameters _volume(K1), _volume(K2)... to avoid repeating numeric data (see §1.9).