소스 분리

Open-Unmix HQ 는 스테레오 음악 트랙을 4 개의 독립 스템 — 보컬, 드럼, 베이스, 기타 로 분리합니다. 각 스템마다 독립된 BiLSTM 모델이 혼합 STFT 에 대해 크기 마스크를 생성하며, 선택적 Wiener 후처리로 이들을 조정합니다. Apple Silicon 에서 MLX로 동작합니다.

개요

아키텍처

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.

커맨드라인

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 앱이나 파이프라인 안에서 가벼운 오프라인 소스 분리를 원할 때. 스템당 890 만 파라미터로 다운로드와 메모리 부담이 적습니다. 크기 마스킹 + Wiener 는 대부분의 팝/록 콘텐츠에서 양질의 스템을 만들어 줍니다. 스튜디오 수준의 최신 보컬 분리는 Demucs / MDX-Net 계열 대형 모델이 낫습니다. 이 패키지는 앱에 실용적으로 탑재할 수 있는 균형점을 겨냥합니다.