how to create an audio buffer to access mic input few seconds ago

285 Views Asked by At

i am trying to create a voice recognition function that can be activate with a hotword. i found this snowboy package that can create a hotword listener that can listen full time and run a certain task on activation.

my problem i need to run a voice authentication function upon the hotword detection. assume my hotword is "hello" and the input need for my voice authentication is "hello, please open the door". but if i start recording after the hotword is detected i need to repeat the word hello. how can i get the full "hello, please open the door" recording without repeating it.

is there a way that snowboy can output the short audio file "hello" that it used to activate, if so then i can just combine them.

if now can i create a audio buffer that will hold the last 10 seconds of mics data all the time without slowing effecting the cpu much. at the same time this need to share the mic with the snowboy too.

this is my idea, but i dont know know how to implement this. please tell me how i can do this or any other i can get the full recording.

feel free to edit the question is some place is not clear.

thank you!!

1

There are 1 best solutions below

1
On

Yes. Upon detection, Snowboy is defaulted to play a "ding" wave file found in the resources folder. You can edit snowboydecoder.HotwordDetector function to play another sound file instead of the ding (you may need a rough understanding of the language it's compiled in). You may download a custom wave file to play here, or use a various list of free TTS APIs on the internet to produce a "robotic sounding" custom message, saved to your computer. I will follow with detailed explanation if needed