MycroftAI / mycroft-precise

A lightweight, simple-to-use, RNN wake word listener
Apache License 2.0
842 stars 227 forks source link

USB speaker Device unavailable error #48

Open dipendra77 opened 5 years ago

dipendra77 commented 5 years ago

I am trying to use mycroft based wakeup hotword to talk with google speech recognition api using the same mic simultaneously ? I am using a Respeaker 4 mic array v2.0 with a Raspberry Pi3.i Both applications (Google and mycroft ) are working fine independently. Seems like both the APIs cannot access the speaker input at one time.So I tried to access it through dsnoop but I need a method which i can call to retrieve the dsnoop device name. By default it is always fetching the default mic. I am getting this following error when i try to call some functions from the google speech recognition api.

with m as source: r.adjust_for_ambient_noise(source) (Pdb) n Expression 'ret' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 1736 Expression 'AlsaOpen( &alsaApi->baseHostApiRep, params, streamDir, &self->pcm )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 1904 Expression 'PaAlsaStreamComponent_Initialize( &self->capture, alsaApi, inParams, StreamDirection_In, NULL != callback )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2171 Expression 'PaAlsaStream_Initialize( stream, alsaHostApi, inputParameters, outputParameters, sampleRate, framesPerBuffer, callback, streamFlags, userData )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2840 OSError: [Errno -9985] Device unavailable

MatthewScholefield commented 5 years ago

Can you use one input stream for both tools? On Precise's end, you can use a ReadWriteStream instance passed as the stream= parameter to PreciseRunner to write raw audio data from the microphone into precise.

Let me know if you want more details on that. You can see roughly how to do that in the mycroft-core code.

Also, sorry for the late reply.

dipendra77 commented 5 years ago

I am sorry. I didn't quite understand what you are trying to say @MatthewScholefield