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:
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:
**** 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:
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.
Recording WAVE 'output.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
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.
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.
Did you find this tutorial helpful? Then please be generous and support Xmodulo!
Latest posts by Dan Nanni (see all)
- How to install Suricata intrusion detection system on Linux - September 3, 2015
- How to switch from NetworkManager to systemd-networkd on Linux - August 31, 2015
- How to set up a system status page of your infrastructure - August 25, 2015