On Thu, 20 Sep 2001, Adam Wiggins wrote:

>    When recording via arecord I frequently see:
> xrun!!! (at least 12.096 ms long)

This is actually an underrun. While your computer is doing something else
(other programs, drivers, etc), soundcard's buffer area has become
full with recorded data. So as a result you get the an underrun
(no place to put more data, so previously recorded data is lost).

As a solution, you need a realtime-capable recording
application and double-buffering between the recording application
(arecord) and the pipe (here 'conv').

> arecord -D hw:1 -c 12 -r 96000 -f S32_LE -t raw | conv > out.raw

Download ecasound from http://eca.cx and then:

ecasound -r -z:db -sr:96000 -z:intbuf -f:s32_le,12,96000 -i alsa,hw:1 -o stdout | conv 
> out.raw

And run with root-priviledges. On average machine (no badly behaving 
drivers, etc), this is rock-solid. As for the params:

-r = use realtime scheduling (SCHED_FIFO)
-z:db = double-buffered disk i/o 
-sr:96000 = to avoid resampling, set internal sample rate to 96000
-f = set audio format for folloing inputs/outputs
-i = input definition
-o = output definition

>    "conv" is a program I wrote that strips out the all but the first
> two channels, since I couldn't figure out any way to do such a thing
> with arecord or ALSA by itself.

Well, ok, no need for this...:

ecasound -r -z:db -z:intbuf -f:s32_le,12,96000 -i alsa,hw:1 -f:s32_le,2,96000 -o 
out.raw

... and ta-daa, a 2ch output file. :)

-- 
 http://www.eca.cx
 Audio software for Linux!


_______________________________________________
Alsa-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-user

Reply via email to