# Prism kind .......... project status ........ paused since 2026-07-15 · software written, hardware not built checked ....... 2026-10-20 stack ......... c++ · htdemucs · jack2 · raspberry pi source ........ private repo page .......... https://brodymontag.com/projects/prism A design for a box that splits a DJ's track into drums, bass, vocals and other, so the DJ can set each stem's level. No hardware exists yet. Prism is a design for hardware in the DJ booth. When a CDJ loads a track, Prism splits the track into four stems in the background. The design gives each stem its own encoder, or a DJM-V10 knob over MIDI. The firmware is about 2,200 lines of C++20 with 54 unit tests. The tests use synthetic Pro DJ Link packets. No test ran against a real CDJ or a real mixer. HTDemucs runs as an INT8 model on the CPU. I dropped the plan to run it on a Hailo-10H accelerator. The export to the Hailo format failed, and attention and matrix multiplies are 63.3% of the model's compute. On a Mac with an M4 Pro, the model splits audio at 5.79 times real time. The audio never waits for the model. The model fills a buffer ahead of the playhead, and the audio callback reads only stems that are complete. ## highlights - Status: software written, hardware not built - Measured: 5.79× real time on an M4 Pro Mac (INT8, 10 s chunks) - Measured: attention and matrix multiplies are 63.3% of HTDemucs compute (334.9 GFLOPs) - Stem controls go live once 40 s of stems are ready - Target: 1.9 ms audio round trip (calculated, not measured) - Architecture decision records: 7 committed, 5 in draft ## detail updated 2026-10-20 ### how it works figure 1 · the stems fill ahead of the playhead · schematic A track loads. The model fills four stem lanes ahead of the playhead, in windows that overlap. The stem controls go live when 40 seconds of stems are ready. A CDJ sends its state over Pro DJ Link on UDP port 50002. When a new track ID arrives, Prism starts to extract stems from the start of that track. A worker thread runs the model on 10-second windows in time order. Each window adds 7.5 seconds of new audio, so two windows overlap by 2.5 seconds. The audio callback runs in JACK at 192 kHz. It reads the stems at the CDJ position, which it moves forward between packets at the CDJ pitch. It reads only segments that the worker finished. Until 40 seconds of stems are ready, the stem return stays silent and the DJ hears the dry track through the mixer. figure 2 · from a track load to the mixer The CDJ sends a track load over Pro DJ Link. The extractor runs HTDemucs on 10-second windows and stores the stems in a ring of 12 segments. The transport mixes the stems at the encoder levels and sends them to the mixer. ```mermaid flowchart TD A[CDJ] -->|Pro DJ Link| B[PdjMonitor] B -->|track load| C[ProgressiveExtractor] C -->|10 s windows| D[HTDemucs INT8 on CPU] D --> E[ring of 12 segments] E --> F[StemTransport] G[encoders and DJM MIDI] -->|stem levels| F F -->|JACK 192 kHz| H[mixer FX return] ``` the worker: windows in time order, live at 40 seconds stem-box@a4db71f · src/sync/progressive_extractor.cpp:108-131 · not public ```cpp void ProgressiveExtractor::worker_loop(){ std::cout<<"[Extractor] "<(); if(!extract_segment(cursor, hop, *seg)){ set_state(ExtractionState::Failed,0.0f); return; } uint64_t end=std::min(cursor+(uint64_t)hop,(uint64_t)duration_ms_); seg->start_ms=cursor; seg->end_ms=end; seg->valid=true; store_segment(std::move(seg)); cursor=end; extracted_ms_.store(cursor); float prog=(float)cursor/duration_ms_; if(state_.load()==ExtractionState::Extracting && cursor>=(uint64_t)(ACTIVATION_SECONDS*1000)) set_state(ExtractionState::Ready,prog); else set_state(state_.load(),prog); std::cout<<"[Extractor] "<& vols){ std::memset(out_l,0,nframes*sizeof(float)); std::memset(out_r,0,nframes*sizeof(float)); if(mode_.load()!=Mode::Stemming)return; // Target gain per stem for this callback. On the first callback after // (re)entering Stemming, snap smoothed_gain_ straight to target — nothing // was playing before, so there's no discontinuity to declick against. // On every later callback, smoothed_gain_ ramps toward target one-pole // per sample, so a volume/mute change never produces a hard step. float target_gain[N_STEMS]; for(int s=0;s= 250.0f) return StemSegment::STEP_MS; // One 4/4 bar in milliseconds const float bar_ms = 60000.0f / bpm * 4.0f; // Number of bars whose total length is nearest to the default 7500 ms hop. // At least 1 bar; capped so the hop never exceeds CHUNK_SECS*1000 - 500 ms // (preserving a minimum 500 ms overlap for a clean crossfade). const int max_bars = (int)std::floor( (StemSegment::CHUNK_SECS * 1000 - 500) / bar_ms ); const int n_bars = std::max(1, std::min(max_bars, (int)std::round((float)StemSegment::STEP_MS / bar_ms) )); const uint32_t hop = (uint32_t)std::round((float)n_bars * bar_ms); return hop; } ``` decision: Run the model on the CPU, not on the Hailo accelerator (accepted, 2026-07-02) context: The HTDemucs STFT branch uses complex numbers, and the ONNX exporters could not export it. Without ONNX, the Hailo compiler cannot take the model. decision: Prism runs a TorchScript trace of HTDemucs with INT8 quantization on the CPU. On 2026-07-14, a FLOP count showed attention and matrix multiplies at 63.3% of the compute, and I dropped the Hailo-10H from the plan. cost: The speed on a Raspberry Pi 5 is not measured. Estimates from the Mac figure fall below the 1.3× gate. ### results figure kind value separation speed, M4 Pro, INT8, 4 threads measured 5.79× real time time for one 10 s window, same run measured 1.73 s attention and matrix-multiply share of the compute measured 63.3% of 334.9 GFLOPs sustained speed the Pi 5 must hold target 1.3× real time audio round trip, 64 frames at 192 kHz target 1.9 ms, calculated method: speed: the RTF harness on an M4 Pro Mac with the INT8 model and 4 threads, the core count of a Pi 5. Compute: torch 2.8 FlopCounterMode over one 7.8 s segment, with formulas added for two attention ops that it does not count. · as of 2026-07-14 ### limits limits: - No hardware exists. No test ran against a real CDJ or a real mixer. - The lookup from a track ID to its audio file is not built for real CDJ media yet. - The ring holds 90 s, and the worker does not wait for the playhead. On a longer track, it can overwrite stems before they play. - The speed figure comes from a Mac. The Pi 5 speed is not measured. - No blind A/B test or SDR figure compares the INT8 stems with full precision. ### status and next status: - Done: the firmware with 54 unit tests, the FLOP count and the Mac speed run (2026-07-14). - Blocked: the sustained speed test needs a Raspberry Pi 5 build. Paused since 2026-07-15. - Next: run that test under heat. Its result picks the board. -- end of page · this page as text: https://brodymontag.com/machine/projects/prism · index: https://brodymontag.com/machine · summary: https://brodymontag.com/llms.txt