Re: Swiss Army Knife of Sound has me Baffled.
On Wed 18 Aug 2021 at 21:41:06 (-0500), Martin McCormick wrote:
> I have a little shell script called fullstereo which works fine.
> It's short so I'll show it to you. It records sound from a
> Creative Labs usb sound card which is probably much happier on a
> Windows box but that's not where I need it. It has only 1
> sampling rate that works under debian and that is 48 KHZ. I want
> 44.1 KHZ and I get 2 good stereo channels with the following script:
>
> #! /bin/sh
> cd ~/tmp
> filename=$1.wav
> echo $filename
> arecord -D hw:1,0 -r 48000 -d $2 -c 2 -f S16_LE - \
> | sox -t wav - -r44100 $filename
>
> $2 is a value in seconds, minutes or hours and it goes
> like a house on fire with no problem.
>
> So, I want a mono version. Let's try this:
>
> #! /bin/sh
> cd ~/tmp
> filename=$1.wav
> echo $filename
> arecord -D hw:1,0 -r 48000 -d $2 -c 1 -f S16_LE - \
> | sox -t wav - -r44100 $filename
>
> This hasn't worked yet. It is identical to the good version but
> for c 1 as the number of channels to arecord instead of c 2 .
Try -r 8000, or leave out -r and -c entirely, and you should
succeed. But I doubt that's really your priority, is it?
> […] and I
> guess I could leave it in stereo mode and tell sox to mix the
> left and right channels which is fine with me but kind of clunky.
That's why it's the "Swiss Army knife". After mixing the two channels,
you can write to a single-channel WAV file.
What you can't do is tell /arecord/ to use an ADC that doesn't exist.
Cheers,
David.
Reply to: