[Klug-general] Linux Sound Programming
James Morris
james at jwm-art.net
Tue Mar 16 22:18:39 UTC 2010
On Tue, March 16, 2010 11:27, Peter Childs wrote:
> I'm trying to figure out how to do some relatively simple stuff with
> sound under Linux. I'm drawing a bit of a blank.
>
> There seams to be about 10 different ways of doing it, all of them
> with relatively poor docs and near no examples.
>
> I'm using Qt and C++ so Phonon looks like the best answer, however I
> need to record and phonon can't do that.
>
> GStreamer is looking like a good answer but its tied me in knots already.
>
> Pulse like it should do what I want and looks like the text book answer.
>
> Alsa and Portaudio are other options.
>
> I'm currently trying to write a small program that records, writes
> does what what it records and archives in into 15 minute time
> segments. (so MP3 or ogg encoding would be handy too) (This small
> program can be written in anything, it does not really need to link
> into the main Qt program....)
>
>
> I'm really just trying to work out where to start, and I've been
> trying for the last week now!
>
> Peter.
Forget all the rest and use JACK. Pulse audio and JACK are not the best of
friends. But use JACK. It's reliable, you can connect any application to
it either because that app uses JACK, or you can create ALSA JACK plugins
so for example I was recording youtube audio into JACK - as well as
various other (possibly more advanced) methods.
If you download the source code for JACK you'll find a whole directory of
examples. If you build JACK, make sure you have doxygen installed and
you'll have the documentation on your system. Take a look at
http://dis-dot-dat.net/index.cgi?item=/jacktuts//starting/
for a tutorial.
Anyone serious about audio on Linux uses JACK, but don't take my word for
it. The API is not that difficult to use and hardware + s/w driver issues
are completely abstracted away - all you're dealing with is buffers - but
make sure you don't do any stupid stuff in the RT thread like file i/o or
printf etc. Again, the examples show how to do this.
James.
More information about the Kent
mailing list