How to use the usb microphone from the pimoroni store?


#1

Hello,
I am trying to set up the pocketsphinx on an old raspberry pi 2.
I’ve got bluetooth and wifi all added with dongles. I’ve added the speaker phat for sound and have the £5 mic from the store.

I’m following this tutorial and have got to the bit just after “testing the speech recognition”. This is where I am unable to initiate the usb.
Granted I haven’t followed it completely from beginning to end, I skipped the part about the asla sound system and have gone back to it. I’ve followed it and some other guides that list the usb’s.

I guess my question is how to choose the usb microphone as the audio input device from the list.
If you need some code snippets, I’ll post them.

Thankyou

Creatoroblivion


#2

http://forums.pimoroni.com/t/audio-in/2354/4
I also followed sandy’s bit of advice here and had a look. I couldn’t figure out which usb socket was the microphone.

bus 001 device 006: ID Obda:8176 Realtek Semiconductor Corp. RTL8188CUS 802.11n WLAN Adapter
bus 001 device 005: ID Oa12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
bus 001 device 004: ID 8086:0808 Intel Corp.
bus 001 device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
bus 001 device 002: ID 0424:9514 Standard Microsystems Corp.
bus 001 device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

So far I’ve figured out the obvious ones, 006 is wifi, 005 is bluetooth, 003 is the ethernet, 002 is the empty usb port.

However I don’t know which one would allude to the microphone from pimoroni…

Actually, I figured it out, it was the Intel Corp. one, I did this by taking usb out and checking the usb list then finding the missing one.

I’ll test out the rest and hopefully anyone trying to do the same as me, can see this post and be helped.


#3

update:
I’ve been able to get the usb ro record some audio,
when I run the command below,

pocketsphinx_continuous -inmic yes

I get a message saying;
“Available sampling rate 44100 is too far from requested 16000
FATAL: “continuous.c”, line 239: Failed to open audio device”


#4

That’s odd. Mine appears as “C-Media Electronics, Inc. CM108 Audio Controller” in lsub.

It should just pop up in the “Raspberry Pi > Preferences > Audio Device Settings” as a “USB PnP Sound Device” that you can control in the “Capture” tab.

To record, I would use arecord -D plughw:1 -f cd /tmp/recording.wav.

I’m not familiar with Pocketsphinx, so it’s hard to tell what it’s doing behind the scenes to the audio config. The error suggests that the sample rate set for the microphone is incorrect.


#5

Is it an up-to-date version of Raspbian that you’re using?


#6

Thank you, I’ll take a look at this when I get back from work.

I’m using the noobs sd that was purchased from the store, sudo updated and upgraded


#7

this comes up as
bash: lsub: command not found edit: I realised this was only missing an s and is actually lsusb

this has come up with

arecord: main:722: audio open error: No such file or directory edit: after changing a few different things and changing over to a different audio adapter one with two ports, one for a microphone and one for a set of headphones. I have don’t this recording and it works, the audio is clear, (however, I am sad that I have been unable to use the usb microphone from the store.)

With this bit, I’ve had a look here but for me it just shows a dial and a button box that changes colour from grey to red with a slider dial above it. I don’t really know what this does at all.
Again, thank you for the help.

Edit, in the aslamixer it shows a name similar to what you said before, but it doesn’t show this name with lsusb

Edit 2: I have just found that, probably though my own tinkering in trying to get pocketsphinx to work, I have deactivated the speakerphats VU meter.
Could it be that the two programmes are trying to use the same something or other? It seems that I can only have the usb mic OR the speaker phat as the default sound device.

Edit 3: I have also found that I don’t have a /etc/modprobe.d/alsa-base.conf file


#8

http://stackoverflow.com/questions/35867490/fatal-error-continuous-c-line-246-failed-to-open-audio-device

Above I’ve been able to get the continuous.c working, however the problem remains with the ability to get the sound in from the usb and the sound out through the speakerphat. :)


#9

On the speakerphats page, it says to purchase a mic with it, so you can create something like amazon echo. is there any tutorial on this please?


#10

not to my knowledge, but I’m sure @sandyjmacdonald would be happy to add it to the list of “stuff to get round doing when time permits!”


#11

If I figure it out before that happens, I’ll add it to here and I don’t mind you guys using it on the website. If you approve of how I do it and such… Or you can even edit it or whatever :)