Update README.md

add speed_change
This commit is contained in:
刘悦
2024-07-22 11:51:47 +08:00
committed by GitHub
parent cf43100f66
commit 866207dbf0

View File

@@ -80,7 +80,7 @@ export PYTHONPATH=third_party/Matcha-TTS
``` python
from cosyvoice.cli.cosyvoice import CosyVoice
from cosyvoice.utils.file_utils import load_wav
from cosyvoice.utils.file_utils import load_wav,speed_change
import torchaudio
cosyvoice = CosyVoice('pretrained_models/CosyVoice-300M-SFT')
@@ -89,6 +89,10 @@ print(cosyvoice.list_avaliable_spks())
output = cosyvoice.inference_sft('你好,我是通义生成式语音大模型,请问有什么可以帮您的吗?', '中文女')
torchaudio.save('sft.wav', output['tts_speech'], 22050)
# if you wanna change the speed
audio,sample_rate = speed_change(output["tts_speech"],22050,"1.6")
torchaudio.save('sft_speed_1.6.wav',audio, 22050)
cosyvoice = CosyVoice('pretrained_models/CosyVoice-300M')
# zero_shot usage, <|zh|><|en|><|jp|><|yue|><|ko|> for Chinese/English/Japanese/Cantonese/Korean
prompt_speech_16k = load_wav('zero_shot_prompt.wav', 16000)
@@ -156,4 +160,4 @@ You can also scan the QR code to join our official Dingding chat group.
5. We borrowed a lot of code from [WeNet](https://github.com/wenet-e2e/wenet).
## Disclaimer
The content provided above is for academic purposes only and is intended to demonstrate technical capabilities. Some examples are sourced from the internet. If any content infringes on your rights, please contact us to request its removal.
The content provided above is for academic purposes only and is intended to demonstrate technical capabilities. Some examples are sourced from the internet. If any content infringes on your rights, please contact us to request its removal.