viet tts
v20241212

Vietttsは、自然な音声合成と堅牢な音声クローニングが可能な強力なベトナムTTSモデルをコミュニティに提供するオープンソースツールキットです。効果的な実験のために設計されたVietttsは、ベトナムの音声技術における研究と応用をサポートしています。
Vietttsは、Pythonインストーラー(Linuxのみ、WindowsとMacOSのサポートが近日中に登場)またはDockerを介してインストールできます。
git clone https://github.com/dangvansam/viet-tts.git
cd viet-tts
# (Optional) Install Python environment with conda, you could also use virtualenv
conda create --name viettts python=3.10
conda activate viettts
# Install
pip install -e . && pip cache purgeDocker、Nvidia Driver、Nvidia Container Toolkit、およびCudaをインストールします。
次のコマンドを実行します。
git clone https://github.com/dangvansam/viet-tts.git
cd viet-tts
# Build docker images
docker compose build
# Run with docker-compose - will create server at: http://localhost:8298
docker compose up -d
# Or run with docker run - will create server at: http://localhost:8298
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 | ドーレモン | ? | |
| 12 | Speechify_4 | ? | |
| 13 | ジャックスパロウ | ? | |
| 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 | ? |
Vietttsコマンドラインインターフェイス(CLI)を使用すると、端末から直接音声を迅速に生成できます。使用方法は次のとおりです。
# Usage
viettts --help
# Start API Server
viettts server --host 0.0.0.0 --port 8298
# List all built-in voices
viettts show-voices
# Synthesize speech from text with built-in voices
viettts synthesis --text " Xin chào " --voice 0 --output test.wav
# Clone voice from a local audio file
viettts synthesis --text " Xin chào " --voice Download/voice.wav --output cloned.wavOpenAIクライアントの環境変数を設定する必要があります。
# Set base_url and API key as environment variables
export OPENAI_BASE_URL=http://localhost:8298
export OPENAI_API_KEY=viet-tts # not use in current version入力テキストからスピーチを作成するには:
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' ) # Get all built-in voices
curl --location http://0.0.0.0:8298/v1/voices
# OpenAI format (bult-in 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
# API with voice from local file
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 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ライセンスの下でライセンスされています。ご不便をおかけして申し訳ございません。
上記のコンテンツは学術目的のみであり、技術的能力を実証することを目的としています。いくつかの例はインターネットから供給されています。コンテンツがあなたの権利を侵害している場合は、その削除を要求するためにお問い合わせください。