[Python-Dev] linuxaudiodev test does nothing (original) (raw)

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


Jeremy Hylton writes:

I can play the .au file and I use a variety of other audio tools regularly. Is Peter still maintaining it or can someone else offer some assistance?

The Linux audio programming docs do clearly state:

There are three parameters which affect quality (and memory/bandwidth requirements) of sampled audio data. These parameters are the following:

Sample format (sometimes called as number of bits) Number of channels (mono/stereo) Sampling rate (speed) NOTE! It is important to set these parameters always in the above order. Setting speed before number of channels doesn't work with all devices.

linuxaudiodev.c does this: ioctl(self->x_fd, SOUND_PCM_WRITE_RATE, &rate) ioctl(self->x_fd, SNDCTL_DSP_SAMPLESIZE, &ssize) ioctl(self->x_fd, SNDCTL_DSP_STEREO, &stereo) ioctl(self->x_fd, SNDCTL_DSP_SETFMT, &audio_types[n].a_fmt)

which is exactly the reverse order of what is recommended!

Alas, even after fixing this, I still can't get linuxaudiodev to play the damned .au file. It works fine for the .wav formats.

I'll continue hacking on this as time permits.