Take the 2-minute tour ×
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.

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 at 8:07

2 Answers 2

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:
http://www.tldp.org/LDP/abs/html/devref1.html

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 at 7:48

Your Answer

 
discard

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.