[linux-audio-user] Copying one channel from a Stereo File with sox

Martin McCormick martin at dc.cis.okstate.edu
Sun Jun 27 16:50:21 EDT 2004


	This appears to be right on target except I am going to need
to play a bit with the input file and probably name it something else
than a .wav file.

	I connected a stereo tape recorder to the two inputs of the
sound card and used the following command to capture 2 tracks of audio
containing separate program material recorded at 1-and-7/8 IPS.
That's the reason for the low sample rate:

arecord -d 86400 -t wav -r 8000 -F S8 -c 2 2channelarchive.wav

	This produced a two-channel recording all right that plays
just fine back through the sound card.  Unlike  a 44,100 .wav,
however, this file alternates bytes for the left and right channels.
16-bit samples alternate bits for the left and right channels so that
each word completes loading in to its respective D/A converter one
bit-time apart.

	So far, I have created a very strange effect by using the avg
-l effect.  What I get is a single channel of audio which plays at the
correct speed, but which contains audio from both streams as well as a
horrible 4-KHZ modulation effect.  The output half of the sox command
is working, I am pretty sure, but it is receiving data in a format it
isn't expecting.

	Funny thing, If I cat the 2channelarchive.wav file >/dev/dsp,
I hear both audio channels at half speed which is exactly what one
should get if the left and right channel samples aren't interleaved.

	When playing back this two-channel 8-K recording, the read
pointer must move at 16,000 bytes per second with the driver sending
alternating left and right bytes to the sound buffers to restore the
8-K sampling rate for both channels.

	Thanks for the help and I'll let the list know if I can figure
out what to tell sox to do to pull off the left or right channel to another
file.

Martin McCormick

wes schreiner writes:
>executable.  What you want is the "avg" effect.   So to take only the 
>left channel of a stereo WAV file, one could give the command:
>
>sox stereo.wav -c 1 mono.wav avg -l



More information about the Linux-audio-user mailing list