pico2wave.py 500 B

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