Main Page
Namespaces
Classes
Files
File List
scripts
mycroft
tts
spdsay_tts.py
Go to the documentation of this file.
1
# Copyright 2017 Mycroft AI Inc.
2
#
3
# Licensed under the Apache License, Version 2.0 (the "License");
4
# you may not use this file except in compliance with the License.
5
# You may obtain a copy of the License at
6
#
7
# http://www.apache.org/licenses/LICENSE-2.0
8
#
9
# Unless required by applicable law or agreed to in writing, software
10
# distributed under the License is distributed on an "AS IS" BASIS,
11
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
# See the License for the specific language governing permissions and
13
# limitations under the License.
14
#
15
import
subprocess
16
17
from
mycroft.tts
import
TTS, TTSValidator
18
19
20
class
SpdSay
(
TTS
):
21
def
__init__
(self, lang, config):
22
super(SpdSay, self).
__init__
(lang, config,
SpdSayValidator
(self))
23
24
def
execute
(self, sentence, ident=None):
25
self.
begin_audio
()
26
subprocess.call(
27
[
'spd-say'
,
'-l'
, self.
lang
,
'-t'
, self.
voice
, sentence])
28
self.
end_audio
()
29
30
31
class
SpdSayValidator
(
TTSValidator
):
32
def
__init__
(self, tts):
33
super(SpdSayValidator, self).
__init__
(tts)
34
35
def
validate_lang
(self):
36
# TODO
37
pass
38
39
def
validate_connection
(self):
40
try
:
41
subprocess.call([
'spd-say'
,
'--version'
])
42
except
Exception:
43
raise
Exception(
44
'SpdSay is not installed. Run: sudo apt-get install '
45
'speech-dispatcher'
)
46
47
def
get_tts_class
(self):
48
return
SpdSay
mycroft.tts.TTS.voice
voice
Definition:
scripts/mycroft/tts/__init__.py:171
mycroft.tts
Definition:
scripts/mycroft/tts/__init__.py:1
mycroft.tts.TTS.end_audio
def end_audio(self)
Definition:
scripts/mycroft/tts/__init__.py:202
mycroft.tts.spdsay_tts.SpdSay.__init__
def __init__(self, lang, config)
Definition:
spdsay_tts.py:21
mycroft.tts.TTS.begin_audio
def begin_audio(self)
Definition:
scripts/mycroft/tts/__init__.py:197
mycroft.tts.spdsay_tts.SpdSayValidator.validate_lang
def validate_lang(self)
Definition:
spdsay_tts.py:35
mycroft.tts.spdsay_tts.SpdSayValidator
Definition:
spdsay_tts.py:31
mycroft.tts.spdsay_tts.SpdSayValidator.get_tts_class
def get_tts_class(self)
Definition:
spdsay_tts.py:47
mycroft.tts.TTS.lang
lang
Definition:
scripts/mycroft/tts/__init__.py:164
mycroft.tts.TTS
Definition:
scripts/mycroft/tts/__init__.py:144
mycroft.tts.spdsay_tts.SpdSayValidator.__init__
def __init__(self, tts)
Definition:
spdsay_tts.py:32
mycroft.tts.TTSValidator
Definition:
scripts/mycroft/tts/__init__.py:398
mycroft.tts.spdsay_tts.SpdSay
Definition:
spdsay_tts.py:20
mycroft.tts.spdsay_tts.SpdSay.execute
def execute(self, sentence, ident=None)
Definition:
spdsay_tts.py:24
mycroft.tts.spdsay_tts.SpdSayValidator.validate_connection
def validate_connection(self)
Definition:
spdsay_tts.py:39
mycroft_ros
Author(s):
autogenerated on Mon Apr 26 2021 02:35:40