Better Linux Sound Managment With ALSA, Part 2
Testing Sound ChannelsLast week we learned how to configure soundcards for playback with ALSA. It's easy, it works on all Linuxes, it doesn't create conflicts or introduce latency, and it doesn't require the X Window System. Today we're going to use ALSA for recording, and learn how to test our sound system.
A quick and horrid way to see if sound is working is to pipe the contents of a file to dev/dsp:
$ cat /dev/urandom > /dev/dsp
$ speaker-test -t wav -D plug:front -c2 -l2 speaker-test 1.0.14 Playback device is plug:front Stream parameters are 48000Hz, S16_LE, 2 channels WAV file(s) Rate set to 48000Hz (requested 48000Hz) Buffer size range from 16 to 16384 Period size range from 8 to 8192 Using max buffer size 16384 Periods = 4 was set period_size = 4096 was set buffer_size = 16384 0 - Front Left 1 - Front Right Time per period = 2.731660 0 - Front Left 1 - Front Right Time per period = 2.986495
You should hear a pleasant woman's voice saying "Front left, front right". -c2 means two channels, and -l2 means run the test twice.
It's common to have 5:1 surround sound even with onboard sound chips, so you can test this too:
$ speaker-test -t wav -D plug:surround51 -c6 -l2
Note how the different channels are numbered. To test a single speaker, select it with the -s option. This example generates a sine wave tone at 45 Hz, which sounds like power hum, on the LFE channel:
$ speaker-test -t sine -f 45 -D plug:surround51 -c6 -s6
Beware the channel-numbering gotcha- speaker-test output numbers from zero, but the -s option starts from one. Aren't computers fun!
LFE means Low Frequency Effects, which usually means your subwoofer. Of course it's more complex than that; see What is the LFE Channel? for more information.