Dear colleagues,
I have just seen a new commit by Anthony solving the problem of Csound
output files. The work I am presenting here is anterior to this update,
so it will require a small adjustment.
I developed a simple PHP environment to exploit (almost) all features of
the new BP. My approach is to reproduce as much as possible the old
operational model. This may be changed in the future, but I see more
clear running the old and the new BP versions side by side.
The package is here:
https://leti.lt/bolprocessor/bolprocessor-php-v1.zip
It contains "bp" as I had recompiled it, which is good enough for the
present demo.
After dezipping you will get a "bolprocessor" folder (don't rename it!)
that should be placed in the htdocs folder of your local Apache server,
presumably MAMP.
To run the program (after starting Apache in MAMP) just follow the link:
http://localhost/bolprocessor/php/
The "php" folder contains all required PHP files.
The display should be the directory of the bolprocessor folder, yet only
folders and BP-relevant files. Grammar files are highlighted because
they are the ones from which you start a "project".
I have put much more material than needed because I wanted to trace
encoding mistakes: we're moving files from MacOS Roman to UTF8, which
generates garbage on a few characters. When loading a file a few bugs
are fixed. Others need to be fixed by hand, notably the '•' sign used
for "period notation".
Move to the "ctest" folder and click “-gr.NotReich”. I am attaching a
picture of the scene, so you can follow my explanation.
You can edit and save the grammar. At the bottom of the page two buttons
are displayed for editing “-se.NotReich” and “-or.NotReich”. The
“orchestra” file is a mapping of MIDI channels to GeneralMIDI
instruments. Only useful when composing music for several instruments.
Still, the format needs to be extended to more than 16 channels.
The “settings” file contains all settings. It also could be edited and
saved but this is risky because we have no clue to the actual meaning of
each parameter. My next work will be to extract all variables and
display them in a comprehensive format.
Back to the grammar you can set up a folder that will receive all output
files. By default it is named "output" but you can create new folders
with different names, including subfolders such as "output/myitems".
This a global saving managed by PHP and saved in a “_settings.php” file.
In the middle table you can set up the name of the output file, or no
name if you want real-time MIDI. Then save the grammar to confirm the
name. It will automatically append an extension or a prefix, depending
on the type of file.
Here we have the CSOUND file format and the file will be called
"out.sco". CSOUND file output is the only option that creates something
with the current version of BP. Click "PRODUCE ITEM(s)" and you will
land on a page that says:
cwd = /Applications/MAMP/htdocs/bolprocessor/php
root = /Applications/MAMP/htdocs/
dir = /Applications/MAMP/htdocs/bolprocessor/ctests/
output file = /Applications/MAMP/htdocs/bolprocessor/output/out.sco
command = /Applications/MAMP/htdocs/bolprocessor/bp -gr.NotReich -d
--csoundout > /Applications/MAMP/htdocs/bolprocessor/output/out.sco
Well, absolute links are used to avoid mistakes on relative paths. After
all, this is internal cuisine and I needed to make sure that BP would
handle these absolute links. It does, except for the grammar because it
checks its name is compliant with a BP grammar but it does it without
removing the path. To go around this I did a chdir() in PHP that located
the process in the same "ctest" folder containing the grammar.
Other absolute paths are in fact well-managed by the Linux command, and
we get the "/output/out.sco" file as expected. Except that it contains a
mixture of the score with computation messages as I had pointed out. For
this reason, Anthony fixed the output option which I guess should fit
with the new command:
command = /Applications/MAMP/htdocs/bolprocessor/bp -gr.NotReich -d
--csoundout /Applications/MAMP/htdocs/bolprocessor/output/out.sco
Other commands produced by the PHP interface in compliance with
BP2-Help, but which do not work, are:
command = /Applications/MAMP/htdocs/bolprocessor/bp -gr.NotReich -d --rtmidi
command = /Applications/MAMP/htdocs/bolprocessor/bp -gr.NotReich -d
--midiout /Applications/MAMP/htdocs/bolprocessor/output/out.mid
command = /Applications/MAMP/htdocs/bolprocessor/bp -gr.NotReich -d -o
/Applications/MAMP/htdocs/bolprocessor/output/-da.out
The last one complains that '-o' is not a valid option.
The first one is real-time MIDI which we will address later…
Maybe there should be a '-m' option (set by default) meaning that we
don't want to see any of those messages that used to appear at the
bottom line of the old BP. Their main purpose was to make the user aware
that the machine is doing something and not stuck or looping. Now the
machine is running so much faster that they don't make sense. If
necessary we'll set up "Trace" in the settings.
Indeed, BP still reads “-se.NotReich” and it requires it for setting a
few parameters required for the CSOUND output score. Once I have
developed the interface for changing settings, we will be able to do
things that otherwise would require many more options in the command line.
Take for instance “-gr.Mozart”. As shown on the video I sent a few days
ago, it continuously creates new variations. This is a setting of
“-se.Mozart”. If we don't change the setting and run the grammar to
create a file, it will grow forever!
I tried to create that incident but it failed for another reason: the
display of “-gr.Mozart” is perfect but its computation fails. You will
find the list of errors in "output/Mozart.out". The same happens with
the “Visser3_UTF8.bpgr” and both yield the same bizarre errors:
BP2 Console completed initialization.
Err. ReadLine(). c == '\n'
Err. ReadLine(). c == '\n'
Err. ReadLine(). c == '\n'
Err. ReadLine(). c == '\n'
Err. ReadLine(). c == '\n'
Err. ReadLine(). c == '\n'
Err. GetTextChar(). pos out of range
Err. ReadLine(). c == '\n'
Err. ReadLine(). c == '\n'
Err. ReadLine(). c == '\n'
Compiling alphabet…
Err. ReadLine(). c == '\n'
Err. ReadLine(). c == '\n'
Err. ReadLine(). c == '\n'
Err. ReadLine(). c == '\n'
Err. ReadLine(). c == '\n'
Err. ReadLine(). c == '\n'
Err. GetTextChar(). pos out of range
Looking for time patterns…
Err. ReadLine(). c == '\n'
Err. ReadLine(). c == '\n'
Err. ReadLine(). c == '\n'
Err. GetTextChar(). pos out of range
Err. ReadLine(). c == '\n'
Err. ReadLine(). c == '\n'
Err. ReadLine(). c == '\n'
Compiling subgrammar #1…
Err. ReadLine(). c == '\n'
Err. ReadLine(). c == '\n'
Err. ReadLine(). c == '\n'
I tried to understand why a '\n' character was doing a mess and how to
compensate it in the editor. Empty lines? No doubt it will make sense to
Anthony! ;-)
I still have a lot of work to do on this minimal interface. I am using
beginner's PHP: no session variable, no javascript, to make it easy to
reconstruct in a different environment.
All the best, enjoy!
Bernard
|