diff --git a/coquitts/tts.py b/coquitts/tts.py index ac39ec8..4b1d694 100644 --- a/coquitts/tts.py +++ b/coquitts/tts.py @@ -1,3 +1,4 @@ +from io import BytesIO from TTS.utils.manage import ModelManager from TTS.utils.synthesizer import Synthesizer import numpy as np @@ -22,5 +23,8 @@ class TTS: initial_noise=1, window_size=160, noise_threshold=0.15) - write(fn, self.synthesizer.output_sample_rate, enhanced) - return fn + b = BytesIO() + write(b, self.synthesizer.output_sample_rate, enhanced) + b.seek(0,0) + buf = b.read() + return buf