Bol Processor ‘BP3’ and its PHP interface

This is a pre­sen­ta­tion of the Bol Processor BP3. Download the pack­ages, install a local Apache serv­er and try these pro­ce­dures in your envi­ron­ment: MacOS, Windows, Linux etc.

Send questions/suggestions to the devel­op­ers via the con­tact form or join the BP devel­op­ers list on SourceForge. Bugs can be report­ed to Git issues for a quick fix.

The cur­rent ver­sion of the ‘BP3’ Bol Processor pro­duces BP scores, stan­dard MIDI files and Csound scores. MIDI files are instant­ly audi­ble thanks to the built-in MIDIjs play­er, where­as Csound scores are auto­mat­i­cal­ly con­vert­ed into sound files that are sent to a stan­dard HTML5 audio player. 

Real-time MIDI was also imple­ment­ed in May 2024. It works per­fect­ly in a MacOS envi­ron­ment and is like­ly to work well in Linux and Windows, sub­ject to ver­i­fi­ca­tion… Once you have installed and test­ed the BP3, go to the Real Time MIDI page to enjoy the full range of pos­si­bil­i­ties it offers!

BP3 is cur­rent­ly being test­ed in the MAMP envi­ron­ment (see below) on a com­put­er run­ning MacOS Sonoma 14.4. Earlier ver­sions such as Mojave 10.14 had also been ful­ly tested.

This page pro­vides an overview of all inter­ac­tions with the Bol Processor BP3 ‘bp’ con­sole. The objec­tive is to ver­i­fy its oper­a­tion in any envi­ron­ment suit­able for com­pil­ing the core pro­gram (i.e. the ‘bp’ con­sole). We are seek­ing testers for Windows and Linux envi­ron­ments.

Once the instal­la­tion of BP3 and (option­al) Csound has been com­plet­ed and checked, you may pro­ceed to read and check these fea­tures in any order you see fit.

The next phase of devel­op­ment will be to cre­ate a stand­alone appli­ca­tion based on the PHP/HTML/Javascript code used in this version.

Install the package

Installing the Bol Processor BP3 does not require any pro­gram­ming skills. In par­tic­u­lar, there is no need for Unix com­mands sent via the Terminal… Just fol­low the 7 steps with great care.

  1. To use the Bol Processor BP3 you will need to install an Apache+PHP pack­age on your desk­top com­put­er:
    https://en.wikipedia.org/wiki/List_of_Apache-MySQL-PHP_packages
    This will allow you to run a local web ser­vice. Geeks can indeed install Apache and PHP them­selves…
    At the moment, Bol Processor can­not be used on shared web­sites because most (afford­able) host­ing ser­vices do not accept bina­ry applications.
  2. On Mac and Windows machines we rec­om­mend MAMP or XAMPP, both Apache/PHP servers with pre-installed fea­tures. Only Apache and PHP (with the GD Graphics option) need to be run­ning as no data­base is used by this inter­face. MAMP requires a pay­ment after for two weeks, where­as XAMPP is com­plete­ly free…
    Don’t try the vir­tu­al machine ver­sion of XAMPP! It won’t work on Macs with M1 chips (and above). Use the native installer.
    If you want Apache to start auto­mat­i­cal­ly when you start your com­put­er, this process is easy with MAMP, but a bit more com­plex with XAMPP. Mac users can cre­ate a start­up script to do this. Windows users, try this method, and Linux Ubuntu users, try that method
  3. Download the lat­est ver­sions of files for the PHP inter­face files: php-frontend-master.zip and the exam­ple set bp3-ctests-main.zip. These files are updat­ed reg­u­lar­ly. All updates are announced on the BP devel­op­ers list and uploaded to the GIT repos­i­to­ry.
  4. After unzip­ping these pack­ages, cre­ate a “bol­proces­sor” fold­er at a loca­tion suit­able for your local web serv­er — nor­mal­ly the “htdocs” fold­er cre­at­ed by XAMPP or MAMP. For XAMPP on a Mac, the “htdocs” fold­er is in “Applications/XAMPP/xamppfiles”. For MAMP, the “htdocs” fold­er is in “Applications/MAMP”. Linux or Windows users, find out the loca­tions and send us the details!
  5. At the top lev­el of the “bol­proces­sor” fold­er, cre­ate fold­er called “ctests”. Copy the con­tents of “php-frontend-master” into the “bol­proces­sor” fold­er and the con­tents of “bp3-ctests-main” into “ctests”. Later you can cre­ate more data fold­ers at the same loca­tion.
    You should now see the fol­low­ing in “bol­proces­sor”:
    • The “php” fold­er
    • The “BP2_help.txt” file
    • The “LICENSE” file
    • The “README.md” file
    • The “compile.php” file
    • The “ctests” fold­er con­tain­ing a set of exam­ples of the Bol Processor: gram­mars, alpha­bets, data, sound-object pro­to­types, etc. Veterans can include any file pre­vi­ous­ly saved with the BP2.9.8 appli­ca­tion.
    • The “csound_resources” fold­er con­tain­ing Csound orches­tra files and instru­ments, their asso­ci­at­ed wave­form files etc. BP3 auto­mat­i­cal­ly moves Csound resources to this fold­er in case it finds them in a data fold­er. This avoids dupli­ca­tion and conflicts.
  6. Download the con­sole pack­age from GitHub — name­ly, bolprocessor-graphics-for-BP3.zip — and unzip it. Then copy all its con­tents into the “bol­proces­sor” fold­er. It con­tains the C source files that will be com­piled to cre­ate the “bp” con­sole (path: source/BP2), and the “make­file” file which con­tains instruc­tions for the com­pi­la­tion. It also con­tains a few (obso­lete) files used in pre­vi­ous versions.
  7. Ensure that the “bol­proces­sor” fold­er and all files with­in it have read/write per­mis­sions for all users — numer­ic mode “777″ — oth­er­wise you will get blank pages or a mes­sage such as “error 500″. Carefully set read/write per­mis­sions on the “bol­proces­sor” fold­er, includ­ing its sub­fold­ers and files.
    There is no secu­ri­ty risk in set­ting read/write per­mis­sions, as the Apache serv­er will be run­ning on your pri­vate com­put­er. In addi­tion, the Bol Processor BP3 nev­er creates/modifies files out­side of its “bol­proces­sor” fold­er.

The file struc­ture is shown on the left. This image includes “bp” which will be cre­at­ed later.

The “temp_bolprocessor” and “my_output” fold­ers are auto­mat­i­cal­ly cre­at­ed when the inter­face is run. The con­tents of the “temp_bolprocessor” fold­er will be cleared of all files/folders old­er than 24 hours.

Save a copy of the “ctests” fold­er, as you will prob­a­bly mod­i­fy some data files while using the pro­gram. You may want to restore the orig­i­nal ver­sions later.

Running the inter­face will also cre­ate “BP2_help.html” in the “php” fold­er using “BP2_help.txt” as its source. The lat­ter should there­fore always remain inside the “bol­proces­sor” fold­er.

If you want to check the pro­duc­tion of Csound scores and asso­ci­at­ed sound files, a Csound instal­la­tion is required. Packages are avail­able for all sys­tems on the Csound down­load page. If you don’t feel com­fort­able com­pil­ing source code, you can choose a pre-built instal­la­tion. For exam­ple, the OS X dmg archive installs Csound on Macintosh com­put­ers with a sin­gle click; no tech­ni­cal skills are required.

Due to a design error, Csound ver­sions 6.16 and 6.17 did not work when invoked from a web brows­er. This prob­lem has been fixed in Csound 6.18. Make sure you have a com­pat­i­ble ver­sion if Csound is already installed on your com­put­er. Updating to the lat­est ver­sion is always a good idea!

Start your local Apache server

The fol­low­ing are expla­na­tions for Mac users, which should be eas­i­ly trans­fer­able to Windows and Linux — your sug­ges­tions are wel­come!

If you have MAMP installed, start­ing the Apache serv­er is fair­ly straightforward:

The MAMP PRO main page (ver­sion 5.7)
  1. Launch MAMP (or MAMP PRO) from the Applications folder.
  2. In the MAMP main win­dow, click the Apache Enable but­ton (see image).
  3. The image shows the default set­tings for PHP, which is start­ed with Apache. Version 7.4.2 was the high­est ver­sion cur­rent­ly sup­port­ed by MAMP PRO (and 2022).
  4. Note the set­tings for ports (see image) and of hosts (gen­er­al and Apache).

If you have XAMPP installed, open the XAMPP fold­er in the Applications fold­er and launch manager-osx.app as shown below.

The XAMPP main page will appear. Click on the Manage Servers tab, then select Apache Web Server and click Configure. This is nec­es­sary to set up the port to any val­ue except “80″ (or except “8888″ in case you are also run­ning MAMP). Suggestion: set it to “81″.
Then click the Start but­ton. If there is no con­flict with the ports, Apache will show up as “run­ning”:

The XAMPP fold­er (in the Applications fold­er on a Mac) and the XAMPP main page

Once Apache is run­ning, you can click on the Welcome tag and the Go to Application but­ton. This should dis­play a (local) page about XAMPP in the path http://localhost/dashboard. Both the dash­board and bol­proces­sor fold­ers are locat­ed in the Applications/XAMPP/xamppfiles/htdocs folder.

You may not be able to run both MAMP and XAMPP Apache servers at the same time if they use the same ports. This would­n’t be a good idea anyway…

Compile ‘bp’ and check its operation

Bol Processor BP3 home page after com­pil­ing the ‘bp’ console
  • Start your Apache/PHP serv­er (see pre­vi­ous chap­ter) and point your (favourite) web brows­er at the file bolprocessor/php/index.php. The URL should look some­thing like http://localhost:8888/bolprocessor/php/. Note that “http” is used, not “https. The “8888″ port is the one set by the serv­er to avoid clash­ing with the “80″ default port used for exter­nal web browsing.
  • If you get an error mes­sage or see noth­ing, check point 7 (file per­mis­sions) of the instal­la­tion pro­ce­dure above, and set the appro­pri­ate ports as shown above (see pic­ture).
  • The first time, you will not see the home page as shown above. Instead, you will get a warn­ing that “bp” was not found — or is not respond­ing prop­er­ly on your sys­tem — along with a link to the “compile.php” page. This page will attempt to com­pile “bp” if the “source” fold­er has been prop­er­ly copied to “bol­proces­sor” (step 6 above).
    This com­pi­la­tion runs your sys­tem’s “make” com­mand and reads the “Makefile” set of instruc­tions.
    This process works well on MacOS. We need your help to con­firm that it also works on Linux and Windows. Please share your expe­ri­ence!
  • After com­pi­la­tion, you will see a con­fir­ma­tion mes­sage if it was suc­cess­ful, or a list of errors if it was not. You can then return to the home page, which will look like the pic­ture above. 
  • Check that the “bp” con­sole is respond­ing appro­pri­ate­ly by click­ing the link on the con­sole’s Help file at the top right of the page. Failure to respond would indi­cate that the com­pi­la­tion was­n’t appro­pri­ate. The help will appear in a pop-up win­dow. Pop-up win­dows cre­at­ed by the Bol Processor should be vis­i­ble regard­less of secu­ri­ty set­tings on your web browser.
  • Mac users: if the com­pi­la­tion fails, you may need to install the com­mand line devel­op­er tools in OS X (expla­na­tions) or the Xcode toolk­it on your machine. This should not be nec­es­sary when run­ning a recent sys­tem such as MacOS Sonoma 14.
  • Linux (Ubuntu) users: If not already installed, you need to install gcc for com­pil­ing and make for automat­ing the build. Type the fol­low­ing com­mands:
       sudo apt update
       sudo apt install build-essential

    Further, for real-time MIDI sup­port you will need the ALSA libraries. Type:
       sudo apt install libasound2-dev
    We still need a con­fir­ma­tion that this pro­ce­dure works!
  • Windows users: You may need to install MinGW which pro­vides a min­i­mal envi­ron­ment for gcc. Download and install MinGW for a 64-bit archi­tec­ture.
    Alternatives are w64devkit (down­load and com­pile it or down­load a com­piled ver­sion) and Cygwin.(down­load it).

😀  You’ve done the dif­fi­cult part! 😀

  • Once “bp” has been cre­at­ed, the home page will dis­play the con­tents of the “bol­proces­sor” fold­er, in par­tic­u­lar a link to the “ctests” fold­er. If Csound is installed and respon­sive, a friend­ly warn­ing will appear on the top right hand cor­ner along with a men­tion of its ver­sion (see pic­ture above).
  • If Csound is not respon­sive, you prob­a­bly need to spec­i­fy the path to the “csound” appli­ca­tion.
    Linux and Windows users: It is pos­si­ble that the appli­ca­tion is not called “csound” in your envi­ron­ment. Please con­tact us if you have this prob­lem, as it will require an update of the interface.
  • Follow the “ctests” link. You will find a list of avail­able exam­ple files. Their names have colour labels indi­cat­ing the type of each file. In gen­er­al, the name of a Bol Processor gram­mar starts with “-gr”, but it can also end with the exten­sion “bpgr”. The name of Bol Processor data starts with “-da”, but it can also end with the exten­sion “bpda”. Both file type con­ven­tions are sup­port­ed by BP2 and BP3. This became nec­es­sary a long time ago, when upgrad­ing BP2 from MacOS 9 to MacOS 10…
  • Click on “-gr.koto3″ to open a gram­mar. This will auto­mat­i­cal­ly cre­ate a fold­er called “my_output” at the top of the “bol­proces­sor” fold­er if it does­n’t already exist. Try cre­at­ing an out­put fold­er with a dif­fer­ent name and check its pres­ence at the top of “bol­proces­sor”. The cur­rent name of the out­put fold­er is saved in “_settings.php” which is recalled each time the inter­face is used. Failure to change the set­tings and/or cre­ate out­put fold­ers would reveal a wrong con­fig­u­ra­tion of file per­mis­sions on your local web server.
  • You can cre­ate sub­fold­ers of the cur­rent out­put fold­er. For exam­ple, if the cur­rent out­put is set to “my_output”, cre­ate “my_output/todays_folder”. The inter­face auto­mat­i­cal­ly replaces spaces with ‘_’ as these may be unwant­ed on some systems.
  • If you need to recom­pile “bp”, you can sim­ply point your brows­er to http://localhost/bolprocessor/compile.php, which will auto­mat­i­cal­ly call the “Makefile” sys­tem command.
  • The Grammar page has a Test image link that dis­plays a pop-up win­dow with draw­ings, text and ani­ma­tion. This is used to check cross-platform compatibility.

Produce items

👉 After June 12, 2024, pre­fix­es and suf­fix­es of some files have been changed to make them more meaningful:

  • Prefix “-ho” and suf­fix “bpho” are replaced by “-al” and “bpal” (Alphabet files)
  • Prefix “-mi” and suf­fix “bpmi” are replaced by “-so” and “bpso” (Sound-object files)
    These changes are auto­mat­i­cal­ly man­aged by the inter­face and the con­sole. No man­u­al edit­ing is required.
A gram­mar page. Related files “-al.abc1”, “-se.koto3” etc. have been iden­ti­fied and appear as but­tons at the bottom.
Sound-object dis­play of an item pro­duced by gram­mar -gr.koto3
  • Open the “-gr.koto3″ gram­mar and click PRODUCE ITEM(s). This will open a “BP con­sole” pop-up win­dow and launch the con­sole application.
  • By default, the out­put was set to MIDI files. A link is pro­vid­ed to down­load this MIDI file, and a javascript MIDIjs play­er is dis­played to lis­ten to its contents.
  • In the absence of “MIDI pro­gram” mes­sages, piano-like sounds are pro­duced which do not resem­ble the ren­der­ing of the -“gr.koto3″ gram­mar on a prop­er MIDI device — here a Roland D-50 syn­the­sis­er, lis­ten to the real thing. Don’t waste time try­ing to under­stand how this gram­mar works, we’re just doing a tech­ni­cal test!
  • While the con­sole appli­ca­tion is run­ning, a detailed list of actions is record­ed, which you can dis­play in the pop-up window.
  • At the top of the win­dow, the com­mand line cre­at­ed to call the con­sole is dis­played in red. This is used by pro­gram­mers to check the con­sole’s response.
  • An “Image” link will appear at the top of the BP con­sole win­dow. Click it to dis­play the image in a new win­dow. By default, this pic­ture shows the sound-objects a, b, c etc. We will see a pianoroll lat­er as anoth­er option.
  • At the top of the “BP con­sole” there is a link to the “trace file” which shows the full process of deriva­tions for cre­at­ing items. It was cre­at­ed by adding the --trace-production option to the com­mand line to check the details. The Trace mode can be enabled or dis­abled in the “-se.koto3set­tings page.
  • Check the “bolprocessor/my_ouput” fold­er. It should con­tain “koto3.mid” — the default name for this MIDI file.
Part of the Bol Processor score of the “koto3” item
  • Return to the gram­mar and select “BP data file” as the out­put option, then click the SAVE but­ton. Now the name “koto3.bpda” will be cre­at­ed, but you can change it to any­thing you like, keep­ing the “bpda” exten­sion, or using the “-da” pre­fix instead.
  • Click the PRODUCE ITEM(s) but­ton again. A link to the data file in Bol Processor score nota­tion appears at the top (see image). The Trace file shows the same deriva­tions. The file “koto3.bpda” should also be vis­i­ble in the bolprocessor/my_ouput folder.
A pianoroll dis­play of the same item pro­duced by gram­mar -gr.koto3
  • In the set­tings for “-gr.koto3″ it is pos­si­ble to change the for­mat of the graph­ics dis­play. Currently it is “Show objects”. Let us try “Piano roll”. This for­mat empha­sis­es the melod­ic and har­mon­ic struc­ture of the com­po­si­tion where­as the “objects” for­mat is explic­it about the size and posi­tion of the sound-objects.
  • Comparing the two images we can guess that “a” con­tains a stroke of the note A5 and “b” con­tains two strokes of the note B5. The «f» sound-object is an out-time object of zero dura­tion, con­tain­ing a sin­gle stroke of the note F2. The «chik» object is also out-time and con­tains a chord: {C3, F3, C4}.

The main mech­a­nism for cre­at­ing musi­cal items in this gram­mar is called sub­sti­tu­tions, indi­cat­ed as SUB on top of the 2nd sub­gram­mar. A sub­sti­tu­tion rule, when select­ed, is applied simul­ta­ne­ous­ly to each frag­ment of the work string. This is made clear by dis­play­ing the deriva­tions of the string. To do this, select the “Display pro­duc­tion” option on the Settings page. The deriva­tion steps will appear in the Trace window:

All deriva­tion steps of a piece pro­duced by “-gr.koto3”

Clicking “Trace pro­duc­tion” in the set­tings will give more details about the infer­ence process.

In the “Non-stop improvize” mode, every step of the sub­sti­tu­tion is used for the sound out­put. To do this, vari­ables are erased and only ter­mi­nal sym­bols are played. The effect is that the work string “grows” until it col­laps­es as a poly­phon­ic phrase with out-time objects «f» and «chik» play­ing the bass. The the­o­ret­i­cal mod­el behind this process is a (one-dimensional) cel­lu­lar automa­ton. For exam­ple, lis­ten to this per­for­mance of “-gr.koto3″:

An improviza­tion of “-gr.koto3” pro­duced by BP2.9.8 and played on a Roland D-50 synthesiser

As this is only a tech­ni­cal review of how BP3 works, we won’t dis­cuss the arcanes or rule-based com­po­si­tion in the Bol Processor. You should read the tuto­ri­als to become famil­iar with it.

If you set up the out­put for­mat to “Real-time MIDI”, the impro­vi­sa­tion will play for­ev­er on the MIDI device con­nect­ed to your com­put­er. Clicking the STOP or PANIC but­ton will stop it. Read expla­na­tions on the page Real-time MIDI.

Importing music

The pre­vi­ous para­graph was an intro­duc­tion to the main fea­ture of Bol Processor: cre­at­ing music using a gram­mar, an alpha­bet and def­i­n­i­tions of sound-object pro­to­types, which we will see in more detail below. This requires some knowl­edge of both music com­po­si­tion and the spe­cif­ic task envi­ron­ment of Bol Processor, as shown in the old BP2 ref­er­ence man­u­al and more recent tuto­ri­als.

With BP3 it is pos­si­ble to take a sim­pler (but arguably less cre­ative) approach: import pre-composed music and reuse its frag­ments to cre­ate new musi­cal works. This process can be achieved by using stan­dard sheet music con­vert­ed into the MusicXML for­mat. MusicXML files are down­loaded from the web or export­ed by score edi­tors such as MuseScore. A descrip­tion of this method can be found on the Importing MusicXML scores page, along with a brief pre­sen­ta­tion of the MusicXML format.

Below is an exam­ple of Beethoven’s Fugue in B flat major import­ed from MusicXML and con­vert­ed as Bol Processor data — a set of poly­met­ric expres­sions, see tuto­r­i­al. It was played on the PianoTeq physical-model syn­the­sis­er using the MIDI file pro­duced by BP3. This exam­ple illus­trates both the accu­ra­cy of the con­ver­sion and the lev­el of com­plex­i­ty han­dled by Bol Processor.

Beethoven’s Fugue in B flat major — piano ver­sion played by the Bol Processor with PianoTeq

Help messages

Displaying the help on reserved words in a grammar
  • Open the “-gr..Visser.Waves” gram­mar (designed by . At the bot­tom of the page, click the SHOW HELP ENTRIES but­ton. This will dis­play the gram­mar with links appear­ing on reserved words. For exam­ple, click on the link for “_transpose”. A pop-up win­dow will open, dis­play­ing the help at the exact loca­tion of the reserved word.
  • At the bot­tom of the gram­mar file, there is one more more but­ton: EDIT ‘-se.Visser.Waves’. It has been cre­at­ed auto­mat­i­cal­ly because the “-se.Visser.Waves” dec­la­ra­tion was found at the top of the gram­mar. Click on it to edit or cre­ate the file.
  • You can now pro­duce the “Visser.Waves” item, lis­ten to its sound ren­der­ing with MIDIjs and view the graph­ic out­put as “pianoroll” or “objects”. Below is a ren­der­ing of this gram­mar with phys­i­cal mod­el instru­ments (read expla­na­tions):
“Waves” by Harm Visser (1998)
played on phys­i­cal mod­el syn­the­sis sax­o­phone and piano

Error messages

  • Now, let us do some­thing wrong to check for errors. In “-se.Visser.Waves” change the “Note con­ven­tion” from ‘0’ (English) to anoth­er option such as ‘1’ (Italian/Spanish/French). Click on SAVE PARAMETERS, go back to the “-gr..Visser.Waves” gram­mar, click on SAVE and PRODUCE ITEM(s). Now, nei­ther the “out­put file” nor the graph­ics will be vis­i­ble, because the con­sole can­not not cre­ate an item due to its mis­un­der­stand­ing of note names. For exam­ple, “B3” is inter­pret­ed as a vari­able and not as a sim­ple note. This is not accept­able in the first argu­ment of con­trol “_transpose()”.
  • The note “B3” should have been replaced by its French equiv­a­lent “si2”. The good news is that this can be done auto­mat­i­cal­ly in a gram­mar: select the con­ven­tion you want to use at the bot­tom of the page.
  • PRODUCE ITEM(s) some­times reports that errors have been detect­ed by the con­sole. They appear in the “error” trace file.
  • Try the same pro­ce­dure with “-gr.trial.mohanam”. It is set for the Indian sargam note con­ven­tion = 2. After chang­ing the con­ven­tion to “French”, the out­put file will only con­tain notes “re6” which have the same name in both con­ven­tions. Confusing note con­ven­tions is a com­mon source of error when design­ing music with the Bol Processor. For this rea­son, the cur­rent set­ting of this con­ven­tion is dis­played on the Grammar window.
  • Note that the ren­der­ing of “-gr.trial.mohanam” is bet­ter with the out­put selec­tion set to “CSOUND file”. If Csound is installed and respon­sive on your machine, just try it!

Compile a grammar

  • So far, the gram­mars have been well formed, so click­ing on the COMPILE GRAMMAR but­ton would tell you that there is no error. Now go to the gram­mar called “unknown-terminal.bpgr“and click on COMPILE GRAMMAR. It tells you that errors have been found, and the “trace” file explains that it has found (at least) one unknown ter­mi­nal sym­bol. In fact, the sym­bols ‘x’ and ‘a’ have not been declared as sound-objects in a relat­ed “-alalpha­bet file.
  • The COMPILE GRAMMAR pro­ce­dure renum­bers sub­gram­mars and rules. If you are still play­ing with “unknown-terminal.bpgr”, replace “gram#1[1] S --> A B” with “S --> A B” and click on COMPILE GRAMMAR. The num­ber­ing “gram#1[1]” is restored. This takes account of insert­ing or delet­ing rules.
  • The gram­mar named “symbols.bpgr” com­piles suc­cess­ful­ly because its has an attached alpha­bet file con­tain­ing all its ter­mi­nal sym­bols. The alpha­bet file is called “symbols.bpal” and its dec­la­ra­tion in the gram­mar is “-al.:symbols.bpal”. This unex­pect­ed syn­tax is a trick to recog­nise file types whose names do not begin with the stan­dard pre­fix. This is just to demon­strate how to man­age files, as this alpha­bet does not pro­duce any sound.

Change the start string

Grammar -gr.Mozart with all its vari­ables extract­ed at the bottom
  • Musical items are pro­duced by a Bol Processor gram­mar which, by default, uses the sym­bol ‘S’ as the start­ing string for deriva­tions. However, it is some­times inter­est­ing to try to derive from anoth­er vari­able with the same gram­mar, or to lis­ten to a poly­met­ric expres­sion. Both of these are eas­i­ly achieved in the gram­mar window.
  • An exam­ple of this is the use of “-gr.Mozart”, where the vari­ables rep­re­sent musi­cal frag­ments that are assem­bled in the final ele­ment (read expla­na­tion). All vari­ables have been iden­ti­fied by the inter­face and dis­played as but­tons at the bot­tom of the page (see image on the right). Clicking on a but­ton pro­duces a deriva­tion of the variable.
  • Note how­ev­er that in this gram­mar deriva­tions from A1 to B8 won’t be unique, because they are cho­sen ran­dom­ly. Conversely, deriva­tions from T1 to T176 are unique.
  • At the bot­tom of the page is a field for enter­ing a poly­met­ric expres­sion, for exam­ple {{2,sol3,si3}-,fa5 re5 si4}. This expres­sion can con­tain vari­ables. Click on PRODUCE ITEM to lis­ten to the result or to obtain the out­put file (depend­ing on the out­put for­mat selected).
  • The “--start” and “-S” com­mand line options used in these pro­ce­dures are not yet implemented.

An exam­ple of using “-gr.Mozart” in Improvize mode is dis­cussed on the Mozart’s musi­cal dice game page.

Play data

Open “-da.checkPoly”:

Data file -da.checkPoly with auto­mat­i­cal­ly extract­ed items on the right side
  • The Data win­dow (see pic­ture) extracts lines that can be inter­pret­ed as musi­cal items in BP notation.
  • Each line is asso­ci­at­ed with two buttons:
  1. The PLAY but­ton sends a “play” com­mand to the con­sole after sav­ing the data line to a tem­po­rary file “…outdata.bpda” stored in the “temp_bolprocessor” fold­er. The con­sole is asked to process this data as a MIDI file or a Csound score.
  2. The EXPAND but­ton sends an “expand” com­mand to the con­sole after sav­ing the data line to a tem­po­rary file “…outdata.bpda” stored in the “temp_bolprocessor” fold­er. The result will be dis­played as text.

Scripts

  • Bol Processor BP2.9.8 was ful­ly script­able in the sense that all com­mands launched from its menu could be cap­tured as sequences of script instruc­tions and repro­duced at will. This includ­ed open­ing fold­ers and files, mod­i­fy­ing text or doing some­thing with the selection.
  • A script was run every evening for about half an hour check­ing all pro­ce­dures and track­ing changes in the out­put data, in addi­tion to the sound check.
  • This lev­el of automa­tion will not be achieved in the cur­rent release of BP3 because of the decou­pling between the con­sole and its PHP inter­face. As a result, many BP2 script instruc­tions won’t be valid in BP3. They will be ignored dur­ing script execution.
  • 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 Bol Processor BP3...
    Type Hope you enjoyed 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. A musi­cal sequence is played on MIDI and a Csound score is created.
  • In this script, instruc­tions “Show mes­sages OFF”, “Show graph­ics ON”, “Show mes­sages ON”, “Activate win­dow Scrap” and “Wait for C4 chan­nel 1” are ignored. The “Play” instruc­tion will expand the poly­met­ric expres­sion - - {2,G4,E4,C4,- C5 - C5 {C5_-,A#4_ _}} and send it to MIDI in real time. The note con­ven­tion has been set to “English” to recog­nise “G4”, “E4” etc. as sim­ple notes. The tem­po is set to stan­dard metronome = 60 beats per minute.
  • The “Type” instruc­tion dis­plays a line of text (which may con­tain HTML elements).
  • This script calls a sub­script called “-sc.trySubscript” in the same fold­er. Its con­tent is:
    Load project -gr.Ames
    Csound score ON
    Produce items
  • Here the machine will call the gram­mar “-gr.Ames” and set the out­put for­mat to “Csound score”.
  • The exe­cu­tion of the script is dis­played in a pop-up win­dow (see image above), which lists (in red) the com­mands sent to the con­sole. The sec­ond com­mand pro­duces a Csound score, as expected.
  • The image also shows (light blue) but­tons for enter­ing script instruc­tions. No typ­ing is required. There’s a but­ton called CHECK THIS SCRIPT which shows any errors, such as a file not found.
  • Below the script, the LIST ALL SCRIPT INSTRUCTIONS but­ton lists all the instruc­tions han­dled by BP2.9.8, indi­cat­ing which are obso­lete for BP3 and which are under development.

Sound-object prototypes

The gram­mar “-gr.koto3″ uses an alpha­bet of sound-objects, name­ly “-al.abc1″, which is relat­ed with a set of sound-object pro­to­types “-so.abc1″. The pianoroll dis­play of an item (above in the “Produce items” chap­ter) already indi­cat­ed that the sound-object “chik” con­tains a chord of 3 notes. We will now show you how to cre­ate or mod­i­fy these sound-objects.

The main page of a sound-object pro­to­type file
  • Open “-so.abc1″ (or a copy of it). If the file is cor­rect, below the hor­i­zon­tal line you should see a table with the names of its sound-object pro­to­types: a, a’, b, chik, cycle1 etc.
  • When you opened “-so.abc1″, a tem­po­rary fold­er was cre­at­ed in the “temp_bolprocessor” fold­er. It has a com­pli­cat­ed name, for exam­ple ‑so.abc1_ec02bffaaee23e051fa2afee52e57520_temp which con­tains the ses­sion iden­ti­fi­er. If you restart your com­put­er (or your brows­er), the ses­sion num­ber will be dif­fer­ent. This fold­er will there­fore become obso­lete and a new one will be cre­at­ed with the cur­rent ses­sion identifier.
  • The inter­face auto­mat­i­cal­ly deletes out­dat­ed fold­ers that are more than 24 hours old. Keep pages and tags open while you work on a par­tic­u­lar set of sound-object prototypes!
  • Despite the depen­den­cy on ses­sion iden­ti­fiers, no data is ever lost because “-so.abc1″ is in autosave mode, auto­mat­i­cal­ly sav­ing every 30 sec­onds while work­ing on its sound-object pro­to­types. This fea­ture is indi­cat­ed by red mes­sages at the top of the page.
  • In the table you will be offered the option of delet­ing sound-objects. Try a cou­ple of DELETE but­tons. The good news is that a but­ton called RESTORE ALL DELETED OBJECTS will appear… Click it to undelete sound-objects and return to the ini­tial state.
  • You can also cre­ate or dupli­cate sound objects. If you do so, don’t for­get to add their names to any “-al” (alpha­bet) file that declares a link with “-so.abc1″. The inter­face ensures that you do not cre­ate mul­ti­ple objects with names that are cur­rent­ly in use or have recent­ly been deleted.
  • Now let us edit an object, for exam­ple “chik”. Click on the but­ton with this name. The para­me­ters are the same as those shown in BP2.9.8. You can mod­i­fy any para­me­ter and click on SAVE THIS PROTOTYPE. In most cas­es the con­sis­ten­cy of the val­ues is not checked. We would need a sound out­put to check the effect.
  • Editing an object involves set­ting the met­ric and topo­log­i­cal para­me­ters used by the time-setting algo­rithm. Read the descrip­tion of this constraint-solving algo­rithm that takes these para­me­ters into account.
  • PLAY sends a com­mand to the con­sole, which will lat­er be exe­cut­ed to play the sound-object or a com­bi­na­tion of sound-objects (arranged in a poly­met­ric struc­ture) entered on the form.

Modify MIDI codes in sound-object prototype

Bottom of the page of a sound-object pro­to­type and its graph­ic display
  • At the bot­tom of each sound-object pro­to­type page, the EXPLICIT MIDI codes and TIME-STAMPED MIDI bytes links dis­play the lists of MIDI instruc­tions and time-stamped bytes that will be sent to the MIDI dri­ver. (The first num­ber is actu­al­ly the num­ber of bytes.)
  • Don’t for­get that the “-so” file is saved in the back­ground every 30 sec­onds (autosave) while you are mod­i­fy­ing sound-object pro­to­types… To return to the orig­i­nal ver­sion, close the “-so” tag and restore the “-so” file from its copy!
  • The IMAGE link dis­plays an image of the sound-object pro­to­type along with indi­ca­tions of its topo­log­i­cal and met­ri­cal prop­er­ties, sim­i­lar to the BP2.9.8 interface.
  • The Play MIDI file link pro­duces a sound out­put based on MIDI events con­tained in the sound-object pro­to­type. The “chik” sound-object pro­to­type plays a 250 ms chord on a stringed instru­ment. The inter­face uses MIDIjs Javascript MIDI Player to do this.
  • Note that there are five “Channel pres­sure” MIDI instruc­tions in this sound-object. These may have been picked up by play­ing on a pressure-sensitive key­board and their rel­e­vance is low since chan­nel pres­sure can be con­trolled at a high­er lev­el by per­for­mance para­me­ters. It is there­fore advis­able to click on SUPPRESS chan­nel pres­sure and check the effect on EXPLICIT MIDI codes and TIME-STAMPED MIDI bytes. If the change is not imme­di­ate­ly vis­i­ble (this depends on the brows­er), sim­ply reload the pop-up win­dow. Other “con­tin­u­ous” para­me­ters such as “vol­ume con­trol” can be sup­pressed in a sim­i­lar way.
  • APPEND AllNotesOff (all chan­nels) can be a use­ful option to ensure that this object turns off all pend­ing notes on the sound machine. It sends an instruc­tion to each of the 16 channels.
  • The MIDI con­tent of this object can be changed by load­ing a MIDI file. Click Choose File to select a MIDI file — for exam­ple, “test.mid” in the “ctests” fold­er — and then send to upload it. It is not finalised imme­di­ate­ly: you can exam­ine the EXPLICIT MIDI codes and TIME-STAMPED MIDI bytes of this file before sav­ing it to the sound-object pro­to­type. The exam­ple “test.mid” con­tains no less than 432 bytes because of the “Channel pres­sure” and “Parameter ctrl 7” mes­sages, which con­trol pres­sure and vol­ume. You can accept the import by click­ing SAVE or can­cel it by click­ing CANCEL. There is cur­rent­ly no “undo” func­tion in case the MIDI sequence has been replaced or delet­ed by mistake.
  • An impor­tant fea­ture is QUANTIZE NoteOns. We are deal­ing with “stri­at­ed sound-objects”, which means that they are designed to be played at a cer­tain tem­po. The tem­po at which the MIDI con­tent of this object was cap­tured is gen­er­al­ly not the same as the tem­po at which it will be played, as the lat­ter depends on per­for­mance para­me­ters. The ref­er­ence tem­po is giv­en by Tref which in this case is 1000 ms for a metronome with 60 beats/mn. The MIDI con­tent uploaded by “test.mid” has a dura­tion of 3500 ms, i.e. 3.5 beats. This dura­tion can be set either in mil­lisec­onds or in beats. Regardless of the dura­tion, it is often con­ve­nient to locate NoteOn and NoteOff events to a pre­cise frac­tion of a beat. An Quantizing to 1/64th of a beat is often a good choice. For sim­plic­i­ty’s sake, we will set it to 1/50th of a beat, or 20 ms.
    Before click­ing on QUANTIZE NoteOns, check the EXPLICIT MIDI codes. You will notice that there is a NoteOn of key 62 at 804 ms and a NoteOff of key 60 at 825 ms. Set the quan­ti­za­tion to 1/50th of a beat and click QUANTIZE NoteOns. Now the tim­ings of these events have been changed to 800 ms and 820 ms respec­tive­ly, which are mul­ti­ples of 20 clos­est to the orig­i­nal timings.

Csound

Integration of Csound in the Bol Processor environment

Csound is a pro­gram for the design and trans­for­ma­tion of digi­tised sounds. Csound and Bol Processsor are sim­i­lar and com­ple­men­tary in their text-oriented, pro­gram­ming approach, with respec­tive empha­sis on sound and musi­cal struc­tures. Their inter­ac­tion is sum­marised in the BP2 envi­ron­ment image.

Note that Csound orches­tra files con­tain­ing sound pro­duc­tion algo­rithms can be edit­ed on this inter­face although it is not used by the ‘BP3’ con­sole — nor was it used by BP2.9.8. Its name is stored in the Csound orches­tra file. Arguments declared in the lat­ter should match those in the former.

A sim­ple orches­tra file called “0-default.orc” is pro­vid­ed in the “csound_resources” fold­er. It can be used for Csound scores cre­at­ed by Bol Processor when no Csound orches­tra file is specified.

The use of Csound by the Bol Processor ‘BP3’ is the same as doc­u­ment­ed in chap­ter 17 of the BP2.9.8 instruc­tions man­u­al. Advanced fea­tures are doc­u­ment­ed in the arti­cles Csound check­up and Csound objects.

  • Open “-gr.Mozart“in the “ctests” fold­er.
  • Select the CSOUND file out­put option, which (by default) will cre­ates a file called “Mozart.sco” in the “my_output” fold­er. You can mod­i­fy these parameters.
  • If Csound is installed and respon­sive, this sta­tus will be men­tioned on the gram­mar. Otherwise the machine will rec­om­mend installing of Csound (from this site) or chang­ing the path to Csound — by default “/usr/local/bin/” on a Mac. Each time a new path is entered, the machine will try to call “csound --ver­sion” and will stop try­ing if it succeeds.
  • Click PRODUCE ITEM(s). A pop-up win­dow will indi­cate that the process was suc­cess­ful. Click Read the out­put file to read the Csound score on anoth­er pop-up window.
Csound score pro­duced by gram­mar -gr.Mozart

In this exam­ple, the Csound score has been gen­er­at­ed by the Bol Processor as a sequence of “sim­ple notes” that appear at the end of each score line: “mi5”, “do3”, “do5”, etc. To do this, the Bol Processor uses con­ver­sion pro­ce­dures to replace MIDI events with score lines.

If Csound is installed and respon­sive, it will auto­mat­i­cal­ly be called to pro­duce a sound file (in the WAV for­mat) which will appear on a HTML play­er (see image). Checking the sound out­put — or rather the valid­i­ty of the Csound score — is there­fore the mat­ter of a sin­gle click on PRODUCE ITEM(s).

On each score line, the “1” of “i1” is the val­ue of argu­ment “1”, the left­most one. The next two argu­ments are assigned to the start date and dura­tion of the event, mea­sured in beats. Then comes argu­ment “4”, which is assigned to the pitch in octave point pitch-class for­mat. Arguments “5” and “6” are for con­tin­u­ous vol­ume con­trol (in the range 0…127). Argument “7” can con­tain the ref­er­ence to a table for refin­ing these vari­a­tions. Arguments “8” and “9” are used for (con­tin­u­ous) pitch­bend con­trol, and argu­ment “10” may con­tain the ref­er­ence to a table for refin­ing pitch­bend variations.

Pianoroll dis­play of “-gr.Mozart”
Some vari­a­tions on “-gr.Mozart” ren­dered by Csound using the “0-default.orc” orches­tra and Zarlino’s mean­tone tem­pera­ment to tune the instrument

A just-intonation ver­sion of Mozart’s musi­cal dice game can be heard on the Just into­na­tion: a gen­er­al frame­work page.

Csound instrument files

Bol Processor can gen­er­ate a Csound out­put from scores stored in sound-objects or con­vert­ed from the MIDI stream. It also has a direct con­trol of the per­for­mance para­me­ters that the Csound orches­tra can inde­pen­dent­ly manip­u­late on the stan­dard MIDI con­trols (“pitch­bend”, “mod­u­la­tion”, “vol­ume”, etc.). These para­me­ters are fur­ther inter­po­lat­ed by the Csound orches­tra, using the GEN07 (lin­ear inter­po­la­tion) or GEN08 (cubic spline) Csound gen­er­a­tors. All this is doc­u­ment­ed in chap­ter 17 of the BP2.9.8 instruc­tions man­u­al and set up in a “-cs” Csound instru­ment file as the one shown below.

  • Open “-cs.tryCsound” in the “ctests” fold­er. Note that this page is in autosave mode (see below): changes to Csound instru­ments are auto­mat­i­cal­ly saved at a rate of twice per minute.
  • This Csound instru­ment file is declared to be linked to a Csound orches­tra file called “tryCsound.orc”. As this file is miss­ing from the “csound_resources” fold­er, a link to cre­ate the file is dis­played. Otherwise it would lead to edit­ing the file.
  • The text area for Tables needs no more expla­na­tion than giv­en in the BP2.9.8 instruc­tions man­u­al. These tables are not used to cre­ate Csound scores. They are only insert­ed at the begin­ning of the score.
  • Csound instru­ments can be asso­ci­at­ed to MIDI chan­nels. For exam­ple, here, MIDI mes­sages sent to chan­nel 2 will be con­vert­ed into instruc­tions sent to instru­ment 3 “Harpsichord”.
  • At the bot­tom of the page is a list of the Csound instru­ments declared in this “-cs” file. These can be delet­ed, undelet­ed and dupli­cat­ed much in the same way as sound-object pro­to­types (see above). Clicking on the blue but­ton with the name of the instru­ment opens an edi­tor for that instrument.

Editing a Csound instrument

Page of a Csound instru­ment show­ing para­me­ters asso­ci­at­ed with MIDI controllers

The Csound instru­ment edi­tor is very sim­i­lar to that of the BP2.9.8’s inter­face. A detailed descrip­tion can be found in chap­ter 17 of the BP2.9.8 instruc­tions man­u­al.

  • For exam­ple, let us exam­ine the instru­ment Harpsichord in “-cs.tryCsound”. Its index is “3”, which means that it can be called as _ins(3) or _ins(Harpsichord) on a Bol Processor score.
  • The para­me­ters dis­played on the “Harpsichord” page are those asso­ci­at­ed with MIDI con­trollers. These can be con­trolled con­tin­u­ous­ly if argu­ments are giv­en to mod­i­fy the start and end date val­ues in a con­tin­u­ous change. The argu­ment under “table” is the ref­er­ence of an option­al tab­u­lar function.
  • For the vol­ume para­me­ter, “0”, “64” and “127” (MIDI val­ues) must to be con­vert­ed to “-24”, “0” and “+24” (Csound val­ues) respec­tive­ly. The con­ver­sion is from a lin­ear to a log­a­rith­mic scale.
  • The start and end val­ues of the con­tin­u­ous­ly chang­ing vol­ume are set by argu­ments “7” and “8” respec­tive­ly. These are used by an algo­rithm that sets the vol­ume in the asso­ci­at­ed Csound orches­tra, based on the GEN07 (lin­ear inter­po­la­tion) or GEN08 (cubic spline) gen­er­a­tors.
  • Given three pairs of input/output val­ues, BP2 tries to define a qua­drat­ic map­ping between the input and the out­put. However, it may be dif­fi­cult to fit the three val­ues to a monot­o­ne qua­drat­ic func­tion… See the Csound argu­ment map­ping page for a detailed explanation.
  • At the bot­tom of the page you will find a list of Csound para­me­ters that have noth­ing to do with MIDI con­trollers. This is where Bol Processor Csound pro­duc­tion can dif­fer rad­i­cal­ly from MIDI!
  • This instru­ment has only one addi­tion­al para­me­ter called “blurb”.
A spe­cif­ic “blurb” Csound parameter

These addi­tion­al para­me­ters can be cre­at­ed, delet­ed and undelet­ed in the same way as instru­ments (see above). The inter­face ensures that a new para­me­ter does not have the same name as an exist­ing one or a (tem­porar­i­ly) delet­ed parameter.

Let us look at the “blurb” para­me­ter (image on the left). Each para­me­ter has a default val­ue which is not nec­es­sar­i­ly zero. Values found on Csound scores can be com­bined addi­tive­ly (ADDval) or mul­ti­plica­tive­ly (MULTval). This “blurb” para­me­ter sends its start val­ue to argu­ment “9” of the algo­rithm in the Csound score, and its end val­ue (for con­tin­u­ous vari­a­tions) to argu­ment “10”.

Using a Csound instrument in a grammar

This use is demon­strat­ed in a hypo­thet­i­cal music pro­duc­tion that is sim­ple enough to grasp the basic fea­tures of Csound in its Bol proces­sor imple­men­ta­tion. A com­plete demo based on a real musi­cal exam­ple can be found in the arti­cle Sarasvati vina. We have also doc­u­ment­ed all the fea­tures of the Csound imple­men­ta­tion in the arti­cles Csound check­up and Csound objects, show­ing exam­ples that can be checked with the eval­u­a­tion ver­sion of BP3.

The gram­mar “-gr.tryCsound” calls “-cs.tryCsound” and uses its instru­ment “3” (Harpsichord):

S --> _ins(3) _volumecont _volume(127) A4 G4 C5 A5 A4 G4 C5 A5 _volume(0)

The Csound score pro­duced by this gram­mar is shown below:

; Csound score
f1 0 256 10 1
f2 0 256 10 1 0.5 0.3 0.4
t 0.000 60.000
i3 0.000 1.000 440.00 8191.500 8191.500 24.000 21.688 0.000 0.000 0.000 0.000 0.000 ; A4
i3 1.000 1.000 392.00 8191.500 8191.500 21.688 18.431 0.000 0.000 0.000 0.000 0.000 ; G4
i3 2.000 1.000 523.25 8191.500 8191.500 18.431 12.899 0.000 0.000 0.000 0.000 0.000 ; C5
i3 3.000 1.000 880.00 8191.500 8191.500 12.899 -0.031 0.000 0.000 0.000 0.000 0.000 ; A5
i3 4.000 1.000 440.00 8191.500 8191.500 -0.031 -1.179 0.000 0.000 0.000 0.000 0.000 ; A4
i3 5.000 1.000 392.00 8191.500 8191.500 -1.179 -2.794 0.000 0.000 0.000 0.000 0.000 ; G4
i3 6.000 1.000 523.25 8191.500 8191.500 -2.794 -5.547 0.000 0.000 0.000 0.000 0.000 ; C5
i3 7.000 1.000 880.00 8191.500 8191.500 -5.547 -24.000 0.000 0.000 0.000 0.000 0.000 ; A5
s
e
Mapping of vol­ume in Csound instru­ment 3
  • Arguments “5” and “6” show the pitch­bend start and end val­ues as spec­i­fied by the instru­ment. These remain at the default val­ue of “8191.5” in the absence of pitch­bend instructions.
  • Arguments “7” and “8” dis­play the start and end val­ues of the vol­ume para­me­ter as expect­ed. The con­tin­u­ous range is from “+24” to “-24”. This is the result of a map­ping between MIDI val­ues in the range [0…127] and the vol­ume para­me­ter of this instru­ment in the range [-24…+24] (see image). This map­ping is based on a log­a­rith­mic inter­po­la­tion using a qua­drat­ic regres­sion.
  • Csound will be able to achieve a con­tin­u­ous vari­a­tion of this vol­ume para­me­ter. To do this, it will invoke its own inter­po­la­tion scheme spec­i­fied as GEN07.
  • The _volumecont instruc­tion at the begin­ning of the sequence actu­al­ly means “con­ti­nu­ity”. This resolves a dis­crep­an­cy between the MIDI and Csound rep­re­sen­ta­tion of “musi­cal events”: in the MIDI envi­ron­ment, each event is asso­ci­at­ed with a time point where­as Csound scores deal with time seg­ments of spe­cif­ic dura­tions. It is up to the Csound orches­tra to decide how to mod­i­fy a para­me­ter from the on-set to the off-set of a segment.
  • Arguments “9” and “10” remain at the default val­ue “0.000” as the “blurb” para­me­ter is not used.
  • Arguments “11” and “12” remain at the default val­ue “0” of the unused mod­u­la­tion parameter.
  • Argument “13” remains at the default val­ue “0” of the unused panoram­ic parameter.

Csound scores cre­at­ed with “-gr.tryCsound” can­not be played with “BP2test.orc” because their argu­ments do not match. They require a dif­fer­ent orches­tra file called “tryCsound.orc” which we haven’t been able to design yet…

A real musi­cal exam­ple using many fea­tures of the Csound inte­gra­tion in the Bol Processor is a phrase of Carnatic music composed/designed by Srikumar K. Subramanian in 1996. Read the descrip­tion of this exam­ple and lis­ten to its musi­cal ren­der­ing (in “just into­na­tion”) below:

“Pallavi” of song “Maayaatiita Svaruupini, Nannu brovave” in raga “maya­maalava­gaula”

Microtonality

In con­junc­tion with Csound, the Bol Processor BP3 is open to micro­tonal­i­ty and the pro­gram­ming of cus­tom scales. Read the pages Microtonality and Csound tun­ing in BP3. Applications to west­ern har­mo­ny and to the into­na­tion of ragas in Indian music are pre­sent­ed in the “Musicology” sec­tion.

Editing the Timebase

A time­base with 3 tracks set up in 4 beats

The Timebase is a device for cre­at­ing a rhyth­mic pat­tern to be super­im­posed on a piece of music pro­duced by the Bol Processor in real time via MIDI. Superimposition did not work well with BP2.9.8, but did work with old­er ver­sions con­nect­ed to MIDI via the OMS pack­age. It has not yet been imple­ment­ed in the ‘BP3’ con­sole. Here we show a time­base edi­tor which is a lit­tle more advanced than on BP2. We also try the over­lay by import­ing the Bold Processor pro­duc­tion as a MIDI file.

  • Create a new time base called “try.bptb” in the “ctests” fold­er and open it.
  • By default, the time base con­tains 3 tracks, 2 of which are set to a sim­ple 4-beat tem­po of mm = 60 beats/mn. The third track is emp­ty. Fill it with 4 strokes on key = 100 at a speed ratio of 2/1.
  • Now lis­ten to the com­bined 4 tracks (repeat­ed 3 times):
  • To under­stand the struc­ture you can mute some tracks.
  • Now click on “Choose File” to select a MIDI file, for exam­ple “acceleration.mid”, and click on the “send” but­ton to import it.
A MIDI file “acceleration.mid” has been loaded in the timebase.
  • You can lis­ten to the import­ed file and to the com­bi­na­tion of this piece of music piece with the tick­ing pat­tern:
After load­ing “this_song.mid” a change of tem­po is suggested.
  • The over­lay sounds good because the piece was cre­at­ed at mm = 60 and it fits a rhyth­mic pat­tern of 4 beats. You can try chang­ing the metronome val­ue in the table above. You will receive a warn­ing if the metronome set­ting does not match the tem­po declared in the import­ed MIDI file.
  • For exam­ple, check this rhyth­mic cycle above “this_song.mid” in the “ctests” fold­er. You will be asked to set the metronome to 9 beats in 4 sec­onds, as declared in the MIDI file (pic­ture on the right). The tim­ing is per­fect:
  • This inter­face allows an unlim­it­ed num­ber of cycle tracks to be added. (The lim­it in BP2 was 3 tracks).
  • Playing with speed ratios cre­ates com­plex cycles that can be used to con­trol a drum machine if the appro­pri­ate chan­nels, key num­bers and veloc­i­ties are set up. Traditional rhyth­mic struc­tures can also be eas­i­ly pro­grammed. See exam­ples below:



A 15-beat rhyth­mic struc­ture called pan­chamas­vari tala in Hindustani music


Slowly drift­ing rhyth­mic patterns

Tick patterns as polymetric expressions

For experts!

The Timebase page on the PHP inter­face pro­vides a con­ve­nient way of super­im­pos­ing a pro­grammed tick pat­tern with a pro­duc­tion of Bol Processor pre­vi­ous­ly saved as a MIDI file. Another usage of time bases is the con­trol of a MIDI drum machine tak­ing part in the per­for­mance. It would be ben­e­fi­cial to design the drum machine track as part of the per­for­mance, as poly­met­ric expres­sions are able to han­dle super­po­si­tions. We will see that although it is often pos­si­ble, it remains a tedious task.

A poly­met­ric equiv­a­lent of the tick pat­tern 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 expres­sion is dis­played at the foot of the Timebase page.

Let us try to add this poly­met­ric expres­sion as vari­able “Drum” to the gram­mar “-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 will not work because the “Piano” pat­tern needs to be repeat­ed at the cor­rect tem­po instead of being extend­ed in dura­tion… The solu­tion will be to replace it with a cyclic sound object. Let us do it…

  • Create the fol­low­ing “-gr.drum” gram­mar and use it to cre­ate 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 pro­to­types file called “-so.drum” and define a sound-object called “cycle2”.
Setting a sound-object to “cyclic”
  • Set it to “cyclic” (see pic­ture on the left).
  • Import “drum.mid” into sound-object protype “cycle”.
  • Bad news: its dura­tion is 6000 ms instead of the expect­ed 4000 ms…
  • A look at EXPLICIT MIDI codes reveals that the last 2 sec­onds are a fade-out added by the Bol Processor to avoid an abrupt end.
  • Good news: the sound-object pro­to­type edi­tor allows you to crop the sound-object by trun­cat­ing its end. So let us crop it to 4000 ms.
  • Listen to the cropped “cycle2” sound-object and look at its image. Everything is per­fect. This object sounds iden­ti­cal to the sequence pre­vi­ous­ly pro­grammed on the Timebase page:

    Cropping sound-objects is done care­ful­ly. If nec­es­sary, the algo­rithm rewrites “NoteOff” mes­sages that have been delet­ed by the cropping.
  • Now the sound-object will be added to the gram­mar 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 “cycle2” sound-object and its asso­ci­at­ed “-so.drum” pro­to­type file must be declared in the fol­low­ing “-al.drum” alpha­bet file:
    -so.drum
    *
    cycle2
    The ‘*’ on the sec­ond line of the alpha­bet is an arbi­trary sym­bol declar­ing a homo­mor­phism — not used here.

     
  • This method is tedious, although it con­forms to the Bol Processor mod­el. Worse still, the equiv­a­lent poly­met­ric expres­sion can become extreme­ly com­plex if the speed ratios and/or beat cycles of all the tracks are not the same. In this case, it will not be dis­played at the bot­tom of the Timebase page.

Setting max computation time

There are many ways to ensure that a gram­mar does not repeat the same process over and over again. These are part of the syn­tax in the Bol proces­sor. For exam­ple, a flag can be decre­ment­ed each time a rule is applied, and can inval­i­date all rules when it reach­es zero.

However, mis­takes can — and will — hap­pen. For exam­ple, con­sid­er the fol­low­ing gram­mar, where one rule rewrites the same string over and over:

RND

gram#1[1] S --> X Y
gram#1[2] X --> C4 D4 E4 [Let us at least produce this!]
gram#1[3] Y --> Y [This rule makes the grammar loop forever]
Setting max com­pu­ta­tion time

Running this gram­mar with­out any pre­cau­tions would use rule [3] for­ev­er. The result would be an emp­ty page until a break is called. Fortunately, a lim­it can be set in the pref­er­ences. For exam­ple 9 seconds.

Note that this gram­mar will stop, but it will still have cre­at­ed an item “C4 D4 E4” that can be dis­played and heard in MIDI or Csound.


Programming tricks (for developers)

This PHP inter­face has been designed in a con­ven­tion­al man­ner, pri­ori­tis­ing func­tion­al­i­ty over aes­thet­ics. The aim of this approach is to deliv­er a ful­ly oper­a­tional work envi­ron­ment which soft­ware design­ers will be able to “decode” as a base for the design of a stand­alone inter­face in var­i­ous sys­tems. However, a few spe­cial fea­tures have been imple­ment­ed which require expla­na­tions because of the painstak­ing search for doc­u­men­ta­tion that was involved.

It is impor­tant to note that pop-up win­dows should be vis­i­ble regard­less of the secu­ri­ty set­tings on the web brows­er. This is because they are cre­at­ed by a stan­dard window.open() call attached to the button.

A typ­i­cal link that acti­vates a pop-up win­dow is this one in “prototype.php”:

echo "<a onclick=\"window.open('".$text_link."','MIDItext','width=300,height=300'); return false;\"
href=\"".$text_link."\">EXPLICIT MIDI codes</a>";

The same window.open() code may be incor­po­rat­ed into a “sub­mit” button.

Autosave

The autosave fea­ture is designed to emu­late the auto­mat­ed updat­ing process of Google Docs pages or WordPress posts/pages. This func­tion­al­i­ty has been inte­grat­ed into the edit­ing of sound-object pro­to­types and Csound instruments.

Please be aware that if you are edit­ing pro­to­types belong­ing to “-so.abc1″, all data is con­tained in this file. When work­ing on a par­tic­u­lar pro­to­type and click­ing the SAVE THIS PROTOTYPE but­ton, only the tem­po­rary file will be updat­ed – the path of which is shown at the top of the page. Once you have com­plet­ed your work, you should return to the “-so.abc1″ file and click the SAVE ‘-so.abc1’ INCLUDING ALL CHANGES TO PROTOTYPES but­ton. The autosave, which is indi­cat­ed by a red line at the top of the page, can be ignored.

The same fea­ture has been imple­ment­ed on the page deal­ing with Csound instru­ment files. For instance, the file “-cs.tryCsound” is auto­mat­i­cal­ly saved every 30 sec­onds while the user is work­ing on the edi­tion of instru­ments or addi­tion­al para­me­ters stored in this file.

In prac­tice, the autosave fea­ture is acti­vat­ed by a sim­ple call of JavaScript code in files autosaveObjects.js or “autosaveInstruments.js. The com­mand itself is myVar = setInterval(savePost, 30000), where “30000” rep­re­sents 30 sec­onds. A savePost() func­tion sends POSTs to file “autosaveObjects.php” or “autosaveInstruments.php”. The chal­lenge lies in deter­min­ing how these POSTs are gen­er­at­ed in func­tion getData1(). This exam­ple will be invalu­able for devel­op­ing autosave in var­i­ous envi­ron­ments, such as data­base editing.

GD graphics and Canvas

The GD graph­ics library is already includ­ed in recent dis­tri­b­u­tions of PHP. No instal­la­tion is nec­es­sary if PHP has been com­piled with the “gd” option. If you have any doubts, please dis­play the “http://localhost/try/bolprocessor/php/phpinfo.php” page on your local server.

As an illus­tra­tion of the use of GD instruc­tions, please refer to page “prototype_image.php”. It should be not­ed that all vari­ables used to build the image have been stored in a tem­po­rary file “image.php”. This elim­i­nates the need to send hun­dreds of POST mes­sages to “prototype_image.php”.

The con­sole has been enhanced with graph­ic pro­ce­dures imple­ment­ed in HTML Canvas, which is com­pli­ant with stan­dard HTML5 and does not require PHP. Each image is saved as a set of JavaScript instruc­tions, allow­ing its vec­torised con­struc­tion. This dif­fers from GD graph­ics, used in the PHP/Javascript inter­face, which pro­duces a PNG image. The Canvas script con­tains width and height val­ues used for clip­ping the image. These are read by the PHP script on “produce.php” for set­ting up dimen­sions of the pop-up win­dow that will con­tain the image.

Leave a Reply

Your email address will not be published. Required fields are marked *