|
|
@@ -23,34 +23,5 @@ def play(clip):
|
|
|
"""
|
|
|
|
|
|
fname = os.path.join(_CLIP_FOLDER, clip)
|
|
|
- tts._play(fname, False)
|
|
|
- return
|
|
|
-
|
|
|
- """
|
|
|
- audio = pyaudio.PyAudio()
|
|
|
-
|
|
|
- if clip not in _CLIP_DATA_CACHE:
|
|
|
- fname = os.path.join(_CLIP_FOLDER, clip)
|
|
|
- f = wave.open(fname, 'rb')
|
|
|
-
|
|
|
- data = f.readframes(f.getnframes())
|
|
|
- n_channels = f.getnchannels()
|
|
|
- width = f.getsampwidth()
|
|
|
- framerate = f.getframerate()
|
|
|
-
|
|
|
- _CLIP_DATA_CACHE[clip] = (data, n_channels, width, framerate)
|
|
|
-
|
|
|
- data, n_channels, width, framerate = _CLIP_DATA_CACHE[clip]
|
|
|
-
|
|
|
- audio = pyaudio.PyAudio()
|
|
|
- stream_out = audio.open(
|
|
|
- format=audio.get_format_from_width(width),
|
|
|
- channels=n_channels,
|
|
|
- rate=framerate, input=False, output=True)
|
|
|
- stream_out.start_stream()
|
|
|
- stream_out.write(data)
|
|
|
- time.sleep(0.2)
|
|
|
- stream_out.stop_stream()
|
|
|
- stream_out.close()
|
|
|
- audio.terminate()
|
|
|
- """
|
|
|
+ tts._play(fname, True)
|
|
|
+ return
|