0

I have a Raspberry Pi 3 and trying to use a USB microphone in order to create a translator (i.e. https://daveconroy.com/how-to/turn-raspberry-pi-translator-speech-recognition-playback-60-languages/) as a class project. I've been running into a few problems (so I followed a couple of tutorials for guidance, but still hit road blocks), one of those problems being in trying to find a certain file "sudo nano usr/share/alsa/alsa.conf" and edit it in order to set my USB mic as the default sound card. Problem is, this file does not exist on my Raspberry Pi 3 (I get errors saying it doesn't exist, and if I create the file manually, it doesn't allow me to save it).

How can I get my USB microphone to work without having this file in the first place? Or am I just going a totally wrong way about this?

  • 1
    I just did a quick Google like this: https://www.google.com/search?q=raspberry+Pi+usb+microphone and there are a lot of sites offering information. I think what you are looking for is the alsamixer control, and there is another alternative called PulseAudio: https://raspberrypi.stackexchange.com/questions/639/how-to-get-pulseaudio-running Meanwhile, welcome to Raspberry Pi SE. Be sure to take the http://raspberryPi.stackexchange.com/Tour to get the most out of this site. – SDsolar Apr 07 '18 at 07:23
  • I've already tried a search on Google similar to that (I can tell by the abundance of purple-colored links I've clicked on already). Problem is, many of these links lead to tutorials that go on different tangents, so if I have roadblocks following one tutorial, going on another tutorial for help will just result in me having to start from square 1.

    I'd rather just have a concise tutorial here for my Pi 3 on how to get it to recognize my USB mic so that I can record audio on it and get it one step closer to using the Pi 3 as a speech-to-text Google Translator device.

    –  Apr 08 '18 at 01:53
  • You didn't mention whether you tried alsamixer or PulseAudio. Those usually work if the hardware is compatible. – SDsolar Apr 08 '18 at 05:35
  • PulseAudio is no longer in use on current raspbian distributions, which use Alsamixer @SDsolar . – Benjamin Ashbaugh Apr 08 '18 at 17:26

1 Answers1

2

Welcome to Stack Exchange!

it appears your problem is a simple spelling error. When you login to your rpi with the pi user, you land by default in the home directory, or /home/pi. And when you type commands on the command line, when you give a file location, such as usr/share/..., if you don't put a / in front, it appends that location on to the current directory. So when you type sudo nano usr/share/alsa/alsa.conf, what it is really trying too edit is /home/pi/usr/share/alsa/alsa.conf, which is not what you want. so redo the command, this time typing

sudo nano /usr/share/alsa/alsa.conf

and make sure you have the / in front of usr/share/....

Hope this helps!

Benjamin Ashbaugh
  • 1,077
  • 7
  • 17
  • Please feel free to let me know of any more problems you have! – Benjamin Ashbaugh Apr 07 '18 at 15:22
  • it is unclear why the OP is not be able to save the file .... it doesn't allow me to save it – jsotola Apr 07 '18 at 18:36
  • He's unable to save it because he either not using sudo to edit/create the file or tried to edit the file before creating it. – Benjamin Ashbaugh Apr 08 '18 at 17:25
  • 1
    Thank you! Adding the slash helped me access the file. However, I still have another roadblock. The Pi, for whatever reason, doesn't recognize my USB microphone. I've used "cat /proc/asound/cards" and "cat /proc/asound/modules", but I don't think I see anything related to my USB microphone. I'd post a picture but I can't find any option to do that here. This is the USB microphone I'm using: https://www.amazon.com/gp/product/B078SP1S92/ref=oh_aui_detailpage_o02_s01?ie=UTF8&psc=1 –  Apr 08 '18 at 20:16
  • It could be that the pi doesn't have the right drivers for that certain mic. However, the listing says "plug and play", so that means that it uses the default drivers and should work with the rpi. But, I think you are looking in the wrong place for microphone soundcards. try typing sudo arecord -l and see if it returns anything. Also, type lsusb and look in the results. this will list all the usb devices, and you can look for a device name that might be the mic.(it might be usb mic, it might be the brand name, or something else, on mine it's the brand name.) – Benjamin Ashbaugh Apr 08 '18 at 23:55
  • From using "lsusb" I managed to see my microphone. However, when I used "sudo arecord -l", only this message appeared: "**** List of CAPTURE Hardware Devices ****" but there was nothing shown under that. –  Apr 09 '18 at 01:59
  • try typing usb-devices. a whole list of all USB devices will pop up. look for your microphone listing. then look for a row in the listing that contains Driver=snd-usb-audio or something like that. if you find this line, that means that the rpi detects some kind of audio device.... – Benjamin Ashbaugh Apr 09 '18 at 14:37
  • Unfortunately, it says "Driver=(none)". However, the whole line itself mentions audio in it. The whole line says:

    "If#= 0 Alt= 0 #EPs= 0 Cls=01(audio) Sub=01 Prot=00 Driver=(none)"

    There is another line under it that is slightly different. It says:

    "If#= 1 Alt= 0 #EPs= 0 Cls=01(audio) Sub=02 Prot=00 Driver=(none)"

    –  Apr 09 '18 at 18:49
  • Hm. looks like you might need to install some more audio drivers, it looks like the pi doesn't recognize any on the mic. I don't know how you'd fix this, you'll probably have to search up how to install audio drivers raspberry pi or something like that... Maybe you should try plugging the mic into a pc or mac, to make sure it works. @PiNoob96 – Benjamin Ashbaugh Apr 10 '18 at 01:00
  • Plug and play means drivers for Windows (and in this case apparently Mac). i.e. there may be no drivers for it and linux. What is the output of lsusb? – Wilf Apr 10 '18 at 11:48
  • @Wilf , Rpi does have all the most common "plug and play" drivers for audio installed already, but it might not have this one... Look at the comment thread to see what his lsusb output was... his mic is showing up on lsusb and usb-devices but the driver isn't showing up on usb-devices. – Benjamin Ashbaugh Apr 10 '18 at 14:40
  • @PiNoob96 you can put your code/commands/errors/stuff in the grayed code font by putting backticks(in the upper left of most keyboards) in front of and after the text, like this: \lalala`` – Benjamin Ashbaugh Apr 10 '18 at 14:43
  • @scitronboy Was thinking more like lsusb output as in Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub - lsusb -t can shows drivers though Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 5000M though doesn't seem to go for some cameras. For more info on formatting click 'help' to the right or here. – Wilf Apr 11 '18 at 14:54
  • 1
    From following the tutorial @scitronboy linked to, I was able to see my usb mic, but it seemed to be listed with an error of some sort. When I try to use arecord -l I still run into the issue where it simply says "**** List of CAPTURE Hardware Devices ****" and nothing is below it. With all these issues, I'm deciding it's best to just try a different mic. Perhaps it's as @Wilf said that this mic just isn't compatible with my Pi's OS. May you guys please link any mics on Amazon that you know for sure will work with the Pi? –  Apr 12 '18 at 00:48
  • If you look for something that it is compatible with linux it should work, you should also be able to find ones that say they are compatible with Raspberry Pi https://www.adafruit.com/product/3367 (i.e. low power and work with the linux systems it usually uses. There is also a list of compatible sound cards here – Wilf Apr 12 '18 at 16:33
  • @PiNoob96 , try looking on the RPI verified peripherals page. It might help you. Also, what was the port error error you said you got? – Benjamin Ashbaugh Apr 12 '18 at 20:28
  • @scitronboy The error comes from when I type the command: sudo tail -f /var/log/messages as it says in the tutorial. The error I see is on a long line of code (I'll quote the most relevant part of the line): "snd-usb-audio: probe of 1-1.4:1.0 failed with error -16" –  Apr 16 '18 at 18:53
  • I will look into the link of the list of compatible Sound cards. I can just invest in a cheap headset w/ a mic since these sound cards only have jack ports on them. –  Apr 16 '18 at 18:57
  • @PiNoob96 see this , and also, you should try borrowing a mic from a friend just to test your raspbian distro. Most usb mics should work with raspbian. – Benjamin Ashbaugh Apr 17 '18 at 14:28
  • @scitronboy I've ordered one of the USB headphones on the list you linked. I will also test out the sound card I've also ordered with a pair of earbuds I have that comes with a mic built in. They should be arriving this Monday. I'll update you on whichever one ends up working. –  Apr 22 '18 at 08:11
  • My mistake, I meant I ordered one of the USB microphones on the list you linked me to-- not headphones. –  Apr 22 '18 at 09:49
  • @scitronboy After a little tinkering, the Blue Snowflake mic ended up being the thing that worked! Thank you so much for all the help! –  Apr 28 '18 at 00:36