Finally, the "check Trace file" option doesn't work because a file may
be visible before it is closed — even if it is never closed… It was
confusing because sometimes bp has enough time to finish the score and
sometimes csound throws its plate off the table…
So I modified the console to create this "done.txt" file which the
interface waits for and then deletes.
Creating files as flags in a process is an old strategy I was using when
programming on archive servers. Probably my young colleagues would smile
at it! ;-) At least it is not system-dependent.
Bernard
-------
In fact, no need to create "done.txt": I made a loop to wait until the
Trace file has been created.
This is acceptable only because the PHP interface always calls option
"--traceout". We could indeed force "bp" to do a trace whenever it needs
to create output files : Csound, MIDI or images…
For the moment I wouldn't change anything because if you call the
console via the Terminal, then you will wait physically for sufficient
time before running Csound. So this would only be a problem for creating
shell scripts or designing a different interface. But we agree that the
current PHP interface is used as a "reference" for writing the required
code, don't we? ;-)
Bernard
-------
Dear Anthony,
The whole chain of producing sound via BP and Csound works, as you can
see on the attached image. You will notice that it is set for the WAVE
format because AIFF is not recognized by the HTML audio tag.
However there is a small problem. Csound should wait until BP has
finished writing the Csound score, otherwise it produces a shorter sound
file based on part of the score. We can see in the trace that BP was
interrupted by the running of Csound.
For the time being I have put a sleep(4) instruction to keep PHP waiting
for 4 seconds after sending its ccommand to the console. With 2 seconds
it doesn't work, and evidently this delay will depend on the size of the
score, the speed of the application etc.
Therefore my suggestion is that we instruct the console to create a
small file, for instance "done.txt" so that the interface waits for the
file to appear, deletes it and then procedd to Csound (and to the
display of images).
Indeed there maybe other methods for checking that "bp" is still active
but I am afraid of system dependency…
I am going to try this on the current "graphics-for-BP3" is it hasn't
yet been merged. ;-)
Bernard
|