Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I know that it is possible to write arbitrary data into /dev/dsp and a noise will come up from the speakers. But whatever data I pass to this file the noise is the same. I wonder is it possible to generate some meaningful sound just by writing to /dev/dsp?

share|improve this question
Have you tried with a wav file? – YoMismo Jul 29 '14 at 8:07

It must be possible, though I haven't come across any program to generate a file in this type of raw format.

If you are just interested in how it works and what must be written do the device to have sound output, you can look into the source code of sox. This program can be used to transcode a given input file and play it by outputing to /dev/dsp. (Run the program with -t oss option).

If you are just looking for the simplest to play a sound from the console, you'd be probably much better off using ALSA instead of OSS. Use aplay that is part of the alsa-utils. You'll most probably just have it installed by default.

share|improve this answer

The advanced bash scripting guide. Example 29.2 linked here:

Has the calculations commented...

share|improve this answer
This is a good catch and the linked resource looks quite relevant, but we tend to prefer you excerpt the relevant parts of linked pages here - links can break later on, and then the answer's no help any more. You can edit your answer (the link is just below it) and add more details. – Michael Homer Jul 29 '14 at 7:48

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.