mycroft-core
mycroft-core copied to clipboard
Add pause and resume capability to TTS playback thread
Description
This adds pause and resume functionality to the TTS playback thread for use in barge in.
From Ken:
Barge-In is not an issue for Precise, however, core has some issues. When a wave file is speaking the recognizer confuses the wav file for the mic. Ducking helps a bit with this but its more useful as an audible confirmation as the recognizer still favors this over the mic input. The proper solution is to pause the audio output until the recognizer has consumed the utterance.
The root problem arises from the tts module which does not use the audio service but it wants to act like one. It has start and stop method and a queue but no pause or resume. This PR corrects that. It also contains the code which uses this new functionality to help with the barge-in process.
Replication of #2939 against the dev branch so it doesn't get lost.
How to test
Unit tests need to be added.
Enable your barge-in config flag and use a long playing dialog skill like the new duck duck go or wiki skill (these return an abstract rather than a single sentence) and then say 'stop'. Without this PR this will not work 90% of the time.
Contributor license agreement signed?
- [x] CLA
Voight Kampff Integration Test Succeeded (Results)
Codecov Report
Merging #2940 (a50ad82) into dev (80f9eb0) will decrease coverage by
0.02%
. The diff coverage is50.00%
.
@@ Coverage Diff @@
## dev #2940 +/- ##
==========================================
- Coverage 52.64% 52.62% -0.03%
==========================================
Files 123 123
Lines 11021 11039 +18
==========================================
+ Hits 5802 5809 +7
- Misses 5219 5230 +11
Impacted Files | Coverage Δ | |
---|---|---|
mycroft/client/speech/__main__.py | 0.00% <0.00%> (ø) |
|
mycroft/tts/tts.py | 77.88% <46.15%> (-1.59%) |
:arrow_down: |
mycroft/audio/speech.py | 90.65% <71.42%> (-1.43%) |
:arrow_down: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 80f9eb0...a50ad82. Read the comment docs.