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)