Using WAV file as snips INPUT

Hello! I have an example of Snips working nicely on my MacOS with python code to monitor MQTT traffic and retrieve the results. I’ve been trying to find a way to use a WAV file (“hey snips…tell me the sum of 1 and 2”) as the INPUT to snips. I was hoping that I could somehow inject/pipe the WAV file into the snips-audio-server, in lieu of microphone input, and have the audio server do its thing with MQTT–but I’m not seeing anything relevant in these forums. Any pointers?

This is for testing, by the way. I want to preprocess an audio file in different ways, feed the results to snips, and see the results to gauge the confidence scores.

thanks.

Update: I found this project:

https://github.com/Romkabouter/Matrix-Voice-ESP32-MQTT-Audio-Streamer

where the author apparently reimplemented the snips-audio-server to handle a WAV file. I’m hoping to avoid reimplementing the server, if possible.

Still looking for tips, pointers, any help…

1 Like

With linux you could use a loopback device to create a virtual mic that “records” whatever you play to the corresponding output device. I’d assume there’s something similar for OSX.

Thanks, StefanFabian.

SoundFlower for MacOS may do what you’re suggesting.

I also came across this:

https://github.com/KillingJacky/snips_tests/blob/master/snips_asr_test_with_file.sh

which appears to tell snips-audio-server to use a network port instead of a mic
(–nomike --hijack) and netcat to pipe audio data into the port. I haven’t tried it yet.

I’m surprised that this functionality isn’t easily accessible to developers. It seems obvious that when testing snips, you’d want to script something with canned audio files instead of muttering “hey snips” into a microphone all day.

1 Like