1
0
mirror of https://github.com/malarinv/tacotron2 synced 2026-03-08 01:32:35 +00:00

1. make pyaudio as extra requirement

2. warn if pyaudio not installed if player_gen is used
This commit is contained in:
2020-01-22 13:52:59 +05:30
parent 42a85d177e
commit cb0c8ddd06
2 changed files with 9 additions and 2 deletions

View File

@@ -3,9 +3,9 @@
import numpy as np
import torch
import pyaudio
import klepto
import argparse
import warnings
from pathlib import Path
from .model import Tacotron2
from glow import WaveGlow
@@ -156,6 +156,11 @@ class TTSModel(object):
def player_gen():
try:
import pyaudio
except ModuleNotFoundError:
warnings.warn("module 'pyaudio' is not installed requried for playback")
return
audio_interface = pyaudio.PyAudio()
_audio_stream = audio_interface.open(
format=pyaudio.paInt16, channels=1, rate=OUTPUT_SAMPLE_RATE, output=True