I upgraded my openSUSE installation from 12.1 to 12.2 recently and to my chagrin, my audio recording script stopped working. I use references to ALSA devices such as hw:1. The error message was cryptic:
rec FAIL formats: can't open output file `hw:1': can not open audio device: Invalid argument
After a lot of searching, I found the answer. The base cause is that in libsox2, which openSUSE 12.2 uses instead of libsox1, has separated out the Linux specific ALSA support into a separate shared object which is not loaded unless you set the environment variable AUDIODRIVER=alsa. So this is what I had to do in my script:
export AUDIODRIVER=alsa
export AUDIODEV=hw:1
rec ... program.wav
You are supposed to be able to use -t alsa in the options of rec but I had no luck with that.
Similarly for the play command which is just a link to sox like rec.
If you are just using the default sound device, you may not hit this bug as it may fall back to pulseaudio support. It's only when you must target a specific ALSA sound card that this bug manifests itself.
Here is the bug report that was the crucial clue.
rec FAIL formats: can't open output file `hw:1': can not open audio device: Invalid argument
After a lot of searching, I found the answer. The base cause is that in libsox2, which openSUSE 12.2 uses instead of libsox1, has separated out the Linux specific ALSA support into a separate shared object which is not loaded unless you set the environment variable AUDIODRIVER=alsa. So this is what I had to do in my script:
export AUDIODRIVER=alsa
export AUDIODEV=hw:1
rec ... program.wav
You are supposed to be able to use -t alsa in the options of rec but I had no luck with that.
Similarly for the play command which is just a link to sox like rec.
If you are just using the default sound device, you may not hit this bug as it may fall back to pulseaudio support. It's only when you must target a specific ALSA sound card that this bug manifests itself.
Here is the bug report that was the crucial clue.
No comments:
Post a Comment