[alsa-devel] Trying to understand alsa

Jonathan Andrews jon at jonshouse.co.uk
Thu Jan 12 22:44:11 CET 2012

Hi people, i'm trying to understand alsa....

I have an application that works using 512 sample packets of 22050Hz 16
bit mono audio.  The 'receiver' takes many audio streams from a network
via UDP, at the moment it pipes them into pulse.

Can alsa buffer audio. At the moment every time I and set an audio
buffer size I get a negative response from
snd_pcm_hw_params_set_buffer_size .  I'm somewhat confused about the
units alsa uses ...

What I want to do is tell ALSA to hold a buffer of 3 of my packets (3 x
1024Bytes, thats 512 x 16 bit samples) while I feed extra packets (1K
Byte, 512 samples per buffer) in for playback.  The packets are arriving
at roughly the correct rate, I just need a buffer to  iron out any
jitter in network transmit, do I have to do this myself ?

Can somebody help by telling me which numbers I push into which places
to make it work ?

At the moment I get i keep getting a broken pipe, if I underrun how can
I make it just wait for me ?

I only code in plain old C at the moment.

Many thanks for any help/advice anyone can offer.


More information about the Alsa-devel mailing list