[Python-Dev] linuxaudiodev test does nothing

Charles G Waldman cgw@fnal.gov
Thu, 31 Aug 2000 14:04:15 -0500 (CDT)


The problem is that the test file 

audiotest.au: Sun/NeXT audio data: 8-bit ISDN u-law, mono, 8000 Hz

and the linuxaudiodev module seems to be (implicitly) expecting ".wav" format
(Microsoft RIFF).

If you open a .wav file and write it to the linuxaudiodev object, it works

There is a function in linuxaudiodev to set audio format - there
doesn't seem to be much documentation, the source has:

if (!PyArg_ParseTuple(args, "iiii:setparameters",
                          &rate, &ssize, &nchannels, &fmt))
        return NULL;
  
 and when I do

x = linuxaudiodev.open('w')
x.setparameters(8000, 1, 8, linuxaudiodev.AFMT_MU_LAW )

I get:
linuxaudiodev.error: (0, 'Error')

Also tried '1' for the sample size, thinking it might be in bytes.

The sample size really ought to be implicit in the format.  

The code in linuxaudiodev.c looks sort of dubious to me.  This model
is a little too simple for the variety of audio hardware and software
on Linux systems.  I have some homebrew audio stuff I've written which
I think works better, but it's nowhere near ready for distribution.
Maybe I'll clean it up and submit it for inclusion post-1.6

In the meanwhile, you could ship a .wav file for use on Linux (and
Windows?) machines.  (Windows doesn't usually like .au either)