Bol Processor ‘BP3’ and its PHP interface

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

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

The cur­rent ver­sion of ‘BP3’ Bol Processor pro­duces BP scores, stan­dard MIDI files and Csound scores. MIDI files can be heard imme­di­ate­ly owing to the in-built MIDIjs play­er, and Csound scores are auto­mat­i­cal­ly con­vert­ed to sound files sent to a stan­dard HTML audio play­er.

The present page is a sur­vey of all inter­ac­tions with the Bol Processor BP3 con­sole. The aim is to check its oper­a­tion in any envi­ron­ment accept­ing the com­pi­la­tion of the bina­ry pro­gram. All fea­tures are cur­rent­ly devel­oped and ver­i­fied under MacOS. We need testers for Windows and Linux environments.

After com­plet­ing and check­ing the instal­la­tion of BP3 and (option­al­ly) Csound, feel free to read and ver­i­fy these fea­tures in a ran­dom order…

The next major stage of devel­op­ment will be the pro­duc­tion of a stand­alone appli­ca­tion built on PHP/HTML/Javascript code used in this demo.

Install the package

  1. To use Bol Processor BP3 you need to install an Apache+PHP pack­age on your desk 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. At the moment, Bol Processor can­not be used on shared sites because most host­ing ser­vices do not accept bina­ry applications.
  2. On Mac and Windows machines we rec­om­mend the free-of-charge ver­sion of MAMP, an Apache/PHP serv­er sup­plied with pre-installed fea­tures. Only Apache and PHP (with the GD Graphics option) are required since MySQL data­bas­es are not used by this interface.
  3. Download the lat­est ver­sions of files for the PHP inter­face: php-frontend-master.zip and its sam­ple set bp3-ctests-main.zip. These files are reg­u­lar­ly updat­ed. All updates are announced on the BP devel­op­ers list and major updates sub­mit­ted 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 — for instance, inside the “htdocs” fold­er cre­at­ed by MAMP. At the top lev­el in the “bol­proces­sor” fold­er, cre­ate fold­ers “php” and “ctests”. Copy the con­tent of “php-frontend-master” to the “bol­proces­sor” fold­er and the con­tent of “bp3-ctests-main” to “ctests”. Now, inside “bol­proces­sor” you should see:
    • 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 Bol Processor: gram­mars, alpha­bets, data, sound-object pro­to­types, etc. You may 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 attached 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­cat­ing mate­r­i­al and cre­at­ing conflicts.
  5. Now down­load the con­sole pack­age from GitHub and unzip it. For those con­ver­sant with GitHub, this belongs to the “Graphics for BP3” branch. Unzip it and copy its con­tent to the “bol­proces­sor” fold­er.

The set­up of files is dis­played on the right. This pic­ture includes “bp” that will be cre­at­ed later.

Keep a copy of the “ctests” fold­er because you will prob­a­bly mod­i­fy some data files while using the inter­face and may need to restore ini­tial versions.

Folders “temp_bolprocessor” and “my_output” will be auto­mat­i­cal­ly cre­at­ed when run­ning the inter­face. Folder “temp_bolprocessor” is cleared of all files old­er than 24 hours.

Running the inter­face will also cre­ate “BP2_help.html” in the “php” fold­er using “BP2_help.txt” as its source. Therefore, the lat­ter should always remain at the top of the “bol­proces­sor” fold­er.

If you plan to check the pro­duc­tion of Csound scores and their use to pro­duce sound files, a Csound instal­la­tion is nec­es­sary. Packages are avail­able for all sys­tems on Csound’s down­load page. If you don’t feel com­fort­able com­pil­ing its source code, select a ready-made instal­la­tion. For instance, the OS X dmg archive installs Csound in a few clicks on Macintosh com­put­ers; this does not require any spe­cif­ic tech­ni­cal experience.

First checks

  • Launch your Apache/PHP serv­er and point a brows­er at the file bolprocessor/php/index.php. In case you are using MAMP, the URL will look like http://localhost/bolprocessor/php/. You will get a warn­ing that “bp” has not been found — or it is not prop­er­ly respond­ing on your sys­tem — along with a link to the “compile.php” page. This page will attempt a com­pi­la­tion of “bp” if the fold­er “source” has been prop­er­ly copied to “bol­proces­sor”. This com­pi­la­tion runs the “make” com­mand of your sys­tem, read­ing the “Makefile” set of instruc­tions. This process works per­fect­ly on MacOS. We need your help to adapt it to oth­er environments.
  • Once “bp” has been cre­at­ed, you will see the con­tent of the “bol­proces­sor” fold­er, notably the “ctests” fold­er. If Csound is installed and respon­sive, a warn­ing will be dis­played on the top right (see picture).
  • Click the “ctests” link. It will dis­play a list of avail­able sam­ple files. Their names are tagged with col­or labels indi­cat­ing the type of each file. Generally, a Bol Processor gram­mar’s name starts with “-gr” but it may as well end with exten­sion “bpgr”. Both con­ven­tions of file types are sup­port­ed by BP2 and BP3. This had become nec­es­sary, long time ago, when upgrad­ing from MacOS 9 to MacOS 10…
  • Click “-gr.koto3” to open a gram­mar. This will auto­mat­i­cal­ly cre­ate a “my_output” fold­er at the top of the “bol­proces­sor” fold­er in case it was­n’t already there. Try to cre­ate an out­put fold­er with a dif­fer­ent name and ver­i­fy its pres­ence at the top of “bol­proces­sor”. The out­put fold­er’s cur­rent name is saved in “_settings.php” to be recalled each time the inter­face is used. Failure to mod­i­fy set­tings and/or to cre­ate out­put fold­ers would reveal a bad 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. If the cur­rent out­put is set to “my_output”, cre­ate for instance “my_output/todays_folder”. The inter­face auto­mat­i­cal­ly replaces spaces with ‘_’ as these may be unwant­ed on some systems.
  • Verify that the “bp” con­sole is respond­ing appro­pri­ate­ly by click­ing the link to con­sole’s help file at the top right of the page. The help will appear on a pop-up win­dow. Pop-up win­dows cre­at­ed by Bol Processor should be vis­i­ble irre­spec­tive of secu­ri­ty set­tings on your web brows­er (read details). Failure to respond would indi­cate that the com­pi­la­tion was­n’t appro­pri­ate or the “bp” file has not been found at the top lev­el of the “bol­proces­sor” folder.
  • If you need to recom­pile “bp” you can sim­ply open the page http://localhost/bolprocessor/compile.php which auto­mat­i­cal­ly launch­es the “Makefile” sys­tem command.
  • The Grammar page has a tem­po­rary IMAGE link dis­play­ing a pic­ture with draw­ings, texts and ani­ma­tion. This is used for check­ing cross-platform compatibility.

Produce items

A gram­mar page. Related files “-ho.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 call the con­sole application.
  • If the con­sole appli­ca­tion is run­ning, a detailed list of actions will flow on the pop-up win­dow. One of them is “Errors: 0″ indi­cat­ing that the run­ning was fault­less. It should be fault­less with this exam­ple. On top of the win­dow, the com­mand line cre­at­ed to call the con­sole is dis­played in red col­or. This is used by pro­gram­mers for check­ing the response of the console.
  • An “Image” link appears at the top of the BP con­sole win­dow. Click it to dis­play the image on a new win­dow. By default, the image dis­plays sound-objects a, b, c etc. We will see lat­er a pianoroll anoth­er option.
  • By default, the out­put was set to MIDI files. A link is sup­plied to down­load this MIDI file, and a javascript MIDIjs play­er is shown to lis­ten to its con­tent. 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­siz­er, lis­ten to exam­ples.
  • At the top of “BP con­sole” a link points to the “trace file” show­ing the full process of deriva­tions for cre­at­ing the item. It has been cre­at­ed because the “--trace-production” option had been append­ed to the com­mand line for the sake of check­ing details. The Trace mode can be enabled or dis­abled on 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.
Bol Processor score of the “koto3” item
  • Return to the gram­mar and select the “BP data file” option for the out­put, then click the SAVE but­ton. Now the name “koto3.bpda” will be cre­at­ed, but you can change it to any­thing while keep­ing the “bpda” exten­sion, or use the “-da” pre­fix instead.
  • Click again the PRODUCE ITEM(s) but­ton. A link to the data file in Bol Processor score nota­tion appears on the top (see pic­ture). The Trace file dis­plays the same deriva­tions. File “koto3.bpda” should also be vis­i­ble in the bolprocessor/my_ouput folder.
  • If you return to the tag dis­play­ing the con­tent of the “ctests” fold­er, you can click the “[move up]” link and enter the “my_output” fold­er. There you will see “koto3.mid” and “koto3.bpda” which have just been cre­at­ed. Because of its “bpda” exten­sion, the data file has a link open­ing it with the inter­face. Follow that link to ver­i­fy that it is displayed.
A pianoroll dis­play of the same item pro­duced by gram­mar -gr.koto3
  • In the set­tings of “-gr.koto3″ it is pos­si­ble to change the for­mat of graph­ic dis­play. Currently it was “Show objects”. Let us try “Piano roll”. This for­mat high­lights the melod­ic and har­mon­ic struc­ture of the com­po­si­tion where­as the “objects” for­mat is explic­it on the size and loca­tion of sound-objects.
  • Comparing the two images we can guess that “a” con­tains one instance of A5 and “b” con­tains two strokes of B5. The «f» sound-object is an out-time object of nil dura­tion con­tain­ing a sin­gle stroke on 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 every frag­ment of the work string. This is made clear by dis­play­ing deriva­tions of the string. To this effect, select option “Display pro­duc­tion” on the Settings page. Derivation steps will appear on the Trace window:

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

In the “Non-stop improvize” mode, every step of the sub­sti­tu­tion is used for the sound out­put. To this effect, vari­ables are erased and only ter­mi­nal sym­bols are played. This pro­duces an effect of the work string “grow­ing” 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 (uni­di­men­sion­al) cel­lu­lar automa­ton. Listen for exam­ple 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 synthesizer

Importing music

The pre­ced­ing para­graph was an intro­duc­tion to the main fea­ture of Bol Processor: cre­at­ing music with the aid of a gram­mar, an alpha­bet and def­i­n­i­tions of sound-object pro­to­types which we will see in greater detail below. This requires a cer­tain amount of exper­tise in 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 pro­ceed in a more sim­ple (yet arguably less cre­ative) man­ner: import pre-composed music and reuse its frag­ments to cre­ate new vari­a­tions. This process may be achieved by the auto­mat­ic con­ver­sion of stan­dard musi­cal score in 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 is found on page Importing MusicXML scores along with a dis­cus­sion 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, read tuto­r­i­al. It has been played on the PianoTeq physical-model syn­the­siz­er using the MIDI file pro­duced by BP3. This exam­ple illus­trates both the accu­ra­cy of this 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 Bol Processor with PianoTeq

Help messages

Displaying the help on reserved words in a grammar
  • Open the “-gr.NotReich” gram­mar. 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. Click for instance the link on “_volumecont”. A pop-up win­dow will open and dis­play the help at the very loca­tion of the reserved word. The help file is still the one used by BP2.9.8. It is being upgrad­ed to BP3.
  • At the bot­tom of the gram­mar file, two more but­tons are dis­played: EDIT ‘-se.NotReich’ and EDIT ‘-or.NotReich’. These have been auto­mat­i­cal­ly pro­duced because of dec­la­ra­tions “-se.NotReich” and “-or.NotReich” on top of the gram­mar. Click these but­tons to edit or cre­ate these files.
  • You can now pro­duce the “notReich” item, lis­ten to its sound ren­der­ing with MIDIjs and dis­play the graph­ic out­put as “pianoroll” or “objects”.

Error messages

  • Let us now do some­thing wrong to check errors. In “-se.NotReich” change the “Note con­ven­tion” from ‘0’ (English) to anoth­er option such as ‘1’ (French). Click SAVE PARAMETERS, go back to the “-gr.NoteReich” gram­mar, click SAVE and PRODUCE ITEM(s). Now, nei­ther the “out­put file” nor the graph­ics will be vis­i­ble as the con­sole can­not not cre­ate an item due to its mis­un­der­stand­ing of note names. For instance, “G3” is inter­pret­ed as a vari­able and not a note because BP3 takes “G3” as a vari­able and not a sim­ple note: “G3” should actu­al­ly have been replaced its equiv­a­lent “sol2” in the French convention.
  • PRODUCE ITEM(s) some­times tell that errors have been detect­ed by the con­sole. They appear on the “error” trace file.
  • Try the same pro­ce­dures with “-gr.trial.mohanam”. It is set for the Indian sargam note con­ven­tion = 2. After mod­i­fy­ing the con­ven­tion to “French”, the out­put file will only con­tain notes “re6” which share the same name in both con­ven­tions. The con­fu­sion of note con­ven­tions is a fre­quent source of errors 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.

Compile a grammar

  • So far, gram­mars were well-shaped and click­ing but­ton COMPILE GRAMMAR would tell that there is no error. Now go to the gram­mar named “unknown-terminal.bpgr” and click COMPILE GRAMMAR. It tells that errors have been found and the “trace” file explains that it found (at least) an unknown ter­mi­nal sym­bol. Indeed, sym­bols ‘x’ and ‘a’ have not been declared as sound-objects in a relat­ed “-ho” 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 COMPILE GRAMMAR. The num­ber­ing “gram#1[1]” will be restored. This takes into account 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 named “symbols.bpho” and its dec­la­ra­tion in the gram­mar is “-ho.:symbols.bpho”. This unex­pect­ed syn­tax is a trick for rec­og­niz­ing file types whose names do not start with the stan­dard prefix.

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 using by default sym­bol ‘S’ as a start string of deriva­tions. However it is some­times inter­est­ing to try deriv­ing from anoth­er vari­able with the same gram­mar, or lis­ten to a poly­met­ric expres­sion. Both these will eas­i­ly be achieved on the Grammar window.
  • An exam­ple is the usage of “-gr.Mozart” in which vari­ables rep­re­sent musi­cal frag­ments put togeth­er in the final item. All vari­ables have been extract­ed by the inter­face and dis­played as but­tons at the bot­tom of the page (see pic­ture on the right). Clicking a but­ton will pro­duce a deriva­tion of the vari­able. (This does­n’t yet work.)
  • Note how­ev­er that in this gram­mar deriva­tions of A1 to B8 won­t’t be unique because they are select­ed 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 instance {{2,sol3,si3}-,fa5 re5 si4}. This expres­sion may con­tain vari­ables. Click PRODUCE ITEM to lis­ten to the result or get the out­put file (depend­ing on the select­ed out­put format).
  • The “--start” and “-S” command-line options used in these pro­ce­dures have not yet been implemented.

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

Play data

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 which may 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 stor­ing the data line in a tem­po­rary file “…outdata.bpda” saved 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 stor­ing the data line in a tem­po­rary file “…outdata.bpda” saved in the “temp_bolprocessor” fold­er. The result is 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 to be 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 exe­cut­ed every evening for about half an hour check­ing all pro­ce­dures and trac­ing changes in out­put data, in addi­tion to the sound verification.
  • This lev­el of automa­tion will not be achieved in the ini­tial ver­sion of BP3 because of the dis­en­tan­gle­ment between the con­sole and its PHP inter­face. Consequently, many script instruc­tions of BP2 will nev­er be valid in BP3. During the exe­cu­tion of a script they will be ignored.
  • 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” will be 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 real-time MIDI. The note con­ven­tion has been set to “English” to rec­og­nize “G4”, “E4” etc. as sim­ple notes. The tem­po will be default metronome = 60 beats/mn.
  • The “Type” instruc­tion dis­plays a line of text (which may con­tain HTML elements).
  • This script calls a sub­script named “-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 gram­mar “-gr.Ames” and set the out­put for­mat to “Csound score”.
  • Script exe­cu­tion is dis­played on a pop-up win­dow (see pic­ture above) list­ing (in red) com­mands sent to the con­sole. The sec­ond com­mand pro­duces a Csound score, as expected. 
  • The pic­ture also shows (light blue) but­tons for enter­ing script instruc­tions. No typ­ing is required. There is a but­ton labelled CHECK THIS SCRIPT dis­play­ing all errors such as a file that was­n’t found.
  • Below the script, but­ton LIST ALL SCRIPT INSTRUCTIONS dis­plays all instruc­tions han­dled by BP2.9.8 indi­cat­ing which ones are obso­lete for BP3 and the ones under development. 

Sound-object prototypes

Grammar “-gr.koto3″ uses an alpha­bet of sound-objects, name­ly “-ho.abc1″, which is relat­ed with a set of sound-object pro­to­types “-mi.abc1″. The pianoroll dis­play of an item (above in the “Produce items” chap­ter) already indi­cat­ed that sound-object “chik” con­tains a chord of 3 notes. We will now show how these sound-objects can be cre­at­ed or modified.

The main page of a sound-object prototype file
The main page of a sound-object pro­to­type file
  • Open “-mi.abc1″ (or a copy of it). If the file is cor­rect, below the hor­i­zon­tal line you should see a table con­tain­ing the names of its sound-object pro­to­types: a, a’, b, chik, cycle1 etc.
  • When open­ing “-mi.abc1″, a tem­po­rary fold­er has been cre­at­ed in the “temp_bolprocessor” fold­er. It has a com­pli­cat­ed name, for instance ‑mi.abc1_ec02bffaaee23e051fa2afee52e57520_temp con­tain­ing 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 obso­lete fold­ers old­er than 24 hours. Keep pages and tags open as long as 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 “-mi.abc1″ is in autosave mode, auto­mat­i­cal­ly saved at a peri­od of 30 sec­onds while work­ing on its sound-object pro­to­types. This fea­ture is traced by red mes­sages at the top of the page.
  • In the table you are offered the option of delet­ing sound-objects. Try a few DELETE but­tons. The good news is that a but­ton named RESTORE ALL DELETED OBJECTS will appear… Click it to undelete sound-objects and return to the ini­tial state.
  • You are also offered the option of cre­at­ing or dupli­cat­ing sound-objects. In case you do it, don’t for­get to add their names to every “-ho” (alpha­bet) file declar­ing an affil­i­a­tion with “-mi.abc1″. The inter­face makes sure that you are not cre­at­ing sev­er­al objects with names cur­rent­ly used or recent­ly deleted.
  • Let us now edit an object, for instance “chik”. Click the but­ton bear­ing that name. Parameters are the same as the ones dis­played on BP2.9.8. You can change any para­me­ter and click SAVE THIS PROTOTYPE. In most cas­es the con­sis­ten­cy of val­ues is not checked. We would need a sound out­put to ver­i­fy the effect.
  • The PLAY sends a com­mand to the con­sole that 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, links EXPLICIT MIDI codes and TIME-STAMPED MIDI bytes dis­play the lists of MIDI instruc­tions and time-stamped bytes that will be sent to the MIDI dri­ver. (First num­ber is actu­al­ly the num­ber of bytes.)
  • Don’t for­get that the “-mi” file is saved in back­ground every 30 sec­onds (autosave) while mod­i­fy­ing sound-object pro­to­types… To return to the ini­tial ver­sion, close the “-mi” tag and restore the “-mi” 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, much like BP2.9.8’s 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 chord on a stringed instru­ment last­ing for 250 ms. The inter­face uses MIDIjs Javascript MIDI Player to this effect.
  • Notice 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 lever by per­for­mance para­me­ters. Therefore it is wise to click SUPPRESS chan­nel pres­sure and check its effect on EXPLICIT MIDI codes and TIME-STAMPED MIDI bytes. If the change is not imme­di­ate­ly vis­i­ble (it depends on browsers) just 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 manner.
  • APPEND AllNotesOff (all chan­nels) may be a use­ful option to make sure that this object will switch off all pend­ing notes on the sound machine. It broad­casts an instruc­tion on each of the 16 channels.
  • The MIDI con­tent of this object can be mod­i­fied by load­ing a MIDI file. Click Choose File to select a MIDI file — for instance “test.mid” in the “ctests” fold­er — then send to upload it. It is not final­ized imme­di­ate­ly: you can exam­ine EXPLICIT MIDI codes and TIME-STAMPED MIDI bytes of this file before sav­ing it to the sound-object pro­to­type. The “test.mid” exam­ple con­tains no less than 432 bytes because of “Channel pres­sure” and “Parameter ctrl 7” mes­sages con­trol­ling pres­sure and vol­ume. You can accept the import by click­ing SAVE or reject it click­ing CANCEL. At present there is no “undo” in case the MIDI sequence has been mis­tak­en­ly replaced or deleted. 
  • An impor­tant fea­ture is QUANTIZE NoteOns. We are deal­ing with “stri­at­ed sound-objects”, there­by mean­ing 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 has been cap­tured is gen­er­al­ly not the same at which it will be per­formed, the lat­ter depend­ing on per­for­mance para­me­ters. The ref­er­ence tem­po is spec­i­fied by Tref which is here 1000 ms for a metronome at 60 beats/mn. The MIDI con­tent uploaded from “test.mid” has a dura­tion of 3500 ms, which means 3.5 beats. This dura­tion can be adjust­ed either in mil­lisec­onds or in beat counts. Whatever the dura­tion, it is often con­ve­nient to locate NoteOn and NoteOff events on a pre­cise frac­tion of the beat. An quan­ti­za­tion of 1/64 beat is often a good choice. To make things eas­i­er we well set it to 1/50 beat, which means 20 ms.
    Before click­ing QUANTIZE NoteOns, check 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 quan­ti­za­tion at 1/50 beats 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 dig­i­tized 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­ma­rized on the BP2 envi­ron­ment picture.

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

A sim­ple orches­tra file named “0-default.orc” is sup­plied in the “csound_resources” fold­er. It can be used for Csound scores pro­duced by Bol Processor when no Csound orches­tra file is specified.

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

  • Open “-gr.Mozart“in the “ctests” fold­er.
  • Check out­put option CSOUND file which will (by default) pro­duce a file named “Mozart.sco” in the “my_output” fold­er. You can change these parameters.
  • If Csound is installed and respon­sive, this sta­tus is men­tioned on the gram­mar. Otherwise the machine rec­om­mends the instal­la­tion of Csound (from this site) or to mod­i­fy the path to Csound — by default “/usr/local/bin/”. Each time a new path is entered, the machine tries to launch “csound --ver­sion” and it stops try­ing once successful.
  • Click PRODUCE ITEM(s). A pop-up win­dow will dis­play the suc­cess­ful process. 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 Bol Processor as a sequence of ‘sim­ple notes’ appear­ing at the end of each line: “mi5”, “do3”, “do5” etc. To this effect, Bol Processor uses con­ver­sion pro­ce­dures for replac­ing MIDI events with lines of the score.

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 appears on a play­er (see pic­ture). 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 on-setting date and dura­tion of the event, mea­sured in beats. Then comes argu­ment “4” assigned to pitch in octave point pitch-class for­mat. Arguments “5” and “6” are for con­tin­u­ous vol­ume con­trol (in range 0…127). Argument “7” may con­tain the ref­er­ence of a table for refin­ing these vari­a­tions. Arguments “8” and “9” used for (con­tin­u­ous) pitch­bend con­trol, and argu­ment “10” may con­tain the ref­er­ence of a table for refin­ing vari­a­tions of the pitchbend.

Pianoroll dis­play of “-gr.Mozart”
A few 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 for tun­ing the instrument

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

Csound instrument files

Bol Processor is able to pro­duce a Csound out­put using scores stored in sound-objects or con­vert­ed from the MIDI stream. Furthermore, it has a direct con­trol of per­for­mance para­me­ters which the Csound orches­tra can han­dle inde­pen­dent­ly on MIDI stan­dard 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 GEN07 (lin­ear inter­po­la­tion) or GEN08 (cubic spline) Csound gen­er­a­tors. All these are 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. Pay atten­tion to the fact that this page is in autosave mode (read below): changes in Csound instru­ments are auto­mat­i­cal­ly saved at the rate of two times a minute.
  • This Csound instru­ment file is declared linked to a Csound orches­tra file named “tryCsound.orc”. As this file is miss­ing in the “csound_resources” fold­er, a link is dis­played for cre­at­ing the file. Otherwise it would lead to edit­ing it.
  • The text area for Tables does not need more expla­na­tions than giv­en in the BP2.9.8 instruc­tions man­u­al. These tables are not used in the pro­duc­tion of Csound scores. They are just insert­ed at the begin­ning of the score.
  • Csound instru­ments may be asso­ci­at­ed with MIDI chan­nels. Here, for instance, MIDI mes­sages sent to chan­nel 2 will be con­vert­ed to instruc­tions sent to instru­ment 3 “Harpsichord”.
  • At the bot­tom of the page is a list of 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 the blue but­ton bear­ing the name of the instru­ment opens an edi­tor of this 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 BP2.9.8’s inter­face. A detailed pre­sen­ta­tion may be found in chap­ter 17 of the BP2.9.8 instruc­tions man­u­al.

  • Let us for instance exam­ine instru­ment Harpsichord in “-cs.tryCsound”. Its index is “3”, there­by mean­ing that it may be called as _ins(3) or _ins(Harpsichord) on a Bol Processor score.
  • Parameters 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 for mod­i­fy­ing the start-date 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­lat­ed function.
  • On the vol­ume para­me­ter, “0”, “64” and “127” (MIDI val­ues) need to be con­vert­ed to “-24”, “0” and “+24” (Csound val­ues) respec­tive­ly. Conversion 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 will be set by argu­ments “7” and “8” respec­tive­ly. These are used by an algo­rithm set­ting the vol­ume in the asso­ci­at­ed Csound orches­tra, based on GEN07 (lin­ear inter­po­la­tion) or GEN08 (cubic spline) gen­er­a­tors.
  • Given three pairs of input/output val­ues, BP2 attempts to define a qua­drat­ic map­ping between the input and the out­put. However it may be dif­fi­cult to match the three val­ues with a monot­o­nous qua­drat­ic func­tion… Read page Csound argu­ment map­ping for a detailed explanation.
  • At the bot­tom of the page you will find a list of Csound para­me­ters unre­lat­ed with MIDI con­trollers. This is where Bol Processor Csound pro­duc­tion may dif­fer rad­i­cal­ly from MIDI!
  • In this instru­ment, only one addi­tion­al para­me­ter named “blurb” has been attributed.
A spe­cif­ic Csound parameter

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

Let us look at the “blurb” para­me­ter (pic­ture 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 may 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 usage will be demon­strat­ed in a hypo­thet­ic music pro­duc­tion sim­ple enough to grasp basic Csound fea­tures in its Bol Processor imple­men­ta­tion. A com­plete demo based on a real musi­cal exam­ple is found on arti­cle Sarasvati vina. We also doc­u­ment­ed all fea­tures of the Csound imple­men­ta­tion in 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.

Grammar “-gr.tryCsound” is call­ing “-cs.tryCsound” and using 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” dis­play pitch­bend start and end val­ues as spec­i­fied by the instru­ment. These remain at the default val­ue “8191.5” in the absence of pitch­bend instructions.
  • Arguments “7” and “8” dis­play start and end val­ues of the vol­ume para­me­ter as expect­ed. The con­tin­u­ous vari­a­tion is from “+24” to “-24”. This is the result of a map­ping between MIDI val­ues in range [0…127] to this instru­men­t’s vol­ume para­me­ter in range [-24…+24] (see pic­ture). 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 this effect, it will call its own inter­po­la­tion scheme spec­i­fied as GEN07.
  • The _volumecont instruc­tion in the begin­ning of the sequence real­ly means “con­ti­nu­ity”. This resolves a dis­crep­an­cy between 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 a para­me­ter should be mod­i­fied from the on-setting to the off-setting of a segment.
  • Arguments “9” and “10” stay at default val­ue “0.000” since the “blurb” para­me­ter is not used.
  • Arguments “11” and “12” stay at the default val­ue “0” of the unused mod­u­la­tion parameter.
  • Argument “13” stays at the default val­ue “0” of the unused panoram­ic parameter.

Csound scores pro­duced by “-gr.tryCsound” can­not be played with “BP2test.orc” because their argu­ments are not match­ing. They require a dif­fer­ent orches­tra file named “tryCsound.orc” which we haven’t yet been able to design…

A real musi­cal exam­ple using many fea­tures of Csound inte­gra­tion in the Bol Processor is a phrase of Carnatic music composed/designed by Srikumar 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 its asso­ci­a­tion with Csound, Bol Processor BP3 is open to micro­tonal­i­ty via to the pro­gram­ing of cus­tomized scales. Read pages Microtonality and Csound tun­ing in BP3. Applications to Western har­mo­ny and to the into­na­tion of ragas in Indian music are exposed in cat­e­go­ry “Musicology”.

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 that will be super­posed to a musi­cal piece pro­duced by Bol Processor in real-time MIDI. The super­po­si­tion did not work well with BP2.9.8, yet it was work­ing 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 an edi­tor of the Timebase which is a bit more advanced than on BP2. We also try the super­po­si­tion by import­ing Bold Processor’s pro­duc­tion as a MIDI file.

  • Create a new time base called “try.bptb” in fold­er “ctests” and open it.
  • By default, the time base con­tains 3 tracks, 2 of which are set up for a sim­ple 4-beat tem­po at mm = 60 beats/mn. The third track is emp­ty. Fill it with 4 strokes on key = 100 at a speed ratio 2/1.
  • Now lis­ten for the com­bined 4 tracks (repeat­ed 3 times):
  • To under­stand the struc­ture you can mute some tracks.
  • Now click “Choose File” to select a MIDI file, for instance “acceleration.mid”, and click 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 musi­cal piece with the tick pat­tern:
After load­ing “this_song.mid” a change of tem­po is suggested.
  • The super­po­si­tion sounds good because the piece has been pro­duced at mm = 60 and it does match a rhyth­mic pat­tern of 4 beats. You can try mod­i­fy­ing the metronome val­ue on top of the table. In fact, you will get a warn­ing if the metronome set­ting does not agree with the tem­po declared in the import­ed MIDI file.
  • Check for instance this rhyth­mic cycle on top of “this_song.mid” in the “ctests” fold­er. You will be told to fix the metronome to 9 beats in 4 sec­onds as declared in the MIDI file (pic­ture on the right). The match­ing of beats is per­fect:
  • This inter­face makes it pos­si­ble to add an unlim­it­ed num­ber of cycle tracks. (The lim­it was 3 tracks in BP2.)
  • Playing with speed ratios cre­ates com­plex cycles that can be exploit­ed 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 may also eas­i­ly be pro­grammed. Examples 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 is 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 make sense to design the drum machine track as part of the per­for­mance since poly­met­ric expres­sions are able to han­dle super­po­si­tions. We will see that even though 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 bot­tom of the Timebase page.

Let us try to add this poly­met­ric expres­sion as vari­able “Drum” to the “-gr.acceleration” grammar:

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 pat­tern “Piano” needs to be repeat­ed at the prop­er 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 pro­duce a MIDI file named “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 “-mi.drum” and define a sound-object named “cycle2”.
Setting a sound-object to “cyclic”
  • Set it to “cyclic” (see pic­ture on the left).
  • Import “drum.mid” to sound-object protype “cycle”.
  • Bad news: its dura­tion is 6000 ms instead of the expect­ed 4000 ms…
  • Looking at EXPLICIT MIDI codes reveals that the last 2 sec­onds are a fade-out added by Bol Processor to avoid an abrupt ending.
  • Good news: the sound-object pro­to­type edi­tor allows crop­ping the sound-object by trun­cat­ing its end. Let us there­fore 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 ear­li­er pro­grammed on the Timebase page:

    Cropping sound-objects is care­ful­ly done. If nec­es­sary, the algo­rithm rewrites “NoteOff” mes­sages delet­ed by the cropping.
  • Now the sound-object will be added to the gram­mar as follows:
    -ho.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 relat­ed “-mi.drum” pro­to­type file must be declared in the fol­low­ing “-ho.drum” alpha­bet file:
    -mi.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 despite its com­pli­ance with the Bol Processor mod­el. Worse, the equiv­a­lent poly­met­ric expres­sion may become extreme­ly com­plex when­ev­er speed ratios or/and beat cycles of all tracks are not equal. In that case it is not dis­played at the bot­tom of the Timebase page.

Setting max computation time

There are many ways to make sure that a gram­mar does not repeat for­ev­er the same process. These are part of the syn­tax in Bol Processor. For instance, a flag may be decre­ment­ed each time a rule is applied and may inval­i­date all rules when it reach­es zero.

However, mis­takes may hap­pen — and they will hap­pen. Take for instance the fol­low­ing gram­mar in which a rule rewrites the same string forever:

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

If run with­out pre­cau­tion this gram­mar would apply rule [3] for­ev­er. The result would be a blank page until some inter­rup­tion is called. Fortunately, a lim­it can be fixed in the set­tings. For instance 9 seconds.

Note that this gram­mar will stop but it will nev­er­the­less have cre­at­ed an item “C4 D4 E4” that can be dis­played and lis­tened to in MIDI or Csound.


PHP programming tricks

This PHP inter­face is designed in the most con­ven­tion­al man­ner, priv­i­leg­ing func­tion­al­i­ty over the 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…

Pop-up win­dows should be vis­i­ble irre­spec­tive of secu­ri­ty set­tings on the web brows­er because they are cre­at­ed by a stan­dard window.open() calls attached to the button.

A typ­i­cal link acti­vat­ing 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 put in a “sub­mit” button.

Autosave

The idea of autosave is to mim­ick the behav­iour of Googledocs pages or WordPress posts/pages which are auto­mat­i­cal­ly updat­ed at a reg­u­lar rate. This fea­ture has been imple­ment­ed for the edit­ing of sound-object pro­to­types and Csound instruments.

For instance, if you are edit­ing pro­to­types belong­ing to “-mi.abc1”, keep in mind that all data is con­tained in this file. Working on a par­tic­u­lar pro­to­type and click­ing the SAVE THIS PROTOTYPE but­ton will only update the tem­po­rary file — whose path is shown at the top of the page. To final­ize the work you should nor­mal­ly return to the -mi.abc1” and click but­ton SAVE ‘-mi.abc1’ INCLUDING ALL CHANGES TO PROTOTYPES. The autosave which is traced on a red line at the top of the page makes it unnecessary.

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

In prac­tice, autosave 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) in which “30000” stands for 30 sec­onds. A savePost() func­tion sends POSTs to file “autosaveObjects.php” or “autosaveInstruments.php”. The dif­fi­cul­ty lies in fig­ur­ing out how these POSTs are cre­at­ed in func­tion getData1(). This exam­ple will be very use­ful for pro­gram­ming autosave in var­i­ous envi­ron­ments such as data­base editing…

GD graphics and Canvas

The GD graph­ics library is already bun­dled with recent dis­tri­b­u­tions of PHP. No instal­la­tion is required pro­vid­ed that PHP has been com­piled with the “gd” option.

An exam­ple of using GD instruc­tions is on page “prototype_image.php”. Note that all vari­ables used to build the image have been stored in a tem­po­rary file “image.php”. This makes it unnec­es­sary to send hun­dreds of POST mes­sages to “prototype_image.php”.

Graphic pro­ce­dures in the con­sole have been imple­ment­ed in the 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­tor­ized con­struc­tion, unlike GD graph­ics 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 *