silero tts enhanced
0.0.5
ReadMe มีให้บริการในภาษาต่อไปนี้:
Silero TTS เป็นไลบรารี Python ที่ให้วิธีง่ายๆในการสังเคราะห์คำพูดจากข้อความโดยใช้โมเดล Silero TTS ภาษาและลำโพงต่างๆ มันสามารถใช้เป็นสคริปต์แบบสแตนด์อโลนหรือรวมเข้ากับโครงการ Python ของคุณเอง
pip install silero-tts
โคลนที่เก็บ:
git clone https://github.com/daswer123/silero-tts-enhanced
ติดตั้งการพึ่งพาที่ต้องการ:
pip install -r requirements.txt
คุณสามารถใช้ Silero TTS เป็นสคริปต์แบบสแตนด์อโลนเพื่อสังเคราะห์คำพูดจากไฟล์ข้อความหรือไดเรกทอรีที่มีไฟล์ข้อความ
python -m silero_tts [options]
--list-models : รายการรุ่นที่มีอยู่--list-speakers : รายการลำโพงที่มีอยู่สำหรับรุ่น--language LANGUAGE : ระบุรหัสภาษา (จำเป็น)--model MODEL : ระบุ ID รุ่น (ค่าเริ่มต้น: เวอร์ชันล่าสุดสำหรับภาษา)--speaker SPEAKER : ระบุชื่อลำโพง (ค่าเริ่มต้น: ลำโพงแรกที่มีอยู่สำหรับรุ่น)--sample-rate SAMPLE_RATE : ระบุอัตราตัวอย่าง (ค่าเริ่มต้น: 48000)--device DEVICE : ระบุอุปกรณ์ที่จะใช้ (ค่าเริ่มต้น: CPU)--text TEXT : ระบุข้อความเพื่อสังเคราะห์--input-file INPUT_FILE : ระบุไฟล์ข้อความอินพุตเพื่อสังเคราะห์--input-dir INPUT_DIR : ระบุไดเรกทอรีอินพุตพร้อมไฟล์ข้อความเพื่อสังเคราะห์--output-file OUTPUT_FILE : ระบุไฟล์เสียงเอาต์พุต (ค่าเริ่มต้น: output.wav)--output-dir OUTPUT_DIR : ระบุไดเรกทอรีเอาต์พุตสำหรับไฟล์เสียงสังเคราะห์ (ค่าเริ่มต้น: เอาต์พุต)--log-level INFO : ระบุระดับบันทึกคุณสามารถปิดการใช้งานไม่มีค่า (ค่าเริ่มต้น: ข้อมูล) สังเคราะห์คำพูดจากข้อความ:
python silero_tts.py --language ru --text "Привет, мир!"
สังเคราะห์คำพูดจากไฟล์ข้อความ:
python silero_tts.py --language en --input-file input.txt --output-file output.wav
สังเคราะห์คำพูดจากไฟล์ข้อความหลายไฟล์ในไดเรกทอรี:
python silero_tts.py --language es --input-dir texts --output-dir audio
นอกจากนี้คุณยังสามารถรวม Silero TTS เข้ากับโครงการ Python ของคุณเองโดยการนำเข้าคลาส SileroTTS และใช้วิธีการของมัน
from silero_tts . silero_tts import SileroTTS
# Get available models
models = SileroTTS . get_available_models ()
print ( "Available models:" , models )
# Get available languages
languages = SileroTTS . get_available_languages ()
print ( "Available languages:" , languages )
# Get the latest model for a specific language
latest_model = SileroTTS . get_latest_model ( 'ru' )
print ( "Latest model for Russian:" , latest_model )
# Get available sample rates for a specific model and language
sample_rates = SileroTTS . get_available_sample_rates_static ( 'ru' , latest_model )
print ( "Available sample rates for the latest Russian model:" , sample_rates )
# Initialize the TTS object
tts = SileroTTS ( model_id = 'v3_en' , language = 'en' , speaker = 'en_2' , sample_rate = 48000 , device = 'cpu' )
# Synthesize speech from text
text = "Hello world!"
tts . tts ( text , 'output.wav' )
# Synthesize speech from a text file
# tts.from_file('input.txt', 'output.wav')
# Get available speakers for the current model
speakers = tts . get_available_speakers ()
print ( "Available speakers for the current model:" , speakers )
# Change the language
tts . change_language ( 'en' )
print ( "Language changed to:" , tts . language )
print ( "New model ID:" , tts . model_id )
print ( "New available speakers:" , tts . get_available_speakers ())
# Change the model
tts . change_model ( 'v3_en' )
print ( "Model changed to:" , tts . model_id )
print ( "New available speakers:" , tts . get_available_speakers ())
# Change the speaker
tts . change_speaker ( 'en_0' )
print ( "Speaker changed to:" , tts . speaker )
# Change the sample rate
tts . change_sample_rate ( 24000 )
print ( "Sample rate changed to:" , tts . sample_rate )Silero TTS CLI มีคุณสมบัติต่อไปนี้:
--language เพื่อสังเคราะห์คำพูดในภาษาที่ต้องการ--model ธงหรือปล่อยให้ CLI เลือกรุ่นล่าสุดสำหรับภาษาที่ระบุโดยอัตโนมัติ--speaker หรือใช้ลำโพงเริ่มต้นสำหรับรุ่นที่เลือก--sample-rate--device อุปกรณ์--text แฟล็กหรือระบุไฟล์ข้อความอินพุตโดยใช้ค่าสถานะ --input-file--input-dir ธง--output-file ธงหรือไดเรกทอรีเอาต์พุตสำหรับการประมวลผลแบบแบตช์โดยใช้ธง --output-dir--list-models--list-speakers โครงการนี้ได้รับใบอนุญาตภายใต้ใบอนุญาต MIT