Commit Graph

125 Commits (0faa2a4451d64571f81874bc9cd27a256a436564)

Author SHA1 Message Date
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
Chris Veilleux d8f3095d40 Rename the message bus client and abstract config loading
Message bus config loading is now shared by service and client.

messagebus.client.ws file is still available in case skills are using it. It is a backport that inherits from the new MessageBusClient class. Adds depreciation warning.
2019-07-19 08:16:54 +02:00
Åke 0a67544ea4
Merge pull request #2168 from forslund/feature/update-pychromecast
Update pychromecast to 3.2.2
2019-06-26 10:34:55 +02:00
Åke Forslund 62b115e22c Update pychromecast to 3.2.2
pychromecast needed to be updated to fix pip package version conflict
when using streaming google STT.

Minor issues with startup of audio needed to be handled, mainly adding
explicit waits to ensure commands would be accepted
2019-06-20 08:59:27 +02:00
Åke Forslund 5211e51ec0 Remove requirement for seek_methods 2019-06-14 13:42:34 +02:00
Åke Forslund 39c844a257 Update old style metaclasses
the old "__metaclass__" has been ignored since the switch to python 3
this restores the metaclass functionality by updating it to the new
class kwarg syntax
2019-06-14 12:56:48 +02:00
Steve Penrod d80081d6b6 Remove unused subprocess module 2019-06-10 22:43:39 -05:00
Ruthvicp d2514b01be Remove additional space after initials 2019-05-16 17:27:51 -05:00
Åke Forslund 1400af2b16 Fix pycodestyle errors 2019-05-15 13:46:43 +02:00
Matthew D. Scholefield 8c09f88e53
Merge pull request #2088 from forslund/feature/audioservice-list
Feature/audioservice list
2019-04-19 00:30:38 -05:00
Steve Penrod dd976b6042 Fix bug with paused audio
The simple audio service can be paused.  The audio is "paused" but placing the
audio playback mechanism (usually aplay or mpg123) into the background, kinda
like hitting Ctrl+Z.  While in the background that process can no longer react
to the SIGTERM signal.  So paused audio has to be brought to the foreground
using SIGCONT, and _then_ sent SIGTERM.

Also added a belt to go with these suspenders and perform a process.kill() if
the audio process doesn't go away after 1 second.
2019-04-09 01:49:54 -05:00
Åke Forslund 9248be1691 Add list of available backends to audioservice
The message returned is a dict of all available audio backends as keys
containing 'supported_uris' listing supported uri types (file:// http://
etc.), 'remote' (bool) True if remote), 'default' (bool) true if the
default audio backend.
2019-04-08 15:28:56 +02:00
Åke Forslund 0d401c8757 Remove superfluous mycroft.stop handler removal 2019-04-08 15:13:34 +02:00
Åke Forslund 6186afd25f Remove the mimic_fallback_obj at shutdown 2019-03-28 11:15:45 +01:00
Ruthvicp ba305c5bfc separate the cache & avoid voice overlap
- The cache is now stored in a TTS specific directory
- Only a single fallback-tts is created
2019-03-28 10:40:02 +01:00
Åke 327511c937 Fix simple audio backend pausing by voice (#2045)
The restore_volume would previously unpause the service even if the user just asked for pausing playback.

This separates the paused flag from the pausing/resuming action so lowering/restoring volume doesn't affect the logical pausing state and can check it to determine if lowering/restoring is needed/wanted.
2019-03-08 02:24:58 -06:00
Steve Penrod dd25b76be6 Add pause/resume to simple audio services
This adds a very simple mechanism for pausing and resuming audio streams
that are actively playing.  The process is suspended and resumed when
requested.

This also uses that same method to implement lower_volume()/restore_volume() for simple "ducking" of audio.
2019-03-07 17:40:59 -06:00
Ruthvicp d3015ca7e8 Pause at semicolon (#1989)
Split at semicolon and speak each chunk of data, similar to a period.
2019-02-15 02:54:42 -06:00
Åke 8ff2ccc4fa
Merge pull request #1963 from forslund/feature/audioservice-prefer-local
Play on local audiobackends before trying remotes
2019-01-31 09:09:32 +01:00
Steve Penrod 01ea0afdeb
Minor edit of comments 2019-01-31 01:46:35 -06:00
Åke 0ae66c3f93 Bugfix/speech stop (#1961)
* Refactor mimic2 to use the shared tts architecture

* Make sure the queue is cleared

- Add a convenience method grouping clear_queue and clear_visemes
- The start time is now set before the lock to allow multiple speech requests queued before the stop signal to also be cancelled
- Make sure the any pending TTS generation is cleared from the queue by calling tts.clear() when breaking from the chunking loop.
2019-01-31 01:30:53 -06:00
Åke Forslund 5c26a5d9a5 Play on local audiobackends before trying remotes
- Adds RemoteAudioBackend class, which is used to differentiate between
Remotes and local audio backends
- When searching for audio backends the backends are storted to first
check local ones and secondly remote ones
2019-01-21 16:10:24 +01:00
jarbasal 15141528bd vlc audio length check 2019-01-12 13:10:54 +01:00
jarbasal 1c3543f5e5 Support for audio seek
The audioservice can now jump forward and backward in the audio stream/file

The functionality is accessed via the audioservice class's seek_forward(),
seek_backward() and seek() methods
2019-01-12 13:10:54 +01:00
Åke Forslund 38701a9790 Remove inheritance from object
Inheriting from object isn't necessary in python3.
2019-01-11 09:24:21 +01:00
Åke Forslund 8859ff1d3b Don't stop audio right after play start
The common play skill sends a stop message in the CPS_start(), if the play message is sent too close to the stop message it may be executed before the stop message causing playback to immediately stop.

To circumvent this a 1 second stop ignore time is added.
2018-11-15 13:57:17 +01:00
Michael Nguyen b22e9d975d fall back tts function for connection errors 2018-10-08 16:54:22 -05:00
Åke f091f44c85 Audioservice repeat (#1805)
* Add repeat option to audioservice

The audioservice.play() method now accepts a repeat parameter. If this
parameter is True the playlist passed to the audio service will be
repeated.

* Add repeat support to vlc

* Add the repeat parameter to all services

Not functional but playback will work at least. Hacktoberfest?
2018-09-24 15:12:12 -05:00
Åke 5c25af000c Fix chromecast audio backend (#1790) 2018-09-10 13:20:38 -05:00
Åke bd7cd7daee Bugfix/simple audioservice (#1774)
* Use correct method to guess mime type

* Use the commands from mycroft.conf

- Remove hardcoded commands and use the ones from mycroft.util to handle
configurations.
- Improve error handling
2018-08-29 14:25:53 -05:00
Steve Penrod 97138ae403 Address Python 3 changes 2018-08-28 12:41:59 -05:00
Åke Forslund c4afe7429a Rename emitter "bus" for consistency 2018-08-23 09:03:53 +02:00
Åke Forslund 7b4c6ed583 Audio service mimetypes
Add possibility for mimetypes to be passed with each track.
Make simple audio service try to detect mime type if missing
2018-08-23 08:41:01 +02:00
Josh Cox c57fcfe328 Add Simple audio backend
Uses simple command line tools to play audio. This replaces the mpg123 and the pogg123 backends.
2018-08-23 08:41:01 +02:00
Åke 64476eb143 Replace emitter/ws with bus (#1757)
Makes the code a bit more understandable
2018-08-21 20:50:50 -05:00
Åke Forslund 6fa17dbed3 Separate AudioService from main 2018-08-16 20:45:17 +02:00
Åke Forslund a66e23d8ab start processess using python -m
- rename process main.py to __main__.py
- update start-mycroft.sh/stop-mycroft.sh scripts to reflect the change
2018-08-16 15:21:22 +02:00
Åke 41fec03d80 Add retry limit for chromecast detection (#1729)
Limit the connection tries to 2 and lower the timeout to 5 seconds.
2018-08-15 03:44:24 -05:00
JarbasAI 65fcfcfcff remove isSpeaking signal on audio startup (#1721)
* remove isSpeaking signal on audio startup

* clean import
2018-08-14 22:07:59 -05:00
Josh Cox 2abb8fa74b Add Ogg123 support (#1678)
This is reimplementation of #1649 which became divergent.

## Description
Adds a Ogg123Service and a play_ogg exactly like Mpg123Service and play_mp3

## How to test
I have a skill for a podcast which does not have an mp3 feed:
https://github.com/joshuacox/skill-GNUworldOrder

## Contributor license agreement signed?
signed by @joshuacox
2018-07-26 22:25:39 -05:00
Michael Nguyen fb2a6209ee
Merge pull request #1506 from forslund/feature/vlc-update
Feature/vlc update
2018-07-18 11:28:33 -05:00
Åke 14349cfb25 Remove stray lock.release() (#1680)
This fixes a stray lock.release() causing a silent

RuntimeError: release unlocked lock

after TTS execution but just before reporting the timing for the TTS system.
2018-07-10 12:28:45 -05:00
Åke Forslund 0ae9ccda9a Make vlc ducking configurable 2018-07-10 11:21:33 +02:00
Åke Forslund 8f979df5b1 Reduce log level to debug 2018-07-10 11:21:33 +02:00
Åke Forslund 78dbdf1fb0 Restore volume when stopping playback 2018-07-10 11:20:41 +02:00
Åke Forslund bb2c727485 Add comments and basic docstrings 2018-07-10 11:19:54 +02:00
Åke Forslund 775c536de5 Fix vlc lowering volume while not playing. 2018-07-10 11:19:54 +02:00
Åke f8eb7587df Handle stop correctly in the audio service. (#1677)
* Handle stop correctly in the audio service.

This allows for example the news skill playback to be stopped without
the listening being triggered.

* Handle case where service stops at end of playlist

- Fix issue when receiving multiple stop signals
- Stop method of services now returns True or False depending on if audio was playing
2018-07-10 03:23:41 -05:00
Steve Penrod 17aab53fae Enhance the behavior of the Mark 1 button (#1668)
The Mark 1 button press can now be "consumed" when a skill handles
the Stop command.  When this happens, the button press will not
trigger listening mode.  An additional press would be needed to
trigger listening.

This introduces the "mycroft.stop.handled" messagebus message.  It
carries a data field called "by" which identifies who handled it.
Currently the values are "TTS" for when speaking ends or the name
of a skill which implements Stop and returns True from the call.

Also fixed a potential bug when the flag to clear queued visemes
was left set after a button press.
2018-07-05 20:56:54 +02:00