-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The tts_to_file and tts methods of TTS/api.py themselves support the …
…speed parameter, but the internal tts method and synthesizer.tts method do not pass the speed parameter, resulting in the speed parameter being meaningless. After adding it, the speaking speed change function can be used normally.
- Loading branch information
qwq
committed
Apr 15, 2024
1 parent
dbf1a08
commit 4b8fde6
Showing
2 changed files
with
21 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import torch | ||
from TTS.api import TTS | ||
|
||
# Get device | ||
device = "cuda" if torch.cuda.is_available() else "cpu" | ||
|
||
# List available 🐸TTS models | ||
print(TTS().list_models()) | ||
|
||
# Init TTS | ||
tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2").to(device) | ||
|
||
# Run TTS | ||
# ❗ Since this model is multi-lingual voice cloning model, we must set the target speaker_wav and language | ||
# Text to speech list of amplitude values as output | ||
# wav = tts.tts(text="Hello world!", speaker_wav="my/cloning/audio.wav", language="en") | ||
# Text to speech to a file | ||
# The tts_to_file and tts methods of TTS/api.py themselves support the speed parameter, but the internal tts method and synthesizer.tts method do not pass the speed parameter, resulting in the speed parameter being meaningless. After adding it, the speaking speed change function can be used normally. | ||
tts.tts_to_file(text="Hello world!", speaker_wav="my/cloning/audio.wav", language="en", file_path="output.wav", speed=0.5) |