Commit Graph

173 Commits (5f4c68e5831e668f11dddc9a2d00bf11698f8c5b)

Author SHA1 Message Date
Matthew D. Scholefield ac26131b71 Fix SSML when tag spans multiple sentences
Now, sentence splitting is disabled if the utterance contains any xml tags
2018-04-18 14:45:09 -05:00
Matthew D. Scholefield cbf73d4b30 SSML Changes
- Engines now specify if they support ssml rather than the configuration
 - The text client strips out ssml tags
 - Engines can modify tags via the `self.modify_tag` method
2018-04-18 14:45:09 -05:00
Jarbas 7c6af2017c add SSML support 2018-04-18 14:45:09 -05:00
Matthew D. Scholefield 10bd9a1cf3 Change initial kill to SIGINT
This sends a ctrl+c signal to each process which will allow code to exit properly by handling KeyboardInterrupt
Other notable changes:
 - create_daemon method used to clean up create daemon threads
 - create_echo_function used to reduce code duplication with messagebus
 echo functions
 - wait_for_exit_signal used to wait for ctrl+c (SIGINT)
 - reset_sigint_handler used to ensure SIGINT will raise KeyboardInterrupt
2018-04-11 21:29:10 -05:00
Åke Forslund 2e0a622447 Log exception and exception message 2018-03-28 15:38:14 -05:00
Åke Forslund 26d6e674df Reduce audio service logging verbosity
- Duplicates removed
- Many debugging messages reduced to debug level
2018-03-28 15:38:14 -05:00
jarbasai 24d022d00a active flag 2018-03-27 18:08:49 +02:00
jarbasai 5905a6460b Add mplayer audio backend 2018-03-27 18:08:32 +02:00
jarbasai 8d277747a9 honor "active" flag for audio backends
The backends are active by default, but can be enforced or disabled with
the active flag.
2018-03-22 04:44:56 +01:00
jarbasai 6fefac1c88 add stop 2018-03-22 04:17:33 +01:00
jarbasai 7b4a3b49ed clean shutdown 2018-03-22 04:17:24 +01:00
jarbasai a865930fd7 fix previous 2018-03-17 16:23:21 +00:00
Åke 50b05ae6b4
Merge pull request #1446 from MycroftAI/refactor/exceptions
Remove redundant except (SystemExit, KeyboardInterrupt) clauses
2018-02-27 23:08:27 +01:00
Matthew D. Scholefield 98eaa83db8 Fix audio service loading
If service_module failed to load, it shouldn't continue loading it
2018-02-27 14:37:37 -06:00
Matthew D. Scholefield fbb9231adc Remove redundant except (SystemExit, KeyboardInterrupt) clauses
This can be replaced by ensuring the final except clause is 'except Exceptions'. This works because SystemExit and KeyboardInterrupt do not inherit from the base 'Exception' class
2018-02-27 14:28:29 -06:00
penrods c68ad44b1c Internal documentation, typos, remove misleading message
* Made MycroftSkill.remove_event() return a bool, preventing unnecessary/misleading message from being posted by MycroftSkill.cancel_scheduled_event()
* More doc and several minor renames around intent processing
* Several minor typo and doc corrections
2018-02-13 02:54:12 -06:00
Augusto Monteiro dd0012c2a1
Merge pull request #1367 from forslund/feature/track-start-message
Add message on track start
2018-02-07 12:56:05 -03:00
Åke f0e695bbc4 Feature/metrics classes (#1393)
* Report type of TTS when reporting tts metrics

* Report type of STT when reporting stt metrics
2018-02-01 02:35:27 -06:00
Åke Forslund 12da2070b2 Add message on track start
====  Tech Notes ====
When a new track starts playing the audio service will send a message
indicating which track has started.

==== Protocol Notes ====
"mycroft.audio.service.track_start" message added
2018-01-17 15:15:23 +01:00
Åke Forslund 936bd54180 Add a function to build the standard timing report 2018-01-08 18:01:03 -06:00
Åke Forslund c1d3342fc6 Add playback timing reports in playback thread
This covers the default case with mimic and in the future more as they
are moved over to using the playback thread
2018-01-08 18:01:03 -06:00
Åke Forslund fe3b85c755 Add tts into the flow by digging throug the stack
The speak method digs through the stack trying to find a Message object
and if found uses the context from that message when sending the data to
the speech subsystem.
2018-01-08 18:01:03 -06:00
Åke Forslund baa15b98aa Send timing metrics for various subsystems
====  Tech Notes ====
STT, intent handling, intent fallbacks, skill handlers are now timed and
tied together with a ident (consistent through the chain so the flow from
STT until completion of the skill handler can be follewed.

TTS execution time is also measured, right now this is not tied into the
ident due to the nature of the speech.

The report is always called "timing" and always contain the following
fields:

- id: Identifier grouping the metrics into interactions
- system: Which part (STT, intent service, skill handler, etc)
- start_time: timestamp for when the action started
- time: how long it took to execute the action

The different system adds their own specific information, for example
the intent_service adds the intent_type, i.e. which handler was matched.

==== Protocol Notes ====
mycroft.skills.loaded is sent togheter with skill id and skill name
whenever a skill is loaded. This is used in the intent_service to
convert from id to skill name when reporting
2018-01-08 18:01:03 -06:00
Åke 742558046d Python 2/3 compatibility (#1259)
Add Python 2/3 compatibility

====  Tech Notes ====
This allows the main bus, skills and cli to be run in both python 2.7 and
3.5+.

Mainly trivial changes
- syntax for exceptions
- logic for importing correct Queue module
- .iteritems -> future.utils.iteritems when accessing dicts key value
pairs

* Allow audio service to be run in python 3
* Make speech client work with python 3
* Importing of Queue version dependent
* Exception syntax corrected
* Creating sound buffer is version dependant
- Adapt context use range from builtins
- Use compatible next() instead of .next() when walking the skill
directory

* Make CLI Python 3 Compatible
- Use compatible BytesIO instead of StringsIO
- Open files as text instead of binary
- Make sure integer divisions are used

* Make messagebus send compatible
* Fix failing travis

Re-add future 0.16.0

* Make string checks compatible
* basestring doesn't exist in python 3 so it's imported from the "past"
* Fix latest compatibility issues in speech client
- handle urllib
- handle encoding before calling md5

* Make Api.build_json() python 2/3 compatible
2017-12-18 17:24:21 -06:00
Åke Forslund 41f8c1dcae Move comment regarding to isSpeaking to tts 2017-12-07 15:56:10 -06:00
Åke Forslund d3ecb20e0c Fix bare except, as pointed out by pep8 bot 2017-12-07 15:56:10 -06:00
Åke Forslund 9ed40010fa Fix lock around speech.
the lock could be taken by a waiting thread between sentences in a multi-sentenced utterance. This locking method will allow the entire utterance to be synthezised before handling next.
2017-12-07 15:56:10 -06:00
Åke 799ff1d231
Merge pull request #1248 from MycroftAI/feature/min-wait-time
Increase min wait time in wait_while_speaking()
2017-11-22 20:33:21 +01:00
Michael Nguyen 4c6b57c5c5
Merge pull request #1197 from forslund/feature/audioservice-update
Feature/audioservice update
2017-11-22 13:27:15 -06:00
penrods 55b3f20bf3 Increase min wait time in wait_while_speaking()
In code like this:
   self.speak_dialog("something")
   mycroft.audio.wait_while_speaking()
It was possible that the speaking of "something" would take longer to
start than the 0.1 seconds that was built into the wait_while_speaking().
The definition of this behavior is slightly fuzzy, but this is definitely
a case where the expectation is that previous request for speech would
start and complete.  For now, I have just bumped the minimum wait to
0.3 seconds.

In the long run we might consider tracking specific speak requests and
generating a notification when that request has been serviced.  Then the
skill could automatically hold off until that request has been serviced.
But the basic skill code won't have to change to make this happen, so
this additional sleep is adequate for today.

Also snuck in a minor change to a comment.
2017-11-22 13:21:23 -06:00
penrods 6463b9a92d Add 'mycroft.mic.listen' messagebus command
Add support for 'mycroft.mic.listen' on the messagebus to trigger the system
to listen for STT processing.  This can be posted on the messagebus by outside
systems, such as a physical or GUI Listen button.
2017-11-21 22:45:12 -06:00
Åke Forslund bfa26e6916 Fix issues reported by codacy 2017-11-10 10:24:59 +01:00
Åke Forslund 8527074ee3 Refactor audio service
====  Tech Notes ====
- Encapsulate the audio service into a class to reduce the number of
global variable.
- Remove redundant code
2017-11-10 10:24:59 +01:00
Åke Forslund 441436adbf Add queue command to audio service
==== Tech Notes ====
queue command will start playback if no playback is running.
mpg123 and vlc services updated support queueing tracks while playing

==== Protocol Notes ====
mycroft.audio.service.queue message added
2017-11-10 10:24:59 +01:00
Åke Forslund 574d66802c Minor cleanup.
- Remove print statements
- Fix syntax error
2017-10-27 17:39:28 -05:00
Åke Forslund c328bacf5f Quit current app before starting new playback
====  Tech Notes ====
Before the current chromecast application was quit when mycroft was started which caused some interference. Now the current app is quit right before starting playback on the device instead.
2017-10-27 17:39:28 -05:00
Åke Forslund 3e878bd59f Replace ConfigurationManger with Configuration 2017-10-26 19:02:32 -04:00
Åke Forslund 45af24db54 Only stop speech is there's any
==== Fixed Issues ====
If stop speech happened while no speaking was happening the following
utterance was lost.
2017-10-26 18:48:47 -04:00
Åke Forslund 7814e207d3 Fix sending message in stop_speaking()
====  Tech Notes ====
Previous approach did not work as websocket client was not running, this
uses the standalone send functionality recently added to send a single
message.
2017-10-26 18:48:47 -04:00
Rhett Aultman ad0b637856 Add https support to audio service
The audio service could not handle https URLs.  VLC can support them,
so https was added to its supported_uris.  Additionally, the play( )
function in the audio service could not actually correctly search the
backends for a supported uri, so the code there has been fixed
2017-10-18 11:39:18 -04:00
Åke Forslund a5b96ba285 Correct stop_speaking() to handle threaded tts OK
====  Tech Notes ====
Now the stop_speaking() method sends a signal to the speech module to
stop speech instead of killing all aplay/paplay instances
2017-10-10 14:02:18 -05:00
Åke Forslund 0daee0eb53 Fix bug in stop_speaking()
====  Tech Notes ====
stop_speaking would not run properly due to two missing imports
2017-10-10 14:02:18 -05:00
penrods 8f2e5d9498 Change to Apache 2.0 license from GPLv3.0
This commit officially switches the mycroft-core repository from
GPLv3.0 licensing to Apache 2.0.  All dependencies on GPL'ed code
have been removed and we have contacted all previous contributors
with still-existing code in the repository to agree to this change.

Going forward, all contributors will sign a Contributor License
Agreement (CLA) by visiting https://mycroft.ai/cla, then they will
be included in the Mycroft Project's overall Contributor list,
found at: https://github.com/MycroftAI/contributors.  This cleanly
protects the project, the contributor and all who use the technology
to build upon.

Futher discussion can be found at this blog post:
https://mycroft.ai/blog/right-license/

This commit also removes all __author__="" from the code.  These
lines are painful to maintain and the etiquette surrounding their
maintainence is unclear.  Do you remove a name from the list if the
last line of code the wrote gets replaced?  Etc.  Now all
contributors are publicly acknowledged in the aforementioned repo,
and actual authorship is maintained by Github in a much more
effective and elegant way!

Finally, a few references to "Mycroft AI" were changed to the correct
legal entity name "Mycroft AI Inc."

==== Fixed Issues ====
#403 Update License.md and file headers to Apache 2.0
#400 Update LICENSE.md

====  Documentation Notes ====
Deprecated the ScheduledSkill and ScheduledCRUDSkill classes.
These capabilities have been superceded by the more flexible MycroftSkill
class methods schedule_event(), schedule_repeating_event(), update_event(),
and cancel_event().
2017-10-04 01:28:44 -05:00
Matthew D. Scholefield 5e392f34aa Optimize imports
Remove unused imports and group local vs external alphabetically
2017-09-18 16:07:50 -05:00
Matthew D. Scholefield cfdc405da5 Add new LOG class 2017-09-18 13:56:06 -05:00
Åke Forslund 65fa735a3a Fix isSpeaking
====  Tech Notes  ====
isSpeaking was lowered as soon a the tts had synthesized the audio and
not when the output finished. This commit moves the signal
raising/lowering to the tts instead of the 'mycroft.speak' handler.
2017-09-13 12:02:27 -05:00
Åke Forslund 44b68e3f3f Add handlers for lowering/restoring pulseaudio vol
====  Tech Notes ====
pulse_lower_volume() scans through the list of running input sinks and
reduces the volume to 30% of original volume skipping over the stream
named 'mycroft-voice'

pulse_restore_volume() restores the volume again.

If activated with the 'pulseaudio' config parameter they will be called
when mycroft starts/stops listening and starts/stops speaking

==== Environment Notes ====
The Audio->pulseaudio configuration parameter can now be set to 'lower'
to activate this feature
2017-08-11 16:44:24 +02:00
Augusto Monteiro 540adbd195 Merge pull request #959 from forslund/bugfix/issue-958
Make visime stream end together with audio
2017-08-09 13:57:35 -04:00
Åke Forslund 86cb1bb462 Fix message bus logging for audio service
==== Fixed Issues ====
#969

====  Tech Notes ====
The criteria for excluding messages were inverted and excluded all
messages containing 'mycroft.audio.service'. This criteria has been
fixed.

====  Documentation Notes ====
NONE - things like description of a new feature or notes on behavior
changes

==== Localization Notes ====
NONE - point out new strings, functions needing international versions,
     etc.

==== Environment Notes ====
NONE - new package requirements, new files being written to disk,
etc.

==== Protocol Notes ====
NONE - message types added or changed, new signals, etc.
2017-08-08 14:23:02 +02:00
Åke Forslund 5b4ae74cfb Make visime stream end together with audio
===Fixed issues ====
#958

====  Tech Notes ====
Adds method clear_visimes() to voice playback thread to stop visime stream
instead of having visime stream check for signals.

====  Documentation Notes ====
NONE - things like description of a new feature or notes on behavior
changes

==== Localization Notes ====
NONE - point out new strings, functions needing international versions,
     etc.

==== Environment Notes ====
NONE - new package requirements, new files being written to disk,
etc.

==== Protocol Notes ====
NONE - message types added or changed, new signals, etc.
2017-08-03 10:57:14 +02:00
Åke Forslund a0ac65ac35 Fix rebase issues introduced with audio subsystem
util/signal.py add missing import time
move tts thread shutdown/clear to audio/speech.py
2017-08-02 16:53:48 -05:00
Åke Forslund df18f42ae0 Remove debug prints 2017-08-01 11:45:42 +02:00
Åke Forslund 0e2029d9fe Add support for muting pulse audio streams
when the audio configuration option "pulseaudio" is set to mute running
audio streams will be muted while mycroft is speaking and while mycroft
is listening.
2017-07-31 13:37:18 +02:00
Åke Forslund 6f37d3c8f8 Fix bug in track_info_method
* import Message to allow audio service to reply info
* Add default message to audio service class
2017-07-31 13:37:18 +02:00
Åke Forslund 68506cb519 Add basic tests for audio service 2017-07-31 13:37:17 +02:00
Åke Forslund 93a9848a4c Move speech information methods to audio 2017-07-31 13:37:17 +02:00
Åke Forslund 769b4f900e Move text to speech to audio service 2017-07-31 13:37:17 +02:00
Åke Forslund 824503ae4d Volume is now changed in relation to current volume for vlc 2017-07-31 13:37:17 +02:00
Åke Forslund 8d4aabe6ca Correct resume handler 2017-07-31 13:37:17 +02:00
Åke Forslund d012702bde Update control logic for mpg123 process
Removes the cases where the process keeps playing in the background
when a new track is started.
2017-07-31 13:37:17 +02:00
Åke Forslund 839803c958 Rename messages.
As requested by Augusto Monteiro
2017-07-31 13:37:17 +02:00
Åke Forslund 86a557e1ac Docstrings! 2017-07-31 13:37:17 +02:00
Åke Forslund e9a8eb01ca Handle file:// uri's in mpg123 backend 2017-07-31 13:37:17 +02:00
Åke Forslund 0749b3c088 Only display message bus messages related to audio service 2017-07-31 13:37:17 +02:00
Åke Forslund 2270448fff Fix pep8 errors 2017-07-31 13:37:17 +02:00
Åke Forslund bddccad7b9 Make service loading more robust 2017-07-31 13:37:17 +02:00
Åke Forslund aab65d8178 Add docstrings. 2017-07-31 13:37:17 +02:00
Åke Forslund 177187bee6 Rename manual_load to load_service. 2017-07-31 13:37:17 +02:00
Åke Forslund bccc9f78d8 Handle stop 2017-07-31 13:37:17 +02:00
Åke Forslund a39033fa98 Re-add resume functionality 2017-07-31 13:37:17 +02:00
Åke Forslund 3001dd5a83 Move backend base class to audio/services 2017-07-31 13:37:17 +02:00
Åke Forslund 7dc746370a Load all audio services in the service directory 2017-07-31 13:37:17 +02:00
Åke Forslund c7ad6b11bb Move audio service to separate process. 2017-07-31 13:37:17 +02:00