Q:

Output sound by writing to /dev/dsp

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?

A:

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.

