mimic1
mimic1 copied to clipboard
Streaming with Portaudio on osX
The streaming when running with -o stream seems broken, I'm building on osX and linking to PortAudio, the equivalent code using flite works fine, but I saw they did not use PortAudio so it might be due to that
It sounds a bit like the call to PortAudio is blocking in the same thread, and blocks the processing of the next chunk, are we supposed to create a audio thread when using PortAudio, and why is this not needed when using the streaming_info from original flite ?
Thanks for the bug report and sorry for the late reply.
The PortAudio streaming functionality is not working (with -o stream), because I did not test that feature when I wrote the audio module. Sorry about that. Long story short I used the callback approach instead of the read/write method (both described in the
PortAudio documentation).
While rewriting the PortAudio module in mimic is not very time consuming or difficult, the testing can take a while, so it may take a while for me to find time to implement the solution. Pull requests are welcome, though.
The steps I believe would work (in case you want to give it a try) are:
- Open src/audio/au_portaudio.c
- Set
pa_callbacktoNULLanddatatoNULLin the Pa_OpenStream call. Remove the (now unused)datavariable and remove as well thepa_callbackstatic function from the beginning of the file. - Move the
Pa_OpenStreamand thePa_StartStreamcalls fromaudio_write_portaudioto the end ofaudio_open_portaudio. - Move the
Pa_StopStreamcall toaudio_flush_portaudio. Move thePa_CloseStreamcall to the beginning ofaudio_close_portaudio. - The
audio_write_portaudioshould be almost empty, the while loop has to be replaced with a singlePa_WriteStreamcall. - Test with
-o streamand without.
In the end I did it. It needs testing though. On my Linux system it works well.
Would you mind testing on your mac?
git clone https://github.com/MycroftAI/mimic
cd mimic
git checkout fix_portaudio_streaming
./configure --with-audio=portaudio --disable-vid_gb_ap
make # or make -j4 if you prefer
./mimic -voice slt -o stream doc/alice
# Press ctrl+c to cancel the streaming
./mimic -voice slt doc/alice
# Press ctrl+c to cancel
Thank you