I am writing a Python script in which a small portion involves playing
a sound beep on error. I am using the play utility from the sox
package. I use Fedora 6 and my sound card is Via 8235. It is working
fine on my box using the following command:

"""
   sox --device=/dev/audio --channels=2 --file=somefile.wav
"""

To make the script portable across distros I have to locate a way to
select the default audio device. I have checked out in /etc/ also but
no files talked of the default device.
What is the method to locate the default audio device?

The script has the following problem when I use it elsewhere. It gives
the following error:

"""
ALSA lib pcm.c:2143:(snd_pcm_open_noupdate) Unknown PCM /dev/audio
sox: Failed writing /dev/audio: cannot open audio device
"""

I tried the above for /dev/dsp, /dev/mixer but a similar error message
creeps up.

Initially I thought it was a permission problem and so changed the
permissions but to no avail (I even tried using it from root). The
problem persists.

By default the permissions for the devices are

"""
crw------- 1 puthraya root 14, 4 Apr  8 06:53 /dev/audio
crw------- 1 puthraya root 14, 3 Apr  8 06:53 /dev/dsp
crw------- 1 puthraya root 14, 0 Apr  8 06:53 /dev/mixer
"""

In the dev directory there are too many files that reference to audio
devices like:
/dev/adsp
/dev/audio
/dev/dsp
/dev/mixer
/dev/mixer1
/dev/snd/controlC0  
/dev/snd/controlC1  
/dev/snd/midi1  
/dev/snd/midiC1D0  
/dev/snd/pcmC0D0c  
/dev/snd/pcmC0D0p  
/dev/snd/pcmC0D1c  
/dev/snd/pcmC0D1p  
/dev/snd/seq  
/dev/snd/timer

Which one could it be?

Google wasn't of much help. Hopefully someone in the list might help out.

Thanks in advance
Thejaswi Puthraya
http://thejuhyd.blogspot.com

Reply via email to