raVmiX: Building a Two-Deck DJ Mixer in the Browser
Practicing DJ mixing usually means owning a controller, installing heavy desktop software and loading a library onto one machine. I wanted to see how much of that could be replaced by a web page. The result is raVmiX, a two-deck DJ mixer that runs entirely in the browser using the Web Audio API. Audio files never leave your computer, and no server is needed.
Why I built it
I build web apps, games and tools as side projects, and a DJ controller seemed like a good stress test for the browser's audio stack. It needs precise timing, real-time effects, low-latency scratching and a dense interface with many knobs, faders and pads. I modelled the layout on the Pioneer DDJ-FLX4, so the on-screen controls match a real piece of hardware, and so that the same page can also talk to that hardware over USB.
What it does
You press the power button, add songs (with the + ADD SONGS button or by dragging files onto the collection or a deck display), and load tracks onto deck 1 or 2. From there you mix.
- Decks: play/pause, CUE with Pioneer-style behaviour, beat sync, master tempo (key lock), a tempo fader and a jog wheel for scratching, pitch bend and search.
- Loops: in/out, reloop/exit, halve and double, and beat jump of four beats when no loop is active.
- Pads: eight modes, including hot cue, pad FX, beat jump, sampler, keyboard, beat loop and key shift.
- Mixer: trim, three-band EQ with full kill, a filter, channel faders, level meters, a crossfader with smooth, scratch and thru curves, and a smart fader that does a bass swap.
- Beat FX: delay, echo, ping pong, spiral, reverb, trans, filter, flanger, phaser and HPF/LPF sweeps, synced to the beat and assignable to channel 1, 2 or master.
- Extras: automatic BPM detection and beat grid, scrolling three-band waveforms, quantize, and mix recording that downloads a file.
Headphone cueing works three ways: a split cable (left channel is cue, right is master), the outputs 3/4 of a connected DDJ-FLX4 used as a sound card, or a second output device.
YouTube decks
You can also paste a YouTube link and load it like any song. This comes with a real limitation: YouTube plays through its official embedded player, so its audio cannot enter the mixer. On those decks you get play and cue, hot cues, loops, beat jump, tempo and volume control, but not EQ, filters, FX, scratching, waveforms, BPM detection or headphone cue. Tempo moves in 5% steps and keeps the key. The player uses privacy-enhanced mode, so it does not use your signed-in account, though YouTube may show ads. Videos whose owners disable embedding will not play.
How it works
The project is plain JavaScript, HTML and CSS, run with Vite (npm run dev serves it on port 5173, and npm run build outputs to dist). The code is split by responsibility:
src/audio/holds the engine (mixer, routing, recording), the deck, effects, the sampler and analysis (BPM and waveform).src/ui/holds knobs, faders, buttons, the jog wheel, waveforms, the deck and mixer panels and the library.src/midi.jshandles Web MIDI and MIDI Learn.public/worklets/deck-processor.jsruns playback on the audio thread.
The most reusable decision is putting playback in an AudioWorklet. Tempo changes, key lock using granular time-stretch, scratching, loops and slip mode all depend on deciding what sample to play next, many times per second. Doing that on the main thread, where it competes with UI rendering, would produce glitches. In the worklet it runs on the audio thread, and the UI just sends it parameters.
Separating the engine from the UI helps too. The on-screen controls, the keyboard shortcuts and the MIDI hardware all drive the same engine, so a physical button and its on-screen twin end up in the same code path.
MIDI and MIDI Learn
Clicking CONNECT MIDI connects a real DDJ-FLX4 over USB. A default map is built in. If a control does not respond, you click MIDI LEARN, click the on-screen control, then move the hardware control. Mappings are saved in the browser. Offering a learn mode is a pragmatic answer to hardware variations you cannot test everywhere. Web MIDI and output-device selection need Chrome or Edge.
What I learned
- Keep anything sample-accurate off the main thread. An AudioWorklet is the right home for scratch, loops and time-stretch.
- Be honest about hard boundaries. Embedded YouTube audio cannot be routed through Web Audio, so I scoped the YouTube decks to the features that can work, and documented what is missing instead of faking it.
- One engine with several input surfaces (mouse, keyboard, MIDI) keeps behaviour consistent and makes MIDI Learn simple to build.
- Copying a known hardware layout saves design time. Every control had a defined purpose and behaviour, such as Shift modifiers for secondary functions.
Try it
The live version is at https://ravmix.vercel.app. Press the power button, add two songs, load one on each deck and start mixing. Use Chrome or Edge for the full feature set, and press H to see the keyboard shortcuts.
To run it yourself, install dependencies with npm install and start npm run dev. Deployment to Vercel needs no environment variables, since Vercel detects Vite automatically.
Conclusion
raVmiX shows that a capable DJ mixer fits in a browser tab when the audio-thread work is handled by an AudioWorklet and the interface is kept separate from the engine. It is a side project and still has clear limits, especially on YouTube decks, but it works as a practice tool without installing anything. Feedback is welcome at hello@iramesh.com.