🚀 VietTTS: オープンソースのベトナム語テキスト読み上げシステム
VietTTS は、ベトナム語の自然な音声合成と強力な音声クローニング機能を持つ、オープンソースのツールキットです。ベトナム語音声技術の研究やアプリケーション開発に最適です。
VietTTS: An Open-Source Vietnamese Text to Speech
✨ 主な機能
- TTS:プロンプトオーディオを使用して任意の声でテキストを音声に変換
- OpenAI-API互換:OpenAIのText-to-Speech API形式と互換性があります
📦 インストール
VietTTSは、Pythonインストーラー(Linuxのみ、WindowsとmacOSのサポートは間もなく提供予定)またはDockerを使用してインストールできます。
Pythonインストーラー (Python>=3.10)
git clone https://github.com/dangvansam/viet-tts.git
cd viet-tts
conda create --name viettts python=3.10
conda activate viettts
pip install -e . && pip cache purge
Docker
- Docker、NVIDIA Driver、NVIDIA Container Toolkit、およびCUDAをインストールします。
- 以下のコマンドを実行します:
git clone https://github.com/dangvansam/viet-tts.git
cd viet-tts
docker compose build
docker compose up -d
docker run -itd --gpu=alls -p 8298:8298 -v ./pretrained-models:/app/pretrained-models -n viet-tts-service viet-tts:latest viettts server --host 0.0.0.0 --port 8298
💻 使用例
組み込み音声 🤠
以下の利用可能な音声を使用して音声合成を行うことができます。
展開
ID |
音声 |
性別 |
音声再生 |
1 |
nsnd-le-chuc |
👨 |
|
2 |
speechify_10 |
👩 |
|
3 |
atuan |
👨 |
|
4 |
speechify_11 |
👩 |
|
5 |
cdteam |
👨 |
|
6 |
speechify_12 |
👩 |
|
7 |
cross_lingual_prompt |
👩 |
|
8 |
speechify_2 |
👩 |
|
9 |
diep-chi |
👨 |
|
10 |
speechify_3 |
👩 |
|
11 |
doremon |
👨 |
|
12 |
speechify_4 |
👩 |
|
13 |
jack-sparrow |
👨 |
|
14 |
speechify_5 |
👩 |
|
15 |
nguyen-ngoc-ngan |
👩 |
|
16 |
speechify_6 |
👩 |
|
17 |
nu-nhe-nhang |
👩 |
|
18 |
speechify_7 |
👩 |
|
19 |
quynh |
👩 |
|
20 |
speechify_8 |
👩 |
|
21 |
speechify_9 |
👩 |
|
22 |
son-tung-mtp |
👨 |
|
23 |
zero_shot_prompt |
👩 |
|
24 |
speechify_1 |
👩 |
|
コマンドラインインターフェイス (CLI)
VietTTSのコマンドラインインターフェイス (CLI) を使用すると、ターミナルから直接音声をすぐに生成できます。使い方は次のとおりです:
viettts --help
viettts server --host 0.0.0.0 --port 8298
viettts show-voices
viettts synthesis --text "Xin chào" --voice 0 --output test.wav
viettts synthesis --text "Xin chào" --voice Download/voice.wav --output cloned.wav
APIクライアント
Python (OpenAIクライアント)
OpenAIクライアントの環境変数を設定する必要があります:
export OPENAI_BASE_URL=http://localhost:8298
export OPENAI_API_KEY=viet-tts
入力テキストから音声を作成するには:
from pathlib import Path
from openai import OpenAI
client = OpenAI()
output_file_path = Path(__file__).parent / "speech.wav"
with client.audio.speech.with_streaming_response.create(
model='tts-1',
voice='cdteam',
input='Xin chào Việt Nam.',
speed=1.0,
response_format='wav'
) as response:
response.stream_to_file('a.wav')
CURL
curl --location http://0.0.0.0:8298/v1/voices
curl http://localhost:8298/v1/audio/speech \
-H "Authorization: Bearer viet-tts" \
-H "Content-Type: application/json" \
-d '{
"model": "tts-1",
"input": "Xin chào Việt Nam.",
"voice": "son-tung-mtp"
}' \
--output speech.wav
curl --location http://0.0.0.0:8298/v1/tts \
--form 'text="xin chào"' \
--form 'audio_file=@"/home/viettts/Downloads/voice.mp4"' \
--output speech.wav
Node
import fs from "fs";
import path from "path";
import OpenAI from "openai";
const openai = new OpenAI();
const speechFile = path.resolve("./speech.wav");
async function main() {
const mp3 = await openai.audio.speech.create({
model: "tts-1",
voice: "1",
input: "Xin chào Việt Nam.",
});
console.log(speechFile);
const buffer = Buffer.from(await mp3.arrayBuffer());
await fs.promises.writeFile(speechFile, buffer);
}
main();
🙏 謝辞
📄 ライセンス
VietTTS のソースコードは Apache 2.0ライセンス の下で公開されています。事前学習モデルと音声サンプルは、実環境のデータセットに基づいて CC BY-NCライセンス の下でライセンスされています。ご不便をおかけして申し訳ありません。
⚠️ 免責事項
上記の内容は学術目的のみで提供されており、技術的な機能を示すことを目的としています。一部の例はインターネットから取得しています。もし何らかの内容があなたの権利を侵害している場合は、削除を要求するために私たちに連絡してください。
💬 連絡先
- Facebook: https://fb.com/sam.rngd
- GitHub: https://github.com/dangvansam
- Email: dangvansam98@gmail.com