The following is an example of successful association of Bol Processor with Csound. Both software packages for music composition are still in development after almost 4 decades… Csound was originally written by Barry Vercoe at MIT in 1985, whereas Bol Processor dates back to 1981.
Short musical phrases have been composed in 1995 by Srikumar Karaikudi Subramanian, an accomplished practitioner of Carnatic music with deep understanding of maths and physics — read his blog and list of patents.
Listen to the result:
The manufacture of this example requires a 33-millisecond waveform sample of Sarasvati vīna (vina-wave-table.aif) and a grammar (-gr.vina3) associated with a Csound instrument description (-cs.Vina). All these are handled by Bol Processor in both BP2 and BP3 versions. This process produces a Csound score which Csound converts to a sound file using a Csound orchestra file (new-vina.orc).
The demo had been initially designed on Bol Processor BP2, the standalone application still available for Mac computers. In October 2020 it was reiterated on BP3, the multiplatform version under development, to check the validity of Csound procedures in the new environment.
Grammar “-gr.vina3″ is available with all required ingredients in the sample set bp3-ctests-main.zip shared on GitHub. Follow instructions on Bol Processor ‘BP3’ and its PHP interface to install BP3 and learn its basic operation. Download and install Csound from its distribution page.
Grammar “-gr.vina3” is shown below.
This grammar is interesting for its usage of variables representing “musical gestures” ahead of their sound rendering. Thus, “Pull0”, “Pull1” and “Pulll2” are different ways of pulling the string to raise its pitch. This is reflected by changing the value of a pitchbender, which is a standard of MIDI and has been reproduced in the Csound orchestra.
Another gesture is named “slide”, here meaning the movement of one fret to the next one. It also has an effect on the frequency of the note, although in a discontinuous manner because the movement is a rapid change.
A more sophisticated model could include the strength of plucking a note which may be mapped to a parameter resembling the velocity parameter in MIDI.
The Csound score
Once the grammar is open in the BP3/PHP interface environment, clicking “Produce item(s)” creates (by default) a Csound score named “vina3.sco” shown below.
Note that the first line of this score — table “f1″ — contains the link to the “vina-wave-table.aiff” sampled waveform and the Csound orchestra file “new-vina.orc” located in the same folder. Value “1” in the fourth argument indicates that data is transfered from a soundfile into a function table (see documentation).
Lines starting with “i1″ are note statements submitted to the “vina” instrument to produce notes ‘C3’, ‘G3’, ‘F4’ etc. The second and third arguments are the starting time and duration respectively (see documentation). The fourth argument is the pitch expressed as “octave.note”: for instance, “7.05” means the 7th note of octave 7, which is F3. Pitch could also be specified in Herz with respect to ‘A4′ = 440Hz — see Csound tuning in BP3.
Statements “f102″, “f103″ etc. describe tables used for the interpolation of pitchbend and “slide” parameters associated with the “vina” instrument. In the settings of the “slide” parameter, the table index is the 13th argument. In effect, the 13th parameter of instructions “i1” contains “101”, “103” etc. In each of these tables, the fourth argument indicates the GEN routine that Csound will use for its interpolation. Value “-7” means “GENO7″ (linear interpolation) with no post-normalization (read documentation).
Statements “f102″, “f104″ etc. are tables for the interpolation of pitchbender values. These are referred in the 10th argument of “i1″ events, as shown on the picture. We see that the range of MIDI values [0 .. 16383] is mapped to [-500 .. +500] used by the Csound instrument, both being logarithmic scales. The central mapping of 8191.50 to 0 is used for constructing this interpolation with a quadratic regression. Read page Csound argument mapping for a detailed explanation.
For example, in this event:
i1 4.750 0.656 7.07 90.000 90.000 0.000 0.000 100.000 104.000 0.000 0.000 105.000 ; G3
table “f104″ (10th argument) is invoked for interpolating pitchbend values between 0.000 and 100.000 (the 8th and 9th arguments). In event:
i1 21.000 1.000 7.05 90.000 90.000 0.000 0.000 0.000 0.000 0.000 201.000 117.000 ; F3
table “f117″ (13th argument) is invoked to interpolate the “slide” parameter between 0.000 and 201.000 (the 11th and 13th arguments). However, in the “new-vina.orc” orchestra file, this parameter is not treated as continuous because it represents a quick move from a fret to the next one. Therefore, instruction _cont(slide) is irrelevant to this version of the grammar. It could be deleted or replaced with _step(slide).
Making the sound file
Open a console and reach the folder containing “vina3.sco” and “new-vina.orc”.
csound -o Vina3.aif new-vina.orc out.sco
If the operation is successful — as confirmed by messages on the console — the desired sound file “Vina3.aif” has been created.
WAV format, 24-bit resolution etc. are also available with Csound. Type a plain “csound” to see a few options or “csound --help” to see the complete list.
By default, Csound displays messages imitating the graphic rendering of all tables used in the score. This option can be disabled.
This whole process of converting a Csound score to a sound file has been rendered automatic on the interface of Bol Processor BP3. If Csound has been installed and is responsive, it is called to do the conversion. The sound file it is instructed to create is in the WAV format because this format (unlike AIFF) is recognized by the <audio> tag in HTML5. Therefore, sound files created in this way are directly accessible to listening on the interface’s page.
An important feature of this example is the choice of a microtonal scale in replacement of the equal-tempered 12-tone scale commonly used on electronic or modern keyboard instruments. In BP3 it is possible to define microtonal scales using Csound function tables which are automatically inserted on top of the Csound score. For instance, a “just intonation” scale may be defined as follows:
f2 0 128 -51 12 2 264 60 1 1.066 1.125 1.2 1.25 1.333 1.42 1.5 1.6 1.666 1.777 1.875
Numbers in red denote frequency ratios. Thus, for instance, the size of the fifth (C - G) is 1.333 = 4/3 which makes it “perfect”. Listen to both interpretations in just intonation and equal-tempered tunings:
Was it worth?
Apart from using a sample of real Sarasvati vīna sound to create the musical piece, is it worth opting for the Csound environment in replacement of MIDI on the Bol Processor? After all, any MIDI sampler could handle the waveform and render the same sound as Csound…
We do not have a MIDI sampler to reproduce the sound of a Sarasvati vīna, but “-gr.vina3″ can be instructed to produce a MIDI file and play it on a MIDI device. The following is a rendering on PianoTeq:
Listening to this version makes it clear that pitchbend instructions have been partly interpreted whereas the “slide” parameter specific to the “vina” Csound instrument was ignored. This confirms that Csound brings the possibility of enhancing the description of any piece of music with performance parameters that do not belong to standard MIDI categories: pitchbend, modulation, pressure etc.
We documented all features of the Csound implementation in articles Csound checkup and Csound objects, showing examples that can be checked with the evaluation version of BP3. More details on the handling of continuous parameters will be found on page Continuous parameters in Csound scores.
A call for participation
We invite musicians conversant with Csound to design examples of the full usage of Csound on Bol Processor. This will increase our confidence that none of the implemented Csound features is incomplete or faulty.
A set of examples exposing all possible ways of controlling Csound parameters in the Bol Processor environment is available on this page.
➡ Development of Csound beyond our initial work on the topic (in 1995) is expected to trigger new ideas for a more advanced integration in future versions of BP3.