Select Page
ChatTTS-完整使用指南

ChatTTS-完整使用指南

免費且超強大的 AI TTS,文字轉語音模型+工具,有許多語氣的控制,也可以很精準的寫程式控制效果,是RD眼中好用的Local端開源的TTS

特色說明

1.大規模的數據:10萬小時的訓練資料

2.專用設計:專門對於對話情境、視頻介紹的情境所設計的模型

3.開源特性:可以很簡單的整合到你的WEB中

4.支持語氣:oral, laugh, break

安裝前準備

python 3.10

CUDA

GIT

gradio

安裝說明

github 複製

git clone https://github.com/2noise/ChatTTS
cd ChatTTS

安裝依賴

pip install --upgrade -r requirements.txt

執行 webui

python examples/web/webui.py

利用 CLI

python examples/cmd/run.py "Your text 1." "Your text 2."

要整合在 python 程式碼中,可以安裝 PyPI

pip install ChatTTS
pip install git+https://github.com/2noise/ChatTTS
pip install -e .

整合程式碼

###################################
# Sample a speaker from Gaussian.

rand_spk = chat.sample_random_speaker()
print(rand_spk) # save it for later timbre recovery

params_infer_code = ChatTTS.Chat.InferCodeParams(
    spk_emb = rand_spk, # add sampled speaker 
    temperature = .3,   # using custom temperature
    top_P = 0.7,        # top P decode
    top_K = 20,         # top K decode
)

###################################
# For sentence level manual control.

# use oral_(0-9), laugh_(0-2), break_(0-7) 
# to generate special token in text to synthesize.
params_refine_text = ChatTTS.Chat.RefineTextParams(
    prompt='[oral_2][laugh_0][break_6]',
)

wavs = chat.infer(
    texts,
    params_refine_text=params_refine_text,
    params_infer_code=params_infer_code,
)

###################################
# For word level manual control.

text = 'What is [uv_break]your favorite english food?[laugh][lbreak]'
wavs = chat.infer(text, skip_refine_text=True, params_refine_text=params_refine_text,  params_infer_code=params_infer_code)
"""
In some versions of torchaudio, the first line works but in other versions, so does the second line.
"""
try:
    torchaudio.save("word_level_output.wav", torch.from_numpy(wavs[0]).unsqueeze(0), 24000)
except:
    torchaudio.save("word_level_output.wav", torch.from_numpy(wavs[0]), 24000)

V3版本

音色庫

https://www.modelscope.cn/studios/ttwwwaa/chattts_speaker

注意事項

1.是否要使用CUDA,需要的話,記得安裝依賴

2.要用CUDA,怎選擇 Linux 平台,相容性比較好

3.Python最好用3.10版本,並且用conda

直接使用

https://chattts.com

colab

modalScope

參考資源

ChatTTS Github

ChatTTS官網

MediaFire一件安裝包

Lobe Chat UI-有plugin,多模態的AI CHAT UI – 雨 (rain.tips)

AI Tools – AI工具大全(總整理) – 雨 (rain.tips)

搭配 Free AI 產圖Flux

Youtube 電影十分鐘解說的 AI 語音合成

Youtube 電影十分鐘解說的 AI 語音合成

我睡覺前的催眠語音,經過了分析以及搜尋,終於找到正確的 AI ,分別是阿里雲的直播天王-艾菲,和 MS AZURE 的雲希

阿里雲 – 智能语音交互

https://ai.aliyun.com/nls

Microsoft AZURE – 文字轉換語音

https://azure.microsoft.com/zh-tw/products/cognitive-services/text-to-speech/#features

https://azure.microsoft.com/zh-cn/products/cognitive-services/text-to-speech/#features

Raspberry pi 如何使用 ACR122U NFC Reader

Raspberry pi 如何使用 ACR122U NFC Reader

ACS-ACR122U-NFC-Reader

最近更新 ACR122 NFC Reader 到了 ACR122U NFC Reader (A9) 最新版本,發現之前的 Driver 不能使用了,所以重新記錄一下,如何在 Raspberry Pi 的 Raspbian OS 上頭安裝 ACR122U 的驅動程式(Driver),先決條件要是 Raspberry Pi model 2B 以上,以及 2015 Debian Wheezy, kernel 3.18 以上。

我這一次的專案是需要用在幼兒園的家長接送的情境上,身為家長一定都覺得老師的記憶力超好,不管是幼幼班、幼兒園還是國小低年級學生,老師都需要負責學生的接送,但我個人上了年紀後能記得的只有自己的名字,所以就協助我本次的業主,設計了一套幼兒園放學時的自動廣播系統,當然最酷的是可以使用我的小米手環5 NFC或是小米手環6 NFC版本,請參考小米手環6 NFC版本,解放了我的口袋以及雙手,這個幼兒園廣播系統其流程如下

  1. 免下車,可以直接靠卡感應
  2. 透過 Wifi 連結幼兒園的主機
  3. 透過 AI 合成語音,並且廣播學生的回家的資訊
  4. 老師聽到後,帶領學生到接送區域

接下來我們就直接進行安裝的指令,首先進行更新

sudo apt-get update
sudo apt-get upgrade

安裝周邊的依賴

sudo apt-get -y install subversion autoconf debhelper flex libusb-dev libpcsclite-dev libpcsclite1 libccid pcscd pcsc-tools libpcsc-perl libusb-1.0-0-dev libtool libssl-dev cmake checkinstall

到 github.com 去下載 libnfc 程式碼安裝

wget https://github.com/nfc-tools/libnfc/releases/download/libnfc-1.7.0-rc7/libnfc-1.7.0-rc7.tar.gz

解壓縮

tar -xvzf libnfc-1.7.0-rc7.tar.gz
cd libnfc-1.7.0-rc7

設定環境以及開始安裝 libnfc

./configure --with-drivers=acr122_usb
make
sudo make install

到了這邊就安裝完成了,接下來可以利用 nfc-list 檢查一下,不過要先安裝好 nfc-list ,指令如下

sudo sh -c "echo /usr/local/lib > /etc/ld.so.conf.d/usr-local-lib.conf"
sudo ldconfig
sudo nfc-list

參考資料
ACR122U NFC USB READER ON A RASPBERRY PI