This is a demo of interactive real-time sound-synthesis written in Haskell.
You find the project files in
http://code.haskell.org/synthesizer/alsa/
Technical details:
I'm running a Linux notebook at 2 GHz.
There is an E-MU X-board plugged to the machine via USB, that sends NoteOn and NoteOff messages.
They are received via ALSA's MIDI facility.
The Haskell program treats the MIDI events as a lazy list
and transforms this list to a lazy StorableVector, that is written to ALSA output.
To be honest, I could cheat here, and could just record the MIDI events and render the music offline.
Actually I have cheated a bit: The sounds are played in realtime, but I get some buffer underruns whenever I play too many notes simultaneously.
In order to get full quality in stereo without those underruns,
I have written the audio stream not only to ALSA output, but also to a file.
Then I have extracted the audio stream from the video recorded with the camera using ffmpeg.
In the next step I have synchronized the rendered audio stream to the recorded one using Audacity.
Then I have assembled the cut rendered audio stream and the recorded video stream using ffmpeg, again.
However, although the video I uploaded is exactly synchronized and of good sound quality, the YouTube replay is slightly desynchronized and the sound quality is poor.
The sounds are rendered in stereo, single precision float (rendering time with double precision is equally fast or equally slow) at 48000 Hz sample rate.
I have chosen quite simple sounds:
The first three sounds are purely synthesized,
whereas the last two sounds (piano and strings) are sampled sounds.
I have modified the sampled string sound in order to get a nice loop.
This is just for testing the phase and time modification method, that I have developed.
http://arxiv.org/abs/0911.5171
I can also utilize pitch bender, the modulation wheel, aftertouch and the other control knobs,
however all effects further increase computation time and thus reduce polyphony.
Currently I can also not switch between instruments that respond to a different set of controllers within the performance.
There is still much room for optimization,
but it becomes more and more difficult to find out the bottlenecks.
Seriously, that carpet brings back memories...
crock2801 2 weeks ago
coooooooooooooooooooooooool :)
TheProNinjaz 11 months ago
nice...
aki44 2 years ago