Support for mimic3 tts

merge-requests/25/head
Bob Mottram 2022-06-29 23:00:24 +01:00
parent 05bf59c825
commit 62eedff7da
4 changed files with 55 additions and 2 deletions

View File

@ -28,6 +28,12 @@ Or if you have picospeaker installed:
~/epicyon-client-pico
```
Or if you have mimic3 installed:
``` bash
~/epicyon-client-mimic3
```
## Commands
The desktop client has a few commands, which may be more convenient than the web interface for some purposes:
@ -87,7 +93,13 @@ Or a quicker version, if you have installed the desktop client as described abov
Or if you have [picospeaker](https://gitlab.com/ky1e/picospeaker) installed:
``` bash
python3 epicyon.py --notifyShowNewPosts --screenreader picospeaker --desktop yournickname@yourdomain
~/epicyon-stream-pico
```
Or if you have mimic3 installed:
``` bash
~/epicyon-stream-mimic3
```
You can also use the **--password** option to provide the password. This will then stay running and incoming posts will be announced as they arrive.

View File

@ -326,6 +326,29 @@ def _speaker_espeak(espeak, pitch: int, rate: int, srange: int,
espeak.synth(html.unescape(say_text))
def _speaker_mimic3(pitch: int, rate: int, srange: int,
say_text: str) -> None:
"""Speaks the given text with mimic3
"""
voice = 'en_UK/apope_low'
if pitch > 20:
voice = 'en_US/m-ailabs_low'
if pitch > 40:
voice = 'en_US/hifi-tts_low'
if pitch >= 50:
voice = 'en_US/ljspeech_low'
if pitch > 75:
voice = 'en_US/vctk_low'
length_scale = str(1.0 - (rate / 200.0))
noise_w = str(srange / 100.0)
text = html.unescape(say_text).replace('"', "'")
cmd = 'mimic3 -v ' + voice + \
' --length-scale ' + length_scale + \
' --noise_w ' + noise_w + \
' "' + text + '"'
os.system(cmd)
def _speaker_picospeaker(pitch: int, rate: int, system_language: str,
say_text: str) -> None:
"""TTS using picospeaker
@ -396,6 +419,8 @@ def _text_to_speech(say_str: str, screenreader: str,
_speaker_espeak(espeak, pitch, rate, srange, say_str)
elif screenreader == 'picospeaker':
_speaker_picospeaker(pitch, rate, system_language, say_str)
elif screenreader == 'mimic3':
_speaker_mimic3(pitch, rate, system_language, say_str)
def _say_command(content: str, say_str: str, screenreader: str,

View File

@ -181,7 +181,8 @@ def _command_options() -> None:
help='Nickname of the account to use')
parser.add_argument('--screenreader', dest='screenreader', type=str,
default=None,
help='Name of the screen reader: espeak/picospeaker')
help='Name of the screen reader: ' +
'espeak/picospeaker/mimic3')
parser.add_argument('--fol', '--follow', dest='follow', type=str,
default=None,
help='Handle of account to follow. eg. ' +

View File

@ -126,9 +126,24 @@ cp ~/epicyon-client ~/epicyon-client-pico
chmod +x ~/epicyon-client-pico
sed -i 's|epicyon.py|epicyon.py --screenreader picospeaker|g' ~/epicyon-client-pico
# TTS version with mimic3
cp ~/epicyon-client ~/epicyon-client-mimic3
chmod +x ~/epicyon-client-mimic3
sed -i 's|epicyon.py|epicyon.py --screenreader mimic3|g' ~/epicyon-client-mimic3
# TTS stream
cp ~/epicyon-client ~/epicyon-client-stream
chmod +x ~/epicyon-client-stream
sed -i 's|epicyon.py|epicyon.py --notifyShowNewPosts --screenreader espeak|g' ~/epicyon-client-stream
# TTS stream
cp ~/epicyon-client ~/epicyon-stream-pico
chmod +x ~/epicyon-stream-pico
sed -i 's|epicyon.py|epicyon.py --notifyShowNewPosts --screenreader picospeaker|g' ~/epicyon-stream-pico
# TTS stream
cp ~/epicyon-client ~/epicyon-stream-mimic3
chmod +x ~/epicyon-stream-mimic3
sed -i 's|epicyon.py|epicyon.py --notifyShowNewPosts --screenreader mimic3|g' ~/epicyon-stream-mimic3
zenity --info --width=400 --text "Epicyon desktop client is now installed. You can run it with ~/epicyon-client"