On Mon, 23 Feb 2009 13:35:14 +0100 Alexandre Ratchov <a...@caoua.org>
wrote:

> aucat records 1-channel, s16le at 16kHz (required by the device)
> then it converts it to 2-channel, s16le at 44.1kHz (required by -o
> defaults) and saves the result. So it appears to work.
> 
> You probably want to record as follows:
> 
> aucat -f /dev/audio1 -C 0:0 -e s16le -r 16000 -o out-wcam-plain.raw
> 
> and then to play it:
> 
> aucat -c 0:0 -e s16le -r 16000 -i out-wcam-plain.raw
> 
> Let me know if above commands properly work on current (they should
> work even on few months old -current system, but iirc not on 4.4)
> 

The above failed on both 4.5-current (Feb 18), and 4.4-Stable.

Though there have been a ton of changes since 4.4-stable, the old code
works perfectly with this device. From the output below, you can see the
4.4-stable code up-sampling from 16000Hz to 44100Hz.

$ aucat -C 0:0 -e s16le -r 16000 -f /dev/audio1 -o test44.raw 
test44.raw: assuming headerless file
/dev/audio1: recording s16le,0:0,16000Hz
/dev/audio1: using 4004ms rec buffer
file_new: /dev/audio1
file_new: test44.raw
test44.raw: s16le,0:0,16000Hz -> s16le,0:0,44100Hz
test44.raw: writing s16le,0:0,44100Hz
starting device...
dev_start: play/rec started
^Cdraining buffers...
sub_rm: copy
aproc_del: wpipe: test44.raw: deleted
abuf_del:
aproc_del: conv: test44.raw: deleted
abuf_del:
aproc_del: sub: copy: deleted
abuf_del:
aproc_del: rpipe: /dev/audio1: deleted
file_poll: test44.raw: deleted
file_poll: /dev/audio1: deleted
test44.raw: closed
dev_stop: play/rec stopped
$
$ aucat -c 0:0 -e s16le -i test44.raw                         
test44.raw: assuming headerless file
/dev/audio: playing s16le,0:0,44100Hz
/dev/audio: using 700ms play buffer
file_new: /dev/audio
file_new: test44.raw
test44.raw: reading s16le,0:0,44100Hz
filling buffers...
starting device...
dev_start: play/rec started
aproc_del: rpipe: test44.raw: deleted
file_poll: test44.raw: deleted
mix_rm: softmix
abuf_del:
mix_out: nothing more to do...
aproc_del: mix: softmix: deleted
abuf_del:
aproc_del: wpipe: /dev/audio: deleted
file_poll: /dev/audio: deleted
draining buffers...
file_poll: nothing to do...
dev_stop: play/rec stopped
$ 


Unfortunately, the above doesn't work in 4.5-current, and the debug
output has been changed somewhat. One of the things I did notice is the
resampling from 16000Hz to 44100Hz does not seem to be occurring in
4.5-current.

$ aucat -C 0:0 -e s16le -r 16000 -f /dev/audio1 -o test45.raw
test45.raw: assuming headerless file
safile_new: using 5872(2936) fpb
file_new: sndio:hdl
dev_init: hw recording s16le,0:0,16000Hz
dev_init: using 8808 fpb
safile_start: play/rec started
file_new: wav:test45.raw
^Cdev_done: dev_mix = 0x0, dev_sub = 0x7c9ae880
safile_stop: play/rec stopped
aproc_del: rpipe(hdl): terminating...
file_del: sndio:hdl <>: delayed
sub_hup: sub: eof
aproc_del: sub(sub): terminating...
aproc_del: wpipe(test45.raw): terminating...
file_del: wav:test45.raw <WOK>: immediate
aproc_del: wpipe(test45.raw): freed
aproc_del: sub(sub): freed
aproc_del: rpipe(hdl): has refs
file_del: sndio:hdl <>: immediate
aproc_del: rpipe(hdl): terminating...
aproc_del: rpipe(hdl): freed

$ aucat -c 0:0 -e s16le -i test45.raw                                 
test45.raw: assuming headerless file
safile_new: using 5888(2944) fpb
file_new: sndio:hdl
dev_init: hw playing s16le,0:0,44100Hz
mix_newout: using 2944 fpb
dev_init: using 8832 fpb
safile_start: play/rec started
file_new: wav:test45.raw
mix_setmaster: 0x81324000: 32768/32768 -> 32768
dev_setvol: 0x81324000
dev_setvol: 0x81324000 -> 32768
aproc_del: rpipe(test45.raw): terminating...
file_del: wav:test45.raw <>: delayed
aproc_del: rpipe(test45.raw): freed
file_del: wav:test45.raw <>: immediate
mix_eof: mix: detached
dev_done: dev_mix = 0x89201580, dev_sub = 0x0
mix_out: nothing more to do...
aproc_del: mix(mix): terminating...
aproc_del: mix(mix): freed
aproc_del: wpipe(hdl): terminating...
file_del: sndio:hdl <WOK>: delayed
aproc_del: wpipe(hdl): has refs
file_del: sndio:hdl <WOK>: immediate
aproc_del: wpipe(hdl): terminating...
aproc_del: wpipe(hdl): freed
$
 
You may also want to note that by defining the rate (-r) as 16000Hz in
the playback still results in it playing too fast and with distortion,
albeit slower than playing it as above at 44100Hz. From the debug output
on the recording, it seems the file is supposed to be saved at 16000Hz,
but on playback, you have the force the rate down to about 8000Hz for
the timing to seem correct (i.e. normal speech speed, but there is also
plenty of distortion).

I still think the issue has something to do with the new resampling
(rate change) code that allows aucat in server mode (-l) to handle
anything you toss at it. If I'm reading the debug output correctly,
the old 4.4-stable aucat resampled from 16000Hz up to 44100Hz, but the
4.5-current aucat is not resampling the input at all during recording?

-- 
J.C. Roberts

Reply via email to