11     _default_voice = 
'voice_kal_diphone' 
   14         super(FestivalPlugin, self).
__init__()
 
   17         if voice 
is None or voice == 
'':
 
   19         encoding = 
'ISO-8859-15' 
   21             voice, encoding = voice.split(
':', maxsplit=1)
 
   22         txtfile = tempfile.NamedTemporaryFile(
 
   23             prefix=
'sound_play', suffix=
'.txt')
 
   24         (wavfile, wavfilename) = tempfile.mkstemp(
 
   25             prefix=
'sound_play', suffix=
'.wav')
 
   26         txtfilename = txtfile.name
 
   30                 if hasattr(text, 
'decode'):
 
   32                         text.decode(
'UTF-8').encode(encoding))
 
   35                         text.encode(encoding))
 
   36             except UnicodeEncodeError:
 
   37                 if hasattr(text, 
'decode'):
 
   40                     txtfile.write(text.encode(
'UTF-8'))
 
   42             cmd = 
"text2wave -eval '({0})' {1} -o {2}".format(
 
   43                 voice, txtfilename, wavfilename)
 
   46                 if os.stat(wavfilename).st_size == 0:
 
   51                     'Sound synthesis failed.' 
   52                     'Is festival installed?' 
   53                     'Is a festival voice installed?' 
   54                     'Try running "rosdep satisfy sound_play|sh".' 
   55                     'Refer to http://wiki.ros.org/' 
   56                     'sound_play/Troubleshooting'