‹ Work with Mark: iStreet - OnlineWork with Mark: iStreet - OS X ›

Work with Mark: iStreet - Recording MP3s for Streaming

2006-09-20 14:52 research, supercollider

Mark d'Inverno wanted to see the Intelligent Street installation gain new live online. So for streaming the sound from iStreet over the 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 the quality and segmentation size etc, there is a callback message from the MP3 converter that evaluates a user-defined segAction function when the 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 LAME-to-SC communication.

Attached is the recorder class plus a help file.

‹ Work with Mark: iStreet - OnlineWork with Mark: iStreet - OS X ›