Skip to contentSkip to conversation

playing underruns

DISCUSSION Chris Raphael 3 participants 3 messages Feb 12, 2003 – Feb 13, 2003

lore
Share & tools
lore
#0 lore raw

Hello List,

This is my first post and I am new (a couple of weeks) to ALSA.

I am working on an application that plays audio output in response to audio input --- the relationship between input and output is complicated and I will not describe it in any detail here --- I am building a musical accompaniment system. I want the output to "respond" to the input with low latency so I cannot write the output samples very long before they are actually going to be played. Currently I have a function that is called repeatedly (through a signal) and writes the samples about .05 secs before they will actually be played. I monitor the delay, in samples, (I can't remember the name of the function (snd_delay_???) and see that the number of unplayed samples fluctuates but there does not seem to be an increasing or decreasing trend. So I assume that I am writing at very close to the right rate and mostly the playback sounds fine. But every so often, maybe once every 10 secs or so, I get a playback underrun. I always check the system clock when my writing routine begins, so I know the underruns are almost always *not* due to my writing routine getting a late callback. By everything I can measure, the samples are written on time. Can anyone tell me what I need to do to fix this problem? Perhaps it is not reasonable of me to hope to write samples such a short time before they need to be played?

I would really appreciate any help I can get on this and will supply any relevant details. I just didn't want to clutter up my question with lots of irrelevant info.

Thanks,

Christopher Raphael

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

#1 lore raw

oh boy. there is so much that you might not know. lets start with the most obvious:

which kernel are you using (version + distribution) SCSI or IDE disk controller
have you ever heard of the low latency patch?

--p

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

#2 lore raw
In reply to Chris Raphael

Hi,

check LAD site,
http://www.linuxdj.com/audio/lad/resourceslatency.php3

you'll find some good information how to get low-latency.

Takashi

At Wed, 12 Feb 2003 17:56:19 -0500,

Quoted 36 lines · Chris Raphael

Hello List,

This is my first post and I am new (a couple of weeks) to ALSA.

I am working on an application that plays audio output in response to audio input --- the relationship between input and output is complicated and I will not describe it in any detail here --- I am building a musical accompaniment system. I want the output to "respond" to the input with low latency so I cannot write the output samples very long before they are actually going to be played. Currently I have a function that is called repeatedly (through a signal) and writes the samples about .05 secs before they will actually be played. I monitor the delay, in samples, (I can't remember the name of the function (snd_delay_???) and see that the number of unplayed samples fluctuates but there does not seem to be an increasing or decreasing trend. So I assume that I am writing at very close to the right rate and mostly the playback sounds fine. But every so often, maybe once every 10 secs or so, I get a playback underrun. I always check the system clock when my writing routine begins, so I know the underruns are almost always *not* due to my writing routine getting a late callback. By everything I can measure, the samples are written on time. Can anyone tell me what I need to do to fix this problem? Perhaps it is not reasonable of me to hope to write samples such a short time before they need to be played?

I would really appreciate any help I can get on this and will supply any relevant details. I just didn't want to clutter up my question with lots of irrelevant info.

Thanks,

Christopher Raphael

Quoted 9 lines

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Alsa-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf