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 
32  def __init__(self, tts):
33  super(SpdSayValidator, self).__init__(tts)
34 
35  def validate_lang(self):
36  # TODO
37  pass
38 
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
def __init__(self, lang, config)
Definition: spdsay_tts.py:21
def execute(self, sentence, ident=None)
Definition: spdsay_tts.py:24


mycroft_ros
Author(s):
autogenerated on Mon Apr 26 2021 02:35:40