19 January 2011

Howto: test your microphone with ALSA on ubuntu

Audio Linux Sound Architecture (ALSA).

To list sound devices:

$ cat /proc/asound/cards


To check which sound devices are recognized by your alsa system is arecord -l:

$ arecord -l


To test microphone we would use arecord on the command line. This small utility will record sound from your default alsa default sound device.

$ arecord -d 10 /tmp/test-mic.wav


This will record 10 seconds. Now it is easy to play your wav file with another simple alsa utility a play:

$ aplay /tmp/test-mic.wav


NOTE:
If you have a more sound devices on your system and you need to use the non default sound card you can specify it to arecord with -D option. For example:

$ arecord hw:1,0 -d 10 /tmp/test-mic.wav


will use second sound card where 1 refers to card and 0 refers to device as returned by arecord -l command. If you want to change your default alsa sound device globally on the system here is a link to unofficial alsa wiki which you might find helpful: http://alsa.opensrc.org/index.php/FAQ026

No comments: