Bol Processor open-source project:

Latest features in BP2.9.5

Previous version: BP2.9.3, November 1998

Piano-roll display
A serial killer...
...behind the bars
BP2/Csound features

Bernard Bel
Anthony Kozar

Piano-roll display

BP2 now offers the option of piano-roll note display. To select this option, check "Piano roll" in the "Layout" menu. The option is saved along with the settings of the current project.

Piano-roll display makes it possible to visualise every single note occuring in the MIDI stream of a sound-object. It is also available in the sound-object prototype editor (accessed typing command-E). The main dialog has a button displaying the piano roll of the current sound-object prototype.

A serial killer...

BP2.8.1 introduced tools inspired by sequence operators in serial music. These tools are extended to musical structures that may not qualify as strictly sequential, thereby enhancing the syntactic model. Phrases may be polyphonic, polyrhythmic and/or tree-structured when they are derived from variables in a grammar.

(Thanks to Harm Visser for suggestions and comments.)


This tool retrogrades sequences in the expression it is applied to.

For example,

_retro C4 D4 G#4

will be played:

G#4 D4 C4

Rhythmic divisions are preserved. For instance, the following expression in period notation (see the 'QuickStart' manual)

_retro C4 D#4 G4 · G4 F#4 G#4 D#4 · G4

will be played:

G4 D#4 G#4 · F#4 G4 G4 D#4 · C4

If an expression contains polymetric structures (see the 'QuickStart' manual), these are reverted accordingly. For example,

_retro C4 D4 {F4 G4,D4 F4 E4} G#4

will be played:

G#4 {G4 F4,E4 F4 D4} D4 C4

Examples of _retro are supplied in '-gr.trySerial' in the "NEW EXAMPLES" folder.


This tool randomizes the order of elements in the expression it is applied to. For example,

_rndseq C4 D4 {F4 G4,D4 F4 E4} G#4

may produce many different items, among which:

D4 {G4 F4,E4 F4 D4} G#4 C4

{F4 G4, F4 D4 E4} D4 G#4 C4

Examples of _rndseq are supplied in '-gr.trySerial' in the "NEW EXAMPLES" folder.


Rotates a sequence of "sound-objects" or "simple notes" (left shift by 'x' units). For instance,

_rotate(3) A4 B4 C4 D4 E4 F4 G4


D4 E4 F4 G4 A4 B4 C4

Just like _retro and _rndseq, _rotate is applied recursively to the fields of a polymetric expression.

An example of _rotate is supplied in '-gr.tryRotate' in the "NEW EXAMPLES" folder.


This tool multiplies by 'x' melodic intervals relative to the centre note 'p'. To make it clear,

_keyxpand(C4,-2) B3 C4 D4 E4


D4 C4 G#3 E3

Explanation: B3 is (-1) semitone relative to C4. The new interval will be (-1) x (-2) = (+2), so the image of B3 is D4.

Just like _retro, _rndseq and _rotate, _keyxpand is applied recursively to the fields of a polymetric expression. For instance,

keyxpand(C4,-2) B3 C4 {keyxpand(C4,-1) D4 E4}


D4 C4 {E4 G#3}

When _keyxpand is applied to a sound-object, notes in its MIDI sequence will also be modified provided that its property "Accept key changes" has been set to true.

Applications of _keyxpand are demonstrated in '-gr.tryKeyXpand' in the "NEW EXAMPLES" folder.


This tool prevents the remaining part of a sequence from being modified by _rndseq, _rotate or _retro.

For example,

retro C4 E4 B3 _ordseq D5 C#5 G#5


D5 C#5 G#5 B3 E4 C4

Note that the sequence D5 C#5 G#5 appears as is, but has been moved to the start by _retro.

Sequences containing variables

When _retro, _rndseq, _keyxpand or _rotate appears in a grammar rule, it may also operate on variables. For instance, the grammar

S --> _retro P Q
P --> C4 E4 B3
Q --> D5 C#5 G#5


G#5 C#5 D5 B3 E4 C4


This tool is used for changing melodic intervals in the expression it is applied to. Arguments p1, q1, p2, q2 are either integer numbers in range [0...127], or the names of simple notes in the current note convention.

For instance, _keymap(A3,C4,A5,G5) indicates a linear mapping of the [A3...A5] interval to [C4...G5]. Notes below A3 or above A5 are not modified, others are changed according to the mapping. Even the notes in the MIDI sequence of a sound-object may be changed provided that its property "Accept key changes" has been set to true.

The default mapping (which changes nothing) in the beginning of any musical item is:

_keymap(0,0,127,127) or equivalently _keymap(C00,C00,G9,G9) in the English note convention.

Key maps may be interpolated. Unlike _keyxpand (see supra), _keymap makes changes on simple notes and sound-objects at the time of performance. (In other words, changes do NOT occur during the production of a grammar.)

A complete demo of key mapping is found in '-gr.tryKeyMap' in the "NEW EXAMPLES" folder.


All these serial tools are documented on-line in BP2. Press the command and '?' keys together, then click their names to display the help.

... behind the bars: the _tempo tool

_tempo(x) multiplies the tempo by 'x'. The 'x' argument may be a floating-point number or an integer ratio. Try for instance:

A3 B3 _tempo(1.5) C4 D4 _tempo(1/2) E4 F4

Here, C4 and D4 are played 1.5 times faster than A3 or B3. E4 and F4 are played at half the speed.

In polymetric expressions (expressions between curled brackets) tempo values are multiplied. For instance, in

A4 B4 _tempo(2) C5 D5 {_tempo(1.5) E5 F5}

the sequence E5 F5 is performed at tempo 3 = 1.5 * 2. This example indicates that tempo change is relative. Thus, "_tempo(2)" is not the strict equivalent of "/2" (the obsolete "tempo marker" notation) although it should replace it in most cases.

Combining intricated tempo values in superimposed sequences produces "splits" of the time structure into independent layers, a feature termed as "polychronicity". BP2 offers the unique feature of imbedding polychronicity in a comprehensive syntax instead of submitting it to the rigidity of measure bars. Hence, it all works behind the bars!

Examples of _tempo will be found in '-da.trytempo' of the "NEW EXAMPLES" folder.

Miscellaneous upgrades

Very complex musical items

Items may grow extremely complex when they contain durations defined by numbers whose lowest common multiple is very large. Indeed, musicians should not be concerned with this because the structural complexity is not necessarily reflected in the actual music. A challenge was first posed by '-gr.Visser3' (in the "NEW EXAMPLES" folder) which forced BP2 to quantize the time structure with a compression rate larger than 2,000,000...

Indeed, '-gr.Visser3' isn't 100,000 more "complicated" than '-gr.Visser5' which gts through with a compression rate of 22 for the same global time accuracy... Explaining such discrepancies would be technical, so we beg musicians to rely on BP2's ability to sort out the maths on their behalf.

In order to deal with these examples (and forthcoming ones that will certainly grow bigger) it became necessary to rewrite the integer arithmetic routines of BP2. In short, this new version of BP2 still provides for absolute accuracy, performing calculations on integer ratios, but whenever an integer number grows beyond range the machine approximates the ratio it is involved in. Consequently, there is no limitation (that we are aware of) in the complexity of items.

When dealing with large items, do not forget to deactivate the graphic display because QuickDraw operates within its own computation time/space limitations.

Memory management

A robust management of memory overflow has also been implemented in this version. BP2 tries to anticipate shortage of memory and proposes solutions that range from increasing the time quantization to using temporary memory outside the RAM partition of the program. The latter should be used carefully as it might cause the system to crash.

If your machine has enough RAM (your boss paid for it, eh?) and BP2 cries for memory, consider either -- or both -- solutions:


This tool allows random fluctuations of the velocities of notes following it in the same sequence. For instance,

_rndvel(20) _vel(60) D5 A#4 ...

will play the notes with velocities in range [40..80].

An alternate syntax would be

_rndvel(K1=20) _vel(K2=60) D5 A#4 ...

which allows the real-time control of these parameters by MIDI controllers mapped to K1 and K2 thanks to definitions supplied in the Interaction window.

A demo of random velocities is provided in '-da.tryRandomVelocity' in the "NEW EXAMPLES" folder.


This tool allows random fluctuations of the timings of sound-objects following it in the same sequence. For instance,

_rndtime(50) D5 A#4 ...

will play notes and sound-objects with a +/- 50 millisecond fluctuation.

A demo of random timings is provided in '-da.tryRandomTime' in the "NEW EXAMPLES" folder.


Works both as a grammar procedure and as a performance control.

On top of a subgrammar, _randomize picks up an arbitrary seed for the sequence of random numbers so that all subsequent random choices become unpredictable. This is equivalent to clicking the "New seed" button in the "Random sequence" dialog, or calling "Randomize" in a script.

If _randomize is found in an item being played, the sequence of random numbers is shifted to an arbitrary position, causing unpredictable choices to occur in _rndseq, _rndtime, etc.

The effect of _randomize is cancelled by _srand.


Sets the random generator's seed to 'x' and resets the random sequence.

On top of a grammar, resetting will take place during computation, before any rule of the grammar is applied. If it is placed before _rndseq, _srand will force the order of the sequence to a preset one that depends on the value of 'x'.

Values of 'x' are arbitrary. They are used to mark identical sequences or derivations in grammars. The range is 0..32767.

The effect of _srand is cancelled by _randomize.

A demo of _randomize and _srand is provided in '-da.trySrand' in the "NEW EXAMPLES" folder.


The "_transpose()" tool has been enhanced. Transpositions may now be cumulated in polymetric expressions. For instance,

_transpose(-3) {A4 _transpose(+7) C3 D3}

is interpreted as:

A4 _transpose(+4) C3 D3 [ ... since -3 + 7 = 4 ]

In addition, the numeric parameter may be a decimal number down to +/- 0.01. (See '-gr.tryTranspose' in the "NEW EXAMPLES" folder)

Transpositions may be interpolated. Try for instance

_transposecont _transpose(0) C4 C4 C4 C4 C4 C4 C4 C4 C4 C4 C4 _transpose(12) C4

to generate a chromatic scale. (There are smarter ways to use this tool!)

MIDI orchestra

This feature is accessible from the "Devices" menu. It shows a list of General MIDI instruments that have been assigned MIDI channels via "Program change" messages. (This works notably with multitimbral synthesizers such as that of QuickTime Music, on which each patch works on a single MIDI channel.)

To add an instrument, first click a channel number on the "MIDI" dialog (upper left), then click a program number on the "MIDI programs" dialog. The name appears and is inserted in the MIDI orchestra list. The list may be saved (with prefix '-or') or exported as a text file. MIDI orchestra files can be loaded automatically by grammars, alphabets or data if their names are placed on top of the window.

MIDI orchestra is a simple alternative to the General MIDI glossary whenever a single multitimbral patch is required. With the orchestra, changing the instrument means only changing a MIDI channel, and all instruments can play together. You may insert proper rules in the grammar or glossary for choosing an instrument, for instance:

Piano --> _chan(1)
Violin --> _chan(3) etc.

Start, Stop, Continue

BP2 can insert these messages thanks to embedded script lines, thus taking the control of other devices receiving MIDI data. Use script lines:

MIDI send Start
MIDI send Continue
MIDI send Stop

BP2 also responds to these messages when sent by other devices. Use script lines:

Wait for Start
Wait for Stop
Wait for Continue

Button "Synchronize start" on the bottom left of the "Settings" dialog, when checked, causes BP2 to hang waiting for a "Start" or a "Continue" message, unless this synchronization is assigned to a NoteOn message in the '-in' interactive file, with an instruction such as:

IN Start play C5 channel 1


Randomizing ("shuffling" the sequence of random numbers) is now possible in several ways:

Fade-out in MIDI files

(See "File save preferences" in the "Misc" menu)

If set to a value 'x' greater than zero, fade-out will append silences of duration 'x' after each track of a MIDI file, during which volume decreases stepwise on all channels. This compensates for the harshness of terminating the playback of MIDI files: listen for instance good.mid versus bad.mid.

Note that this fade-out is performed during a silence and does not affect notes played during the performance. Use "_volume" and "_volumecont" to change volume during the performance.


Apple Events

BP2 receives Apple Events (from local or remote computers).

It is also able to create Apple Events and send them to a local application (running on the same computer), using script instructions:

AE send fast class '«AEclass»' ID '«AEID»' to application '«signature»'
AE send normal class '«AEclass»' ID '«AEID»' to application '«signature»'

If the target application is not active, BP2 will first look for it and open it.

BP2/Csound features

Csound is a software environment for the design and transformation of digitized sounds. It runs on different platforms: Unix, NeXT, MacOS... Check and download the MacOS version from <>.

To produce Csound scores the "Csound scores" option should be checked in the "Output" menu. A Csound score is created on request for each musical item produced by a grammar or played from its text representation (a BP2 "score"). The same musical items may be played on real-time MIDI, saved as Csound scores, MIDI files, or any combination thereof.

If the musical item contains simple notes or sound-objects defined as streams of MIDI messages, BP2 converts the stream to a sequence of Csound events, using specifications of Csound instruments defined in a "Csound instrument file". This file can be edited in the "Csound instruments" dialog accessible from the "Output" menu. Csound instrument specifications should contain data consistent with the "orchestra" file invoked by Csound at the time it compiles scores produced by BP2.

If no Csound instrument file is loaded, BP2 uses a default instrument which has the start/end timing parameters and accepts volume (range 0..127), pitch (in the "octave point pitch-class" format) and pitchbend (in cents). The orchestra file for this instrument is "BP2test.orc" in the example folder. It is of course recommended to design a Csound orchestra with instruments taking more parameters like channel pressure, modulation etc., which BP2 handles in a smart way, using a "vector" representation of continuous parameter changes.

Sound-object prototypes may also contain Csound scores. In this case, BP2 creates a Csound score of the musical item combining these individual scores. BP2 may produce Csound scores using only Csound events and Csound instrument specifications as an input, thereby bypassing the limitations of MIDI.

A mapping between Csound parameters values (the ones found in the Csound score) and MIDI / BP2 ranges may be defined by supplying three points. BP2 performs linear or quadratic interpolation, plus logarithmic mapping if requested to do so. (See the Reference Manual §9)

Waveform tables used by Csound instruments may be edited and stored along with the Csound instrument description file -cs.<name>. They are automatically inserted on top of Csound scores.

In addition to parameters mapped to MIDI controls such as pitchbend, modulation, volume, panoramic and pressure, BP2 handles continuously-varying parameters with arbitrary names specific to the Csound environment. (See "QuickStart" manual §17.5) This version of BP2 automatically generates function tables whenever these are required for the description of fine variations of parameters. These tables may invoke GEN07 or GEN08. (See "QuickStart" manual §17.12)

All Csound features are documented on-line in BP2.

Check demos: