firstsubmit

This commit is contained in:
yumoqing 2024-01-27 18:18:06 +08:00
parent 8a428c21ab
commit 70065b9283
5 changed files with 88 additions and 0 deletions

0
coquitts/__init__.py Normal file
View File

26
coquitts/tts.py Normal file
View File

@ -0,0 +1,26 @@
from TTS.utils.manage import ModelManager
from TTS.utils.synthesizer import Synthesizer
import numpy as np
from logmmse import logmmse
from scipy.io.wavfile import write
from ahserver.serverenv import ServerEnv
class TTS:
def __init__(self, model_name):
manager = ModelManager()
model_path, config_path, model_item = manager.download_model("tts_models/zh-CN/baker/tacotron2-DDC-GST")
self.synthesizer = Synthesizer(
model_path, config_path, None, None, None,
)
def generate(self, text):
wavs = self.synthesizer.tts(text)
enhanced = logmmse(np.array(wavs, dtype=np.float32),
self.synthesizer.output_sample_rate,
output_file=None,
initial_noise=1,
window_size=160,
noise_threshold=0.15)
write(fn, self.synthesizer.output_sample_rate, enhanced)
return fn

1
coquitts/version.py Normal file
View File

@ -0,0 +1 @@
__version__ = '0.0.1'

9
requirements.txt Normal file
View File

@ -0,0 +1,9 @@
tts
jieba
logmmse
scipy
numpy
git+https://git.kaiyuancloud.cn/yumoqing/apppublic
git+https://git.kaiyuancloud.cn/yumoqing/ahserver
git+https://git.kaiyuancloud.cn/yumoqing/sqlor

52
setup.py Executable file
View File

@ -0,0 +1,52 @@
# -*- coding: utf-8 -*-
from coquitts.version import __version__
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
required = []
with open('requirements.txt', 'r') as f:
ls = f.read()
required = ls.split('\n')
with open('coquitts/version.py', 'r') as f:
x = f.read()
y = x[x.index("'")+1:]
z = y[:y.index("'")]
version = z
with open("README.md", "r") as fh:
long_description = fh.read()
name = "coquitts"
description = "coquitts"
author = "yumoqing"
email = "yumoqing@gmail.com"
package_data = {}
setup(
name="coquitts",
version=version,
# uncomment the following lines if you fill them out in release.py
description=description,
author=author,
author_email=email,
platforms='any',
install_requires=required ,
packages=[
"coquitts"
],
package_data=package_data,
keywords = [
],
url="https://github.com/yumoqing/coquitts",
long_description=long_description,
long_description_content_type="text/markdown",
classifiers = [
'Operating System :: OS Independent',
'Programming Language :: Python :: 3',
'License :: OSI Approved :: MIT License',
],
)