Skip to content

Onnesok/raspberrypi_mic_speaker_fix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Raspberry pi microphone and sound problem fixed

Facebook URL Youtube URL Instagram URL Pinterest URL

In freshly installed raspbian os sometimes we need to specify cards to work with microphone. Sometimes it may require to create .asoundrc file to specify speaker and microphone card seperately

update and upgrade your pi

sudo apt update -y
sudo apt upgrade -y

Now find device ids.

For speakers type

aplay -l 

Output

**** List of PLAYBACK Hardware Devices ****
card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
  Subdevices: 7/7
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
  Subdevice #4: subdevice #4
  Subdevice #5: subdevice #5
  Subdevice #6: subdevice #6
card 0: ALSA [bcm2835 ALSA], device 1: bcm2835 IEC958/HDMI [bcm2835 IEC958/HDMI]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: Microphone [USB Microphone], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
  

Based on the above output we have three devices:

The onboard 3.5mm plug listed as BCM2835 ALSA: Card 0, Device 0 (“hw:0,0”) The onboard HDMI connection listed as bcm2835 IEC958/HDMI: Card 0, Device 1 (“hw:0,1”) The USB microphone listed as USB Audio: : Card 1, Device 0 (“hw:1,0”) In this example we want to use the 3.5mm audio jack, so we’ll use Card 0, Device 0 as the way to locate our speaker device. The USB microphone doesn’t have audio output and is not valid as a speaker setting. It is listed however, which can cause confusion.

Now for microphone

arecord -l

Output


**** List of CAPTURE Hardware Devices ****
card 1: Microphone [USB Microphone], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0

Based on the output usb microphone is there as Card 1 and Device 0 (“hw:1,0”)

Now let's change or create file to fix that

sudo nano home/pi/.asoundrc

now use the given code in repository and you're done

Test if it works

Record


arecord -f S16_LE -r 48000 onnesok.wav

play

aplay onnesok.wav

ok fixed


About

Raspberry pi mic fix instructions.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages