सोर्स सेपरेशन

Open-Unmix HQ एक स्टीरियो म्यूज़िक ट्रैक को चार स्वतंत्र स्टेम में बाँटता है — वोकल, ड्रम्स, बेस और अन्य। चार स्वतंत्र BiLSTM मॉडल (हर स्टेम के लिए एक) मिश्रण STFT पर मैग्निट्यूड मास्क बनाते हैं; वैकल्पिक Wiener पोस्ट-फ़िल्टर उन्हें मिलाता है। MLX के माध्यम से Apple Silicon पर चलता है।

यह क्या है

आर्किटेक्चर

Four independent stems, each a copy of the same network:

StageShape / operation
STFT4096-point FFT, 1024-hop, periodic Hann window, reflect-pad. 2049 frequency bins per frame.
Input normalizeCrop to 1487 bins (≈16 kHz), apply learned per-bin mean + scale from training.
EncoderLinear 2974 → 512 + BatchNorm + tanh. Input is 2 channels × 1487 bins.
BiLSTM3 layers, 256 hidden per direction (512 effective). Captures temporal context across frames.
DecoderSkip-concat of encoder and LSTM outputs (1024) → Linear 1024 → 512 + BN + ReLU → Linear 512 → 4098.
Output denorm + maskElement-wise multiply with mixture magnitude; phase from mixture; iSTFT overlap-add.
Wiener (optional)Power-ratio masks across all 4 stem estimates. Refines phase so stems sum to mixture.

मॉडल

ComponentValue
Parameters / stem8.9M
Parameters total (4 stems)~35.6M
Sample rate44.1 kHz stereo
Chunk latencyOffline (full-track STFT)
Weightsaufklarer/OpenUnmix-HQ-MLX (safetensors, ~136 MB)
Upstreamsigsep/open-unmix-pytorch (Stöter et al., JOSS 2019)

त्वरित शुरुआत — Swift

import SourceSeparation
import AudioCommon

let separator = try await SourceSeparator.fromPretrained()

let stereo = try AudioFileLoader.loadStereo(
    url: URL(fileURLWithPath: "song.wav"),
    targetSampleRate: 44100
)

let stems = separator.separate(audio: stereo, sampleRate: 44100)
// stems[.vocals], stems[.drums], stems[.bass], stems[.other]
// Each is [[Float]] — left channel, right channel.

try WAVWriter.writeStereo(
    left: stems[.vocals]![0],
    right: stems[.vocals]![1],
    sampleRate: 44100,
    to: URL(fileURLWithPath: "vocals.wav")
)

Pass wiener: true (default) for best quality. Pass targets: [.vocals] to extract only a subset of stems and skip the other models.

CLI

speech separate song.wav                              # all 4 stems into song_stems/
speech separate song.wav --stems vocals               # vocals only
speech separate song.wav --stems vocals,drums         # subset
speech separate song.wav --output-dir /tmp/stems/     # custom output dir
speech separate song.wav --verbose                    # show timing

कब उपयोग करें

Open-Unmix तब फिट होता है…

…जब आपको Apple Silicon पर किसी ऐप या पाइपलाइन के भीतर हल्का, ऑफ़लाइन सोर्स-सेपरेशन पास चाहिए। प्रति स्टेम 8.9M पैरामीटर्स डाउनलोड और मेमोरी को नियंत्रित रखते हैं। अधिकांश पॉप/रॉक कंटेंट पर मैग्निट्यूड मास्किंग + Wiener अच्छे स्टेम देते हैं। स्टूडियो-स्तर के शीर्ष वोकल आइसोलेशन के लिए बड़ा Demucs/MDX-Net मॉडल चुनेंगे; यह पैकेज व्यावहारिक, ऐप में डाले जाने लायक संतुलन के लिए है।