Yaw Botwe

← All work

SonicSplitz

An AI stem player. Pick two songs, split each into vocals, melody, bass and drums with PyTorch models, and mix the eight parts live, locked to the beat.

Role
Sole designer and engineer
When
2026
Status
Live
Stack
Python, FastAPI, PyTorch, Demucs, React, Web Audio, Docker, Cloudflare R2
Try it
sonicsplitz.com
The SonicSplitz player: two decks, a tempo control at 120 bpm, and a stem board with vocals, melody, bass and drums rows.

What it is

SonicSplitz takes two songs, splits each into vocals, melody, bass and drums, and lets you play any of the eight parts together: one song's vocals over the other's drums, both bass lines, just the drums. The two songs stay locked on the beat and, if you want, in the same key. It's for music fans and bedroom producers who want to play with songs, not edit them, so it's two decks and a board of lights rather than a timeline.

How a song gets split

You search by name (the iTunes and Deezer catalogs) or upload your own file. The server then runs one job per song:

  • Analysis. Beat This!, a PyTorch beat tracker, finds the beat grid and the downbeat. librosa estimates the key and loudness.
  • Separation. Demucs (the htdemucs model) splits the audio into four stems. On an M1 CPU, a four-minute song takes two to three minutes.
  • Encoding and storage. Stems are encoded to MP3 and cached by track, so any song is only ever split once. Songs already split load instantly and show first in search.

Separation takes minutes, so the wait needs an honest progress state rather than a spinner. Each job reports its stage (downloading, analysing, separating, encoding) and progress, and a page reload picks running jobs back up. Both decks can be loading at once while splits run one at a time.

Keeping two songs together

Playback runs entirely in the browser on the Web Audio API.

  • Tempo sync. The first song sets the master tempo. Each deck plays at a rate that matches it, and you can snap to either song's tempo or the midpoint so neither is stretched far.
  • Key lock. Changing playback rate also changes pitch. Each deck runs through a real-time pitch shifter (Signalsmith Stretch) so a sped-up song isn't chipmunked. You can turn it off for a turntable feel.
  • Key match. One song can be transposed up to six semitones into the other's key, treating relative major and minor as the same key.
  • On the beat. Play both and they start on the same beat of the bar. Start one while the other plays and it drops in on the next beat. Seeking keeps them locked to the bar, and loops of 1, 2, 4 or 8 bars start from the current bar.

Sharing

The whole mix lives in the URL. #a=<id>.vd.10,10,10,10.0&b=<id>.ob.10,8,10,10.-2&bpm=124&sync=ab&lock=1 records both songs, which parts are on, their levels, the transposition, tempo and sync, so "Copy mix link" is enough to send someone your exact mix.

Record captures what you hear as a 9:16 video for TikTok, Reels and WhatsApp Status, with a live drawing of the console. It's made in the browser (MP4 where the browser supports it, WebM in Firefox) and nothing is uploaded.

Running it

  • One Docker image on Railway builds the React app and the FastAPI server, and the server serves both from one origin.
  • Both models are downloaded at build time, not on the first request. The container installs CPU-only PyTorch wheels, which cuts several gigabytes from the image since there's no GPU there anyway.
  • Stems and artwork live in Cloudflare R2, split into a public bucket for stems and a private one for originals. I wrote an idempotent migration to move existing songs off the volume.
  • Adding songs needs Google sign-in, with 20 new splits per person per day and uploads visible only to the uploader.