-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Conversation
When mycroft_skill.find_resource fails to load a resource for self.lang fall back to lang 'en-us' as most skills/resources are available in english by default. ==== Fixed Issues ==== MycroftAI#2120
update to lastest dev
update dev
another update
update to latest dev
update to latest dev
update dev
Implement TTS module that works with Mozilla-TTS server. ==== Environment Notes ==== Requires a Mozilla-TTS server running preferably in your local network.
fix missing import and codestyle
Voight Kampff Integration Test Succeeded (Results) |
The dev server moz tts includes can be accessed similarly to mimic2/tacotron, but no visemes are returned. A slightly more generic tool that connects to a url and expects a wav file in return might be ideal, and indicate that moz tts works with this option? |
mycroft/tts/mozilla_tts.py
Outdated
|
||
def get_tts(self, sentence, wav_file): | ||
wav_name = hashlib.sha1(sentence.encode('utf-8')).hexdigest() + ".wav" | ||
wav_file = "/tmp/" + wav_name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's typically a /tmp/mycroft/ folder that might be better used for this. (in fact there's a /tmp/mycroft/cache/tts/ folder)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you should be able to use wav_file without modification that should contain the complete path el-tocino mentions. If this is changed the use of local caching won't work.
fix codestyle
Voight Kampff Integration Test Succeeded (Results) |
Very cool! Are there any good instructions for setting up mozilla TTS server outthere? |
When you have a pre-trained model you can run |
Voight Kampff Integration Test Succeeded (Results) |
there is also https://github.com/synesthesiam/docker-mozillatts using the pip .whl for the pre trained model here did not work out of the box for me, i needed to update numpy and downgrade numba for it to work |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice one! You beat me to it :)
We are going to be extracting all the TTS and STT modules out to plugins, but given the work happening on voices right now I think it makes sense to merge this in.
Outside the scope of this PR, but inspired by it - I'm wondering if we should extract out the phrase chunking functions that are currently in the Mimic2 module so that any TTS module can make use of them?
mycroft/configuration/mycroft.conf
Outdated
}, | ||
"mozilla": { | ||
"lang": "de", | ||
"url": "http://10.0.0.1:5002/api/tts?text=" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wonder if we should default to a 0.0.0.0
IP?
mycroft/tts/mozilla_tts.py
Outdated
from urllib import parse | ||
from .mimic_tts import VISIMES | ||
import math | ||
import base64 | ||
import os | ||
import re | ||
import json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can probably clean some of these up? Presuming they've just been copied across from the Mimic2 module?
I have seen these functions and left them out intentionally as Mozilla-TTS server implements phrase chunking functions itself. |
fix imports and example config
Voight Kampff Integration Test Succeeded (Results) |
Cache handling
Voight Kampff Integration Test Succeeded (Results) |
Finally got the TTS setup, it's working very well! I could minimize the get_tts method to def get_tts(self, sentence, wav_file):
req_route = self.url + sentence
response = requests.get(req_route)
with open(wav_file, 'wb') as f:
f.write(response.content)
return (wav_file, None) # No phonemes This lets mycroft take care of all caching instead of duplicating the check here. Another way to make the code cleaner could be to use the params argument in requests.get setting the url in config to then doing the request call using This would automatically escape anything in |
remove custom cache code improve url handling
Voight Kampff Integration Test Succeeded (Results) |
mycroft/tts/mozilla_tts.py
Outdated
|
||
from .tts import TTS, TTSValidator | ||
from mycroft.configuration import Configuration | ||
from mycroft.util.log import LOG |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like now os, hashlib and mycroft.util.log isn't used. Apart from those tiny things it looks great!
Clean up imports
Voight Kampff Integration Test Succeeded (Results) |
in case this PR is merged adding the "hacktoberfest-accepted" label to it would be a cool thing ;-) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works excellent now! Can without issue say "Sharky & George"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just noticed i made an "invisible" review, @ChanceNCounter pointed out comments dont appear until i submit the review....
doesnt matter now that it is merged, i opened a new PR with the changes i requested. most changes were addressed either way.
I wonder how many times i thought i reviewed something, but not really....
@@ -306,6 +306,10 @@ | |||
"espeak": { | |||
"lang": "english-us", | |||
"voice": "m1" | |||
}, | |||
"mozilla": { | |||
"lang": "de", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lang is not used anywhere
mycroft/configuration/mycroft.conf
Outdated
}, | ||
"mozilla": { | ||
"lang": "de", | ||
"url": "http://10.0.0.1:5002/api/tts?text=" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be changed to http://10.0.0.1:5002/api/tts see comment bellow
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the example should probably also use localhost, I'm surprised that it's near real time in my laptop
mycroft/tts/mozilla_tts.py
Outdated
LOG.info('local response wav found.') | ||
else: | ||
req_route = self.url + sentence | ||
response = requests.get(req_route) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
text can be passed like this instead`(see comment above about url)
response = requests.get(self.url, params={"text": sentence})
pass | ||
|
||
def validate_connection(self): | ||
# TODO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in here you could do something like
def validate_connection(self):
url = self.tts.config['url']
response = requests.get(url)
if not response.status_code == 200:
raise ConnectionRefusedError
Instructions have been added to the docs: |
Description
Implement TTS module for Mozilla-TTS server
How to test
Fire up Mozilla-TTS server, set mycroft.conf: tts.module "mozilla" and configure tts.mozilla.url, mycroft-speak "My name is Mycroft and I am funky"
Contributor license agreement signed?
CLA [X] (Whether you have signed a CLA - Contributor Licensing Agreement