11 _default_voice =
'voice_kal_diphone' 14 super(FestivalPlugin, self).
__init__()
17 if voice
is None or voice ==
'':
19 txtfile = tempfile.NamedTemporaryFile(
20 prefix=
'sound_play', suffix=
'.txt')
21 (wavfile, wavfilename) = tempfile.mkstemp(
22 prefix=
'sound_play', suffix=
'.wav')
23 txtfilename = txtfile.name
27 if hasattr(text,
'decode'):
29 text.decode(
'UTF-8').encode(
'ISO-8859-15'))
32 text.encode(
'ISO-8859-15'))
33 except UnicodeEncodeError:
34 if hasattr(text,
'decode'):
37 txtfile.write(text.encode(
'UTF-8'))
39 cmd =
"text2wave -eval '({0})' {1} -o {2}".format(
40 voice, txtfilename, wavfilename)
43 if os.stat(wavfilename).st_size == 0:
48 'Sound synthesis failed.' 49 'Is festival installed?' 50 'Is a festival voice installed?' 51 'Try running "rosdep satisfy sound_play|sh".' 52 'Refer to http://wiki.ros.org/' 53 'sound_play/Troubleshooting'
def sound_play_say_plugin(self, text, voice)