Skip to main content

mlx-audio-separator

MLX-native stem separation for Apple Silicon Macs.

This project ports the inference paths from audio-separator (upstream repo: nomadkaraoke/python-audio-separator) to MLX so separation runs on Apple Silicon without requiring PyTorch or ONNX Runtime at inference time. Core runtime components are powered by mlx-audio-io (audio I/O) and mlx-spectro (spectral transforms).

Requirements

  • macOS 13+ (Ventura or later)
  • Apple Silicon (M1/M2/M3/M4)
  • Python 3.10+

Installation

pip install mlx-audio-separator

If you need first-run conversion from upstream checkpoints (.ckpt/.onnx/Demucs weights), install conversion extras:

pip install "mlx-audio-separator[convert]"

Quick Start

CLI

# Separate with default model
mlx-audio-separator song.mp3

# Use a specific model
mlx-audio-separator song.mp3 -m htdemucs_ft.yaml

# List supported models
mlx-audio-separator --list_models

Python

from mlx_audio_separator import Separator

sep = Separator()
sep.load_model()
outputs = sep.separate("song.mp3")
print(outputs)

Supported Architectures

  • Roformer (BS-Roformer and MelBand-Roformer families)
  • MDXC (including MDX23C-style checkpoints)
  • MDX
  • VR
  • Demucs

Demucs cache security and migration

Demucs conversion stores MLX weights as <model>.safetensors with a validated <model>_config.json sidecar. The loader verifies that the two files match before constructing a model. Legacy <model>_mlx.pkl caches are never deserialized. When automatic conversion is enabled they are left untouched and replaced by newly generated safe files from the official Demucs source.

To regenerate a cache explicitly:

pip install "mlx-audio-separator[convert]"
python -m mlx_audio_separator.demucs_mlx.mlx_convert htdemucs \
  --output-dir ~/.cache/demucs-mlx

Official Demucs downloads retain their filename hash checks and are loaded with PyTorch's restricted weight-only deserializer. This trusts the installed PyTorch, Demucs, NumPy, and optional DiffQ implementations plus the official model registry; arbitrary checkpoint globals and local pickle caches are not trusted.

Validation Snapshot

Release validation snapshot (2026-02-24 to 2026-02-26):

Check Result
Full-catalog benchmark gate 163/163 models ok (0 failures)
Unit tests 167 passed, 1 skipped
MLX vs audio-separator parity smoke 4/4 models passed (rel L2 <= 5e-2)

Scope: Apple Silicon (M4 mini), MUSDB18-HQ test subset, release gate + parity smoke model set.

Detailed evidence and provenance: docs/release-validation.md.

Performance Snapshot

MLX vs audio-separator (ABBA, 12-song MUSDB18-HQ test subset, M4 mini):

Model MLX speedup vs PAS
htdemucs_ft.yaml 1.40x
model_bs_roformer_ep_317_sdr_12.9755.ckpt 2.16x
mel_band_roformer_instrumental_instv7n_gabox.ckpt 2.50x
UVR-MDX-NET-Inst_HQ_3.onnx 1.53x

Median speedup across the 4-model overlap set: 1.847x.

These numbers are scoped to the benchmark settings above and are not universal guarantees for all machines, models, or audio inputs.

Stable Runtime Tuning

Release-facing stable controls:

  • --speed_mode {default,latency_safe,latency_safe_v2,latency_safe_v3}
  • --cache_clear_policy {aggressive,deferred}
  • --write_workers <int>

Example:

mlx-audio-separator song.mp3 \
  --speed_mode latency_safe \
  --cache_clear_policy deferred \
  --write_workers 2

Basic benchmark command:

mlx-audio-separator \
  --benchmark song.mp3 \
  --benchmark_warmup 1 \
  --benchmark_repeats 3 \
  --benchmark_profile

BS-Roformer-SW Performance (Opt-In)

For BS-Roformer-SW.ckpt, use the opt-in no-drift FLAC profile:

mlx-audio-separator song.mp3 \
  -m BS-Roformer-SW.ckpt \
  --output_format FLAC \
  --speed_mode latency_safe_v3

latency_safe_v3 keeps model inference behavior conservative and focuses on safe end-to-end latency wins (deferred cache clearing + async stem writes).

To avoid repeated checkpoint conversion overhead, pre-convert once to *.safetensors and exit:

mlx-audio-separator \
  -m BS-Roformer-SW.ckpt \
  --save_converted_safetensors \
  --preconvert_only

safetensors primarily improves model load/startup time. It is not expected to materially change per-file inference latency.

Validation command (latency + deterministic equivalence):

uv run --with torch python scripts/perf/compare_latency.py \
  --corpus-file /tmp/corpus_one.txt \
  --baseline-config scripts/perf/configs/bs_roformer_sw_default_baseline.json \
  --candidate-config scripts/perf/configs/bs_roformer_sw_latency_safe_v3_candidate.json \
  --model-file-dir /tmp/audio-separator-models \
  --allow-speed-mode-mismatch \
  --target-improvement-demucs-mdxc 10.0 \
  --equivalence-check \
  --equivalence-threshold-rel-l2 1e-6 \
  --output-json /tmp/bs_roformer_sw_latency_safe_v3_compare.json \
  --output-markdown /tmp/bs_roformer_sw_latency_safe_v3_compare.md

BS-Roformer-SW Optimization Program (Opt-In Tracks)

As of March 4, 2026, latency_safe_v3 remains the only promoted runtime win for BS-Roformer-SW.ckpt; all experimental tracks below are parked pending new evidence.

Candidate configs for staged exploration live under scripts/perf/configs/:

  • bs_roformer_sw_cand_grouped_bandmask.json
  • bs_roformer_sw_cand_fused_ola.json
  • bs_roformer_sw_cand_stream_pipeline.json
  • bs_roformer_sw_cand_compile_fullgraph.json
  • bs_roformer_sw_cand_flac_fastwrite.json

Corpus manifest templates:

  • Quick gate (3 files): scripts/perf/corpora/bs_roformer_sw_quick.txt
  • Full gate (12 files): scripts/perf/corpora/bs_roformer_sw_full.txt

Quick-gate example:

uv run --with torch python scripts/perf/compare_latency.py \
  --corpus-file scripts/perf/corpora/bs_roformer_sw_quick.txt \
  --baseline-config scripts/perf/configs/bs_roformer_sw_latency_safe_v3_baseline.json \
  --candidate-config scripts/perf/configs/bs_roformer_sw_cand_grouped_bandmask.json \
  --model-file-dir /tmp/audio-separator-models \
  --target-improvement-demucs-mdxc 3.0 \
  --equivalence-check \
  --equivalence-threshold-rel-l2 1e-6 \
  --equivalence-max-files 1 \
  --output-json /tmp/bs_roformer_sw_quick_gate.json \
  --output-markdown /tmp/bs_roformer_sw_quick_gate.md

Full-gate example:

uv run --with torch python scripts/perf/compare_latency.py \
  --corpus-file scripts/perf/corpora/bs_roformer_sw_full.txt \
  --baseline-config scripts/perf/configs/bs_roformer_sw_latency_safe_v3_baseline.json \
  --candidate-config scripts/perf/configs/bs_roformer_sw_cand_grouped_bandmask.json \
  --model-file-dir /tmp/audio-separator-models \
  --target-improvement-demucs-mdxc 5.0 \
  --equivalence-check \
  --equivalence-threshold-rel-l2 1e-6 \
  --equivalence-max-files 0 \
  --output-json /tmp/bs_roformer_sw_full_gate.json \
  --output-markdown /tmp/bs_roformer_sw_full_gate.md

Documentation

Document Description
docs/release-validation.md Release evidence snapshot
docs/release-first.md Release execution playbook
docs/reproducibility.md Reproducibility guide
docs/wave4-opt-in.md Wave 4 opt-in/experimental roadmap
docs/bs-roformer-sw-optimization-program.md BS-Roformer-SW candidate gating and promotion table
CHANGELOG.md Changelog
THIRD_PARTY_NOTICES.md Third-party attribution and license notices

License

This project is MIT licensed.

Acknowledgments

mlx-audio-separator is derived from audio-separator (upstream repo: nomadkaraoke/python-audio-separator, MIT) by beveradb and the nomadkaraoke community. Substantial portions of the architecture, model loading, and separation logic are adapted from that project. If you find this package useful, please also star and support the upstream project.

The models used by this project were trained by the Ultimate Vocal Remover community, primarily @Anjok07 and @aufr33. See THIRD_PARTY_NOTICES.md for full attribution and license details.

Additional references:

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mlx_audio_separator-0.1.7.tar.gz (325.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mlx_audio_separator-0.1.7-py3-none-any.whl (342.7 kB view details)

Uploaded Python 3

File details

Details for the file mlx_audio_separator-0.1.7.tar.gz.

File metadata

  • Download URL: mlx_audio_separator-0.1.7.tar.gz
  • Upload date:
  • Size: 325.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for mlx_audio_separator-0.1.7.tar.gz
Algorithm Hash digest
SHA256 bb74bb03b9dc2e0bd717d24e84c1ce70fe73167ae53269616bb9cc10a30b8388
MD5 3e0cc77d1fe96d9cb981857e67ecc775
BLAKE2b-256 ceee8032c287c3aebf73789d2000282a84787d187492e64a17b754bfaf278b56

See more details on using hashes here.

Provenance

The following attestation bundles were made for mlx_audio_separator-0.1.7.tar.gz:

Publisher: release-pypi.yml on ssmall256/mlx-audio-separator

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mlx_audio_separator-0.1.7-py3-none-any.whl.

File metadata

File hashes

Hashes for mlx_audio_separator-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 e4256aab161a028560773d86de93c48c9a377e22a3f4446eb27f0c6adaafcc60
MD5 5b92d29ffbaf6704582d5134a494ad25
BLAKE2b-256 995dba058e044891f789723e8475ae92b574385918f92eb0e7c67f3ba9ddc5fe

See more details on using hashes here.

Provenance

The following attestation bundles were made for mlx_audio_separator-0.1.7-py3-none-any.whl:

Publisher: release-pypi.yml on ssmall256/mlx-audio-separator

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.7 This release

2 files

0.1.6

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.2rc1

2 files

0.1.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page