Thursday, October 20, 2011

routing real-time audio to the internet

I've been working on a server-side audio tool. My app works well on the desktop - it is written in Java and the audio from SourceDataLine just works. So, I moved the app to a remove server.

Pulseaudio was installed on the remote server, and I thought it should be pretty easy to route the output back over the internet to myself.

In the end it was:

parec -r | oggenc -r -o - - | ./sighttpd -f ./oggout.conf


I called my java code with 'padsp', I'm not sure that is necessary but it probably is. This method avoids using Gstreamer (that should be a good solution if you want to scale: It can plug your audio into icecast/shoutcast.)

SourceDataLine provided the audio stream in my Java app.

NOTE: I spent a whole bunch of time playing with a file output pipe from pulse audio. The excellent support from pulse audio mailing list and irc channel steered me away from that.