[alsa-devel] Noisy audio - ALSA Configuration
m-iovescu1 at ti.com
Thu Aug 16 19:36:53 CEST 2007
Thanks. I wanted to avoid short writes as I thought that they may be the
cause of the noise I have in my audio.
What may be other reasons I get bad quality audio?
From: Clemens Ladisch [mailto:cladisch at fastmail.net]
Sent: Thursday, August 16, 2007 2:06 AM
To: Iovescu, Magdalena; alsa-devel at alsa-project.org
Subject: Re: [alsa-devel] Noisy audio - ALSA Configuration
Iovescu, Magdalena wrote:
> Does anyone have examples or documentation on how to configure
> frames and buffers for various sample rates?
Frames don't need configuration; they are dependent on the sample format
only. In your case (S16_LE, 2 channels), one frame = four bytes.
The buffer size determines latency. Low latency is only important when
the audio data is generated from user input in real time; when you can
read (and decode) ahead, you should better use a rather large buffer to
reduce the possibility of underruns.
Periods aren't that important. A period is the interval between two
interrupts, so it might be better to have more small periods than fewer
large ones (unless the interrupt overhead gets too high) so that your
application can get woken up more often, but there isn't much difference
> [...] With a buffer this big, I do not get underruns, but all the
> writes are short writes. I have not been able to find the right
> configuration to avoid short writes,
Short writes happen where there is less free space in the buffer than
you are trying to write. This is the normal case, there's nothing wrong
with that. Is there a reason why you want to avoid them?
More information about the Alsa-devel