Indicated by:
Sometimes the cause of this is selectively pulling out modules suggested by a dist-upgrade, such as the kernel, without the kernel modules.
Add the appropriate modules to your kernel. In Ubuntu you can upgrade to the newest kernel and modules by issuing the following command:
$ sudo apt-get install linux-generic
If you encounter the following error it simply means you are targeting a non-existent or erroneous device:
$ cat /dev/urandom | aplayALSA lib pcm_hw.c:1207:(_snd_pcm_hw_open) Invalid value for cardaplay: main:546: audio open error: No such file or directory
This can often be remedied by simply specifying the device explicitly.
cat/dev/urandom|aplay-Dhw:0,3This is a rather complex option . Essentially, hardware expects a certain datatype for the sound sample, and you're providing the wrong one.
aplay: set_params:901: Sample format non available
Specify the sample format, or amend the rate in the ALSA conf file.
cat /dev/urandom | aplay -f S16_LE ## Where S16_LE is your desired rate
If you do not provide to ALSA the amount of channels you wish to output to, you'll get the following error:
aplay: set_params:901: Channels count non available
Specify the amount of channels you wish to output too. Two is considered safe for the purpose of troubleshooting.
cat /dev/urandom | aplay -c 2 ## Two channels is stereo sound