High-Quality Voice Cloning TTS for 600+ Languages
Python
Fix non-verbal generation (#35)
Han Zhub83ff91730db
diff --git a/README.md b/README.mdindex 9cfe01b..405a2b4 100644--- a/README.md+++ b/README.md@@ -14,17 +14,18 @@<a href="https://zhu-han.github.io/omnivoice"><img src="https://img.shields.io/badge/GitHub.io-Demo_Page-blue?logo=GitHub&style=flat-square"></a></p>-OmniVoice is a state-of-the-art zero-shot multilingual TTS model supporting more than 600 languages. Built on a novel diffusion language model architecture, it generates high-quality speech with superior inference speed, supporting voice cloning and voice design.+OmniVoice is a state-of-the-art massive multilingual zero-shot text-to-speech (TTS) model supporting over 600 languages. Built on a novel diffusion language model-style architecture, it generates high-quality speech with superior inference speed, supporting voice cloning and voice design.**Contents**: [Key Features](#key-features) | [Installation](#installation) | [Quick Start](#quick-start) | [Python API](#python-api) | [Command-Line Tools](#command-line-tools) | [Training & Evaluation](#training--evaluation) | [Discussion](#discussion--communication) | [Citation](#citation)## Key Features-- **600+ Languages Supported**: The broadest language coverage among zero-shot TTS models ([full list](docs/languages.md))+- **600+ Languages Supported**: The broadest language coverage among zero-shot TTS models ([full list](docs/languages.md)).- **Voice Cloning**: State-of-the-art voice cloning quality.- **Voice Design**: Control voices via assigned speaker attributes (gender, age, pitch, dialect/accent, whisper, etc.).+- **Fine-grained Control**: Non-verbal symbols (e.g., `[laughter]`) and pronunciation correction via pinyin or phonemes.- **Fast Inference**: RTF as low as 0.025 (40x faster than real-time).-- **Diffusion Language Model Architecture**: A clean, streamlined, and scalable design that delivers both quality and speed.+- **Diffusion Language Model-Style Architecture**: A clean, streamlined, and scalable design that delivers both quality and speed.---@@ -104,7 +105,7 @@ For full usage, see the [Python API](#python-api) and [Command-Line Tools](#comm## Python API-The OmniVoice model supports three generation modes. All features in this section are also available via [command-line tools](#command-line-tools).+OmniVoice supports three generation modes. All features in this section are also available via [command-line tools](#command-line-tools).### Voice Cloning@@ -177,7 +178,7 @@ See more detailed control in [docs/generation-parameters.md](docs/generation-par### Non-Verbal & Pronunciation Control-OmniVoice supports inline **non-verbal symbols** and **pronunciation hints** within the input text.+OmniVoice supports inline **non-verbal symbols** and **pronunciation correction** within the input text.**Non-verbal symbols**: Insert tags like `[laughter]` directly in the text to add expressive non-verbal sounds.@@ -185,7 +186,7 @@ OmniVoice supports inline **non-verbal symbols** and **pronunciation hints** witaudio = model.generate(text="[laughter] You really got me. I didn't see that coming at all.")```-Supported tags: `[laughter]`, `[confirmation-en]`, `[question-en]`, `[question-ah]`, `[question-oh]`, `[question-ei]`, `[question-yi]`, `[surprise-ah]`, `[surprise-oh]`, `[surprise-wa]`, `[surprise-yo]`, `[dissatisfaction-hnn]`, `[sniff]`, `[sigh]`+Supported tags: `[laughter]`, `[sigh]`, `[confirmation-en]`, `[question-en]`, `[question-ah]`, `[question-oh]`, `[question-ei]`, `[question-yi]`, `[surprise-ah]`, `[surprise-oh]`, `[surprise-wa]`, `[surprise-yo]`, `[dissatisfaction-hnn]`.**Pronunciation control (Chinese)**: Use pinyin with tone numbers to correct specific character pronunciations.diff --git a/docs/generation-parameters.md b/docs/generation-parameters.mdindex 6efc7f8..6ddef0d 100644--- a/docs/generation-parameters.md+++ b/docs/generation-parameters.md@@ -58,6 +58,8 @@ Priority: `duration` > `speed`.## Long-Form Generation+To support stable long-form speech generation with low VRAM consumption, the text is automatically split into smaller segments when the estimated duration of the generated speech exceeds `audio_chunk_duration`, with each segment producing approximately `audio_chunk_duration` seconds of audio. This approach allows the model to accept arbitrarily long text and generate arbitrarily long speech with near-constant VRAM consumption.+| Parameter | Type | Default | Description ||---|---|---|---|| `audio_chunk_duration` | float | 15.0 | Target chunk duration (seconds) when splitting long text. |diff --git a/omnivoice/cli/demo.py b/omnivoice/cli/demo.pyindex 7d90ba0..492e5ca 100644--- a/omnivoice/cli/demo.py+++ b/omnivoice/cli/demo.py@@ -243,8 +243,8 @@ def build_demo(def _gen_settings():with gr.Accordion("Generation Settings (optional)", open=False):sp = gr.Slider(- 0.7,- 1.3,+ 0.5,+ 1.5,value=1.0,step=0.05,label="Speed",diff --git a/omnivoice/models/omnivoice.py b/omnivoice/models/omnivoice.pyindex 3874cce..6385169 100644--- a/omnivoice/models/omnivoice.py+++ b/omnivoice/models/omnivoice.py@@ -1056,7 +1056,7 @@ class OmniVoice(PreTrainedModel):# Build style tokens: <|denoise|> + <|lang_start|>...<|lang_end|># + <|instruct_start|>...<|instruct_end|>style_text = ""- if denoise:+ if denoise and ref_audio_tokens is not None:style_text += "<|denoise|>"lang_str = lang if lang else "None"instruct_str = instruct if instruct else "None"@@ -1131,6 +1131,17 @@ class OmniVoice(PreTrainedModel):B = task.batch_size+ for i in range(B):+ logger.debug(+ "Item %d — text: %s | ref_text: %s | instruct: %s | lang: %s | target_tokens: %d",+ i,+ task.texts[i],+ task.ref_texts[i],+ task.instructs[i],+ task.langs[i],+ task.target_lens[i],+ )+inputs_list = [self._prepare_inference_inputs(task.texts[i],@@ -1494,6 +1505,17 @@ def _combine_text(text, ref_text: Optional[str] = None) -> str:chinese_range = r"[\u4e00-\u9fff]"pattern = rf"(?<={chinese_range})\s+|\s+(?={chinese_range})"full_text = re.sub(pattern, "", full_text)++ # Remove whitespace immediately before special emotion tags (except+ # [laughter]). During training these tags have no preceding space, so+ # the text tokenizer would mis-tokenise them if spaces were present.+ _EMOTION_TAGS = (+ r"sigh|confirmation-en|question-en|question-ah|question-oh|"+ r"question-ei|question-yi|surprise-ah|surprise-oh|surprise-wa|"+ r"surprise-yo|dissatisfaction-hnn"+ )+ full_text = re.sub(rf"\s+(\[({_EMOTION_TAGS})\])", r"\1", full_text)+return full_text