Re: oss emulation under alsa? (LONG)
Marc Shapiro wrote:
> Justin Guerin <email@example.com> wrote:
>> On Wednesday 13 April 2005 12:45, Marc Shapiro wrote:
>>>I am runing Sarge with the stock debian kernel 2.6.7-1-k7 which has ALSA
>>>sound built in. I am trying to run a Python program which was written
>>>for OSS. How do I get ALSA to emulate OSS so that these, or other
>>>programs written for OSS will run?
>>>I have added the following to /etc/modutils/sndconfig:
>>>alias sound-service-0-0 snd-mixer-oss
>>>alias sound-service-0-1 snd-seq-oss
>>>alias sound-service-0-3 snd-pcm-oss
>>>alias sound-service-0-8 snd-seq-oss
>>>alias sound-service-0-12 snd-pcm-oss
>>>and then I ran update-modules and rebooted, but I still get an error
>>>Traceback (most recent call last):
>>> File "./morse.py", line 151, in ?
>>> File "./morse.py", line 99, in main
>>> dev = audiodev.AudioDev()
>>> File "/usr/lib/python2.3/audiodev.py", line 229, in AudioDev
>>> raise error, 'no audio device'
>>>audiodev.error: no audio device
Trying this at home, I get the exact same error. Looking at the source to
audiodev.py, I can see why. It tries to import some platform specific
audio tools, for Irix, Mac, and Sun. If you're not on one of these three
platforms, then the command should fail.
>> Do you have the module snd_pcm_oss loaded? That's the OSS emulation
>> for ALSA. If you're using udev, then /dev/dsp should be created when you
>> load the module. Let us know which, if either, of the above isn't
>> happening, and we'll go from there.
> The module is loaded and /dev/dps is a symlink to /dev/dsp0. The output
> of lsmod and 'ls /dev/dsp*' follows:
> $ lsmod
[snip fine lsmod output]
> $ ls /dev/dsp*
> lrwxrwxrwx 1 root root 9 Jul 12 2004 /dev/dsp ->
> crw-rw---- 1 root audio 14, 3 Jul 12 2004 /dev/dsp0
> crw-rw---- 1 root audio 14, 19 Jul 12 2004 /dev/dsp1
> crw-rw---- 1 root audio 14, 35 Jul 12 2004 /dev/dsp2
> crw-rw---- 1 root audio 14, 51 Jul 12 2004 /dev/dsp3
> Total: ( 1 Files) 65
> As you can see from the following, I am listed as a member of the audio
> $ groups
> mns disk dialout cdrom floppy audio lpadmin
> Sound seems to be working perfectly, otherwise. The only problem I am
> having is with this one Python script. Possibly the problem is with the
> script, and not with my configuration. The script is one of the
> Python2.3 demos, but maybe it has a problem. Does anyone know if there
> is a problem with the audiodev.py module? Here is a copy of the
> offending script:
> $ cat morse.py
I think the script might be a bit stale. I don't see the audiodev.py module
documented in the python 2.3 docs, either. What I do see is ossaudiodev,
which seemed to work for me (that is, importing and creating a device, but
not actually sending any sound through it), though it's a binary file, so I
can't view the source code.
>From reading the docs, it doesn't appear that ossaudiodev is a drop in
replacement for audiodev, so you can't just :%s/audiodev/ossaudiodev/g the
script and expect it to work.
I checked back to python 2.1, and up to python 2.4, and couldn't find a
reference to audiodev, so that module may be from pre-2.0 days.
So to sum up, I think the script is out of date, and the fault isn't with
Hope that helps,