Bol Processor ‘BP3’ and its PHP interface

This is a pre­sen­ta­tion of  BOL PROCESSOR ‘BP3’.
Install it and try these exam­ples in your envi­ron­ment: MacOSWindows or Linux.
👉 ‘BP3’ pro­duces real-time MIDI events, BP scores, stan­dard MIDI files and Csound scores.
👉 Capturing and inter­pret­ing incom­ing MIDI mes­sages is a work in progress. Importing MusicXML scores is ful­ly func­tion­al.
👉 MIDI files are instant­ly audi­ble thanks to the built-in MIDIjs play­er, where­as Csound scores are used to cre­ate sound files that are sent to a stan­dard HTML5 audio play­er.

This page pro­vides an overview of inter­ac­tions with the Bol Processor con­sole. The objec­tive is to ver­i­fy its oper­a­tion in any envi­ron­ment. Musical exam­ples are of low artis­tic val­ue as their pur­pose is to be a com­pre­hen­sive demon­stra­tion of tech­ni­cal aspects.

Once you have com­plet­ed the instal­la­tion of BP3 and (option­al) Csound, you can check these fea­tures in any order you like.

Real-time MIDI was imple­ment­ed in May 2024. It works beau­ti­ful­ly in the three envi­ron­ments… After installing BP3, vis­it 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 with MAMP (see below) on com­put­ers run­ning MacOS Sonoma 14.4 and Windows 10, and with XAMPP on LinuxLite 7.0 (Ubuntu).

👉  Send questions/suggestions to the devel­op­ers via the con­tact form or join the BP devel­op­ers list on SourceForge.

Install the Apache server and Bol Processor package

Installing the Bol Processor BP3 does not require any pro­gram­ming skills. Just use the installers for MacOS and Windows, or the instal­la­tion scripts for Linux.

Follow instruc­tions on instal­la­tion pages for MacOSWindows and Linux.

Compile the console and check its operation

The Bol Processor's PHP inter­face recog­nis­es the sys­tem your com­put­er is run­ning. It checks key fea­tures and tells you what is miss­ing or needs fixing.

The Bol Processor BP3 home page when both the con­sole and Csound are installed and run­ning. The dis­play is the same in all three environments.
  • Start your Apache/PHP serv­er and point your web brows­er at the file bolprocessor/php/index.php.
  • The URL looks like http://localhost/bolprocessor/php/Note that "http" is used, not "https". On Windows, the URL is dis­played as localhost/bolprocessor/php/.
  • MacOS and Linux users: if you get an error mes­sage or see noth­ing, check file per­mis­sions ("775" in the "bolprocessor" fold­er) in your instal­la­tion. The installer or the instal­la­tion script takes care of it: did you use it? This issue did not occur on Windows 10.
  • If you have just done a new instal­la­tion or an upgrade, you will get a warn­ing that the con­sole "bp" (or "bp.exe" or "bp3") was not found — or is not "respond­ing" — along with a link to the "compile.php" page. This page will com­pile the con­sole if the "source" fold­er has been prop­er­ly copied to "bolprocessor". More infor­ma­tion is found on the Quick install page of your sys­tem (see above).
  • After the com­pi­la­tion, you will get a con­fir­ma­tion mes­sage if it was suc­cess­ful, or a list of errors if it was not — which should nev­er hap­pen, oth­er­wise tell us!
  • You can then reload the home page, now look­ing like the pic­ture above, by default in dark mode.

😀  You've done the dif­fi­cult part!  😀
The "bp" (or "bp.exe" or "bp3") con­sole has been created.

If you need to recom­pile the con­sole, you can sim­ply point your brows­er to localhost/bolprocessor/compile.php. This will auto­mat­i­cal­ly run the "Makefile". The con­sole is auto­mat­i­cal­ly recom­piled each time you run an installer to patch an update of the Bol Processor.

  • The home page dis­plays the con­tents of the "bolprocessor" fold­er, in par­tic­u­lar a link to the "ctests" fold­er.
  • Follow the "ctests" link. You will find a list of avail­able exam­ple files clas­si­fied in dis­tinc­tive frames. In gen­er­al, the name of a gram­mar starts with "-gr", but it can also end with the exten­sion "bpgr". The name of a set of 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 "bolprocessor" fold­er if it doesn'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 "bolprocessor". 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.
  • 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.

👉 The Bol Processor inter­face can be dis­played in both dark and light modes: see an exam­ple of dark mode. There is an icon in the top right cor­ner to switch between these modes. Only light mode images are shown on this website.

Produce items

👉 In June 2024, the 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.

In the fol­low­ing sec­tions, the out­put options are either MIDI file or CSOUND file. However, you can opt for real-time MIDI if your machine is set up for it: see details.

A gram­mar page. Related files "-al.abc1", "-se.koto3" etc.
have been iden­ti­fied and appear as but­tons at the bot­tom.
The PANIC but­ton can­cels the per­for­mance if sev­er­al instances of BP3 are running.
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 con­tents.
    👉  If your com­put­er is not con­nect­ed to the Internet, you won't hear any­thing on this play­er… We're work­ing to fix this.
  • 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 console's response.
  • "Image" links will appear at the top of the BP con­sole win­dow. Click them to dis­play images in new win­dows. 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.koto3" set­tings page.
  • Check the "bolprocessor/my_ouput" fold­er. It should con­tain "koto3.mid" — the 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" with the orig­i­nal sounds:

An impro­vi­sa­tion of "-gr.koto3" pro­duced by BP2.9.8 and played on the "koto" instru­ment of a Roland D-50 synthesiser

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.

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 have a look at the tuto­ri­als and exper­i­ment with your own cre­ations to get famil­iar with it.

Importing music

The pre­vi­ous sec­tion was an intro­duc­tion to the main fea­tures of Bol Processor: cre­at­ing music using a gram­mar, an alpha­bet and sound-object pro­to­types, which we will present 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.

Another tech­nique for import­ing music will be the real-time record­ing and inter­pre­ta­tion of MIDI events, which is still in devel­op­ment. Follow the progress of this approach on the Capture MIDI input page.

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. We inter­pret­ed it as a piano piece because we had no syn­the­sis­er that could do a good imi­ta­tion of the string instru­ments. 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

Using a very short quan­ti­za­tion (typ­i­cal­ly less than 10 mil­lisec­onds) on a large item can increase mem­o­ry usage to the point where the MAMP or XAMPP dri­ver hangs with­out warn­ing. For this rea­son, the quan­ti­za­tion is set by default to 10 ms.

Help messages

Displaying the help on reserved words in a grammar
  • Open the "-gr..Visser.Waves" gram­mar (designed by Harm Visser). 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 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 and a link is pro­vid­ed to dis­play it.
  • 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 respond­ing 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 "-al" alpha­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 SAVE, then 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).
  • For geeks: 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. It will play for­ev­er if the real-time MIDI mode is active.

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.

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". This file is locat­ed in the TONALITY resource fold­er, which has a link on the right hand side of each page.

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). 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.
  • For geeks: 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. (Old timers: 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. You will 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 a 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. Here, 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 simplicity'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.

Linux users: At the moment "0-default.orc" is not accept­ed by Csound in the Linux envi­ron­ment. We hope to solve this prob­lem in the near future. For the time being you can use "BP2test.orc".

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.

MacOS and Windows users can down­load a pre-built instal­la­tion of Csound from the down­load page. In Linux, sim­ply type the fol­low­ing instructions:

sudo apt update
sudo apt install csound

If Csound is installed and respond­ing, this sta­tus will be men­tioned on the top of each page. Otherwise the machine will rec­om­mend installing Csound, or chang­ing the path to Csound. This path is by default "/usr/local/bin" on MacOS, "usr/bin" on Linux. The BP3 inter­face will be able to fig­ure this out under Windows. If a new path is entered, the machine will try to call "csound --ver­sion" and will stop try­ing if once it is correct.

  • 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 respond­ing, 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 respond­ing, 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 CSOUND resource 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}

{_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.

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.

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 pro­duce this!]
gram#1[3] Y --> Y [This rule makes the gram­mar 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 are expect­ed to return to the "-so.abc1" file and click the SAVE ‘-so.abc1’ INCLUDING ALL CHANGES TO PROTOTYPES but­ton. Fortunately, the autosave, which is indi­cat­ed by a red line at the top of the page, does it for you in the backgraound.

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".

GD graphics and Canvas

The GD graph­ics library is already includ­ed in cur­rent 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.

👉 Don't hes­i­tate to ask ques­tions or send com­ments on the con­tact page!

Leave a Reply

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