How to capture microphone input to wav format file

If you want to capture input from microphone connected to your Linux computer, there is a simple way to do it. But prior to recording, you probably want to adjust the input volume of your microphone for optimal quality recording. With low input volume, your microphone may not pick up your voice properly, while too high an input volume may introduce a lot of background noise in the recording.

If you are using Ubuntu Desktop, you can adjust microphone input volume by going to "Settings" -> "Sound" -> Input.

In order to record microphone input on Linux, you can use a tool set called alsa-utils which is developed for Advanced Linux Sound Architecture (ALSA). To install alsa-utils on Debian/Ubuntu:

$ sudo apt-get install alsa-utils

One of the command-line utilities contained in alsa-utils is arecord which captures microphone input to wav format.

To verify that microphone is successfully recognized on your system:

$ arecord -l
**** List of CAPTURE Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: CONEXANT Analog [CONEXANT Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

To record microphone input as wav format:

$ arecord output.wav
Recording WAVE 'output.wav' : Unsigned 8 bit, Rate 8000 Hz, Mono

Without any argument, arecord will record microphone input to wav format with sample rate 8000 Hz, unsigned 8 bit depth, and single mono channel. arecord will continue to capture a stream of microphone input until it's terminated by Ctrl+C.

If you want, you can customize output wav format as follows.

$ arecord -f cd output_stereo.wav
Recording WAVE 'output.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
$ arecord -r 16000 -f S16_LE output2.wav
Recording WAVE 'output2.wav' : Signed 16 bit Little Endian, Rate 16000 Hz, Mono

To play back a wav file, you can use another ALSA utility called aplay.

$ aplay output.wav

Subscribe to Xmodulo

Do you want to receive Linux FAQs, detailed tutorials and tips published at Xmodulo? Enter your email address below, and we will deliver our Linux posts straight to your email box, for free. Delivery powered by Google Feedburner.

Support Xmodulo

Did you find this tutorial helpful? Then please be generous and support Xmodulo!

The following two tabs change content below.
Dan Nanni is the founder and also a regular contributor of He is a Linux/FOSS enthusiast who loves to get his hands dirty with his Linux box. He likes to procrastinate when he is supposed to be busy and productive. When he is otherwise free, he likes to watch movies and shop for the coolest gadgets.

One thought on “How to capture microphone input to wav format file

  1. Another application that can be used to capture microphone input to WAV file is fmedia (

    fmedia --record --out=rec.wav

    Like arecord, it uses ALSA capture device, but fmedia also supports more complex output formats such as FLAC, OGG and MP3.

Leave a comment

Your email address will not be published. Required fields are marked *