Sound question

Programming, for all ages and all languages.
Post Reply
giszo

Sound question

Post 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
Kemp

Re:Sound question

Post by Kemp »

That sounds suspiciously like a pure linux (or other similar OS) question to me, rather than a OSdev one...
giszo

Re:Sound question

Post 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 :)
giszo

Re:Sound question

Post by giszo »

Hehe... I did it, wav playing is working! :P
mystran

Re:Sound question

Post 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.
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Re:Sound question

Post 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 :)
giszo

Re:Sound question

Post by giszo »

Yeah... Just some IOCTL were missing... That was the problem first time i tried WAV :)
Eero Ränik

Re:Sound question

Post 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.
Post Reply