Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
634fcf2
Add full MOSS tokenizer codec and streaming decode + some scaffolding
voxmenthe Feb 13, 2026
df330b5
fix codec decode issues and clean up scaffold + misc
voxmenthe Feb 13, 2026
6a8742d
fix decode layout normalization and replace tests
voxmenthe Feb 13, 2026
867689f
Added full runtime modules for text to backbone to local transformer …
voxmenthe Feb 13, 2026
faf32e0
Fixes and runtime scaffolding
voxmenthe Feb 13, 2026
65ad946
Code fixes to unblock real-model test runs
voxmenthe Feb 13, 2026
1a2dc73
update model hf
voxmenthe Feb 14, 2026
1a05642
code and test stabilization
voxmenthe Feb 14, 2026
eb36d46
Stabilization for stream sinc contract and waveform normalization
voxmenthe Feb 14, 2026
e011bb3
add duration and local VQ inference controls for Moss TTS
voxmenthe Feb 14, 2026
c1adc0c
add fixtures
voxmenthe Feb 14, 2026
a15d24c
add moss fixtures
voxmenthe Feb 14, 2026
7407487
fixed decode-layout tie resolution
voxmenthe Feb 14, 2026
a18c294
Implemented new isolated runtime package
voxmenthe Feb 14, 2026
99b2795
add runtime gate coverage and and fix santize remaps and add realtime…
voxmenthe Feb 14, 2026
f7059ce
fix decode/crossfade bugs
voxmenthe Feb 14, 2026
8265d60
add segmented long-form generation with bounded continuity and test c…
voxmenthe Feb 15, 2026
f16e7eb
Enable segmented long-form generation to stream chunk results while p…
voxmenthe Feb 15, 2026
5ca281a
harden codec tie handling and realtime load/prefill contracts
voxmenthe Feb 15, 2026
dd9eea3
add MOSS preset registry and complete CLI/server promotion for missin…
voxmenthe Feb 15, 2026
caaea27
add multilingual evidence tests and readme
voxmenthe Feb 15, 2026
8bc3b04
restore true incremental streaming for moss_tts_realtime and fix squa…
voxmenthe Feb 15, 2026
ea66dc3
update moss documentation and add convert script
voxmenthe Feb 15, 2026
2f7010c
a few fixes and tests
voxmenthe Feb 15, 2026
184367c
align realtime prompt/sampling behavior and document new session cont…
voxmenthe Feb 15, 2026
0a2e18b
Implemented input/pronunciation semantics end-to-end and updated docs.
voxmenthe Feb 15, 2026
61c1cbe
update docs and add moss showcase examples
voxmenthe Feb 15, 2026
8db516f
TTSD continuation and realtime session fixes
voxmenthe Feb 15, 2026
bf9f476
harden realtime stream assembly and speech kwargs validation
voxmenthe Feb 15, 2026
c5ca558
apply black and isort formatting
voxmenthe Feb 15, 2026
4208deb
chore: update pre-commit hooks
voxmenthe Feb 15, 2026
21ae2c0
black isort formatting
voxmenthe Feb 15, 2026
ad4f5a7
add deterministic generation recipes and seedable CLI controls
voxmenthe Feb 15, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ repos:
hooks:
- id: black
- repo: https://github.com/pycqa/isort
rev: 5.13.2
rev: 7.0.0
hooks:
- id: isort
args:
Expand Down
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ for result in model.generate("Hello from MLX-Audio!", voice="af_heart"):
|-------|-------------|-----------|------|
| **Kokoro** | Fast, high-quality multilingual TTS | EN, JA, ZH, FR, ES, IT, PT, HI | [mlx-community/Kokoro-82M-bf16](https://huggingface.co/mlx-community/Kokoro-82M-bf16) |
| **Qwen3-TTS** | Alibaba's multilingual TTS with voice design | ZH, EN, JA, KO, + more | [mlx-community/Qwen3-TTS-12Hz-1.7B-VoiceDesign-bf16](https://huggingface.co/mlx-community/Qwen3-TTS-12Hz-1.7B-VoiceDesign-bf16) |
| **MOSS-TTS Family** | Delay/Local/TTSD/VoiceGenerator/SoundEffect/Realtime | Multilingual + pinyin/ipa input modes | [OpenMOSS-Team/MOSS-TTS](https://huggingface.co/OpenMOSS-Team/MOSS-TTS) |
| **CSM** | Conversational Speech Model with voice cloning | EN | [mlx-community/csm-1b](https://huggingface.co/mlx-community/csm-1b) |
| **Dia** | Dialogue-focused TTS | EN | [mlx-community/Dia-1.6B-fp16](https://huggingface.co/mlx-community/Dia-1.6B-fp16) |
| **OuteTTS** | Efficient TTS model | EN | [mlx-community/OuteTTS-1.0-0.6B-fp16](https://huggingface.co/mlx-community/OuteTTS-1.0-0.6B-fp16) |
Expand Down Expand Up @@ -173,6 +174,16 @@ audio = results[0].audio # mx.array

See the [Qwen3-TTS README](mlx_audio/tts/models/qwen3_tts/README.md) for voice cloning, CustomVoice, VoiceDesign, and all available models.

### MOSS-TTS Family

OpenMOSS MOSS-TTS variants are available through the unified MOSS runtime (`moss_tts` and `moss_tts_realtime` model packages), including Delay, Local, TTSD, VoiceGenerator, SoundEffect, and Realtime.

See the [MOSS-TTS README](mlx_audio/tts/models/moss_tts/README.md) for presets, CLI recipes, and parity artifacts.
Pronunciation-control guidance (tone-numbered pinyin, `/.../`-wrapped IPA, and optional helper conversion flows) is covered there and in [`examples/moss_tts_pronunciation_control.py`](examples/moss_tts_pronunciation_control.py).
Phase 7 showcase scripts include [`examples/moss_tts_continuation_showcase.py`](examples/moss_tts_continuation_showcase.py), [`examples/moss_tts_realtime_multiturn_agent.py`](examples/moss_tts_realtime_multiturn_agent.py), and [`examples/moss_tts_showcase_album.py`](examples/moss_tts_showcase_album.py).
For realtime session controls (voice-prompt API, prompt packing, repetition-window sampling), see [MOSS-TTS-Realtime README](mlx_audio/tts/models/moss_tts_realtime/README.md).
For architecture details and runtime contracts, see [`TECHNICAL_OVERVIEW.md`](mlx_audio/tts/models/moss_tts/TECHNICAL_OVERVIEW.md) and [`moss_tts_realtime/TECHNICAL_OVERVIEW.md`](mlx_audio/tts/models/moss_tts_realtime/TECHNICAL_OVERVIEW.md).

### CSM (Voice Cloning)

Clone any voice using a reference audio sample:
Expand Down
97 changes: 97 additions & 0 deletions examples/moss_sound_effects.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
#!/usr/bin/env python
"""Sound-effect generation with MOSS-SoundEffect.

This example demonstrates ambient and event-conditioned generation for the
SoundEffect variant.

Usage:
uv run python examples/moss_sound_effects.py
uv run python examples/moss_sound_effects.py --ambient-sound "busy cafe" --sound-event "cups clinking"
"""

from __future__ import annotations

import argparse

from mlx_audio.tts.generate import generate_audio


def parse_args() -> argparse.Namespace:
parser = argparse.ArgumentParser(description="MOSS-SoundEffect example")
parser.add_argument(
"--model",
default="OpenMOSS-Team/MOSS-SoundEffect",
help="SoundEffect model id or local path",
)
parser.add_argument(
"--ambient-sound",
default="Thunder and rain over a city street.",
help="Ambient scene description",
)
parser.add_argument(
"--sound-event",
default="storm",
help="Primary sound event cue",
)
parser.add_argument(
"--quality",
default="high",
help="Quality hint",
)
parser.add_argument(
"--preset",
default="soundeffect",
help="Sampling preset",
)
parser.add_argument(
"--tokens",
type=int,
default=140,
help="Target token budget",
)
parser.add_argument(
"--max-tokens",
type=int,
default=260,
help="Safety cap for generation",
)
parser.add_argument(
"--output-dir",
default="outputs/moss_sound_effects",
help="Directory for generated outputs",
)
parser.add_argument(
"--file-prefix",
default="sound_effect",
help="Output filename prefix",
)
parser.add_argument(
"--verbose",
action="store_true",
help="Print runtime stats",
)
return parser.parse_args()


def main() -> None:
args = parse_args()
# `text` is intentionally omitted: generate_audio() mirrors CLI behavior and
# backfills `text` from `ambient_sound` when needed for SoundEffect prompts.
generate_audio(
text=None,
model=args.model,
preset=args.preset,
ambient_sound=args.ambient_sound,
sound_event=args.sound_event,
quality=args.quality,
tokens=args.tokens,
max_tokens=args.max_tokens,
output_path=args.output_dir,
file_prefix=args.file_prefix,
verbose=args.verbose,
play=False,
)


if __name__ == "__main__":
main()
141 changes: 141 additions & 0 deletions examples/moss_tts_basic.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
#!/usr/bin/env python
"""Basic MOSS-TTS usage for Local/Delay checkpoints.

This example demonstrates:
- canonical model loading through `mlx_audio.tts.generate.generate_audio`
- variant presets (`moss_tts_local`, `moss_tts`)
- `tokens` / `duration_s` control
- input representation (`text`, `pinyin`, `ipa`)
- optional streaming output
- Local-only `n_vq_for_inference` override

Usage:
uv run python examples/moss_tts_basic.py
uv run python examples/moss_tts_basic.py --model OpenMOSS-Team/MOSS-TTS --preset moss_tts
uv run python examples/moss_tts_basic.py --input-type pinyin --text "ni hao, huan ying shi yong MOSS"
uv run python examples/moss_tts_basic.py --stream --streaming-interval 0.5
"""

from __future__ import annotations

import argparse

from mlx_audio.tts.generate import generate_audio


def parse_args() -> argparse.Namespace:
parser = argparse.ArgumentParser(description="Basic MOSS-TTS generation example")
parser.add_argument(
"--model",
default="OpenMOSS-Team/MOSS-TTS-Local-Transformer",
help="MOSS model id or local path",
)
parser.add_argument(
"--text",
default="Hello from the MOSS-TTS MLX runtime.",
help="Input text",
)
parser.add_argument(
"--preset",
default="moss_tts_local",
help="Sampling preset (e.g. moss_tts_local, moss_tts)",
)
parser.add_argument(
"--input-type",
choices=["text", "pinyin", "ipa"],
default="text",
help="Input representation for supported models",
)
parser.add_argument(
"--language",
default=None,
help="Optional language hint",
)
parser.add_argument(
"--instruct",
default=None,
help="Optional instruction/style hint",
)
parser.add_argument(
"--quality",
default="balanced",
help="Quality hint (draft/balanced/high/max/custom:...)",
)
parser.add_argument(
"--tokens",
type=int,
default=None,
help="Target token budget (takes precedence over --duration-s)",
)
parser.add_argument(
"--duration-s",
type=float,
default=8.0,
help="Duration hint in seconds when --tokens is not provided",
)
parser.add_argument(
"--max-tokens",
type=int,
default=240,
help="Safety cap for generation loop",
)
parser.add_argument(
"--n-vq-for-inference",
type=int,
default=None,
help="Local-only depth override (1..n_vq)",
)
parser.add_argument(
"--stream",
action="store_true",
help="Emit and save stream chunks instead of one merged clip",
)
parser.add_argument(
"--streaming-interval",
type=float,
default=0.5,
help="Chunk interval in seconds for streaming mode",
)
parser.add_argument(
"--output-dir",
default="outputs/moss_tts_basic",
help="Directory for generated audio",
)
parser.add_argument(
"--file-prefix",
default="basic",
help="Output filename prefix",
)
parser.add_argument(
"--verbose",
action="store_true",
help="Print runtime stats for each generated segment",
)
return parser.parse_args()


def main() -> None:
args = parse_args()
generate_audio(
text=args.text,
model=args.model,
preset=args.preset,
input_type=args.input_type,
language=args.language,
instruct=args.instruct,
quality=args.quality,
tokens=args.tokens,
duration_s=args.duration_s,
max_tokens=args.max_tokens,
n_vq_for_inference=args.n_vq_for_inference,
stream=args.stream,
streaming_interval=args.streaming_interval,
output_path=args.output_dir,
file_prefix=args.file_prefix,
verbose=args.verbose,
play=False,
)


if __name__ == "__main__":
main()
Loading