Skip to content

VoiceStudio is the open-source, fully-local ElevenLabs alternative — voice cloning, voice design, video dubbing, dictation, transcription & audiobook creation in 646 languages.

feat(mlx-audio): add the VoxCPM2 8-bit curated model

velixio4adcb7bc264b
diff --git a/backend/services/tts_backend.py b/backend/services/tts_backend.py
index 496d1ea48..432742ed5 100644
--- a/backend/services/tts_backend.py
+++ b/backend/services/tts_backend.py
@@ -2570,6 +2570,7 @@ class MLXAudioBackend(TTSBackend):
"chatterbox": "mlx-community/Chatterbox-TTS-4bit",
"melotts": "mlx-community/MeloTTS-English-v3-MLX",
"outetts": "mlx-community/Llama-OuteTTS-1.0-1B-4bit",
+ "voxcpm2": "mlx-community/VoxCPM2-8bit",
}
DEFAULT_MODEL_KEY = "kokoro"
@@ -2587,6 +2588,8 @@ class MLXAudioBackend(TTSBackend):
# melotts huggingface.co/mlx-community/MeloTTS-English-v3-MLX
# outetts huggingface.co/OuteAI/Llama-OuteTTS-1.0-1B (high + moderate
# training-data tiers)
+ # voxcpm2 huggingface.co/mlx-community/VoxCPM2-8bit (30 languages,
+ # the same set as VoxCPM2Backend)
CURATED_MODEL_LANGUAGES: dict[str, tuple[str, ...]] = {
"kokoro": ("en", "es", "fr", "hi", "it", "pt", "ja", "zh"),
"csm": ("en",),
@@ -2598,6 +2601,11 @@ class MLXAudioBackend(TTSBackend):
"en", "ar", "zh", "nl", "fr", "de", "it", "ja", "ko", "lt", "ru", "es",
"pt", "be", "bn", "ka", "hu", "lv", "fa", "pl", "sw", "ta", "uk",
),
+ "voxcpm2": (
+ "ar", "my", "zh", "da", "nl", "en", "fi", "fr", "de", "el",
+ "he", "hi", "id", "it", "ja", "km", "ko", "lo", "ms", "no",
+ "pl", "pt", "ru", "es", "sw", "sv", "tl", "th", "tr", "vi",
+ ),
}
def __init__(self):
@@ -3557,6 +3565,7 @@ _MLX_AUDIO_MODEL_LABELS: dict[str, str] = {
"chatterbox": "Chatterbox",
"melotts": "MeloTTS (lightweight)",
"outetts": "OuteTTS",
+ "voxcpm2": "VoxCPM2 8-bit (30 languages, 48 kHz)",
}
diff --git a/tests/test_engine_language_options.py b/tests/test_engine_language_options.py
index b501435ae..c227e6e79 100644
--- a/tests/test_engine_language_options.py
+++ b/tests/test_engine_language_options.py
@@ -139,6 +139,7 @@ def test_metadata_releases_temporary_sidecar_exit_handlers(monkeypatch, engine,
('melotts', 'english', 'japanese'),
('qwen3-tts', 'korean', 'bengali'),
('outetts', 'bengali', 'hindi'),
+ ('voxcpm2', 'thai', 'bengali'),
])
def test_curated_mlx_models_declare_documented_languages(model, allowed, rejected, monkeypatch, tts):
monkeypatch.setenv('OMNIVOICE_MLX_AUDIO_MODEL', model)
diff --git a/tests/test_engines.py b/tests/test_engines.py
index 25273cd91..291c8167c 100644
--- a/tests/test_engines.py
+++ b/tests/test_engines.py
@@ -595,6 +595,26 @@ def test_mlx_audio_generate_auto_language_skips_lang_code_entirely(language, mod
assert "lang_code" not in seen_kwargs
+def test_mlx_audio_voxcpm2_8bit_resamples_48k_and_does_not_claim_cloning():
+ # The curated 8-bit VoxCPM2 emits 48 kHz; the adapter's rate is 24 kHz, so
+ # the audio must be resampled rather than played back at double length.
+ backend = tts_backend.MLXAudioBackend()
+ backend._model_id = backend.CURATED_MODELS["voxcpm2"]
+ backend._ensure_loaded = lambda: None
+ assert backend._model_id == "mlx-community/VoxCPM2-8bit"
+ assert backend.supports_cloning is False
+ seen = {}
+
+ def _fake_generate(**kw):
+ seen.update(kw)
+ return iter([types.SimpleNamespace(audio=[0.0] * 4800, sample_rate=48000)])
+
+ backend._model = types.SimpleNamespace(generate=_fake_generate)
+ wav = backend.generate("hello", language="th")
+ assert seen["lang_code"] == "th"
+ assert wav.shape[-1] == 2400
+
+
@pytest.mark.parametrize("language, expected", [("German", "german"), ("de", "german"), ("pt-BR", "portuguese"), ("Chinese", "chinese")])
def test_mlx_audio_generate_non_kokoro_model_ignores_kokoro_validation(language, expected):
# Qwen3-TTS (and CSM/Dia/Chatterbox/MeloTTS/OuteTTS) don't use Kokoro's