How to capture microphone input to WAV format file

Last updated on August 14, 2020 by Dan Nanni

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 SettingsSoundInput.

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).

Install alsa-utils on Linux

For Ubuntu or Debian:

$ sudo apt-get install alsa-utils

For Fedora:

$ sudo yum install alsa-utils

For Arch Linux:

$ sudo pacman -S alsa-utils

Capture Micophone Input with arecord

One of the command-line utilities contained in alsa-utils is arecord, which can capture 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 to 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 is 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

Support Xmodulo

This website is made possible by minimal ads and your gracious donation via PayPal or credit card

Please note that this article is published by under a Creative Commons Attribution-ShareAlike 3.0 Unported License. If you would like to use the whole or any part of this article, you need to cite this web page at as the original source.

Xmodulo © 2021 ‒ AboutWrite for UsFeed ‒ Powered by DigitalOcean