Blog
Core ML
· Ivan

Run Inworld Voice Isolator on Apple Silicon with Core ML

A podcast editor has the whole recording available before export. A live captioning app needs cleaned audio while the person is still speaking. We converted both versions of Inworld Voice Isolator v1 to Core ML so they can run from Swift on Apple Silicon. Both models take mono audio at 48 kHz. Inworld model card

speech-swift library · Offline model card on Hugging Face · Streaming model card on Hugging Face

Where it fits in an app

Use case Where the model goes What to check before shipping
Podcast, interview, or video editing Run the offline bundle on the recorded voice track before export. Keep the original track available for an A/B listen. Listen to quiet words, breaths, and edits between speakers. Check memory and throughput on the longest files your app accepts.
Lyrics extraction and vocal isolation Run the offline bundle on a 48 kHz mono mix to isolate the foreground vocal. Transcribe the isolated audio to get the lyrics. For synced lyrics, align the transcript to the song. Check the words and timing against the original mix. Listen for missing consonants, harmonies that come through, and instrument bleed.
Dictation, live captions, or a voice agent Put the realtime bundle between microphone capture and speech recognition. Resample its output if the recognizer expects a different rate. Compare word errors on the same clips with and without isolation. Measure time from capture to the first text and check for late audio blocks.
Calls and meeting capture Use the realtime bundle on the local mic after echo cancellation if your app already uses it. For meeting recordings, work on individual tracks when available. Replay overlapping speech at different levels. Check which voices make it through and profile memory at the number of concurrent streams your app needs.

Relative voice level matters in calls. Inworld reports that a louder speaker can stay clear while a quieter overlapping voice is suppressed. Voices at similar levels often both come through. If your app needs every participant, test the mix at different microphone gains before deciding where to insert isolation. Inworld checkpoint behavior

Inworld included singing in training. To audition a backing-track residual, subtract the isolated vocal sample by sample from the same time-aligned mono mix. Inworld model notes

Model architecture

Both checkpoints start with a 2,048-point short-time Fourier transform (STFT) and take a new frame every 480 samples, or 10 ms at 48 kHz. Each frame describes the audio in 1,025 frequency bins.

A band is a range of neighboring frequency bins. Inworld uses 46 bands, from roughly 100 Hz wide at low frequencies to 2 kHz wide at the high end. The encoder maps each band to 512 values, giving the model a fixed-size input for each band in each frame. Inworld model architecture

Seven blocks process those vectors along time and across frequency bands. Four Transformer blocks attend to frames within each band, then attend across bands within a frame. The three alternating Mamba blocks scan the same axes with a 16-value state per channel. Each band head predicts a complex mask adjustment and an additive residual. The inverse STFT turns the corrected spectrum back into audio.

Inworld's signal path from mono audio through band splitting, attention, Mamba, spectrum correction, and inverse STFT. The insets show processing along time and frequency.
Architecture diagram by Inworld AI. Full-size SVG · Original source

What changes when the mic is live

The offline model can look backward and forward within each eight-second window. This lets it use later sounds to help clean an earlier part of the recording. On a long file, it blends neighboring windows where they overlap by two seconds.

The realtime model works forward through the audio and keeps a short history. Its look-ahead setting gives it 0, 20, or 40 ms of later audio to work with before it sends back the cleaned sound. It can still scan the frequency bands in both directions because all the bands in a frame are available at once. Inworld checkpoint behavior

The offline model has 64.0 million parameters and the realtime model has 58.2 million. In Swift, Accelerate handles the audio transforms, and Core ML and Metal run the model layers. Swift implementation

Isolate a voice in a recording

The offline download includes a source patch and build instructions for speech-swift. The CLI writes a 48 kHz mono Float32 WAV. Offline model and build instructions

hf download aufklarer/Inworld-Voice-Isolator-v1-CoreML \
  --local-dir ./InworldVoiceIsolator-LowMemory-CoreML

speech denoise noisy.wav --engine inworld \
  --model ./InworldVoiceIsolator-LowMemory-CoreML -o voice.wav

On our M5 Pro, the offline model took 2.84 seconds to clean an 11-second recording after warm-up. That’s about four seconds of audio per second of processing. Peak memory use was 1.24 GB. Offline benchmark

Spectrograms of the noisy input and isolated voice for the same 11 seconds. Both use the same dBFS scale and show frequencies up to 12 kHz.
The offline CLI output and its input on one dBFS scale. The speech comes from LibriSpeech (© 2014 Vassil Panayotov), with generated hiss in Inworld's fixture. Fixture credits · CC BY 4.0

Use the realtime model from Swift

Inworld reports 63 ms of built-in delay at the default 20 ms of look-ahead. The time to first audio in Swift depends on how much audio goes into its first call and how long that call takes. The realtime download includes the Swift source patch used in this example. Inworld checkpoint behavior · Realtime model

hf download aufklarer/Inworld-Voice-Isolator-v1-Realtime-CoreML \
  --local-dir ./InworldVoiceIsolator-Realtime-Fast-CoreML

Call prepare() before capture, then read preferredPushSamples for each push. The compiled bundle runs eight 10 ms frames per call. The first push needs 4,384 samples, or 91.3 ms of audio at 48 kHz, to fill those first eight frames. Later full pushes contain 3,840 samples, or 80 ms. In the example, pcmChunks supplies the captured audio and consume takes the isolated output.

import Foundation
import SpeechEnhancement

let stream = try InworldVoiceIsolatorStream(
    modelDirectory: URL(fileURLWithPath: "./InworldVoiceIsolator-Realtime-Fast-CoreML")
)
try stream.prepare()
var pending: [Float] = []
for chunk in pcmChunks {
    pending.append(contentsOf: chunk)
    while pending.count >= stream.preferredPushSamples {
        let count = stream.preferredPushSamples
        consume(try stream.push(Array(pending.prefix(count))))
        pending.removeFirst(count)
    }
}
consume(try stream.push(pending))
consume(try stream.flush())

How quickly does live audio come back?

On our M5 Pro, the first cleaned audio arrived about an eighth of a second after capture started (123–128 ms). We fed in recordings at the pace of a live microphone and warmed up the model before timing it.

On the 99-second replay, 57 of the 1,236 full audio blocks after the first came back past their 80 ms deadline. Late audio can delay captions or leave gaps if live playback runs out of buffered sound. Paced streaming results

Memory during live use

The realtime model keeps a short history to help clean the next bit of audio. In Swift, it can make room for that history as needed. Once the space fills up, the model reuses it as new audio arrives.

On our M5 Pro, the three-second test peaked at about 540 MB when Swift made room as it went. Setting aside the whole space at the start used 714 MB for the same clip. In the 33-second test, both peaked at about 730 MB.

Peak memory for 3- and 33-second clips, with space set aside at the start or as needed.
Both ways of setting aside memory produced exactly the same audio in these tests. Memory measurements

Source

Inworld trained and published both Apache 2.0 checkpoints. Each Core ML export includes the upstream license and notices and identifies its checkpoint by hash. Upstream checkpoints · Swift runtime

Both Swift builds passed tests against Inworld’s reference audio. In the realtime model, changing how Swift grouped the input gave the same result on the clean and noisy clips we tried in six languages. Swift benchmark report