MDXNet Mono-to-Stereo
A lightweight MDXNet (ConvTDFNet) model that converts mono music into natural, wide stereo locally or directly in your browser.
Try it live in your browser (WebGPU / WASM): MDXNet Mono-to-Stereo Space
Highlights
- Intelligent Mixing-Aware Panning: Rather than forcefully hard-panning frequencies (which sounds unbalanced and unnatural), the model acts like a professional mixing engineer: anchoring lead vocals, kick, and bass precisely in the center, while intelligently spreading reverb, spatial ambience, chorus harmonies, synths, and rhythm instruments wide across the stereo soundstage.
- Natural in Both Mono & Stereo: Produces clean, immersive stereo audio that maintains full mono compatibility without phase cancellation.
- Portable ONNX Packages: Available in FP16 ONNX (21.9 MB, default) and FP32 ONNX (43.7 MB) for universal CPU/WASM/WebGPU support, with a standalone NumPy/ONNX Runtime inference script (no PyTorch required).
Measured Speed
Tested on a 4-minute song (244s).
| Runtime | Device | Precision | Speed | Time |
|---|---|---|---|---|
| Python - DirectML GPU | AMD RX 6600 | FP16 | approx. 56-60x realtime | approx. 4.1-4.3s |
| Python - CPU | Intel i5-12400 | FP16 | approx. 3.6x realtime | approx. 67s |
| Browser - WebGPU | AMD RX 6600 (desktop) | FP16 | approx. 19-21x realtime | approx. 11.5-14s |
| Browser - WebGPU | Oppo K13 Turbo (mobile) | FP16 | approx. 4.2x realtime | approx. 58s |
| Browser - WebGPU | Oppo K13 Turbo (mobile) | FP32 | approx. 2.9x realtime | approx. 85s |
Model Specifications
| Property | Value |
|---|---|
| Architecture | MonoToStereoConvTDFNet (TFC-TDF U-Net, 11 blocks) |
| Parameters | 10,916,226 (approx. 10.92M) |
| Formats | ONNX FP16 (21.9 MB) & ONNX FP32 (43.7 MB), Opset 17 |
| Sample Rate | 44,100 Hz |
| STFT Config | n_fft = 6144, hop_length = 1024, Periodic Hann window |
Frequency Bins (dim_f) | 3,072 |
Time Frames (dim_t) | 256 |
| Chunk Length | 261,120 samples (approx. 5.92 seconds) |
| Input Tensor | input: [1, 2, 3072, 256] ([Mono_Real, Mono_Imag]) |
| Output Tensor | output: [1, 4, 3072, 256] ([L_Real, L_Imag, R_Real, R_Imag]) |
Repository Files
mdxnet_mono_to_stereo_fp16.onnx- FP16 ONNX model (21.9 MB, default for DirectML, CUDA, CoreML, andshader-f16WebGPU).mdxnet_mono_to_stereo.onnx- FP32 ONNX model (43.7 MB, for FP32-only mobile/WASM/WebGPU runtimes).config.yaml— Model architecture, STFT, and inference configuration.infer.py— Standalone inference script (no PyTorch dependency required).requirements.txt— Minimal Python dependencies.
Quickstart
1. Install Dependencies
pip install -r requirements.txt
For GPU acceleration, swap onnxruntime for your platform backend:
- NVIDIA CUDA:
pip install onnxruntime-gpu - Windows DirectML (AMD / Intel / NVIDIA):
pip install onnxruntime-directml
2. Run Inference
python infer.py --input path/to/mono_song.wav --output path/to/stereo_song.wav
If the ONNX file is not present locally, infer.py automatically downloads it from Hugging Face.
CLI Options
| Flag | Default | Description |
|---|---|---|
--input, -i | (required) | Input audio file (WAV, FLAC, MP3, etc.; stereo inputs are averaged to mono first) |
--output, -o | <input>_stereo.wav | Output stereo WAV path (44.1 kHz) |
--model, -m | (auto by precision) | Local ONNX model path (auto-downloads from HF if missing) |
--precision | fp16 | fp16 (mdxnet_mono_to_stereo_fp16.onnx) or fp32 (mdxnet_mono_to_stereo.onnx) |
--device | auto | Execution provider: auto, cpu, cuda, dml, or coreml |
License
MIT