Monday, January 16, 2012

A quick hack to make Synaesthesia work using PulseAudio

Synaesthesia is my favourite music visualization program. It can input audio that's being played using the EsounD esd_monitor_stream() function. That's broken when using PulseAudio in Debian Wheezy.  The call stops playback and the file descriptor never returns data. Here's a simple solution.

Comment out the EsounD opening code in openSound(), and just use pipeIn = 0 instead. This gets sound data from standard input. You can then provide input from the ALSA stereo monitor using something like: parec --latency=1 --format=s16le --device=alsa_output.pci-0000_00_1b.0.analog-stereo.monitor | synaesthesia esd

If your stereo monitor source is different, you may need to find it using pacmd. You may also need to unmute it. The --latency=1 stops parec from buffering a lot of data and then outputting it at once. The result works, though the high frame rate makes it a bit weird. Perhaps synaesthesia needs a frame rate cap?

No comments: