[Python-Dev] linuxaudiodev test does nothing

Charles G Waldman cgw@fnal.gov
Fri, 1 Sep 2000 11:06:48 -0500 (CDT)


Greg Ward wrote:

 > ...but the sound is horrible: various people opined on this list, many
 > months ago when I first reported the problem, that it's probably a
 > format problem.  (The wav/au mixup seems a likely candidate; it can't be
 > an endianness problem, since the .au file is 8-bit!)

Did you see the msg I sent yesterday?  (Maybe I send out too many mails)

I'm 99.9% sure it's a format problem, because if you replace
"audiotest.au" with some random ".wav" file, it works. (On my system
anyhow, with pretty generic cheapo soundblaster)

The code in test_linuxaudiodev.py has no chance of ever working
correctly, if you send mu-law encoded (i.e. logarithmic) data to a
device expecting linear, you will get noise.  You have to set the
format first. And, the functions in linuxaudiodev which are intended
to set the format don't work, and go against what is reccommended in
the OSS programming documentation.

IMHO this code is up for a complete rewrite, which I will submit post
2.0.  

The quick-and-dirty fix for the 2.0 release is to include
"audiotest.wav" and modify test_linuxaudiodev.au.


Ka-Ping Yee <ping@lfw.org> wrote:
> Are you talking about OSS vs. ALSA?  Didn't they at least try to
> keep some of the basic parts of the interface the same?

No, I'm talking about SoundBlaster8 vs. SoundBlaster16
vs. ProAudioSpectrum vs. Gravis vs. AdLib vs. TurtleBeach vs.... you
get the idea.  You can't know what formats are supported until you
probe the hardware.  Most of these cards *don't* handle logarithmic
data; and *then* depending on whether you have OSS or Alsa there may be
driver-side code to convert logarithmic data to linear before sending
it to the hardware.

The lowest-common-denominator, however, is raw 8-bit linear unsigned
data, which tends to be supported on all PC audio hardware.