Skip to content
Baozhu Zuo edited this page Feb 1, 2018 · 2 revisions

On Linux, we use ALSA (Advanced Linux Sound Architecture) to record and play. We can use tools such as arecord, aplay, speaker-test, alsamixer, audacity, pulseaudio, pavucontrol and etc.

Test sound card

speaker-test -D plughw:0

Note: plughw:0 instead of hw:0 is used, as ALSA plug plugin helps to convert any format to a hardware supported format.

Record & Play

Record an audio with 16000 sample rate and single chanel and play it.

arecord -v -f S16_LE -r 16000 -c 1 -D plughw:0 mono_16k.wav
aplay -v -D plughw:0 mono_16k.wav

or directly pipe input to output:

arecord -f cd | aplay -v

Configure

Change the sound card's volumes

alsamixer -D hw:0

To support multiple applications to record and play simultaneously, try alsa dmix plugins. The used ALSA plugins in the configuration are asym, dmix, dsnoop and plug. Now you can use arecord and audacity to record at the some time. If you can't record or play, try to change the value of ipc_key to another value.

Clone this wiki locally