Edge TTS
v1.0.0

Edge-TTS是Microsoft Edge的文本到語音(TTS)服務的快速實現。該庫提供了一個簡單易用的API接口,使開發人員可以將高質量的文本對語音功能無縫整合到Apple Platform應用程序中。
日本語ドキュメント| 中文文檔| 한국어한국어
將以下依賴項添加到您的軟件包。 Swift文件:
dependencies: [
. package ( url : " https://github.com/brewusinc/edge-tts.git " , from : " 1.0.0 " )
] import EdgeTTS
// Create TTS instance
let tts = EdgeTTS ( config : Configure (
voice : " en-US-JennyNeural " ,
rate : " +0% " ,
pitch : " +0Hz " ,
volume : " +0% " ,
saveJSON : true , // Enable JSON metadata export
saveSRT : true , // Enable SRT subtitle export
boundaryType : . sentence // Use sentence boundary (.word for word boundary)
) )
// Async conversion
Task {
do {
try await tts . ttsPromise ( text : " Hello, World! " , audioPath : " output.mp3 " )
print ( " Conversion completed " )
} catch {
print ( " Conversion failed: ( error ) " )
}
}CLI工具提供了兩個主要命令: list和speak 。
# List all available voices
edge-tts-cli list
# List voices with proxy
edge-tts-cli list --proxy http://host:port # Basic usage with text
edge-tts-cli speak --text " Hello, World! " --output hello.mp3
# Read text from file
edge-tts-cli speak --file input.txt --output hello.mp3
# Specify voice and language
edge-tts-cli speak --text " Hello, World! " --voice en-US-JennyNeural --lang en-US --output hello.mp3
# Adjust speech parameters
edge-tts-cli speak --text " Hello, World! " --rate +50% --pitch +10Hz --volume +20% --output hello.mp3
# Enable JSON and SRT export
edge-tts-cli speak --text " Hello, World! " --save-json --save-srt --output hello.mp3
# Set boundary type
edge-tts-cli speak --text " Hello, World! " --boundary word --output hello.mp3
# Use proxy
edge-tts-cli speak --text " Hello, World! " --proxy http://host:port --output hello.mp3 speak命令的可用選項:
--text :講話--file :輸入文本文件路徑--voice :使用的聲音(默認:En-us-Jennyneural)--lang :要使用的語言(默認:en-us)--rate :語音率(例如 +0%,-10%)--pitch :語音音調(例如 +0Hz,-10Hz)--volume :語音量(例如 +0%,-10%)--boundary :邊界類型(句子或單詞,默認:句子)--save-json :將計時信息保存為JSON--save-srt :將定時信息保存為SRT--proxy :代理URL(例如http://主機:端口)--output :輸出文件名(默認:output.mp3)您可以使用以下方式獲取支持的聲音列表
let voices = try await tts . fetchVoices ( )流行的英語聲音包括:
我們歡迎所有形式的貢獻,包括但不限於:
此項目已根據MIT許可證獲得許可 - 有關詳細信息,請參見許可證。 TXT文件。