Commit Graph

212 Commits (refactor/python-detect)

Author SHA1 Message Date
Kris Gesling 6e058e48b5
Merge pull request #2713 from domcross/feature/mozilla_tts
Feature/mozilla tts
2020-10-07 11:39:54 +09:30
domcross 10ded43c65 Mozilla TTS
Clean up imports
2020-10-06 11:44:54 +02:00
domcross 99f534c1ad Mozilla TTS
remove custom cache code
improve url handling
2020-10-05 19:51:00 +02:00
domcross 12ec5cb9b7 Mozilla TTS
Cache handling
2020-10-02 21:48:55 +02:00
domcross d0fb378c56 Mozilla TTS
fix imports and example config
2020-10-02 14:10:41 +02:00
domcross 65e30ba861 Mozilla TTS
fix codestyle
2020-10-01 21:03:52 +02:00
domcross 104c57a528 Mozilla TTS
fix missing import and codestyle
2020-10-01 20:35:08 +02:00
domcross 5be3b54b27 MozillaTTS
Implement TTS module that works with Mozilla-TTS server.

==== Environment Notes ====
Requires a Mozilla-TTS server running preferably in your local network.
2020-10-01 20:07:47 +02:00
Joshua J. A. Harwood 84a5fd8853 Issue-2700 - Allow for different Polly engines in config 2020-09-27 22:49:59 +00:00
Åke Forslund a54090eef2 Add plugin support for tts
Entrypoints registered under "mycroft.plugin.tts" will be detected and
able to run.
2020-09-23 07:46:13 +02:00
Åke Forslund 37e03589f3 Handle numeric duration stretch 2020-09-14 07:43:48 +02:00
Åke Forslund f40c9cc44f Make Global scope variables upper case 2020-09-12 18:18:38 +02:00
Åke Forslund 725b8a8d15 Fix update of duration stretch
Switch from global config to object config
2020-09-12 18:18:02 +02:00
Joan Montané 594c838a00 Add Festival TTS 2020-07-27 18:04:27 +02:00
Åke Forslund 86a978fadf Fix audio service startup without Internet
If started up without Network connection the audio service would crash
importing the google_tts module as it tried to fetch language list from
google.

This restructures it to be a just-in-time check. It also adds a cached
list of supported languages to use if an error occurs fetching language
codes.

A small fix allowing "en-US" to be matched to "en-us" instead of the
generic "en" is also included.
2020-05-27 21:28:26 +02:00
Åke 4ab9469ff7
Merge pull request #2585 from forslund/polly_tts
Add Polly tts
2020-05-15 08:22:25 +02:00
Åke Forslund 094c2c28d0 Test loading of phonetic spelling dictionary
This also normalizes the path slightly to make sure that the phonetic
spelling is loaded even if the lang code contains capitals.
2020-05-12 08:58:18 +02:00
Åke Forslund 1ee8ec0ff9 Generalize Espeak missing error 2020-05-11 16:14:24 +02:00
Åke Forslund 23c04bf9f0 Update ESpeak to modern TTS standard.
- Fixes wait_while_speaking
- Adds Caching support
2020-05-11 16:14:19 +02:00
Åke Forslund f19547860b Update polly access key config to match AWS better
key_id -> access_key_id
secret_key -> secret_access_key
2020-04-19 17:53:02 +02:00
jarbasal 751040d653 default voice 2020-04-19 17:25:56 +02:00
jarbasal 3707df87b3 update to newer TTS architecture 2020-04-19 17:25:38 +02:00
jarbasai 383ac5f69e Add Amazon polly tts 2020-04-19 17:24:56 +02:00
Åke Forslund d51fb126b8 Fix fallback to mimic
After catching exception to clear the isSpeaking flag the exception
shall be re-raised to allow the fallback TTS to trigger.
2020-04-17 20:43:13 +02:00
Luca Vercelli a9cfa513a3 Use lang validator to raise error 2020-04-15 08:58:40 +02:00
luca-vercelli 0718e397c5 Issues-2534 - language fallback fix
update the lang value if currently set language doesn't exist.
2020-04-15 08:57:49 +02:00
Kris Gesling 1b49774091 Generalize custom remote TTS url config 2020-03-26 20:27:39 +09:30
Kris Gesling bcd45dd0fd add learning-opt-out to request params
fix pep-8
2020-03-26 15:41:09 +09:30
Kris Gesling 15ad6c7249 Add configurable API url to Watson TTS
The new IBM Watson TTS service now provides a unique url for your TTS
API resource. This adds a configuration option to override the default
url. As the url provided by IBM contains the api_path, we check for it 
and if found remove it, as the RemoteTTS.__request method appends it 
when making the call.
2020-03-26 13:39:00 +09:30
Åke Forslund b52722faf3 Add dummy TTS backend
The backend doesn't generate any audio playback, only consumes the
messages
2020-03-24 10:42:07 +01:00
Åke Forslund 27de6c72c4 Add empty tts output on execute exception
This will make sure that the isSpeaking flag is cleared correctly
2020-03-24 10:42:07 +01:00
Åke Forslund bdf7f02226 Remove specific metrics thread from TTS system 2020-02-26 07:25:45 +01:00
Å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
Åke Forslund 8f6822278f Clean-up
tts.py:
- remove unused import
-remove unused variable
- init TTS thread enclosure member
mimic2_tts.py: Fix docstrings
mimic_tts: Fix docstrings and remove unused variables and imports
google_tts: Improve docstrings
2020-01-10 16:26:48 +01:00
Åke Forslund 93ff3d7651 Fix mimic2 text preprocessing 2020-01-10 16:26:48 +01:00
Åke Forslund 391b92ce56 Make Factory get Mimic TTS class from normal list
Removes duplicated code and makes method easier to test
2020-01-10 16:26:48 +01:00
Åke Forslund 72adf0465b Move code out of __init__.py 2020-01-10 15:27:07 +01:00
Ansgar Tuemmers c5b6987d0c Prepare for gTTS 2.1.0
Signature of gTTS.__init__ changes in 2.1.0 and breaks calls with
unnamed arguments like gTTS('some text', 'de')
2020-01-04 17:30:45 +01:00
Christian Clauss a1ff3fb355 Upgrade from pycodestyle to flake8 2019-11-19 23:07:52 +01:00
Åke Forslund c8328526b1 Fallback to Mimic if launch of TTS fails
Logs the exception and fallsback to Mimic as TTS backend if there is an
issue with the selected TTS backend or if the choice is invalid.
2019-10-28 14:20:01 +01:00
David Wagner ddad8d1569 Pass listen to end_audio() 2019-10-10 12:11:11 +00:00
David Wagner feac64b2b0 Add listen arg to other TTS classes 2019-10-10 12:09:50 +00:00
David Wagner d9523fd30f Pass listen to end_audio() 2019-10-10 11:54:58 +00:00
David Wagner e45f527af3 Default to False 2019-10-10 11:50:48 +00:00
Åke Forslund abf8a90f07 Add description of the playback thread loop 2019-10-04 15:14:56 +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
Kirill Kirilenko 58931310e9 Add Yandex TTS support 2019-09-30 20:13:04 +02:00
Andrew Kish 1d2cabd421 Fix missing param when setting up MaryTTS and how it validates a connection 2019-09-26 16:11:02 +02:00
David Wagner cf2791634d Fix bug where no utterance is spoken if cache wav is hit with no visemes cached 2019-09-11 18:44:31 +00:00
Åke Forslund 25bfd1345f Minor cleanup of tts/__init__.py
- Remove unused imports
- Correct docstrings
2019-08-31 14:27:06 +02:00
Åke Forslund 3d37315bc0 Utilize pulseaudio's corking/ducking feature
Pulseaudio allows corking / ducking for streams with prioritized roles
This sets the role for the mycroft speech to "phone" and all other to
"music" if the config tts->pulse_duck is set to true.
2019-08-31 14:27:06 +02:00
Christian Clauss 0053e70bc0
Undeefined name: Except --> Exception
__Except__ is an undefined name in this context with the potential to raise __NameError__ at runtime instead of the desired Exception and message.
2019-07-31 00:02:07 +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
Åke Forslund 1400af2b16 Fix pycodestyle errors 2019-05-15 13:46:43 +02:00
Åke Forslund 5ed417cddb Small style fixes
- Remove unneccessary pass
- Fix bare except statements
- Fix identation
2019-05-13 16:48:15 +02:00
Ruthvicp 90ccae2f69 Cache pre-loading for mimic2
When the mimic2 TTS instance is created the phrases from mycroft-core and mycroft-wifi setup (if available) is generated and stored locally (defaults to /opt/mycroft/preloaded_cache but can be changed with the mimic2 config parameter "preloaded_cache"

On startup the cache will be copied into the cache directory to speed up default interactions.
2019-05-13 14:33:30 +02: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 9eeb8cefc3 Fix mimic 2 long sentences (#2061)
* Fix mimic 2 long sentences

Fixes bug in  the second and third chunking pass incorrectly by
concatinating strings with lists resulting in chunks of single
characters.

* Handle mimic2 chunking correctly

- Move preprocessing from get_tts() to a method called from tts execute,
    this allows all parts to be spoken and the caching to work correctly
- Remove duplicate of phonetic spelling in mimic2_tts
2019-03-22 10:20:06 -05:00
Steve Penrod cd6db9f645 Bugfix for Mimic2 issues (#2043)
Mimic2 voices has several issues:
* Numeric generation was all goofed up for decimal numbers.  It was
  independently doing number to speech for the values before and after
  the period on a decimal number.  E.g. 1.100 became "one.one hundred".
  Removed local normalization altogether since it is handled
  correctly on the Mimic2 server now.
* Sentence splitting was being applied in the middle of things like
  numbers or abbreviations.  E.g. "I.B.M."
* Chunker algorithms were making unnecessary copies of string arrays

While in there I also:
* Removed several unused imports
* Cleaned up docstrings
* Prefixed private helpers with _
* Added debug logging of mimic2 request text
2019-03-07 14:55:31 -06:00
Luis Reinoso 62f0abf021 Issues-1982 - Add input validation 2019-02-27 10:39:22 +01:00
Luis Reinoso bb6de01e72 Issues-1982 - Add IAM authentication for Watson TTS 2019-02-27 10:39:05 +01:00
Åke 7674fa1c65
Merge pull request #1995 from MycroftAI/feature/settings-cleanup
Clean up some exception handling in settings code
2019-02-18 09:11:01 +01:00
Åke ba24cc3d78 Feature/remove old viseme system (#2000)
* Remove the old single viseme message

Instead a single viseme message is sent

* Correct the spelling of viseme.

Ref: https://en.wikipedia.org/wiki/Viseme

* Remove debug print.

This was probably left in by mistake, removing to clean up the audio log somewhat.
2019-02-17 23:54:59 -06:00
Steve Penrod a76c3a6e7a Quiet PEP8 2019-02-14 15:49:05 -06:00
Steve Penrod de818db9cb Clean up some exception handling in settings code
The settings code worked, but was noisy and generally messy about
a few exceptional but common situations:
* When the .mycroft/skills/<SkillName> folder didn't already exist
* When network timeouts and such occcurred

I also slipped in a couple trivial code cleanups for an unused variable
and a log message.
2019-02-14 15:41:27 -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 267c7bf571 Single viseme message (#1973)
* Add new api command to send visemes as single list.  This allows more efficient use of the messagebus and gives implementors flexibility in how they handle the visualization.

* Switch mark1 to use viseme_list
2019-01-31 00:37:55 -06: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 c92f92de4f Bugfix/mimic2 negative numbers (#1927)
* Fix mimic2 negative numbers

Make the regex extracting numbers also match negative numbers when preparsing phrases sent to the mimic2 service

* Update pronounce_number to use "minus" for negatives

After discussion in the chat it was suggested to use "minus" for negatives as default.

When scientific notation is used the term "negative " is still used.
2019-01-02 16:36:04 -06:00
mpolidori a43a748f97 Change regex string to raw string (#1845) 2018-10-10 12:23:59 -05:00
Michael Nguyen 9228367678 catch more exceptions 2018-10-08 17:14:43 -05:00
Michael Nguyen b22e9d975d fall back tts function for connection errors 2018-10-08 16:54:22 -05:00
Steve Penrod a0eee8862b Use the phonetic_spellings.txt in Mimic2
The "phonetic_spellings.txt" mechanism converts odd words to strings that
represent what they should sound like when spoken.  For example, "mycroftai"
to "Mycroft A.I.".  This provides an easy mechanism to provide hints to
lots of Text to Speech engines.

This adds it to Mimic2, along with a spelling of "corgi".
2018-09-26 23:54:23 -05:00
Michael Nguyen 1d472df803 fix commenting 2018-09-12 16:00:53 -05:00
Michael Nguyen 09a785364f remove unecessary log 2018-09-12 13:50:32 -05:00
Michael Nguyen 402b02b7fa added doc string and removed danerous default arg 2018-09-12 13:49:16 -05:00
Michael Nguyen 7b9ed611aa changes to mycroft core to do longer sequence generations 2018-09-06 15:05:00 -05:00
Åke 85ae69597b Separate enclosure api from enclosure client (#1760)
This is a step towards abstracting the idea of an Enclosure which ties Mycroft to the hardware that is running Mycroft.

- Move the enclosure API to mycroft.enclosure.api (previously was mycroft.client.enclosure.api)
- Move display_manager out of enclosure client to mycroft.enclosure.display_manager
- Merge EnclosureWeather into EnclosureMouth
- Wrap display manager in a class
2018-08-27 13:44:12 -05:00
Åke 64476eb143 Replace emitter/ws with bus (#1757)
Makes the code a bit more understandable
2018-08-21 20:50:50 -05:00
Michael Nguyen a5a119507e restrict str.replace from doing a global string replacement 2018-08-15 19:27:59 -05:00
Åke 3099d004dd Fix issue writing phonemes to disk (#1720)
Change Mimic.get_tts() to return phonemes as string instead of bytes
2018-08-15 03:59:11 -05:00
Michael Nguyen 14e862bfaa Fix isSpeaking Signal for Mimic2 TTS (#1724)
Allows skills to determine while TTS is still occurring
2018-08-14 23:10:23 -05:00
Michael Nguyen 408f0ef4bc function to normalized all numbers to text equivalent (#1737)
Numbers are now normalized to the text equivalent. This is to solve problems where mimic2 returns a speed up text generation when saying number values.
2018-08-14 22:01:08 -05:00
Nolan Darilek adfd9154db Better logging around why writing .PHO file fails. 2018-08-06 20:28:52 +00:00
Michael Nguyen fe00294b4c Feature/mimic2 visemse (#1708)
* added ability to create visemes
* clean visemes code, added url to mycroft.conf
2018-08-02 15:08:10 -05:00
Michael Nguyen 1ab9ae3889 Add Mimic 2 TTS
* added asynchronous request to mimic2 backend to break up audio into chunks

 * add chracter threshold

 * refactored split_by_punctuation

 * add punctuation function to sentence chunks

 * fix spelling

 * some more spelling

 * added mimic2 in mycroftconf

 * removed unused imports
2018-07-18 13:10:07 -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
JarbasAI db4740d407 Add Responsive voice tts (#1565)
Adds responsive voice as an optional TTS service.

See https://responsivevoice.org/text-to-speech-sdk/text-to-speech-widget/
2018-07-04 13:21:34 +02:00
Åke Forslund 650e051b0b Handle words with capitals 2018-06-06 17:16:41 +02:00
Matthew D. Scholefield 509162de50 Support tilda in data_dir 2018-05-23 15:03:01 -05:00
Matthew D. Scholefield b0b88bbd62 Remove all references to /opt/mycroft 2018-05-23 08:22:14 +02:00
Åke Forslund 8c5911ecf0 Fix code standard issues
- dev_setup.sh - replace `` with $()
- mycroft/skills/core.py remove remove redundant imports
- mycroft/tts/__init__.py remove remove redundant imports
2018-05-03 12:32:21 +02:00
Åke Forslund a2993e4ba6 Remove backwards compatibility with python 2.7 2018-04-27 08:51:47 -05:00
Åke Forslund 29a2e14a2f Fix google tts now playing audio
The file extention of the audio was not set properly in the google_tts causing it to fail to playback the synthezised audio
2018-04-26 15:08:35 +02: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
jarbasai 29e18cba8f fix bing gender 2018-01-09 19:16:39 +00:00
jarbasai 5c14fb3b62 bing tts 2018-01-09 19:16:26 +00:00
jarbasai f1c64471c6 bing tts 2018-01-09 19:15:28 +00:00
Åke Forslund 936bd54180 Add a function to build the standard timing report 2018-01-08 18:01:03 -06:00