The content on this page is hardware-dependent. Please select from the following:
Find your recording and playback devices.
Locate your USB microphone in the list of capture hardware devices. Write down the card number and device number.
arecord -l
Locate your speaker in the list of playback hardware devices. Write down the card number and device number. Note that the 3.5mm-jack is typically labeled
Analog
orbcm2835 ALSA
(notbcm2835 IEC958/HDMI
).aplay -l
Create a new file named
.asoundrc
in the home directory (/home/pi
). Make sure it has the right slave definitions for microphone and speaker; use the configuration below but replace<card number>
and<device number>
with the numbers you wrote down in the previous step. Do this for bothpcm.mic
andpcm.speaker
.pcm.!default { type asym capture.pcm "mic" playback.pcm "speaker" } pcm.mic { type plug slave { pcm "hw:<card number>,<device number>" } } pcm.speaker { type plug slave { pcm "hw:<card number>,<device number>" } }
Verify that recording and playback work:
Adjust the playback volume.
alsamixer
Press the up arrow key to set the playback volume level to around 70.
Play a test sound (this will be a person speaking). Press Ctrl+C when done. If you don't hear anything when you run this, check your speaker connection.
speaker-test -t wav
Record a short audio clip.
arecord --format=S16_LE --duration=5 --rate=16000 --file-type=raw out.raw
Check the recording by replaying it. If you don't hear anything, you may need to check the recording volume in
alsamixer
.aplay --format=S16_LE --rate=16000 out.raw
If recording and playback are working, then you are done configuring audio. If not, check that the microphone and speaker are properly connected. If this is not the issue, then try a different microphone or speaker.
Note that if you have both an HDMI monitor and a 3.5mm jack speaker connected, you can play audio out of either one. Run the following command:
sudo raspi-config
Go to Advanced options > Audio and select the desired output device.