[Python-Dev] linuxaudiodev test does nothing

Charles G Waldman cgw@fnal.gov
Thu, 31 Aug 2000 18:01:22 -0500 (CDT)


Ka-Ping Yee writes:

 > Side note: is there a well-defined platform-independent sound
 > interface we should be conforming to?  It would be nice to have a
 > single Python function for each of the following things:
 > 
 >     1. Play a .wav file given its filename.
 > 
 >     2. Play a .au file given its filename.

These may be possible.

 >     3. Play some raw audio data, given a string of bytes and a
 >        sampling rate.

This would never be possible unless you also specifed the format and
encoding of the raw data - are they 8bit, 16-bit, signed, unsigned,
bigendian, littlendian, linear, logarithmic ("mu_law"), etc?

Not only that, but some audio hardware will support some formats and
not others.  Some sound drivers will attempt to convert from a data
format which is not supported by the audio hardware to one which is,
and others will just reject the data if it's not in a format supported
by the hardware.  Trying to do anything with sound in a
platform-independent manner is near-impossible.  Even the same
"platform" (e.g. RedHat 6.2 on Intel) will behave differently
depending on what soundcard is installed.