work with mark: istreet - recording mp3s for streaming

mark d'inverno wanted to see the intelligent street installation gain new live online. so for streaming the sound from istreet over internet, i wrote a class for supercollider called ISRecord. it basically records sound to disk in small mp3 segments. so any sound supercollider produces will be spliced into many short mp3 files that could later be sent as small packages over the internet.
the technique is to continuously save the sound into one of two buffers. when one buffer is filled, the recording swaps and continues in the other. the buffer that just got filled is saved to disk and conversion to mp3 is started. this swap-and-write-to-disk cycle should have no problems keeping up realtime recording. but as the mp3 conversion takes a little bit of extra time - depending on quality and segmentation size etc, there is a callback message from the mp3 converter that evaluates a user defined segAction function when the mp3 conversion is finished. thereby one can notify other programs when the mp3 file is ready to be used.
there is also a cycle parameter that controls how many mp3 segments to save before starting to overwrite earlier ones. this is needed to not totally flood the harddrive with mp3s.

the actual mp3 conversion is done using lame and cnmat's sendOSC is also needed for the lame-to-sc communication.
attached is the recorder class plus a helpfile.

AttachmentSize
ISrecord060920.zip5.81 KB