diff --git a/README.md b/README.md index 30eb161..0028850 100644 --- a/README.md +++ b/README.md @@ -229,6 +229,12 @@ python tts.py --device cuda # will use the NVIDIA GPU python tts.py --device xpu # will use the Intel GPU ``` +If you want to use a voice for a different language text (e.g., Japanese voice for English text) you can use `--force_lang` + +```bash +python tts.py -v jf_alpha "Hello there!" --force_lang a +``` + ## Demo Outputs ### Voice: pro (ah_heart) diff --git a/tts.py b/tts.py index 280ef17..57ce710 100644 --- a/tts.py +++ b/tts.py @@ -58,6 +58,13 @@ def parse_args(): default="pro", help="Voice to use (pro, hot, asmr, brit)", ) + parser.add_argument( + "--force_lang", + required=False, + type=str, + default="a", + help="Force language code", + ) parser.add_argument( "--input_file", "-i", @@ -167,7 +174,8 @@ def main(): name = name.replace("\\", "_") name = name.replace("/", "_") - lang_code = voice[0] + lang_code = args.force_lang if args.force_lang else voice[0] + pipeline = KPipeline(lang_code=lang_code, device=args.device, repo_id='hexgrad/Kokoro-82M') '''