Skip to content

Architecture Overview

Application Layout

MIXI uses a CSS Grid with 3 columns and 3 rows:

gridTemplateColumns: '1fr auto 1fr'
gridTemplateRows:    'auto auto 1fr'
RowHeightContent
148px (h-12)Topbar — 3 HUD panels via CSS subgrid
218pxStatus bar — feedback ticker + symmetric VU
3RemainingMain — Deck A, Mixer, Deck B via subgrid

The topbar and main content both use gridTemplateColumns: subgrid to share column tracks with the parent, ensuring pixel-perfect alignment between HUD panels and their corresponding deck/mixer columns.

Audio Engine

Singleton Pattern

MixiEngine is a singleton with private constructor:

MixiEngine.getInstance() → creates AudioContext(44100 Hz) on first call

The AudioContext runs at a fixed 44,100 Hz sample rate.

Top-Level Signal Flow

Deck A Source → DeckChannel A → XfaderGain A ──┐
                                                ├→ MasterBus → Output
Deck B Source → DeckChannel B → XfaderGain B ──┘

DeckChannel A → CueGain A ──┐
                              ├→ HeadphoneBus → Headphone Output
DeckChannel B → CueGain B ──┘

Optional Wasm DSP Path

When useWasmDsp is enabled in Settings, audio routes through a Rust AudioWorklet (mixi-dsp-processor) that implements the full signal chain in WebAssembly, bypassing the WebAudio EQ/FX/MasterBus nodes.

  • Parameter bus: 512-byte SharedArrayBuffer
  • Metering bus: 28-byte SharedArrayBuffer for VU output

Deck Channel

Each deck has a DeckChannel with this signal chain:

Source → Trim (GainNode, default 1.0)
       → EQ Model (selectable, see below)
       → Color FX (BiquadFilterNode)
       → DeckFx (effects chain)
       → Fader (GainNode)
       → Analyser (fftSize=256, smoothing=0.8)
       → XfaderGain (GainNode) → Master Bus

DeckFx output also taps to:
       → CueGain (GainNode, default 0) → Headphone Bus

CUE is a pre-fader listen — it taps the signal after effects but before the volume fader.

EQ Models

Three selectable EQ models, hot-swappable at runtime:

LR4 Isolator (Default)

Linkwitz-Riley 24 dB/octave parallel isolator.

BandTopologyCrossover
Low2× cascaded LP (Q=0.707 each)250 Hz
Mid2× HP @ 250 Hz → 2× LP @ 4000 Hz250 Hz / 4000 Hz
High2× cascaded HP (Q=0.707 each)4000 Hz

Kill switch: when gain ≤ range minimum, band gain is set to 0 (hard kill). Other bands are 100% unaffected — parallel topology guarantees zero interaction between bands.

DJ Peak (Pioneer DJM-style)

Serial shelving/peaking EQ — no kill capability.

BandTypeFrequencyQ
LowLow shelf80 Hz
MidPeaking1000 Hz0.7
HighHigh shelf12000 Hz

Xone Kill (Allen & Heath-style)

48 dB/octave full-kill isolator with slight resonance at crossover points.

BandTopologyCrossoverOrder
Low4× cascaded LP (Q=1.0)200 Hz8th order
Mid4× HP @ 200 Hz → 4× LP @ 2500 Hz200 / 2500 Hz8th order
High4× cascaded HP (Q=1.0)2500 Hz8th order

Color FX

Bipolar knob from -1 to +1:

RangeEffectFrequency
-1 → 0Lowpass sweep20 Hz → 20 kHz (exponential)
0Bypass20 kHz (fully open)
0 → +1Highpass sweep20 Hz → 20 kHz (exponential)

Default Q = 0.707 (Butterworth). Q increases with depth for more aggressive filtering at extremes.

Master Bus

Full signal chain from input to output:

Input (GainNode)
  → Master EQ (3-band: 80 Hz / 1 kHz / 12 kHz, ±12 dB)
  → Master Filter (bipolar LP/HP sweep, 3-path crossfade)
  → Band-Split Distortion (300 Hz crossover)
  → Punch Compressor (parallel, 8:1 ratio)
  → DC Blocker (10 Hz highpass)
  → Headroom Pad (-0.3 dB)
  → Limiter (brickwall, -0.5 dB threshold)
  → Analyser → Channel Splitter → L/R Analysers

Master EQ

BandTypeFrequencyQRange
LowLow shelf80 Hz±12 dB
MidPeaking1000 Hz0.7±12 dB
HighHigh shelf12000 Hz±12 dB

Master Filter

Bipolar knob -1 to +1. Three parallel signal paths (bypass, LP, HP) with gain crossfading.

Frequency mapping: 20 × 1000^(1 - |knob|) — exponential sweep from 20 Hz to 20 kHz.

Band-Split Distortion

ParameterValue
Crossover300 Hz
Sub behaviorSummed to mono below 300 Hz (phase-safe for PA)
Waveshapertanh(k·x) / tanh(k), k = amount² × 80 + 1
Oversampling4× when active, none when off
Curve resolution2048 samples

Punch Compressor

Parallel compression — dry signal is always present, compressed signal is mixed in.

ParameterValue
Threshold-14 dB
Ratio3:1
Attack3 ms
Release120 ms
Knee10 dB
Wet mixamount × 0.5, compensation = 1 / (1 + wet)

DC Blocker

Highpass BiquadFilter at 10 Hz, Q = 0.707. Removes DC offset from distortion and compression.

Headroom Pad

Fixed -0.3 dB gain reduction before the limiter.

Limiter

ParameterValue
Threshold-0.5 dB
Ratio20:1
Attack1 ms
Release100 ms
Knee0 dB (hard)

Visual feedback via LimiterDot:

  • Idle (< 0.3 dB reduction): dark
  • Gentle (0.3–3 dB): amber glow
  • Emergency (> 3 dB): red flash + clip border

Headphone Bus

Stereo Mode (Default)

Both master and headphone output to all speakers.

Split Mode

Master output → right ear, CUE → left ear (via ChannelMergerNode).

CUE Mix

Equal-power cosine crossfade: cueMix = cos(mix × π/2), masterTap = sin(mix × π/2). At 0 = 100% CUE, at 0.5 = equal blend, at 1 = 100% MASTER.

Crossfader

CurveFormulaCharacter
smoothgainA = cos(pos × π/2), gainB = sin(pos × π/2)Equal-power, no center dip
sharpCubic curve with 2% dead zones: (1-x)³ / over 0.02–0.98 rangeFast cuts, both full at center

Position 0 = full Deck A, position 1 = full Deck B.

State Management

MIXI uses Zustand stores:

StoreKey State
mixiStoreDeck states (2), master, crossfader, headphones, AI mode, deck modes
settingsStoreEQ model, EQ range, Wasm DSP, demo tracks, skin, update check
browserStoreTrack browser visibility, file list, sort order
sessionStoreRecording state, session persistence

Deck State Shape

Each deck tracks: transport (isPlaying, playbackRate, isSynced, syncMode), audio (gain, volume, eq, colorFx), analysis (bpm, originalBpm, bpmConfidence, musicalKey, dropBeats), waveform data, performance (hotCues[8], activeLoop, quantize, keyLock, slipModeActive, cueActive), and track info (trackName, duration, loadingStage).

Pluggable Deck Modes

ModeKeyLabelColorComponent
TracktrackDeck colorDeckSection
GrooveboxgrooveboxGROOVEBOX#a855f7GrooveboxDeck (lazy)
TurboKickturbokickTURBOKICK#ef4444TurboKickDeck (lazy)
TurboBassjs303TURBOBASS#00ff88JS303Deck (lazy)

Performance Patterns

Direct DOM Mutation

VU meters, phase meter, and limiter dot update at 30fps via requestAnimationFrame with frame-skipping, writing directly to DOM refs — zero React re-renders.

AudioWorklet Usage

WorkletFilePurpose
mixi-dsp-processormixi-dsp-worklet.jsFull Rust/Wasm signal chain
diode-ladder-processordiode-ladder-processor.jsTurboBass 4-pole diode ladder filter
recording-taprecording-tap.jsDisk recording bridge

React Bridge

useMixiSync and useMixiBridge hooks synchronize the Zustand store with the audio engine bidirectionally.

Watermarking

Three-tier system (all zero-impact on audio quality):

  1. UI Fingerprint — Invisible canvas overlay with per-session build hash at sub-1% opacity
  2. Code Fingerprint — Zero-Width Character steganography in compiled CSS/skin files
  3. Audio Container — Encrypted build metadata appended to exported recording containers (no audio samples modified)