NIUBOYI»Home › › Chat TTS › 中文 | English
微信扫一扫 分享朋友圈

已有 2513 人浏览分享

Chat TTS    ChatTTS Text-to-Speech Tool Demo and Installation and Deployment Tutorial

2024-5-31 10:55:102513 0
https://v.douyin.com/ijf2KRYQ/

I. Using the One-Click Installation Package
https://pan.baidu.com/share/init?surl=-hGiPLs6ORM8sZv0xTdxFA&pwd=h3c5  Extraction code h3c5
There are 3 versions inside. One is the default version released on the official website, and the other two are extended versions developed by community members. The moderator has already tested them for everyone; just choose ChatTTS_colab_offline. It is the easiest to use and has a role-playing feature; the other two do not. Moreover, ordinary users really do not need to do the manual installation below, unless you are a developer who needs to develop an application.

II. Manual Installation

1. Download from GitHub
git clone https://github.com/2noise/ChatTTS  

2. Install Dependencies
Before you start, make sure the necessary packages are installed. You will need torch and ChatTTS. If they are not installed yet, you can install them with pip:
pip install torch ChatTTS

3. Import Required Libraries
Import the libraries required by the script. You need torch, ChatTTS, and Audio from IPython.display.
import torch
import ChatTTS
from IPython.display import Audio


4. Initialize ChatTTS
Create an instance of the ChatTTS class and load the pre-trained model.
chat = ChatTTS.Chat()
chat.load_models()


5. Prepare Text
Define the text to be converted to speech. Replace <YOUR TEXT HERE> with the text you want.
texts = ["Hello, welcome to ChatTTS!",]

6. Generate Speech
Use the infer method to generate speech from the text. Set use_decoder=True to enable the decoder.
wavs = chat.infer(texts, use_decoder=True)

7. Play Audio
Use the Audio class in IPython.display to play the generated audio. Set the sample rate to 24,000 Hz and enable autoplay.
Audio(wavs[0], rate=24_000, autoplay=True)

8. Complete Script
The following is the complete script for reference:

import torch
import ChatTTS
from IPython.display import Audio

# Initialize ChatTTS
chat = ChatTTS.Chat()
chat.load_models()

# Define the text to be converted to speech
texts = ["Hello, welcome to ChatTTS!",]

# Generate speech
wavs = chat.infer(texts, use_decoder=True)

# Play the generated audio
Audio(wavs[0], rate=24_000, autoplay=True)
  • WeChat Official Account

  • Scan to Visit Mobile Site

QQ|NIUBOYI ( 京ICP备17025393号 )|网站地图

GMT+8, 2026-10-30 19:46 , Processed in 0.431222 second(s), 38 queries .

POWERED BY NIUBOYIAI! 主理人:NIUBOYIAI  点亮哥

Copyright © 2001-2020, NIUBOYI AI.