Page 1 of 1

Sound question

Posted: Tue Aug 23, 2005 9:00 am
by giszo
Hi!

Is it possible to write a sound file to /dev/dsp and hear the right sound? I've tried it with .WAV but it isn't working. If it's possible please tell me which sound format it is :)

Thanks

Re:Sound question

Posted: Tue Aug 23, 2005 10:02 am
by Kemp
That sounds suspiciously like a pure linux (or other similar OS) question to me, rather than a OSdev one...

Re:Sound question

Posted: Tue Aug 23, 2005 10:30 am
by giszo
Hmm.. So i asked that because i've ported sound driver from linux. So now it's working under VMware and i'd like to play something easily. I just don't know how :)

Re:Sound question

Posted: Tue Aug 23, 2005 10:51 am
by giszo
Hehe... I did it, wav playing is working! :P

Re:Sound question

Posted: Tue Aug 23, 2005 11:07 pm
by mystran
And for those who wonder: yes, the old OSS drivers work exactly that way. You dump raw data into /dev/dsp and it gets played. Format/samplerate/whatever can be configured with various ioctl()-calls (surprise?).

If one just dumps a .wav into /dev/dsp, one will normally hear it, but it will be played with the default settings (which might be 8-bit unsigned ?-Law mono 22050 or pretty much anything else) which naturally can do all kinds of funny things with the sound. In addition, there will be a burst of noise in the beginning of the sound, because .wav files contain a header, which is not audio data, and throwing that through speakers makes no sense. Finally, this is assuming the .wav isn't compressed, which actually is possible.

Re:Sound question

Posted: Wed Aug 24, 2005 12:31 am
by Candy
mystran wrote: And for those who wonder: yes, the old OSS drivers work exactly that way. You dump raw data into /dev/dsp and it gets played. Format/samplerate/whatever can be configured with various ioctl()-calls (surprise?).
Common way for computer nerd to test whether the sound card works:

Code: Select all

cat /dev/hda >/dev/dsp
NTFS sounds rather funny actually :)

Re:Sound question

Posted: Wed Aug 24, 2005 4:54 am
by giszo
Yeah... Just some IOCTL were missing... That was the problem first time i tried WAV :)

Re:Sound question

Posted: Wed Aug 24, 2005 1:20 pm
by Eero Ränik
Candy wrote:
mystran wrote: And for those who wonder: yes, the old OSS drivers work exactly that way. You dump raw data into /dev/dsp and it gets played. Format/samplerate/whatever can be configured with various ioctl()-calls (surprise?).
Common way for computer nerd to test whether the sound card works:

Code: Select all

cat /dev/hda >/dev/dsp
NTFS sounds rather funny actually :)
This is one thing I'm going to try out, heh.