From 824f2e8b6eccd471f1837f87f7318666e8b9cea5 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Sun, 28 Jan 2024 11:17:41 +0800 Subject: [PATCH] bugfix --- coquitts/tts.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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