Analog Speaker and USB Mic combined for Voice control



  • Hi guys, I have been trying to solve the following problem for 2 days now and I just can’t seem to find a solution.

    I’m trying create a voice control with voice output as reaction and therefore I need microphone and speakers. My speaker is analog and connected to the normal integrated soundcard (3.5mm jack) and for voice input a USB microphone.

    Only the audio device defined as card 0 will work, which means if I configure the speaker as card 0 i can hear voice output when i run the script manually but can’t talk to my raspi. When I set the USB microphone as card 0 I can’t hear anything and get an error because no audio devices can be found to output to but it recognizes my speech input.

    The software I’m using is hardly configurable. It is pyvona as a text to speech tool in a .py script and the MagicMirror module for voicecontrol using snowboy hotword detection: https://forum.magicmirror.builders/topic/425/voicecontrol-module

    Does anyone know a way of combing the 2 audio cards into one that has input and output respectively or has an idea how to configure either python to output to card 1 or the snowboy module on the MagicMirror to use card 1 as input?

    I already tried many of the solutions to combine 2 outputs in ALSA but I can’t seem to get it configured properly (I’m also quite new to this and am just throwing some things randomly together expecting other things to work)

    Thanks a lot in advance for any help!



  • @DevilRev as the PyAudio documentation says, that you can add input_device_index into the configuration https://people.csail.mit.edu/hubert/pyaudio/docs/#pyaudio.Stream.init

    I would give this a shot and add it to line 115 in voicecontrol/snowboy/snowboydecoder.py



  • @strawberry-3.141
    Hi, at first thanks for taking the time and thanks for you help it sounds like a promising solution but I still don’t seem to get this working.

    I used p.get_device_info_by_index() to find out the index of my USB microphone, which is 2, and added input_device_index=2 to the snowboydecoder file BUT it still seems to somehow use the onboard audio card 0 and I have no idea why or what I did wrong.

    I uploaded the error shown when launching the magic mirror to pastebin maybe it can help you help me, I really want to solve this!
    http://pastebin.com/R1n3TmbP

    Also my snowboydecoder config file on pastebin: http://pastebin.com/U0yh4X1f
    maybe I added it at the wrong place but I was thinking this is the right place for it and didn’t know what to do with line 115.

    I really hope you can help me, thanks!


Log in to reply
 

Looks like your connection to MagicMirror Forum was lost, please wait while we try to reconnect.