[Python-Dev] ossaudiodev test failure

Greg Ward gward at python.net
Sat Mar 5 20:09:28 CET 2005

I just discovered that the ossaudiodev test fails on Linux 2.6 with
ALSA's OSS emulation layer.  I'm pretty sure this can be blamed on ALSA
(The difference is this: if you pass bogus sampling parameters to
setparameters(), OSS will accept the request and set the hardware to
something reasonable, while ALSA will reject the request by returning -1
and setting errno, which becomes IOException.)  (IMHO,
test_ossaudiodev.py should not test this feature if it's not reliably
emulated by ALSA.)

Anyways, if you're running Linux or FreeBSD, or any other OS that
contains OSS drivers or OSS emulation, can you please run

  ./python ./Lib/test/test_ossaudiodev.py

from your CVS tree and email me the following info:

  * whether the test passed or not
  * what version of what OS you're running
  * what sound hardware you have
  * (Linux only) are you using ALSA or OSS?
  * whether other audio software (eg. xmms, xine, mpg123, audacity)
    works for you 

A passing test looks like this:

  playing test sound file...
  elapsed time: 3.1 sec

and has a uniquely Pythonesque sound.  ;-)  The failure I've been seeing
is this (you'll see a slightly different traceback, because I've
refactored the code a bit in my working dir):

  playing test sound file...
  elapsed time: 3.1 sec
  Traceback (most recent call last):
    File "Lib/test/test_ossaudiodev.py", line 147, in ?
    File "Lib/test/test_ossaudiodev.py", line 142, in test
    File "Lib/test/test_ossaudiodev.py", line 125, in test_bad_setparameters
      result = dsp.setparameters(fmt, channels, rate, False)
  IOError: [Errno 22] Invalid argument

Oh, to find out if you're using ALSA or OSS:

  * run "lsmod" and look for a bunch of modules starting with "snd_" --
    this is ALSA

  * look for device files like /dev/snd/pcmC0D* -- ALSA again

If you're using ALSA and /dev/dsp doesn't work, try
"modprobe snd_pcm_oss" -- that's the OSS emulation layer.


Greg Ward <gward at python.net>                         http://www.gerg.ca/
I used to be a FUNDAMENTALIST, but then I heard about the HIGH

More information about the Python-Dev mailing list