Sarasvati vina

Sarasvati vīna. Source: Wikipedia

The following is an example of successful combination of Bol Processor and Csound. Both music creation software packages are still in development after four decades… Csound was originally written by Barry Vercoe at MIT in 1985, while Bol Processor dates back to 1981.

Short musical phrases were composed in 1995 by Srikumar Karaikudi Subramanian, an accomplished practitioner of Carnatic music with deep understanding of mathematics and physics — read his blog, PhD thesis (2013) and list of patents.

Listen to the result:

"Pallavi" of song "Maayaatiita Svaruupini, Nannu brovave" in raga "mayamaalavagaula". (The fadeout is post-produced.)

The making 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 this is handled by the Bol Processor in both BP2 and BP3 versions. This process produces a Csound score which Csound converts into a sound file using a Csound orchestra file (new-vina.orc).

The demo was initially developed on Bol Processor BP2, the standalone application still available for Mac computers. In October 2020, it was repeated on BP3, the multi-platform version, to check the validity of Csound procedures in the new environment.

The grammar

The grammar "-gr.vina3" is available with all the necessary ingredients in the example set bp3-ctests-main.zip shared on GitHub. Follow the instructions on the Bol Processor ‘BP3’ and its PHP interface page to install BP3 and learn its basic operation. Download and install Csound as instructed.

The grammar "-gr.vina3" is shown below.

-se.Vina3
-cs.Vina
-to.Vina

// "Pallavi" of song "Maayaatiita Svaruupini, Nannu brovave" in raga "mayamaalavagaula"
// scale - C, C#, E, F, G , G#, B
// Note phrase variations given.

// Terms:
// Spuritam - Quick (discrete) two note succession.
// Taalam - Measure of time (played on vina using the 3 sympathetic strings tuned to C-G-C).
// Gamaka - Smooth motion between two pitches (usually pull of string).
// Pallavi - Theme of composition

ORD

gram#1[1] S --> _ins(Vina) _scale(just intonation,0) {Taalam4 Taalam4, Pallavi Pallavi} Taalam

gram#1[2] Pallavi --> {Maa Yaa Tii • Ta {2, Sva Ruu Pi}•{2, Ni} {1, Nan Nu}• Bro {2, Va Ve}}
gram#1[3] Maa --> C3
gram#1[4] Yaa --> LongSpuritam C3 Slide1
gram#1[5] Tii --> {1, StartSlidePull C3 Slide1 _ _ Slide1 Pull0 _ Slide4 • Pull1 _ Pull0 •Pull0 Pull1 - StopSlidePull }
gram#1[6] Ta --> F3
gram#1[7] Sva --> {3, G3}
gram#1[9] Ruu --> {3, StartSlidePull G3 SlideBack2 _ SlideBack3 _ SlideBack2 • _ SlideBack3 Pull0 _ Pull1 - StopSlidePull}
gram#1[10] Pi --> {2, F3}
gram#1[11] Ni --> G3
gram#1[12] Nan --> G3
gram#1[13] Nu --> {1, StartPull Pull1 G3 Pull0 _ Pull1 - StopPull}
gram#1[14] Bro --> {1, StartSlide F3 Slide2 _ _ _ StopSlide} /slideVa/
gram#1[15] Bro --> {1, GamakaHold F3 Pull2} /pullVa/
gram#1[16] /slideVa/ Va --> StartSlide G3 SlideBack2 StopSlide
gram#1[17] /pullVa/ Va --> StartPull Pull2 F3 Pull0 StopPull
gram#1[18] Ve --> {3, Ve1 Ve2 Ve3}
gram#1[19] Ve1 --> {5, GamakaOscil E3 Pull1}
gram#1[20] Ve2 --> StartSlide C#3 SlideBack1 _ StopSlide
gram#1[21] Ve3 --> StartPull B2 Pull1 StopPull

RND
gram#2[1] Taalam4 --> Taalam Taalam Taalam Taalam
gram#2[2] Taalam --> {3, C3, G3, C4}

SUB1

gram#3[1] LongSpuritam ?1 ?2 --> {1, StartSlide ?1 _ Slide0 _ ?2 }
gram#3[2] GamakaOscil ?1 ?2 --> {StartPull ?1 ?2 Pull0 _ ?2 _ Pull0 _ ?2 StopPull}
gram#3[3] GamakaHold ?1 ?2 --> {1, StartPull ?1 ?2 _ _ _ StopPull}

SUB1

gram#4[1] StartSlidePull --> StartSlide StartPull
gram#4[2] StopSlidePull --> StopSlide StopPull

SUB1

// Lowest level structures

gram#5[1] Pull0 --> _pitchbend(0)
gram#5[2] Pull1 --> _pitchbend(100)
gram#5[3] Pull2 --> _pitchbend(200)

gram#5[4] Slide0 --> _value(slide, 0)
gram#5[5] SlideBack1 --> _value(slide, -101)
gram#5[6] SlideBack2 --> _value(slide, -201)
gram#5[7] SlideBack3 --> _value(slide, -301)
gram#5[8] Slide1 --> _value(slide, 101)
gram#5[9] Slide2 --> _value(slide, 201)
gram#5[10] Slide4 --> _value(slide, 401)

gram#5[11] StartSlide --> _cont(slide) _value(slide, 0)
gram#5[12] StopSlide --> _fixed(slide)
gram#5[13] StartPull --> _pitchcont _pitchrange(500) _pitchbend(0)
gram#5[14] StopPull --> _pitchfixed

This grammar is exemplary for its use of variables that represent "musical gestures" before their sound representation. For example, "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 MIDI standard and has been reproduced in the Csound orchestra.

Another gesture is named "slide", which is the movement from one fret to the next one. It also affects the frequency of the note, but in a discontinuous way, because the movement is a rapid change.

A more sophisticated model might include the strength of the plucking of a note, which could be mapped to a parameter similar to the velocity parameter in MIDI.

The Csound score

Once the grammar is open in the BP3/PHP interface environment, clicking on "Produce item(s)" will (by default) create a Csound score named "vina3.sco", as shown below.

; Csound score
f1 0 256 1 "vina-wave-table.aiff" 0 4 0

t 0.000 60.000
i1 0.000 1.000 7.00 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; C3
f101 1.000 512 -7 0.000 256 -101.000 128 101.000 128 101.000
i1 1.000 1.000 7.00 90.000 90.000 0.000 0.000 0.000 0.000 0.000 101.000 101.000 ; C3
f102 2.000 256 -7 0.000 76 0.000 25 100.000 51 0.000 51 0.000 53 100.000
f103 2.000 256 -7 0.000 25 101.000 51 101.000 25 401.000 155 0.000

i1 2.000 0.833 7.00 90.000 90.000 0.000 0.000 100.000 102.000 0.000 0.000 103.000 ; C3
i1 0.000 3.000 7.00 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; C3
i1 0.000 3.000 7.07 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; G3
i1 0.000 3.000 8.00 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; C4
i1 3.000 1.000 7.05 90.000 90.000 0.000 0.000 0.000 0.000 401.000 401.000 0.000 ; F3
i1 4.000 0.750 7.07 90.000 90.000 0.000 0.000 0.000 0.000 401.000 401.000 0.000 ; G3
f104 4.750 1024 -7 0.000 877 0.000 147 100.000
f105 4.750 1024 -7 0.000 146 -201.000 146 -301.000 146 -201.000 438 -301.000 148 0.000
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
i1 3.000 3.000 7.00 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; C3
i1 3.000 3.000 7.07 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; G3
i1 3.000 3.000 8.00 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; C4
i1 5.500 0.500 7.05 90.000 90.000 0.000 0.000 0.000 0.000 -345.444 -345.444 0.000 ; F3
i1 6.000 2.000 7.07 90.000 90.000 0.000 0.000 0.000 0.000 -345.444 -345.444 0.000 ; G3
i1 8.000 0.500 7.07 90.000 90.000 0.000 0.000 0.000 0.000 -345.444 -345.444 0.000 ; G3
f106 8.500 256 -7 100.000 128 0.000 128 100.000
i1 8.500 0.333 7.07 90.000 90.000 0.000 100.000 100.000 106.000 -345.444 -345.444 0.000 ; G3
i1 6.000 3.000 7.00 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; C3
i1 6.000 3.000 7.07 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; G3
i1 6.000 3.000 8.00 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; C4
f107 9.000 512 -7 0.000 128 201.000 384 201.000
i1 9.000 1.000 7.05 90.000 90.000 0.000 0.000 0.000 0.000 0.000 201.000 107.000 ; F3
f108 10.000 1024 -7 0.000 256 -201.000 768 -201.000
i1 10.000 0.500 7.07 90.000 90.000 0.000 0.000 0.000 0.000 0.000 -201.000 108.000 ; G3
f109 10.500 1024 -7 0.000 204 100.000 204 0.000 204 100.000 204 0.000 208 100.000
i1 10.500 0.937 7.04 90.000 90.000 0.000 0.000 100.000 109.000 -201.000 -201.000 0.000 ; E3
f110 11.437 512 -7 0.000 256 -101.000 256 0.000
i1 11.437 0.375 7.01 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 110.000 ; C#3
i1 9.000 3.000 7.00 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; C3
i1 9.000 3.000 7.07 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; G3
i1 9.000 3.000 8.00 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; C4
i1 11.812 0.188 6.11 90.000 90.000 0.000 0.000 33.333 0.000 -101.000 -101.000 0.000 ; B2
i1 12.000 1.000 7.00 90.000 90.000 0.000 0.000 0.000 0.000 -101.000 -101.000 0.000 ; C3
f111 13.000 512 -7 0.000 256 -101.000 128 101.000 128 101.000
i1 13.000 1.000 7.00 90.000 90.000 0.000 0.000 0.000 0.000 0.000 101.000 111.000 ; C3
f112 14.000 256 -7 0.000 76 0.000 25 100.000 51 0.000 51 0.000 53 100.000
f113 14.000 256 -7 0.000 25 101.000 51 101.000 25 401.000 155 0.000

i1 14.000 0.833 7.00 90.000 90.000 0.000 0.000 100.000 112.000 0.000 0.000 113.000 ; C3
i1 12.000 3.000 7.00 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; C3
i1 12.000 3.000 7.07 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; G3
i1 12.000 3.000 8.00 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; C4
i1 15.000 1.000 7.05 90.000 90.000 0.000 0.000 0.000 0.000 401.000 401.000 0.000 ; F3
i1 16.000 0.750 7.07 90.000 90.000 0.000 0.000 0.000 0.000 401.000 401.000 0.000 ; G3
f114 16.750 512 -7 0.000 472 0.000 40 100.000
f115 16.750 512 -7 0.000 236 -201.000 236 -301.000 40 0.000

i1 16.750 0.468 7.07 90.000 90.000 0.000 0.000 100.000 114.000 0.000 0.000 115.000 ; G3
i1 15.000 3.000 7.00 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; C3
i1 15.000 3.000 7.07 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; G3
i1 15.000 3.000 8.00 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; C4
i1 17.500 0.500 7.05 90.000 90.000 0.000 0.000 0.000 0.000 -351.000 -351.000 0.000 ; F3
i1 18.000 2.000 7.07 90.000 90.000 0.000 0.000 0.000 0.000 -351.000 -351.000 0.000 ; G3
i1 20.000 0.500 7.07 90.000 90.000 0.000 0.000 0.000 0.000 -351.000 -351.000 0.000 ; G3
f116 20.500 256 -7 100.000 128 0.000 128 100.000
i1 20.500 0.333 7.07 90.000 90.000 0.000 100.000 100.000 116.000 -351.000 -351.000 0.000 ; G3
i1 18.000 3.000 7.00 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; C3
i1 18.000 3.000 7.07 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; G3
i1 18.000 3.000 8.00 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; C4
f117 21.000 512 -7 0.000 128 201.000 384 201.000
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
f118 22.000 1024 -7 200.000 256 0.000 768 0.000
i1 22.000 0.500 7.05 90.000 90.000 0.000 200.000 0.000 118.000 0.000 0.000 0.000 ; F3
f119 22.500 1024 -7 0.000 204 100.000 204 0.000 204 100.000 204 0.000 208 100.000
i1 22.500 0.937 7.04 90.000 90.000 0.000 0.000 100.000 119.000 0.000 0.000 0.000 ; E3
f120 23.437 512 -7 0.000 256 -101.000 256 0.000
i1 23.437 0.375 7.01 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 120.000 ; C#3
i1 21.000 3.000 7.00 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; C3
i1 21.000 3.000 7.07 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; G3
i1 21.000 3.000 8.00 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; C4
i1 23.812 0.188 6.11 90.000 90.000 0.000 0.000 33.333 0.000 -101.000 -101.000 0.000 ; B2
i1 24.000 3.000 7.00 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; C3
i1 24.000 3.000 7.07 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; G3
i1 24.000 3.000 8.00 90.000 90.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ; C4
s
e


Settings of "slide" in "vina"

Note that the first line of this score — table "f1" — contains the link to the sampled waveform "vina-wave-table.aiff" and the Csound orchestra file "new-vina.orc" located in the same folder. The value "1" in the fourth argument indicates that data from a sound file will be transferred into a function table (see documentation).

Lines starting with "i1" are note instructions submitted to the instrument "vina" to produce notes 'C3', 'G3', 'F4' etc. The second and third arguments are the start time and duration respectively (see documentation). The fourth argument is the pitch, expressed as "octave.note": for example, "7.05" means the 7th note of octave 7, which is F3. The pitch could also be given in Herz with respect to 'A4' = 440Hz — see Csound tuning in BP3.

Instructions "f102", "f103" etc. describe tables used for the interpolation of pitchbend and "slide" parameters associated with the "vina" instrument. In the "slide" parameter settings, the table index is the 13th argument. In fact, the 13th parameter of the "i1" instructions contains "101", "103" etc. In each of these tables, the fourth argument indicates the GEN routine that Csound will use for its interpolation. The value "-7" means "GENO7" (linear interpolation) with no post-normalization (see documentation).

Pitchbender settings of instrument "vina"

Instructions "f102", "f104" etc. are tables for interpolating pitchbender values. These are referenced in the 10th argument of "i1" events, as shown in the picture. We see that the range of MIDI values [0 .. 16383] is mapped to the [-500 .. +500] interval used by the Csound instrument, both being logarithmic scales. The central mapping of 8191.50 to 0 is used to construct this interpolation with a quadratic regression. See the Csound argument mapping page 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

the table "f104" (10th argument) is invoked to interpolate 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

the table "f117" (13th argument) is used to interpolate the "slide" parameter between 0.000 and 201.000 (the 11th and 13th arguments). However, in the orchestra file "new-vina.orc", this parameter is not treated as continuous because it represents a quick move from one fret to the next. Therefore, the _cont(slide) instruction is irrelevant for this version of the grammar. It could be deleted or replaced by _step(slide).

Making the sound file

Open a Unix console and go to the folder containing "vina3.sco" and "new-vina.orc".

Type :

csound -o Vina3.aif new-vina.orc out.sco

Running Csound on a console: the termination of a successful process

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. Just type "csound" to see some options, or "csound --help" to see the full list.

By default, Csound displays messages that mimic the graphical representation of all tables used in the score. This option can be turned off.

This whole process of converting a Csound score into a sound file has been made automatic on the Bol Processor BP3 interface. If Csound is installed and responding, it will be called to do the conversion. The sound file it is instructed to create is in WAV format.

Microtonal intonation

An important feature of this example is the choice of a microtonal scale to replace the equal tempered 12 tone scale commonly used on electronic or modern keyboard instruments. The scale is defined in the tonal resource "-to.Vina" and is set by the instruction _scale(just intonation,0).

In BP3 it is possible to define microtonal scales and use them either in the MIDI or the Csound environment. (Read the MIDI microtonality page.) Csound uses function tables, which are automatically superimposed on the Csound score. For example, a "just intonation" scale can 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 indicate frequency ratios. For example, 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 temperament:

Just intonation
Equal-tempered intervals

Discussion

This detailed interpretation of a musical phrase in Carnatic music was just an early demonstration of Bol Processor + Csound features. In 2013, Srikumar Karaikudi Subramanian submitted his PhD thesis to the National University of Singapore entitled Modeling Gamakās of Carnatic Music as a Synthesizer for Sparse Prescriptive Notation. He went on to develop the Pāṭāntarā system of high-quality Carnatic music notation.

Apart from using a sample of the real Sarasvati vīna sound to create the musical piece, is it worth using the Csound environment instead of MIDI on the Bol Processor? After all, any MIDI sampler could handle the waveform and produce 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 played on a MIDI device, either in real time or via a MIDI file. The following is a rendering on PianoTeq:

(Dreadful) rendering of -gr.vina3 on a MIDI device. Sorry Srikumar! 😀

Listening to this version, it is clear that the pitchbend instructions have been partially interpreted, while the "slide" parameter specific to the "vina" Csound instrument has been ignored. This confirms that Csound offers the possibility of enriching the description of any piece of music with performance parameters that do not belong to the standard MIDI categories: pitchbend, modulation, pressure, etc.

We have documented all the features of the Csound implementation on the Csound checkup and Csound objects page, showing examples that can be checked with BP3. More details on the handling of continuous parameters can be found on the page Continuous parameters in Csound scores.

A call for participation

We invite musicians who are familiar with Csound to create examples of the full use of Csound on Bol Processor. This will increase our confidence that none of the implemented Csound features are incomplete or erroneous.

➡  The development of Csound beyond our initial work on the subject (in 1995) is expected to stimulate new ideas for more advanced integration in future versions of BP3.

Start with Bol Processor

Bol Processor BP3 logo

    
You have just installed the Bol Processor. Welcome! This page is a guided tour for your first hour with it. You will play some music, look at how it is written, and change a few things to hear what happens. No programming skills are needed.

In a few words, the Bol Processor creates music from texts. A text can be:

  • a score that tells exactly what to play, written in a compact notation. These texts are stored in Data projects;
  • a grammar, i.e. a set of rules that build musical pieces step by step, often with a share of chance. These are Grammar projects.

The music can be heard as a MIDI file (with the built-in player), sent in real time to a MIDI instrument or to Csound , or turned into a Csound score that produces a WAV sound file. You can also import existing music from MusicXML scores.

👉 The sections are meant to be read in order, but you can skip any of them. Each one ends with links to the pages of the Tutorials and Examples menus that take you further.

Before you start

If the Bol Processor is not yet installed, follow the instructions on the Install BP3 page for MacOS, Windows or Linux. Csound is optional: you can install it later.

  • Start your Apache/PHP server (MAMP or XAMPP) and point your web browser at http://localhost/bolprocessor/php/ (note "http", not "https"). If you are using the standalone "BolProcessor.app" on MacOS, just start it.
  • The home page checks your installation and tells you if something is missing. When everything is fine, it says that the console is "responding". The console is the program that actually computes the music; the pages you see in your browser are its interface.
  • Click the "ctests" link. This folder contains all the examples used on this page. The name of each file tells its type: "-da.…" for a Data project, "-gr.…" for a Grammar project, "-se.…" for its settings, etc.

👉 Feel free to modify the examples. The "ctests" folder is restored to its original state each time you update the Bol Processor. For the same reason, keep your own work in another folder (see below).

👉 The interface can be displayed in dark or light mode: use the icon in the top right corner.

The home page when the console is installed and responding

Your first sound: a Data project

In the "ctests" folder, click "-da.acceleration". This is a Data project: a text containing one or more musical items written in Bol Processor notation. This one contains a single item:

_transpose(12) _vel(60) E2 . D2 E2 . _vel(65) B2 D2 E2 . G2 B2 D2 E2 . _vel(70) F#2 G2 B2 D2 E2 . Bb2 F#2 G2 B2 D2 E2 . _vel(75) C2 Bb2 F#2 G2 B2 D2 E2 . _vel(77) G#2 C2 Bb2 F#2 G2 B2 D2 E2 . _vel(80) A2 G#2 C2 Bb2 F#2 G2 B2 D2 E2 . _vel(85) Eb2 A2 G#2 C2 Bb2 F#2 G2 B2 D2 E2 . _vel(87) C#2 Eb2 A2 G#2 C2 Bb2 F#2 G2 B2 D2 E2 . _vel(90) F2 C#2 Eb2 A2 G#2 C2 Bb2 F#2 G2 B2 D2 E2 .

Let us read it before listening:

  • E2, D2, F#2, Bb2… are simple notes in the English convention (C, D, E…). The Italian/French (do, re, mi…) and Indian (sa, re, ga…) conventions are also available.
  • Words starting with an underscore are performance controls. _transpose(12) raises all the notes by one octave (12 semitones), and _vel(60)… _vel(90) set the velocity, i.e. how hard the notes are struck. Here the music gets louder little by little.
  • The periods "." cut the line into beats of equal duration. The first beat contains one note, the second beat two notes, the third beat three notes, and so on until twelve notes. Since all beats last the same time, the notes become shorter and shorter: we hear an acceleration, although no duration is written in the score!

This shows the spirit of the Bol Processor notation: you describe the structure of the music, and the machine works out the exact timings.

Play it as a MIDI file

  • Below the text, the interface shows the item(s) it has found, each with a PLAY button. Click it.
  • A "BP console" window opens. When the console has finished, it shows a MIDI player: click it to listen. A link is also given to download the MIDI file, which is saved in the "my_output" folder.
  • Click the Image link at the top of this window. It displays the notes on a time line, where you can see them getting shorter and shorter.

👉 Some MIDI players need an Internet connection to load their sounds. If you hear nothing, check your connection.

Try this: delete all the periods, click SAVE, then PLAY again. Now all notes have the same duration and the acceleration has disappeared. Put the periods back (or use your browser's Undo) and save again.

Play it in real time

If your computer is connected to a MIDI instrument, or to a software synthesiser, you can send the music to it directly. Above the text, select Real-time MIDI among the output options, save this choice, and click PLAY. The sound quality now depends on your instrument, and the music starts without delay. Read the Real-time MIDI page to set up your MIDI inputs and outputs.

Play it with Csound

If you have installed Csound (version 7 or later), the interface tells you that Csound is responding. Select Csound score as the output option and click PLAY. The console writes a Csound score, then Csound turns it into a sound file that you can hear in the audio player. As no particular instrument is specified here, a simple default instrument ("0-default.orc") is used. We will come back to Csound further down.

Finally, select MIDI file again for the next steps.

👉 Did you notice the "-se.Visser2" and "-gr.acceleration" lines at the top of the data? The first one is a settings file (tempo, note convention, graphics, etc.) used to play this data. The second one is the grammar that composed this item… which brings us to grammars.

A Grammar project

A grammar is a set of rules. Each rule says that a symbol on its left side can be replaced with what is on its right side. Starting from the symbol S, the machine applies rules again and again until only musical elements (notes, rests, sound-objects…) remain. The result is a musical item. Composers use grammars to describe the construction of a piece rather than the piece itself.

Open "-gr.Ames" in the "ctests" folder:

-se.Ames
-cs.tryTunings

// A grammar illustrating the construction of a rather
// complex time structure with an undetermined rest.

ORD
_mm(60.0000) _striated

gram#1[1] S --> _ins(1) {PA, _rest PB}

gram#1[2] PA --> {2,- PA1, 2 PA2} {4,PA3}
gram#1[3] PA1 --> {2,F#3}
gram#1[4] PA2 --> {1,F5,A5}
gram#1[5] PA3 --> PA31 PA32
gram#1[6] PA31 --> {1/2,G#3,E5,G5}
gram#1[7] PA32 --> {7/2,Bb4}

gram#1[8] PB --> {1/4,G#5&,C6,E6,B6&} {2,&G#5,&B6}

Some useful comments:

  • Related files. The first lines name the files this grammar needs: settings "-se.Ames" and Csound instruments "-cs.tryTunings". The interface finds them and shows buttons at the bottom of the page to open them.
  • Comments. Lines starting with // are ignored by the machine. Use them to explain your work.
  • Variables and terminals. S, PA, PB, PA1… are variables: they are rewritten by the rules and disappear from the final result. Notes such as F#3 or Bb4 are terminal symbols: they stay and are played.
  • Rule numbers. "gram#1[3]" means "rule 3 of subgrammar 1". You don't need to type these numbers: click COMPILE GRAMMAR and the interface numbers (or renumbers) the rules for you. Compiling also checks the grammar and reports errors, such as a symbol that is neither a variable nor a known terminal.
  • ORD means that rules are tried in the order they are written. In this grammar each variable has a single rule, so it always produces the same item. Other grammars choose between several rules at random, so each production is different: see the Derivation modes page.
  • _mm(60.0000) sets the metronome to 60 beats per minute, and _striated says that the music follows this regular beat.
  • Curly brackets { } contain polymetric expressions: several voices played together, separated by commas. In {1/2, G#3, E5, G5}, the number before the first comma is the duration (half a beat), and the three notes form a chord. In {2, - PA1, 2 PA2}, the hyphen - is a silence of one unit, and the number 2 placed before a voice is a silence of two units. Each voice is then stretched or compressed to fit the duration given at the start, here 2 beats. See the Polymetric structures tutorial.
  • _rest is an undetermined rest: you don't say how long it lasts, and the machine calculates it. Here, voice PA lasts 6 beats and PB lasts 2¼ beats, so the rest before PB is set to 3¾ beats and both voices end together. Read the Undetermined rests in dance performance page for a real-life use.
  • The ampersand & ties notes: G#5& … &G#5 is a single G#5 that keeps sounding across the two expressions. See Tied notes.
  • _ins(1) selects instrument 1 of "-cs.tryTunings". It is used when the output is a Csound score.

Now click PRODUCE ITEM(s). The console window shows the item that has been produced, after all variables have been replaced:

_ins(Plucked_string1) {{2, - {2, F#3}, 2 {1, F5, A5}} {4, { 1/2 ,G#3, E5, G5} { 7/2 ,Bb4}}, _rest { 1/4 ,G#5&, C6, E6, B6&} {2, &G#5, &B6}}

Listen to it on the MIDI player, then click the Image link to see how the two voices are placed in time.

👉 A common mistake: the note convention must match the way notes are written. "-se.Ames" uses the English convention (C, D, E…). If you change it to Italian/French, "F#3" is no longer recognised as a note and the production fails. The current convention is displayed on the grammar page, and you can convert all notes of a grammar to another convention with a single click at the bottom of the page.

👉 When a production fails, the console window displays the error messages and gives a link to a file with the details.

To go further: the beginner's tutorial builds grammars step by step. The examples of Harm Visser include "-gr.acceleration", the grammar that produced our first item.

Help messages

You don't need to remember all the performance controls and keywords. At the bottom of the "-gr.Ames" page, click SHOW HELP ENTRIES. The grammar is displayed again, with links on all reserved words. Click "_rest": a window opens on the help entry for this word. The same button is available on Data pages.

The complete help file can also be read here.

Help entries displayed on a grammar
Displaying the help on reserved words in a grammar

Try the same with "-gr.Visser.Waves", another grammar by Harm Visser. Produce its item and compare its rendering in MIDI with this one, played on physical-model instruments (read explanations):

“Waves” by Harm Visser (1998), played on physical-model saxophone and piano

Create or import data

The "ctests" folder is a place to experiment, but it is restored during each update. Keep your own work in your own folders (also called workspaces).

Buttons for creating and importing files
  • On the page of a folder, the CREATE FILES OR FOLDERS button opens a form to create a new folder or a new project. Just type a name: the interface adds the right prefix or extension. For example, a grammar called "mygrammar" is saved as "-gr.mygrammar" or "mygrammar.bpgr", as you prefer.
  • IMPORT FILES copies files from your computer into the current folder. Only files used by the Bol Processor are accepted, and they get the access permissions the interface needs.
  • DOWNLOAD FILES lets you take your projects to another computer, and MOVE moves files between folders.
  • Project pages (Data or Grammar) also have download and upload buttons. You can only replace a project with one of the same type, and the replacement can be undone until you save the page.
Download and upload options on a grammar page
Download and upload options on a grammar page

👉 Please don't move files in or out of these folders with the Finder or the File Manager: this can lead to permission errors. If you want to keep your data outside the Bol Processor folder, read the Move data page.

Import MusicXML scores

You can also start from existing music. MusicXML is a standard format for sheet music. Many scores can be downloaded in this format, and score editors such as MuseScore can export it. The Bol Processor converts these scores to its own notation, so you can play them, analyse them, or reuse their fragments in your own grammars.

  • Create a new Data project in one of your folders and open it.
  • At the top of the page, next to Import MusicXML, choose a file and click ← IMPORT. To try, you can take one from the "ctests/xmlsamples" folder.
  • The interface shows the parts of the score and lets you choose which ones to import. The result is a set of polymetric expressions that you can play like any other data.

Below is Beethoven's Fugue in B flat major imported from MusicXML. It shows both the accuracy of the conversion and the complexity of the music that the Bol Processor can handle:

Beethoven's Fugue in B flat major played by the Bol Processor and Csound, with a “Sauveur” temperament ➡ Image
👉 Listen in stereo!

All the details are on the Importing MusicXML scores page. Two famous works are discussed on The Well-tempered Clavier and Bach well-tempered tonal analysis. Music can also be entered from a MIDI keyboard: see Capture MIDI input (work in progress).

Change the start string

A grammar normally starts its work from the symbol S. But you can start from any other variable, to listen to just one part of the construction.

Variables of -gr.Mozart displayed as buttons
Grammar "-gr.Mozart" with its variables at the bottom
  • Open "-gr.Mozart". It is a version of Mozart's musical dice game, in which the variables stand for short musical fragments assembled by chance.
  • At the bottom of the page, the interface lists all the variables as buttons. Click one of them to produce an item starting from this variable.
  • Variables A1 to B8 are chosen at random, so they give a different result each time. Variables T1 to T176 are fixed fragments, so they always sound the same.
  • You can also type a polymetric expression in the field at the bottom, for example {{2,sol3,si3}-,fa5 re5 si4}, and click PRODUCE ITEM. The expression may contain variables. Note that this grammar uses the Italian/French note convention (do, re, mi…).

👉 The settings of this grammar have the Non-stop improvize option checked. Set the output to Real-time MIDI and click PRODUCE ITEM(s): the dice game plays forever, with a new piece each time! Click STOP or PANIC to end it.

Play data

Open "-da.checkPoly". This Data project contains many short items that show the possibilities of polymetric expressions.

Data page with its items
Data project "-da.checkPoly", with the items found by the interface
  • The interface finds every item in the text and shows it with its own buttons. Items are separated by blank lines, so an item can take several lines, for example a title in square brackets above the music. Lines starting with // are comments.
  • PLAY plays the item with the output you have chosen (MIDI file, real-time MIDI, Csound score…).
  • EXPAND shows the item written out in full, with every duration made explicit. It is a good way to understand how the machine reads polymetric expressions.

To learn more about this notation, read Polymetric structures, Tied notes and Carrying over controls.

Sound-object prototypes

So far we have played simple notes. The Bol Processor can also play sound-objects: small pieces of music, such as a drum stroke, a chord or a melodic ornament, that are given a name and used like notes. Their name comes from the bols, the spoken syllables of tabla drumming, which were the first application of the Bol Processor.

The content of sound-objects is stored in sound-object prototype files ("-so.…"). An alphabet file ("-al.…") lists the names that a grammar may use.

Page of a sound-object prototype file
The page of a sound-object prototype file
  • Open "-so.abc1" in the "ctests" folder. Below the horizontal line is a table of its sound-objects: a, a', b, chik, cycle1… These objects are used by the grammar "-gr.koto3", presented on the Interactive improvisation with sound-objects page.
  • Click the button "chik" to open this object. Its PLAY button lets you hear it: it is a chord of three notes. You can also play a combination of objects typed in the form.
  • Each object has parameters that tell the machine how to place it in time: can it be shortened or stretched? Can it overlap with its neighbours? Can it be moved slightly? These are explained on the Sound-objects page.
  • Objects can be created, duplicated or deleted. Try a couple of DELETE buttons: a RESTORE ALL DELETED OBJECTS button appears to undo it. If you create an object, also add its name to the alphabet file.
  • Changes are saved automatically every 30 seconds (see Autosave).

To go further: Sound-objects, Silent sound-objects, and Time-setting of sound-objects for the algorithm.

Csound

Csound in the Bol Processor environment
Csound in the Bol Processor environment

Csound is a free program that creates sounds from two texts: an orchestra, which describes the instruments, and a score, which lists the notes to play. The two programs complement each other: the Bol Processor deals with musical structures and writes the score, and Csound deals with sound.

With Csound, you are no longer limited to the 128 keys and the instruments of MIDI. You can use any tuning or temperament (see Microtonality), and design your own instruments.

  • Open "-gr.Mozart" in the "ctests" folder and select Csound score as the output option.
  • If Csound (version 7 or later) is installed, the interface finds it and says that it is responding. Otherwise, it suggests installing it.
  • Click PRODUCE ITEM(s). The console writes the score "Mozart.sco" in the "my_output" folder, then Csound creates a sound file that appears on an audio player. Click Read the output file to see the score.
Csound score produced by -gr.Mozart
Csound score produced by grammar "-gr.Mozart"

Each line starting with "i" is a note. Its first fields are the instrument number, the start time and the duration (in beats), then the pitch. The following fields carry the volume and other parameters that can change during the note. The name of the note is given as a comment at the end of the line.

Variations on "-gr.Mozart" played by Csound with the "0-default.orc" orchestra, tuned in Zarlino's meantone temperament

A just-intonation version of the dice game can be heard on the Just intonation: a general framework page. All the Csound features are described in Csound in BP3, in particular Csound checkup, Csound objects and Csound tuning in BP3.

Csound instrument files

The Bol Processor can turn MIDI-style controls ("pitchbend", "modulation", "volume", etc.) into parameters of Csound instruments, and it can also handle parameters that have no MIDI equivalent. The orchestra can then make these parameters vary smoothly during a note, using the GEN07 (linear interpolation) or GEN08 (cubic spline) Csound generators. All this is set up in a "-cs" Csound instrument file such as the one shown below, and documented in chapter 17 of the BP2.9.8 reference manual.

Csound instrument file
  • Open "-cs.tryCsound" in the CSOUND resources folder. This page is in autosave mode (see below): changes to Csound instruments are saved automatically twice per minute.
  • This file is linked to a Csound orchestra file called "tryCsound.orc". As this file is missing from the "csound_resources" folder, a link is displayed to create it. Otherwise, the link would open it for editing. The arguments declared in the orchestra must match those in the instrument file.
  • The Tables text area contains Csound function tables. They are not used to create the score. They are only copied at the beginning of it.
  • Csound instruments can be associated with MIDI channels. For example, here, MIDI messages sent to channel 2 are converted into notes of instrument 3 "Harpsichord".
  • At the bottom of the page is the list of Csound instruments declared in this file. They can be deleted, restored and duplicated in the same way as sound-object prototypes. Clicking the blue button with the name of an instrument opens its editor.

A simple orchestra file called "0-default.orc" is provided in the "csound_resources" folder. It is used when no other orchestra is specified, as in our first examples. See also the Simple Csound orchestra page.

Editing a Csound instrument

Page of a Csound instrument
Page of a Csound instrument showing the parameters associated with MIDI controllers

The Csound instrument editor is very similar to the one of BP2.9.8. A detailed description can be found in chapter 17 of the BP2.9.8 reference manual.

  • For example, let us look at the instrument Harpsichord in "-cs.tryCsound". Its index is "3", which means that it can be called as _ins(3) or _ins(Harpsichord) in a Bol Processor score.
  • The parameters displayed on the "Harpsichord" page are those associated with MIDI controllers. They can change continuously if two arguments are given for their values at the start and at the end of each note. The argument under "table" is the reference of an optional function table.
  • For the volume parameter, the MIDI values "0", "64" and "127" are converted to the Csound values "-24", "0" and "+24" respectively. This converts a linear scale into a logarithmic scale.
  • The start and end values of a continuously changing volume are sent to arguments "7" and "8" respectively. The orchestra uses them to set the volume, with the GEN07 (linear interpolation) or GEN08 (cubic spline) generators.
  • Given three pairs of input/output values, the Bol Processor tries to define a quadratic mapping between input and output. It is not always possible to fit the three values to a monotonic quadratic function… See the Csound argument mapping page for a detailed explanation.
  • At the bottom of the page is a list of Csound parameters that have nothing to do with MIDI controllers. This is where Csound production by the Bol Processor can differ radically from MIDI!
  • This instrument has a single additional parameter called "blurb".
The blurb parameter
A specific "blurb" Csound parameter

These additional parameters can be created, deleted and restored in the same way as instruments. The interface makes sure that a new parameter does not have the same name as an existing or (temporarily) deleted parameter.

Let us look at the "blurb" parameter (image on the left). Each parameter has a default value, which is not necessarily zero. Values found in Csound scores can be combined additively (ADDval) or multiplicatively (MULTval). The "blurb" parameter sends its start value to argument "9" of the Csound score, and its end value (for continuous variations) to argument "10".

Using a Csound instrument in a grammar

Csound logo

Here is a simple example showing the basic features of Csound in the Bol Processor. A complete demonstration on a real musical example can be found on the Sarasvati vina page. All the features of the Csound implementation are documented on the Csound checkup and Csound objects pages, with examples that you can try yourself.

The Data project "-da.tryCsound" calls "-cs.tryCsound" and uses its instrument "Harpsichord" (number 3). Type the following line in a Data project linked to "-cs.tryCsound" and play it with the Csound score output:

_ins(Harpsichord) _volumecont _volume(127) A4 G4 C5 A5 A4 G4 C5 A5 _volume(0)

The Csound score produced is:

; Csound score
f1 0 256 10 1
f2 0 256 10 1 0.5 0.3 0.4

t 0.000 60
i3 0.000 1.000 440.000 8192.000 8192.000 127.000 111.125 0.000 0.000 0.000 0.000 0.000 ; A4
i3 1.000 1.000 391.995 8192.000 8192.000 111.125 95.250 0.000 0.000 0.000 0.000 0.000 ; G4
i3 2.000 1.000 523.251 8192.000 8192.000 95.250 79.375 0.000 0.000 0.000 0.000 0.000 ; C5
i3 3.000 1.000 880.000 8192.000 8192.000 79.375 63.500 0.000 0.000 0.000 0.000 0.000 ; A5
i3 4.000 1.000 440.000 8192.000 8192.000 63.500 47.625 0.000 0.000 0.000 0.000 0.000 ; A4
i3 5.000 1.000 391.995 8192.000 8192.000 47.625 31.750 0.000 0.000 0.000 0.000 0.000 ; G4
i3 6.000 1.000 523.251 8192.000 8192.000 31.750 15.875 0.000 0.000 0.000 0.000 0.000 ; C5
i3 7.000 1.000 880.000 8192.000 8192.000 15.875 0.000 0.000 0.000 0.000 0.000 0.000 ; A5
;
e 10.000
Volume mapping of Csound instrument 3
Mapping of volume in Csound instrument 3
  • Argument "4" is the pitch, here in Hertz (440 for A4).
  • Arguments "5" and "6" are the start and end values of the pitchbend, as specified by the instrument. They remain at the default value "8192" in the absence of pitchbend instructions.
  • Arguments "7" and "8" are the start and end values of the volume. The volume decreases from 127 to 0 over the eight notes, as expected.
  • The _volumecont instruction at the beginning of the sequence means "continuous volume". It resolves a difference between MIDI and Csound: in MIDI, each event happens at a point in time, whereas a Csound note is a segment of time with a duration. It is then up to the orchestra to decide how the parameter changes from the start to the end of each note.
  • Arguments "9" and "10" remain at the default value "0" of the unused modulation parameter.
  • Arguments "11", "12" and "13" remain at the default value "0" of the unused panoramic parameter.

Csound scores created with "-cs.tryCsound" cannot be played with "0-default.orc", because their arguments do not match.

A real musical example using many features of Csound in the Bol Processor is a phrase of Carnatic music designed by Srikumar K. Subramanian in 1996. Read the description of this example and listen to it (in just intonation):

"Pallavi" of the song "Maayaatiita Svaruupini, Nannu brovave" in raga "mayamaalavagaula"

Editing the Timebase

A timebase with 3 tracks
A timebase with 3 tracks set up in 4 beats

The Timebase is a tool for creating a rhythmic pattern (a "tick pattern") to be superimposed on a piece of music produced by the Bol Processor. Superimposition in real time has not yet been implemented in the 'BP3' console, but you can try it by importing a production of the Bol Processor saved as a MIDI file.

  • Create a new timebase called "try.bptb" in the "ctests" folder and open it.
  • By default, the timebase contains 3 tracks, 2 of which are set to a simple 4-beat pattern at mm = 60 beats/minute. The third track is empty. Fill it with 4 strokes on key = 100 at a speed ratio of 2/1.
  • Now listen to the combined tracks (repeated 3 times):
  • To understand the structure, you can mute some tracks.
  • Now click "Choose File" to select a MIDI file, for example "acceleration.mid", and click the "send" button to import it.
A MIDI file loaded in the timebase
A MIDI file "acceleration.mid" has been loaded in the timebase.
  • You can listen to the imported file alone, and to its combination with the tick pattern:
A change of tempo suggested after loading a MIDI file
After loading "this_song.mid", a change of tempo is suggested.
  • The two fit together because the piece was created at mm = 60 and in a rhythmic pattern of 4 beats. Try changing the metronome value in the table above. You will get a warning if the metronome setting does not match the tempo declared in the imported MIDI file.
  • For example, try a rhythmic cycle above "this_song.mid" in the "ctests" folder. You will be asked to set the metronome to 9 beats in 4 seconds, as declared in the MIDI file (picture on the right). The timing is perfect:
  • You can add as many tracks as you like. (The limit in BP2 was 3 tracks.)
  • Playing with speed ratios creates complex cycles that can be used to control a drum machine, if the appropriate channels, key numbers and velocities are set up. Traditional rhythmic structures can also be programmed easily. See the examples below:
Panchamasvari tala

Tick patterns as polymetric expressions

➡ For experts!

The Timebase page offers a convenient way of superimposing a tick pattern on a production of the Bol Processor saved as a MIDI file. Timebases can also control a MIDI drum machine taking part in the performance. It would be better to make the drum track part of the performance itself, since polymetric expressions can handle superimpositions. We will see that this is often possible, but tedious. (A more systematic approach is described on the Timebase to polymetric page.)

A polymetric equivalent of the tick pattern shown above would be:

{_chan(1) _vel(120) _staccato(99) C8 - - -, _chan(1) _vel(120) _staccato(99) - C7 C7 C7,
_chan(1) _vel(120) _staccato(98) E7 E7 E7 E7 E7 E7 E7 E7}

This expression is displayed at the bottom of the Timebase page.

Let us try to add this polymetric expression as a variable "Drum" to the grammar "-gr.acceleration":

S --> {Piano, Drum}
Piano --> _vel(60) A B _vel(65) C D _vel(70) E F _vel(75) G _vel(77) H _vel(80) I _vel(85) J _vel(87) K _vel(90) L
A --> E2 .
B --> D2 A
C --> B2 B
D --> G2 C
E --> F#2 D
F --> A#2 E
G --> C2 F
H --> G#2 G
I --> A2 H
J --> D#2 I
K --> C#2 J
L --> F2 K
Drum --> {_chan(1) _vel(120) _staccato(99) C8 - - -, _chan(1) _vel(120) _staccato(99) - C7 C7 C7,
_chan(1) _vel(120) _staccato(98) E7 E7 E7 E7 E7 E7 E7 E7}

Unfortunately, this does not work, because the "Drum" pattern should be repeated at the right tempo instead of being stretched to the duration of "Piano"… The solution is to replace it with a cyclic sound-object. Let us do it:

  • Create the following "-gr.drum" grammar and use it to produce a MIDI file called "drum.mid":
    S --> {_chan(1) _vel(120) _staccato(99) C8 - - -, _chan(1) _vel(120) _staccato(99) - C7 C7 C7,
    _chan(1) _vel(120) _staccato(98) E7 E7 E7 E7 E7 E7 E7 E7}

  • Create a sound-object prototype file called "-so.drum" and define a sound-object called "cycle2".
Setting a sound-object to cyclic
Setting a sound-object to "cyclic"
  • Set it to "cyclic" (see picture on the left).
  • Import "drum.mid" into the sound-object prototype "cycle2".
  • Bad news: its duration is 6000 ms instead of the expected 4000 ms…
  • A look at EXPLICIT MIDI codes shows that the last 2 seconds are a fade-out added by the Bol Processor to avoid an abrupt end.
  • Good news: the sound-object prototype editor lets you crop the sound-object by cutting its end. So let us crop it to 4000 ms.
  • Listen to the cropped "cycle2" sound-object and look at its image. Everything is perfect. This object sounds identical to the pattern programmed on the Timebase page:

    Cropping is done carefully: if necessary, the algorithm rewrites the "NoteOff" messages deleted by the cropping.
  • Now the sound-object can be added to the grammar as follows:
    -al.drum
    S --> {Piano, cycle2}
    Piano --> _vel(60) A B _vel(65) C D _vel(70) E F _vel(75) G _vel(77) H _vel(80) I _vel(85) J _vel(87) K _vel(90) L
    A --> E2 .
    B --> D2 A
    C --> B2 B
    etc…
    J --> D#2 I
    K --> C#2 J
    L --> F2 K

The cropped cycle2 sound-object prototype
The cropped “cycle2” sound-object prototype
  • The "cycle2" sound-object and its prototype file "-so.drum" must be declared in the following "-al.drum" alphabet file:
    -so.drum
    *
    cycle2

    The ‘*’ on the second line of the alphabet is an arbitrary symbol declaring a homomorphism — not used here.

  • This method follows the Bol Processor model, but it is tedious. Worse still, the equivalent polymetric expression can become extremely complex if the speed ratios and/or beat cycles of the tracks are not the same. In this case, it is not displayed at the bottom of the Timebase page.

Scripts

  • Bol Processor BP2.9.8 was fully scriptable: all commands launched from its menus could be recorded as sequences of script instructions and run again at will. This included opening folders and files, modifying text or doing something with the selection.
  • A script was run every evening for about half an hour, checking all procedures and tracking changes in the output data, in addition to the sound check.
  • This level of automation is not possible in BP3, because the console and its PHP interface are separate. As a result, many BP2 script instructions are not valid in BP3. They are ignored when the script is run.
  • Consider for instance "-sc.tryMe":
    Show messages OFF
    Note convention = English
    Show graphics ON
    Play - - {2,G4,E4,C4,- C5 - C5 {C5_-,A#4_ _}}
    Show messages ON
    Activate window Scrap
    Type Welcome to <a href="https://bolprocessor.org/">Bol Processor BP3</a>...
    Type Hope you <big><i><font color="green">enjoyed</font></i></big> the music!
    Type BP3 is now waiting for you to play ‘C4’ on the MIDI keyboard
    Type <return>
    Wait for C4 channel 1
    Run script -sc.trySubscript
    Type That's all folks!

Executing the -sc.tryMe script
Executing the "-sc.tryMe" script. A musical sequence is played on MIDI and a Csound score is created.
  • In this script, the instructions "Show messages OFF", "Show graphics ON", "Show messages ON", "Activate window Scrap" and "Wait for C4 channel 1" are ignored. The "Play" instruction expands the polymetric expression - - {2,G4,E4,C4,- C5 - C5 {C5_-,A#4_ _}} and sends it to MIDI in real time. The note convention is set to "English" to recognise "G4", "E4" etc. as simple notes. The tempo is the standard metronome = 60 beats per minute.
  • The "Type" instruction displays a line of text (which may contain HTML elements).
  • This script calls a subscript called "-sc.trySubscript" in the same folder. Its content is:
    Load project -gr.Ames
    Csound score ON
    Produce items

  • Here the machine calls the grammar "-gr.Ames" and sets the output format to "Csound score".
  • The execution of the script is displayed in a pop-up window (see image above), which lists (in red) the commands sent to the console. The second command produces a Csound score, as expected.
  • The image also shows (light blue) buttons for entering script instructions, so that no typing is required. A CHECK THIS SCRIPT button shows any errors, such as a file not found.
  • Below the script, the LIST ALL SCRIPT INSTRUCTIONS button lists all the instructions handled by BP2.9.8, indicating which ones are obsolete in BP3 and which ones are under development.

Autosave

The autosave feature works like the automatic saving of Google Docs or WordPress pages. It is used when editing sound-object prototypes and Csound instruments.

When you edit the prototypes of "-so.abc1", all data belongs to this file. Clicking the SAVE THIS PROTOTYPE button while working on a particular prototype only updates a temporary file, whose path is shown at the top of the page. When you have finished, you are expected to return to the "-so.abc1" page and click the SAVE ‘-so.abc1’ INCLUDING ALL CHANGES TO PROTOTYPES button. Fortunately, the autosave, shown by a red line at the top of the page, does it for you in the background.

The same feature is used on the page of Csound instrument files. For instance, the file "-cs.tryCsound" is saved automatically every 30 seconds while you are editing its instruments or additional parameters.

👉 Temporary files are kept in the "temp_bolprocessor" folder, in a subfolder whose name contains the identifier of your browser session. If you restart your browser or your computer, a new session begins and a new subfolder is created. The interface deletes subfolders that are more than 24 hours old. Thanks to the autosave, no data is lost.

For developers: the autosave is a simple call of JavaScript code in the files "autosaveObjects.js" or "autosaveInstruments.js". The command is myVar = setInterval(savePost, 30000), where "30000" means 30 seconds. A savePost() function sends POST requests to "autosaveObjects.php" or "autosaveInstruments.php".

Where to go next

You have now seen the main features of the Bol Processor. Here are some suggestions for the next steps:

👉 Don't hesitate to ask questions or send suggestions via the contact form, or join the BP developers list on SourceForge.

Simple Csound orchestra

BP2 makes it possible to use Csound orchestra instructions such as

kr tablei kndx, ifn

to make continuous parameters vary according to a function table (indexed 'ifn') that BP2 produces and insert in the Csound score when necessary.

Below is a typical instrument in which volume and pitchbend are controlled either by linear interpolation, using start and end values, or by function tables.

  • p5 and p6 are the start and end values of volume
  • p8 and p9 are the start and end values of pitchbend
  • p7 contains the index of the volume function table. If it is 0, then volume varies by linear interpolation.
  • p10 contains the index of the pitchbend function table. If it is 0, then pitchbend varies by linear interpolation.

Indexes of function tables are assigned automatically by BP2, and each table is stored in the score as a 'f' statement just preceding the 'i' statement relating to an instrument using the table. BP2 takes care of not overwriting tables that might be refered by Csound instrument and enlisted in the Csound instrument description file.

In any case, it starts indexing from 100 onwards.

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 (vol <= 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
endin

This instrument is currently saved as "BP2test.orc".

Function tables might invoke either GEN07 (straight lines, p.62) or GEN08 (cubic spline, p.64).

If for instance the function table index is 102, and GEN07 is used, the following instruction will be inserted by BP2 into the score:

f102 time size -7 v1 n1 v2 n2 v3 n3 … vmax

with n1 + n2 + … + n(max-1) = maxpoints

'size' is a power of two equal to or greater than the actual number of points 'maxpoints'.
'time' is exactly parameter p2 of the following 'i' statement which makes actual use of the table.

Writing '-7' instead of '7' after 'size' inhibits rescaling.

GEN08 looks better in terms of smoothing the table, but it has the drawback of setting first derivatives to 0 on the first and last points of the table. It also slows down Csound's sound file generation.

Timebase to polymetric

This algorithm is used by the PHP interface of Bol Processor ‘BP3’ under development. Read:

https://bolprocessor.org/misc/BP3/CheckList.html#timebase

It is implemented in function polymetric_expression() of file _basic_tasks.php (read below).

The function creates a polymetric expression equivalent to the rhythmic structure programmed on a Timebase page. We will take for instance a structure which does not sound musical because of its odd ratios:

The metronome speed is 208.571 beats per minute specified as 73 beats in 21 seconds. Bol Processor always compute durations as integer ratios.

Let us define p_clock = 73 and q_clock = 21.

This structure contains 2 tracks. The following algorithm deals with any number of tracks.

  • Track 1 is a cycle of 5 beats [TickCycle] and its speed ratio is 3/2 [Ptick/Qtick]. It produces note C8 (in English notation) at velocity 120 (a MIDI parameter) and duration 10 milliseconds.
  • Track 2 is a cycle of 3 beats [TickCycle] and its speed ratio is 4/5 [Ptick/Qtick]. It produces note C7 at velocity 120 and duration 10 milliseconds.

Tick cycles are made explicit by checked/unchecked boxes. Unchecked boxes denote silences ‘-’:

  • C8 - C8 - - for the first track
  • - C7 C7 for the second track

The rhythmic structure will be represented as a polymetric structure with 2 fields {Track1, Track2} in which fields are forced to the same symbolic duration by the polymetric expansion algorithm (described here). We need to design its content so that the expansion does not alter the tempo declared on each track.

To this effect, consider the symbolic duration of each track:

(q_clock / p_clock) * (TickCycle * Qtick) / Ptick

In order to match symbolic durations, each track should be repeated adequately:

repeat1 * (TickCycle1 * Qtick1) / Ptick1 = repeat2 * (TickCycle2 * Qtick2) / Ptick2 = …

Ratio (q_clock / p_clock) being identical for each track
was eliminated from this equation.

We need to find the set of smallest integers repeat1, repeat2 etc. satisfying this equation.

To this effect, we simplify ratio (TickCycle * Qtick) / Ptick using the greatest common divisor (GCD):

x = GCD((TickCycle * Qtick), Ptick)
y = (TickCycle * Qtick) / x

Then we calculate the least common multiple (LCM) of all y values:

lcm = LCM(y1, y2, …)

This yields for each field:

repeat = (lcm * Ptick) / (TickCycle * Qtick)

In practice,

x1 = GCD((TickCycle1 * Qtick1), Ptick1) = GCD((5 * 2), 3) = 1
y1 = (TickCycle1 * Qtick1) / x1 = (5 * 2) / 1 = 10

x2 = GCD((TickCycle2 * Qtick2), Ptick2) = GCD((3 * 5), 4) = 1
y2 = (TickCycle2 * Qtick2) / x2 = (3 * 5) / 1 = 15

lcm = LCM(10,15) = 30

repeat1 = (lcm * Ptick1) / (TickCycle1 * Qtick1) = (30 * 3) / (5 * 2) = 9
repeat2 = (lcm * Ptick2) / (TickCycle2 * Qtick2) = (30 * 4) / (3 * 5) = 8

The structure will therefore look like:

{Track1 Track1 Track1 Track1 Track1 Track1 Track1 Track1 Track1, Track2 Track2 Track2 Track2 Track2 Track2 Track2 Track2}

We need to include performance parameters setting the duration of ticks. To this effect, we use the _staccato(s) parameter in which s is the percentage of cropped duration at the end of the sound-event. Durations have been set to 10 milliseconds. We calculate the period of each track:

period1 = (((1000 * q_clock) / p_clock) * Qtick1) / Ptick1 = (((1000 * 21) / 73) * 2) / 3 = 192 ms
s1 = 100 * (192 - 10) / 192 = 94%
period2 = (((1000 * q_clock) / p_clock) * Qtick2) / Ptick2 = (((1000 * 21) / 73) * 5) / 4 = 359 ms
s2 = 100 * (359 - 10) / 359 = 97%

Finally, we specify the tempo of each field: 3/2 for the first one and 4/5 for the second one.

The resulting polymetric structure is:

{_tempo(3/2) _chan(1) _vel(120) _staccato(94) C8 - C8 - - C8 - C8 - - C8 - C8 - - C8 - C8 - - C8 - C8 - - C8 - C8 - - C8 - C8 - - C8 - C8 - - C8 - C8 - - , _tempo(4/5) _chan(1) _vel(120) _staccato(97) - C7 C7 - C7 C7 - C7 C7 - C7 C7 - C7 C7 - C7 C7 - C7 C7 - C7 C7}

Note that _tempo(4/5) does not need to be specified because it will be infered by the polymetric expansion algorithm. Therefore, the expression displayed at the bottom of the Timebase page is:

{_tempo(3/2) _chan(1) _vel(120) _staccato(94) C8 - C8 - - C8 - C8 - - C8 - C8 - - C8 - C8 - - C8 - C8 - - C8 - C8 - - C8 - C8 - - C8 - C8 - - C8 - C8 - - , _chan(1) _vel(120) _staccato(97) - C7 C7 - C7 C7 - C7 C7 - C7 C7 - C7 C7 - C7 C7 - C7 C7 - C7 C7}

Implementation in PHP

The following is the code in file _basic_tasks.php.

Table $mute contains flags indicating whether a track is active or mute. Function key_to_note() returns the name of a note in English convention given its key number (MIDI).

Algorithms

A comprehensive documentation of the algorithms implemented in the  Bol Processor.

No posts found.

Csound argument mapping

Performing a quadratic mapping using 3 points: how can we make sure that the function will be monotonous?

This is part of document “Check of Bol Processor ‘BP3’ with PHP interface” on the “Bol Processor” website.

The algorithm is implemented in function Findabc() of "CsoundMaths.c".


When three pairs of input/output values are supplied, BP2 attempts to define a quadratic mapping from the input (x) to output (y).

This is an example of a successful mapping: 

BP2 expects the mapping function to be monotonous, i.e. the three values (x1, x2, x3) supplied as the input and the ones supplied as the output (y1, y2, y3) must be strictly ordered. Even in this case a proper quadratic mapping may not be possible. See for instance: 

Here the quadratic function is not monotonous even though the input values are ordered properly. In this case, BP2 replaces the incorrect part (the one containing an extremum) with a linear function, and changes the other part to make the curve tangent to the linear part. This yields the graph shown below: 


Bol Processor BP3

BP3 is the multi-platform version of the Bol Processor that has been in development since 2020. It consists of two modules:

  • A console written in C language for cross-platform compilation, containing the core algorithms of the Bol Processor
  • An interface that allows non-technical users to edit or create specific material (grammars, sound-objects, Csound instruments) and interact with the console to produce Bol Processor scores, MIDI files, Csound scores and real-time MIDI output/input.

Currently, the interface has been built in the HTML5/JavaScript/PHP environment which makes it possible to work with the Bol Processor on any web browser. The setup works in different environments (MacOS X, Windows, Linux, etc.) but it requires the installation of a local Apache/PHP server.

Follow the instructions on the Bol Processor ‘BP3’ and its PHP interface page to install the latest version.

A standalone version compiled from the PHP/JavaScript package is about to be released.

No posts found.

Two algorithms

Two algorithms for the instantiation of structures of musical objects

Bernard Bel

This is an extended and revised version of the chapter: Symbolic and Sonic Representations of Sound-Object Structures published in M. Balaban, K. Ebcioglu & O. Laske (Eds.) “Understanding Music with AI: Perspectives on Music Cognition”, AAAI Press (1992, p. 64-109).

Abstract

A representational model of discrete structures of musical objects at the symbolic and sonological levels is introduced. This model is being used to design computer tools for rule-based musical composition, where the low-level musical objects are not notes, but “sound-objects”, i.e. arbitrary sequences of messages sent to a real-time digital sound processor.

“Polymetric expressions” are string representations of concurrent processes that can be easily handled by formal grammars. These expressions may not contain all the information needed to synchronise the whole structure of sound-objects, i.e. to determine their strict order in (symbolic) time. In response to this, the notion of “symbolic tempo” is introduced: the ordering of all objects in a structure is possible once their symbolic tempos are known. Rules for assigning symbolic tempos to objects are therefore proposed. These form the basis of an algorithm for interpreting incomplete polymetric expressions. The relevant features of this interpretation are commented.

An example is given to illustrate the advantage of using (incomplete) polymetric representations instead of conventional music notation or event tables when the complete description of the musical piece and/or its variants requires difficult calculations of durations.

Given a strict ordering of sound-objects, summarised in a "phase table" representing the complete polymetric expression, the next step is to compute the times at which messages should be sent. This requires a description of "sound-object prototypes" with their metric/topological properties and various parameters related to musical performance (e.g. "smooth" or "striated" time, tempo, etc.). These properties are discussed in detail, and a time-polynomial constraint satisfaction algorithm for the time-setting of sound objects in a polymetric structure is introduced. Typical examples computed by this algorithm are shown and discussed.

Excerpts of an AI review of this paper (Academia, June 2025)

Summary of the Work

The manuscript introduces a model for representing and instantiating musical structures made of discrete sound-objects. It explores separate representations for symbolic and physical time, then proposes methods to synchronize concurrent musical processes and to compute the precise scheduling of messages (or events) destined for a sound processor. The author conceptualizes “smooth” and “striated” time, describes “polymetric expressions” as high-level objects that can be incomplete, and provides algorithms to infer missing timing details. The paper merges formal language approaches, real-time considerations, and practical examples of usage in a software environment called Bol Processor.

Comprehensive Model of Time

  • The clear distinction between symbolic time (strictly ordered events) and physical time (metronomic or arbitrary “striated” structures) provides an insightful way to handle simultaneous or overlapping musical events.
  • The notion of “smooth” versus “striated” time is conjugated with helpful examples, making it straightforward to envision both contexts of performance.

Polymetric Expressions and Incomplete Descriptions

  • The approach to polymetric expressions accommodates incomplete representations that can later be resolved by an algorithmic interpretation. This is particularly valuable for composers and researchers looking to experiment with generative or rule-based systems without being forced into fully specified notation from the outset.
  • The examples and diagrams showing how one can map polymetric structures to a phase diagram illustrate the concept effectively.

Synchronization and Constraints

  • The proposed synchronization algorithm handles concurrency by carefully propagating symbolic tempos across sequences. This helps manage cases where direct numeric durations are not known beforehand.
  • The introduction of properties such as pivot alignment (PivBeg, PivCent, etc.), truncation, elasticity, and relocatability demonstrates thorough consideration of realistic performance scenarios (e.g., rubato, partial overlaps). The concept of locating a sound object by its pivot was inspired by Marco Stroppa's work at IRCAM in 1990.

Practical Implementation and Examples

  • The paper gives a thorough demonstration of how these algorithms integrate with a functional software environment, including tangible data structures (phase tables, instance tables) and step-by-step flowcharts.
  • Musical examples and references to real-time computer music systems underscore the applicability of the approach.

Rich Technical Detail

  • The stepwise pseudo-code for the time-setting algorithm is extensive and transparent. This level of detail can guide further experimental or production-level implementations.
  • The complexity analysis (O(nmax² · imax³) in the worst case) provides an understanding of potential computational limits, helpful for anyone planning to use or extend these algorithms.

Potential Impact

  • This work is useful to composers, researchers in algorithmic composition, and developers of music software who need robust synchronization methods that go beyond simple “note-by-note” scheduling.
  • The proposed methods can enable more flexible representations of time and concurrency, allowing for richer generative or improvisational projects.

Summary of Review

Overall, this paper provides a detailed, formalized framework for resolving concurrent musical structures. It bridges the gap between abstract symbolic grammars and practical real-time performance considerations. Researchers and musicians interested in algorithmic composing or advanced computer-assisted composition tools will likely find its approach compelling, especially given the extensive examples and robust pseudo-code.

Download this paper (PDF)

Skip to PDF content
« Translate