Commit Graph

173 Commits (5f4c68e5831e668f11dddc9a2d00bf11698f8c5b)

Author SHA1 Message Date
Åke e7ddd51256
TTS playback queue singleton (#3055)
* fix issues when remote excepts out

* Remove explicit clear_cache from MimicTTS

* Updates for using singleton TTS playback thread

- Cache is called on all tts's registered as using the thread
- Begin audio and end audio is handled by the playback thread
- Further changes from self.playback to TTS.playback for consistency

* Remove redundant try/except

* Consolidate general and TTS-specific sentence splitting

This performs all sentence-splitting at the same stage. This fixes a
subtle issue where a TTS splits a sentence into chunks and throws an
error on only one of those chunks. The fallback would generate a
sentence for the original un-chunked sentence. possibly saying the same
parts twice.

This also pre-compiles the regexes used to speed things up a bit.

Co-authored-by: Ken <ken.smith@mycroft.ai>
2022-03-02 09:59:57 +09:30
Kris Gesling df0b8fe212 Remove mplayer audioservice
It is no longer supported by the projects maintainer.
2022-02-28 14:43:10 +09:30
jarbasal 24c4ba4a05 Fix loading of audioservice plugins 2021-07-23 09:17:58 +02:00
Kris Gesling e75a05557b docstring cleanup 2021-05-11 15:10:32 +09:30
Chris Veilleux 4d4f797c5d Add the stack trace to an error message to help with debugging. 2021-03-10 13:39:58 -06:00
Åke Forslund 3ede156c98 Only stop speaking if speaking is active
This also updates the relevant testcase
2021-02-01 20:26:44 +01:00
Åke Forslund 96bbd384ad Add proper docstring 2021-02-01 20:26:44 +01:00
Åke Forslund e3e52d63a0 Remove filesystem signal for stopping speech
The filesystem signal has not been used for quite some time and should
not be used.
2021-02-01 20:26:44 +01:00
Kris Gesling f30adb85de
Merge pull request #2804 from forslund/bugfix/audioservice-issues
Bugfix/audioservice issues
2021-01-29 14:55:27 +09:30
Kris Gesling 1273425799 add ProcessStatus to key services 2021-01-28 17:24:21 +01:00
Åke Forslund aace28dfa3 Use lock around play and stop
Moves the stopping logic to separate method to be able to call from
locked contexts
2021-01-23 11:09:54 +01:00
Åke Forslund c00d37935a Simplify restore audio volume handler 2021-01-22 14:40:00 +01:00
Åke Forslund 8ce1615d75 Lock around tracklist access
Adds a lock and some logic to verify that the audio hasn't stopped
already.
2021-01-22 14:40:00 +01:00
Åke Forslund 375adbbdf0 Make audioservice load backends without callback 2021-01-15 13:49:40 +01:00
Kris Gesling ad32a7a873 move bus connect method to process_utils 2021-01-11 16:57:25 +09:30
Kris Gesling f3c76fac44 Audio service to use common bus client method 2021-01-11 16:57:25 +09:30
jarbasal 1338c4c949 no video 2021-01-04 22:36:36 +00:00
Kris Gesling 6f8bae6ba1
Merge pull request #2736 from forslund/docs/plugin-apis
Add Plugin base classes APIs to readthedocs
2020-12-03 20:33:59 +09:30
Kris Gesling b9c974bc1b
Merge pull request #2718 from forslund/bugfix/mimic-missing-exceptions
Handle Mimic missing properly
2020-11-16 14:40:14 +09:30
Åke Forslund 1ae6271051 Validate fallback TTS object
Verify that the fallback object can execute when creating it
2020-11-14 11:44:32 +01:00
Åke Forslund c747b0487a Improve docstrings for audio service backend classes 2020-11-04 08:03:03 +01:00
Åke Forslund d8ff26bbd9 Add plugin loading of audioservices
All modules registered under the entrypoint group "mycroft.plugin.audioservice"

These shall refer to a module with either an autodetect function or a
load_service function.
2020-09-23 07:46:13 +02:00
Åke Forslund 4e7809d732 Handle ntp sync in audioservice ready wait
Events (any python threading in general) don't use monotonic time and
can be affected by an ntp sync.

This replaces the normal event with the MonotonicEvent class handling jumps
into the future.
2020-09-10 13:26:25 +02:00
Åke Forslund d704981613 Set a more specific module name for audioservices
The basic name caused collisions between the "vlc" audioservice and the
vlc module. This prepends an "audioservice_" to the service folder name.
2020-08-28 07:59:06 +02:00
Åke Forslund ba8c41486c Load audioservices using importlib instead of imp
imp has been deprecated for quite some time
2020-08-21 08:00:08 +02:00
Åke Forslund 0a04efd88d Add system for checking audio service readiness
The new wait_for_loaded() method will wait until services has been
loaded. It has a 3 minute timeout (default)

This improves the audio service readiness indication to not trigger
until the services are loaded.
2020-07-24 22:12:54 +02:00
Åke Forslund 236a2ed594 Add hook for stopping 2020-07-22 11:06:47 +02:00
Åke Forslund 09b1deb511 Add possibility for notification hooks for services
- skills
- audio
- speech client
- messagebus service
- enclosure

The main functions now accepts the arguments ready_hook and error_hook
allowing a service or runner script to catch these states and perform
actions accordingly.

This is useful for things like systemd or a desktop launcher.

Fix audio service startup
2020-07-22 10:52:27 +02:00
Åke Forslund 2bb978362f Use bus.wait_for_message() method to wait for speak 2020-07-05 16:38:52 +02:00
Kris Gesling bf6e6af3e3 remove messagebus argument 2020-06-29 21:38:12 +09:30
Kris Gesling e39fe64ba4 minor cleanup for PR review 2020-06-29 14:30:39 +09:30
Kris Gesling c4478e82ad ensure volume restored after mic recording 2020-06-25 16:17:54 +09:30
Kris Gesling 4345011f7f prevent audio playing between mic record and handling 2020-06-19 15:27:48 +09:30
Åke Forslund b581766a00 Fallback to mimic for bad http status codes
Added a RemoteTTSException exception for non-timeout exceptions, Mimic2
will consider HTTP status code 200-299 as OK while other responses will
trigger raise RemoteTTSException.
2020-02-17 15:08:21 +01:00
jarbasal 0de7f11c6e execute TTS from debug_cli 2020-02-15 15:35:43 +01:00
Jarbas-Core d16964c580 bus message targetting 2020-02-15 12:37:25 +01:00
Åke Forslund 97ff8a4708 Send mycroft.audio.queue_end
The message is sent when there are no more tracks in the queue and
playback has stopped.
2020-01-15 11:13:00 +01:00
Åke Forslund 1b88ebe508 Fix tracks with mime data for VLC backend 2020-01-15 09:06:50 +01:00
Åke Forslund efb9cd1a01 Pass listen flag to fallback tts 2020-01-15 09:06:50 +01:00
Åke Forslund e74b0e3900 Add audioservice method tests
This includes init, shutdown, play, stop, next, previous, pause,
seek_backward, seek_forward, queue lower_volume, restore_volume and resume.
2020-01-15 09:06:50 +01:00
Åke Forslund 9a36639ec7 Clean up mycroft/audio/__init__.py 2020-01-15 09:06:50 +01:00
Åke Forslund 5e90465267 Improve guessing if http fetch fails.
If the server doesn't support getting the http head for the feed a 501
may be generated the guess_mime function will in turn fail if the url
ends with "?arg=x" or similar. This does an extra parsing step trying to
remove such arguments.
2019-11-19 16:34:13 +01:00
Åke Forslund f44165d35d Add exception handler if mime fails 2019-11-19 05:36:16 +01:00
Åke Forslund 6597ccc398 Send listen flag for special picroft case as well 2019-10-18 17:16:55 +02:00
Åke Forslund 29db163a78 Move listen trigger to last chunk of sentence
If rendering a chunk of a sentence takes too long time, the audio queue
may run out and trigger the listening.

This moves the listening trigger to after the last chunk.
2019-10-04 15:09:45 +02:00
Åke Forslund b480dda90f Clean up docstrings
Minor cleanup of docstrings in the files affected by the previous commit
2019-10-03 19:13:02 +02:00
Åke Forslund 46b0b94631 Don't go through FS when triggering listener.
This adds a separate handler for triggering listening on the
"mycroft.mic.listen" message
2019-10-03 19:12:56 +02:00
Åke Forslund 3fea4b1e6f Remove old manual pulse ducking 2019-08-31 14:27:06 +02:00
Chris Veilleux 0bde1bc9df Refactor skill service (#2220)
Major refactoring of the skills startup sequence
- Restructure to a less nested structure
- Remove usage of globals by wrapping a lot of state variables into a class this allows for things like caching a negative pairing status throughout the startup process
2019-07-26 08:53:27 +02:00
David Wagner ed6324d83b
tts_hash to an actual hash
tts_hash was initially set to the text of the config rather than hash so always loaded twice on boot (~750ms for create() for Mimic2)
2019-07-23 15:31:21 -05:00