I've been changing the command line options with sox to convert captured raw sound to wav. Sox is great; i'm trying to learn the basics.
I capture the sound using an altered .asoundrc
Code:
pcm.V8237 { type hw; card V8237; }
ctl.V8237 { type hw; card V8237; }
pcm.!default pcm.V8237
ctl.!default ctl.V8237
pcm.!default {
type plug
slave {
pcm rate48000Hz # Direct default output to the below converter
}
}
pcm.rate48000Hz {
type rate
slave {
pcm writeFile # Direct to the plugin which will write to a file
format S16_LE
# channels 2
rate 48000
}
#route_policy copy
}
pcm.writeFile {
type file
slave {
pcm card0 # Now write to the actual sound card
}
file "aplay-D_card0-t_raw-f_S16_LE-r48000-c_2.raw"
}
pcm.card0 {
type hw
card 0
}
ctl.card0 {
type hw
card 0
}
To convert:
Code:
sox -r 48k -s -b 16 -c 2 aplay-D_card0-t_raw-f_S16_LE-r48000-c_2.raw foo.wav
The r is the rate, -s is signed integer, -b is 16 bit, and -c 2 is for two channels.
I got the .asoundrc mostly from
http://www.swview.org/node/213
Also helpful were the Alsa wiki pages:
http://www.alsa-project.org/alsa-doc...m_plugins_file
including a script to generate a .asoundrc file:
http://alsa.opensrc.org/index.php/.a....asoundrc_file
A question----
Doesn't alsa (.asoundrc) support wav format? When I tried entering 'format wav' in the asoundrc, I received an error message.
A comment--
This is a rather round about way of doing things. The new audio is recorded in the current working directory most often ~ and the new data is neither appended to nor does it replace the old data; it becomes a sort of conglomeration. To record effectively it would be necessary to have a script to enable (put in place) and disable (remove) the .asoundrc file.