Read the statement by Michael Teeuw here.
Microphone advise for PI2 & voice control
-
@richland007 it definetly works. and why should it not? On the spur of the moment I can’t think of any pc connected device that works with only one software (well excluding some proprietary devices that work only with the company’s stuff).
However for example Mouse, Keyboard, speakers, microphone … all definetly work with multiple programs. The components are always connected to the OS, so any software running on that OS can generally ask it for the informations.
I mean if I wanted I could even split for example the cable of the microphone and connect t to two computers and it would work ^^
I never used Alexa Pi, since it is cloud based and I am no big fan of putting my stuff in the cloud, but usually when setting up voice recognitions, you tell which microphone to listen toAnd as an example where you use one muc for 2 programs: when you play video games with a voice chat program in the background and still use the ingame chat ;)
-
I cannot assure, but there could be a possibility of resource possession.
With my experience, Hotword catching program should always hold Mic on to listen the hotwords, so when 2 programs are trying to get a mic together, there would become fails.
I don’t know whetherAlexaPi
andMMM-Voice
are those kinds of program, But without proper pre-processor program for distributing and controlling mic, the two modules will be competing to obtain mic from each other. And with my guess, those two modules are not developed as that way.By Example, My modules -
MMM-Hotword
andMMM-AssistantMk2
both are using one mic together, but when one module is using a mic, the other should release it before. Both modules are made by me, so I can make both to work together. But I cannot thinkMMM-Voice
andAlexaPi
both could do the same thing. -
@Sean @richland007 yeah might be true did not test that ;)
Although I still have no clue why to use two in the first place. I mean when you decide to use Alexa Pi because privacy is no big deal for you then why use a different one for MM2 that might be a decent solution but definetly has it’s drawbacks. Can’t see much sence in taking the drawbacks of alexa in terms of privacy and then not even use the advantages :smiling_face_with_open_mouth_cold_sweat:
Whatever if you really want to have two different running with one mic you might want to consider doing it similar to @Sean by using a separate program running all the time catching the different hotwords, that call the two voice recognitions depending on the hotword -
@maxbachmann AlexaPi has no control over Magic Mirror… as far as i know… it is just an Amazon Alexa on a Rpi instead of an Echo (why should i buy an Echo for the bathroom when i have the mirror).
The only integration/connection to MM is that it displays the status of Listening, Answering etc. While the reason i want MMM-voice, is to “control” the Magic Mirror… hide modules, show modules etc etc.There is no consideration or worries as far as privacy, cloud or whatever … we all know how to live with NSA present at home one way or another…some time even with the much larger PLA … LMAO :grinning_face_with_smiling_eyes: :grinning_face_with_smiling_eyes: :grinning_face_with_smiling_eyes:
I have no idea what these other, separate programs for catching hotwords are … any pointers
D
-
@richland007 I thought you want to run two voice assistants from the same device given you want to use the same mic and the same pi right?
Because now it seems like you want to have alexa in other rooms and mmm-voice for the bathroom ;)
Yes for Alexa you would need to write a module that receives the messages and then just hides the modules accordingly. I am just not sure what exactly you want now.
(never used Alexa, but as far as I know they have some kind of skills aswell you can easily program. Then you just need to write a short module for MM2 that receives those messages and hides/shows the specific modules ;))
For catching wakewords a good offline recognition should be snowboy. Just give it two different hotwords and whenever one is recognised you can directly activate the SST (speech to text engine) of the corresponding voice recognition which for example in case of Sean would be MM-AssistantMk2. (Never used his voice recognition. MMM-Hotword should be a good start it uses snowboy so it should be easy to use it with two hotwords (but @Sean should be able to help you more with his code, since I neither use one of the snowboy/pocketsphinx nor any online voice recongition like alexa. My current offline voice system (currently implementing it to MM2) is snips.).Btw on the privacy side: yes the big bad NSA is everywhere, but I rather make it hard for them to get my data. When they have to attack my custom stuff at home thats absolutely possible, but still harder then them going to amazon/google and telling them to just give the data out. Second thing is companies like google/amazon I absolutely don’t want to know that private things about me. And we all know that although they claim to respect the privacy, your never sure especially since they already abused the trust before. And last but not least there are criminals that might try to abuse the data for example by catching the data while you want to transfer them to amazon/google or back. So while a offline solution might (as long as you give it internet) not be 100% secure and private, but still a lot more private than having them online. Just make getting your data harder then what they are worth for the attacker. Well enough on that guess thats a whole different topic and in the end it’s your choice anyways Lmao :rolling_on_the_floor_laughing:
-
PlayStation pseye works great.
4 mic array. And camera :-)
Works out of the box
Costs 8 eur -
@dvbit @maxbachmann I do not want to run anything any here else but at the same room at the same pi…i want to run alexa and MMM-voice thats it but they will not work with one mic …they need 2 mics to be configured somehow on the pi.
Hotword and Snowboy will not help me much but something like MMM-MirrorMirrorOnTheWall will but that is getting way to difficult to install for some reason…i am on my 3rd try
as far as the playstation mic goes i am sure that may be a good mic but i am not suffering from quality …does that act as 2 separate mics not as an array??
Denis -
@richland007 I am not familar with the ps eye (I know a couple people using it where it works way worse then the respeaker 2 mic hat the moment your not close to the mic, but I only saw the ps eye in action in a quite noisy environment once, which is definetly not the normal case at home)
I personally use the respeaker 4mic hat for the pi (25$) and the respeaker mic array v2 (70$)(pretty awesome but definetly overkill for you)
The 4 mic array always inputs with 4 separate channels the mic array v2 has two different firmwares one only outputs the processed audio channel the other one outputs the input of the 4 mics, the processed audio channel and the music you play with the array which gets used for the AEC)
The 2 mic hat (10$) is already quite good and I guess it just streams the 2 channels aswell.get the index
import pyaudio p = pyaudio.PyAudio() info = p.get_host_api_info_by_index(0) numdevices = info.get('deviceCount') for i in range(0, numdevices): if (p.get_device_info_by_host_api_device_index(0, i).get('maxInputChannels')) > 0: print "Input Device id ", i, " - ", p.get_device_info_by_host_api_device_index(0, i).get('name')
thats the output when executing
Input Device id 2 - ReSpeaker 4 Mic Array (UAC1.0): USB Audio (hw:1,0)
import pyaudio import wave RESPEAKER_RATE = 16000 RESPEAKER_CHANNELS = 6 # change base on firmwares, 1_channel_firmware.bin as 1 or 6_channels_firmware.bin as 6 RESPEAKER_WIDTH = 2 # run getDeviceInfo.py to get index RESPEAKER_INDEX = 2 # refer to input device id CHUNK = 1024 RECORD_SECONDS = 5 WAVE_OUTPUT_FILENAME = "output.wav" p = pyaudio.PyAudio() stream = p.open( rate=RESPEAKER_RATE, format=p.get_format_from_width(RESPEAKER_WIDTH), channels=RESPEAKER_CHANNELS, input=True, input_device_index=RESPEAKER_INDEX,) print("* recording") frames = [] for i in range(0, int(RESPEAKER_RATE / CHUNK * RECORD_SECONDS)): data = stream.read(CHUNK) frames.append(data) print("* done recording") stream.stop_stream() stream.close() p.terminate() wf = wave.open(WAVE_OUTPUT_FILENAME, 'wb') wf.setnchannels(RESPEAKER_CHANNELS) wf.setsampwidth(p.get_sample_size(p.get_format_from_width(RESPEAKER_WIDTH))) wf.setframerate(RESPEAKER_RATE) wf.writeframes(b''.join(frames)) wf.close()
Thats a code example of respeaker on how two get the channels in python with the mic array v2, but I guess it should work similar with other mic arrays
-
I got the info here
https://medium.com/snips-ai/benchmarking-microphone-arrays-respeaker-conexant-microsemi-acuedge-matrix-creator-minidsp-950de8876fda
And it works pretty well. -
Yeah i know that benchmark (using that speech recognition with my mirror already) :) (newer reapeakers not included there yet they definetly perform a lot better with background music as they use the xvf3000 resulting in them nearly completely removing the background music from any samples)
When I saw it it was used in a small robot with speech recognition and it absolutely failed with a distance over around 1 m, but it was on a hackathon so maybe it was just the background noise causing problems.
@dvbit it just sends all four channels to the pc aswell? or does it already create just one channel out of the four?