pico2wave.py 490 B

1234567891011121314151617
  1. import subprocess
  2. from core import AudioPlayer
  3. from tts import TTS
  4. class Pico2wave(TTS):
  5. def __init__(self, audio_player_type=None):
  6. TTS.__init__(self, audio_player_type)
  7. def say(self, words=None, language=None):
  8. temp_file = "/tmp/temp.wav"
  9. devnull = open("/dev/null", "w")
  10. subprocess.check_output(["/usr/bin/pico2wave", "-l=%s" % language, "-w=%s" % temp_file, words], stderr=devnull)
  11. self.play_audio(temp_file)
  12. devnull.close()