TL;DR: I want to create a virtual mic on my pi to stream wav data to it from a named pipe, so apps that look for input from a mic instead of a file can receive it.
I'm running pocketsphinx_continuous on my pi, with really good results. I am using the
-infile option to read from pre-recorded wav files that I receive from Telegram as voice messages (after converting them from ogg format, etc). So far so good.
pocketsphinx_continuous runs only once when using the
-infile option (ie. it starts, recognizes the speech from the wav file, and execution ends). In oposition to this, when
pocketsphinx_continuous is run with the
-inmic yes option to recognize voice from a mic, it runs forever in an infinite loop, detecting silences to start the recognition and loop to a stand-by state again (see the code here if you are interested).
The situation explained above causes the recognition with
-infile to take considerably more time because every execution needs to initialize pocketsphinx again (parse jsgf grammar or language model, etc), while the
-inmic option leaves it running and initializes it only once.
I want to use the
inmic mode of
pocketsphinx_continuous, that will only initialize once and run forever, but simulate the mic in the pi as a pipe or file, and cat the wav files to it (thus, simulating how audio is received from this mic)
I've found many questions around this subject but none seem to be exactly for this case. Some are for ubuntu, not raspbian, some need only to simulate a "dummy" mic but don't need for it to actually work, some use desktop apps like Audacity and so on, some don't have an accepted answer, etc. Some examples are:
So, how can I create a virtual mic that actually works, that takes its input from a named pipe, so I can stream (cat?) an existing .wav file to it, and would be recognized as input from a mic in an application (such as pocketsphinx).