tastycrust
Posts: 50
Joined: Fri Feb 14, 2014 4:59 am

Troubleshooting USB mic issue ("no such file or directory" error)

Wed Feb 28, 2018 9:40 pm

I've never tried to use a microphone in Raspbian, so I'm sure that I'm just missing some obvious step here. I plugged in a USB mic to my RPi0W, and arecord sees that it exists:

Code: Select all

pi@leftEye:~ $ arecord -l
**** List of CAPTURE Hardware Devices ****
card 1: Device [USB PnP Sound Device], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

But when I try to record a test sound, it gives an error:

Code: Select all

pi@leftEye:~ $ arecord test.wav
arecord: main:788: audio open error: No such file or directory
pi@leftEye:~ $ sudo arecord test.wav
arecord: main:788: audio open error: No such file or directory

What are the steps to troubleshooting this issue? Does anyone have a suggestion for a guide to using USB audio devices just so I can learn the basics (i.e., where the config files are, what the typical configurations look like, how to access the device using python, etc.)? I tried using the googles, but nothing seemed particularly helpful in terms of a broad overview of the subject, it was mostly just other people troubleshooting particular problems that are different from my own problems.

subzerosoundman
Posts: 4
Joined: Wed Feb 28, 2018 4:56 pm

Re: Troubleshooting USB mic issue ("no such file or directory" error)

Wed Feb 28, 2018 10:39 pm

arecord -D sysdefault:CARD=1 test.wav

cat /proc/asound/cards (verify your card is there)

cat ~/.asoundrc (check for capture.pcm section)
( add your own pcm.XXX section)

amixer controls (get numid)
amixer cget numid=1 (check volume)
amixer cset numid=1 400 (or whatever the max is)

tastycrust
Posts: 50
Joined: Fri Feb 14, 2014 4:59 am

Re: Troubleshooting USB mic issue ("no such file or directory" error)

Wed Feb 28, 2018 11:11 pm

Thank you for that! Sure enough, the first example works. The card is listed in /proc/asound/cards, but there is no ~/.asoundrc or /etc/asound.conf file, though, so I created the latter and put this in it:

Code: Select all

pcm.!default {
        type hw
        card 1
}

ctl.!default {
        type hw
        card 1
}
I got that by tweaking what was suggested on this page. Now it works without the -D on the command line!

Thanks again for the help.

Return to “Graphics, sound and multimedia”