Document last edited: 26 Oct 2006

Easy sound play trick in the Linux OS with configured ALSA sound.

The Linux ALSA drivers have native sound-devices in the /dev/snd/ directory. 
If you have one card, you might see the following devices:

/dev/snd/pcmC0D0 - the raw audio device for the card

This is the one we want to use for raw audio.

Note other devices:
/dev/snd/mixerC0D0 - the mixer for card 0
/dev/snd/controlC0D0 - the control device for card 0

The first number means the number of the soundcard, 
the second number (if any) is the number of the device. 

A sound card with two PCM devices would have a pcmC0D0 and pcmC0D1 device. 

Please note: the ALSA devices have changed between the previous version. 
Older ALSA drivers use /dev/snd/pcm00 (first number is the card, second number is the device). 

It is possible put any soundfile you want into the PCM device of the first card. 

To cat any file to /dev/snd/pcmC0D0, like this: 

$ cat [filename] > /dev/snd/pcmC0D0. 

The filename can be any file, as long as it has some length. 

The above does not work in all instances.

With ALSA that is setup correctly, you may also play a file like this:

$ aplay [filename]