Web lists-archives.com

sending data to /dev/dsp




	The system with the problem is running Debian GNU/Linux 8
and I am trying to run a program I wrote that works as it should
in Debian GNU/Linux 7.

	The program sends audio to /dev/dsp or /dev/dsp# if the
card is other than card 0 and it works correctly.

	On the Debian 8 system literally everything but the
program works. I got /dev/dsp by placing the snd-pcm-oss line in
/etc/modules and I can cat appropriate 8-bit binary data to
/dev/dsp and hear correct sound.

	The program which sends sound to the audio output
compiles and appears to run on the Debian 8 system but data sent
to /dev/dsp produce total silence.

	I've even got an un-witting form of testing for the
output channel which works as follows:

	The program I wrote is a ring buffer to produce an audio
delay between audio received in to the sound card and the output
back to the sound card. It is necessary to seed all the memory in
the ring buffer with the value that represents silence or one
gets blasted with let's say, 10 seconds of utter noise as the
buffer memory is full of binary garbage when the ring runs for
the first time. In other words, you don't even have to have any
signal at the input to test your output. Just set a 5 or
ten-second delay and turn the volume down on your speakers or
especially headphones, and then fire up the delay. When it's
working, you'll hear what sounds like the end of the Earth
starting up for the duration of the delay and then the ring fills
up and you should hear your delayed audio.

	On the newer Debian system, there is no sound output from
the program even when it is munching uninitialized RAM so I know
I've got trouble somewhere.

	The program uses ioctl calls to initialize /dev/dsp to
look for 16-bit words and do this at 44100 samples per second and
all the ioctl commands run without error.

	/dev/dsp opens without error before the ioctl commands so
it all looks ready to speak but it is mute. Anything else I send
it that should make noise does so with no problem.  Tracing
operation with gdb shows it going round and round like it should.

Here is how I setup the output channel which does work in Debian
7

  FILE *fd;       /* sound device file descriptor */
  fd = open("/dev/dsp", O_RDWR);
  if (fd < 0) {
    perror("open of /dev/dsp failed");
    exit(1);
  }

Here's a write that should make noise.


write(fd, &delaysample, sizeof(delaysample)); /* play  */

That's what just doesn't happen in Debian 8 but there is no error
or stoppage of the program.

Thanks for any ideas.

Martin WB5AGZ