TTS MultiLingual
1.0.0
pip install TTS如果您打算编码或训练型号,请克隆TTS并在本地安装。
git clone https://github.com/saba99/TTS-MultiLingual
pip install -e .[all,dev,notebooks] # Select the relevant extras如果您在Ubuntu(Debian)上,也可以运行以下命令进行安装。
$ make system-deps # intended to be used on Ubuntu (Debian). Let us know if you have a different OS.
$ make install from TTS . api import TTS
# Running a multi-speaker and multi-lingual model
# List available TTS models and choose the first one
model_name = TTS . list_models ()[ 0 ]
# Init TTS
tts = TTS ( model_name )
# Run TTS
# Since this model is multi-speaker and multi-lingual, we must set the target speaker and the language
# Text to speech with a numpy output
wav = tts . tts ( "This is a test! This is also a test!!" , speaker = tts . speakers [ 0 ], language = tts . languages [ 0 ])
# Text to speech to a file
tts . tts_to_file ( text = "Hello world!" , speaker = tts . speakers [ 0 ], language = tts . languages [ 0 ], file_path = "output.wav" )
# Running a single speaker model
# Init TTS with the target model name
tts = TTS ( model_name = "tts_models/de/thorsten/tacotron2-DDC" , progress_bar = False , gpu = False )
# Run TTS
tts . tts_to_file ( text = "Ich bin eine Testnachricht." , file_path = OUTPUT_PATH )
# Example voice cloning with YourTTS in English, French and Portuguese:
tts = TTS ( model_name = "tts_models/multilingual/multi-dataset/your_tts" , progress_bar = False , gpu = True )
tts . tts_to_file ( "This is voice cloning." , speaker_wav = "my/cloning/audio.wav" , language = "en" , file_path = "output.wav" )
tts . tts_to_file ( "C'est le clonage de la voix." , speaker_wav = "my/cloning/audio.wav" , language = "fr-fr" , file_path = "output.wav" )
tts . tts_to_file ( "Isso é clonagem de voz." , speaker_wav = "my/cloning/audio.wav" , language = "pt-br" , file_path = "output.wav" )
# Example voice conversion converting speaker of the `source_wav` to the speaker of the `target_wav`
tts = TTS ( model_name = "voice_conversion_models/multilingual/vctk/freevc24" , progress_bar = False , gpu = True )
tts . voice_conversion_to_file ( source_wav = "my/source.wav" , target_wav = "my/target.wav" , file_path = "output.wav" )
# Example voice cloning by a single speaker TTS model combining with the voice conversion model. This way, you can
# clone voices by using any model in TTS.
tts = TTS ( "tts_models/de/thorsten/tacotron2-DDC" )
tts . tts_with_vc_to_file (
"Wie sage ich auf Italienisch, dass ich dich liebe?" ,
speaker_wav = "target/speaker.wav" ,
file_path = "ouptut.wav"
)
# Example text to speech using [Coqui Studio](https://coqui.ai) models. You can use all of your available speakers in the studio.
# [Coqui Studio](https://coqui.ai) API token is required. You can get it from the [account page](https://coqui.ai/account).
# You should set the `COQUI_STUDIO_TOKEN` environment variable to use the API token.
# If you have a valid API token set you will see the studio speakers as separate models in the list.
# The name format is coqui_studio/en/<studio_speaker_name>/coqui_studio
models = TTS (). list_models ()
# Init TTS with the target studio speaker
tts = TTS ( model_name = "coqui_studio/en/Torcull Diarmuid/coqui_studio" , progress_bar = False , gpu = False )
# Run TTS
tts . tts_to_file ( text = "This is a test." , file_path = OUTPUT_PATH )
# Run TTS with emotion and speed control
tts . tts_to_file ( text = "This is a test." , file_path = OUTPUT_PATH , emotion = "Happy" , speed = 1.5 )| 简短的例子 | 简短的例子 | 简短的例子 |
Rainbow.mp4 | Windy.mp4 | Windy-2.mp4 |
| 彩虹是一种气象现象,是由光的反射,折射和分散引起的 | 司机学到了他的教训。他再也不会在风中开车 | 外面的人们正在弯腰。风很难走路 |
| 漫长的例子 | 漫长的例子 | 漫长的例子 |
an.apple.pie.mp4 | cat.and.a.dog.mp4 | .farmer.mp4 |
| 树上充满了红苹果。农民骑着他的棕色马。他停在树下。他伸出手,从树枝上挑选了一个苹果。他咬住了生苹果。他喜欢苹果。他的马转过头看着他。农民从树上挑选了另一个苹果。他把它交给了马。马吃了生苹果。这匹马喜欢苹果。农民把十二个苹果放进一个袋子里。他骑马回家。他把马放在谷仓里。他走进他的房子。那只猫在他的腿上摩擦。他给猫一碗温暖的牛奶。 /TD> | 黑猫跳到椅子上。它低头看着白狗。狗在骨头上咀嚼。猫跳到狗上。狗不断咀嚼骨头。猫和狗的尾巴一起玩。狗不断咀嚼骨头。那只猫跳回椅子上。它开始舔爪子。狗站起来。它看着猫。它舔了舔猫的皮毛。猫舔了狗的鼻子。那只狗回到了骨头。一个男孩穿过房间。他穿着黄色衬衫。他几乎遇到了椅子。猫跳下椅子。猫跳到沙发上。 | 农民开着拖拉机。拖拉机挖了地面。他在地上种黄玉米。他在春天种黄色玉米。玉米在夏天生长。雨有助于玉米生长。如果没有雨,玉米就会死。如果有很多雨,有很多玉米。他在夏末收获黄玉米。他在蔬菜摊上出售玉米。他卖了一只耳朵的25美分。他以1美元的价格出售四只耳朵。他在短短一个月内就出售了所有玉米。邻居爱他的玉米。玉米是新鲜的。它是明亮的黄色。好吃。很美味。鸟也爱他的玉米。他们不付钱。他们在野外吃 |
| 多语言支持:英语 | 多语言支持:法语 | 多语言支持:荷兰 |
雨和hail.mp4 | fr-rain.and.hail.mp4 | nl-rain.and.hail.mp4 |
| 乌云在天空中。太阳下山了。天气很冷。风开始吹。离开树木。纸飞过空中。人们扣了夹克。雨开始下降。起初,这很安静。然后大声 | unarcoíriso arco iris es unfenómenooptico ymeteorológicoque cone n la aapariciónenen el e el cielo de un arco de un arco de luz多色 | Een Regenboog是Een Gekleurde Cirkelboog Die Aan de Hemel Waargenomen Kan Worden Als de,Laagstaande |
tts 列表提供的模型:
$ tts --list_models
获取模型信息(用于tts_models和vocoder_models):
```
$ tts --model_info_by_name tts_models/tr/common-voice/glow-tts
```
```
$ tts --model_info_by_name vocoder_models/en/ljspeech/hifigan_v2
```
使用默认模型运行TT:
例如:
$ tts --text "Text for TTS" --model_name "tts_models/en/ljspeech/glow-tts" --out_path output/path/speech.wav
运行自己的多演讲者TTS模型:
$ tts --text "Text for TTS" --out_path output/path/speech.wav --model_path path/to/model.pth --config_path path/to/config.json --speakers_file_path path/to/speaker.json --speaker_idx <speaker_id>
|- notebooks/ (Jupyter Notebooks for model evaluation, parameter selection and data analysis.)
|- utils/ (common utilities.)
|- TTS
|- bin/ (folder for all the executables.)
|- train*.py (train your target model.)
|- ...
|- tts/ (text to speech models)
|- layers/ (model layer definitions)
|- models/ (model definitions)
|- utils/ (model specific utilities.)
|- speaker_encoder/ (Speaker Encoder models.)
|- (same)
|- vocoder/ (Vocoder models.)
|- (same)