Skip to content

Architecture

Sidecar has three code bases: the engine (one shared core, run on the Raspberry Pi; a Mac port is for tests and the emulator link, and the frozen Sidecar Mini has its own build), the Rytm mods (built on elekloader), and the web tools (the patcher and the consoles). The source is public: the engine in sidecar-firmware, the mods in sidecar-mods.

Analog Rytm MKII Raspberry Pi 4B / Pi 5
┌──────────────────────┐ ┌───────────────────────────┐
│ patched OS 1.74 │ USB │ USB host: Overbridge, MIDI│
│ + elekloader core │ ◄──────► │ core/ (shared C++17): │
│ + Sidecar mods: │12 ch each│ voices, send FX, │
│ EXT machines, │way audio,│ user FX, host link, │
│ pages, reports │host-link │ pool │
│ │ SysEx │ web server, /ws, web app │
│ │ │ touchscreen UI (LVGL) │
└──────────────────────┘ └─────────┬────────┬────────┘
│ │
touchscreen browser,
(HDMI/DSI) computer
  • The Sidecar is the Rytm’s USB host and runs the Overbridge stream: 48 kHz, 12 channels each way, in blocks of 7 frames (about 6857 blocks a second). The Rytm’s clock paces everything.
  • Rytm to Sidecar: MAIN L/R, the 8 voice outputs (stems), the audio inputs.
  • Sidecar to Rytm: each Sidecar voice goes on its voice’s own Overbridge input. The Rytm adds that input into the voice before its analog filter, so a Sidecar voice is filtered, driven and enveloped by the Rytm’s analog circuitry. The send effects return on MAIN FX (before the Rytm’s analog distortion and compressor) or MAIN (after them).
  • An output FIFO between the render and the USB stream absorbs jitter: 96 frames (2 ms) on both boards.

Portable C++17, built from one source for the Pi, the Mac (tests, emulator link) and the frozen Sidecar Mini.

Part What
platform.h, engine.h, hooks.h what a board provides (clock, cycle counter, log, files, sample RAM) and the core’s entry points: engine_begin, engine_sysex, render_voices, idle work
voices.*, machines.h the 8 voices and the machines; the voice byte’s machine bits select PLAITS, JUNO, DAISYSP, DSP SAMPLE, MD (DIGIDRUM before 0.3.0), 6-OP FM or U1..U5
host_link.*, sysex.*, slots.* the host-link protocol in and out (Host-link protocol)
notes.* the note adapter: a stock Rytm’s MIDI notes as the mods’ reports
main_out.h the voices summed on MAIN for a stock Rytm, with a fade-in and a soft limit at the -12 dBFS track ceiling (0.5.0)
fx/ the send effects (SendFx, header-only, no allocation) and their knob labels
pool/, presets/ the card index, the per-project sample pool, the JUNO and DX7 libraries
user/ the user machine glue for the Pi and the Mac (scan, slots, loading)
ui/ the remote UI: 1-bit canvas, fonts, widgets, page declarations, the remote host
lfo.* the Sidecar LFOs (26 on the Pi in 0.5.0, 4 on the Mini)
rec/ the recorder code shared by both Sidecars (WAV headers, names, the Mini’s recorder)

Rules: one engine per program; one render_voices call per 12-frame block, or disjoint voice ranges on several cores (the Pi); the render path never allocates, blocks or logs; every new SysEx message goes through sysex.* with a test against the protocol reference.

A bare-metal kernel on Circle for the Pi 4B and the Pi 5 (one SD card boots both, with a kernel for each): no Linux, four cores with fixed roles.

Core Role
0 the USB host interrupt (Overbridge in/out), USB plug and play, the Rytm’s USB MIDI, the USB-C gadget, the network and web server (Circle tasks), the display (LVGL), the recorder’s card writes, the console, the watchdog
1 voices 0-3 of each block
2 voices 4-7, then the send effects
3 the control core: MIDI parsing, host-link messages and console commands into the core, block pacing, card work (FatFs, sample streaming), the remote UI host
  • Overbridge host: a Circle USB driver for the Rytm’s streaming interfaces, with two patches to Circle’s xHCI.
  • USB-C gadget: a composite USB Audio Class 2 + USB MIDI device of our own for a computer, on the Pi’s USB-C port (in testing).
  • Network and web: Ethernet with a static link-local address, mDNS (sidecar.local, patched for macOS’s lookups), Circle’s HTTP server with at most 4 connections, the live WebSocket API at /ws, and the web app served from the card (/.rytm/www-next/, not built into the kernel); Wi-Fi in testing (either/or with Ethernet); on the Pi 5, the web page also over the USB-C cable.
  • Display: LVGL 9 on core 0’s loop, an 800x480 frame buffer, USB HID touch with error recovery.
  • Heap buffers: the send effects (about 4.8 MB) and the core’s large buffers are allocated from Circle’s heap once at boot, so the kernel image stays small.
  • Guard: each voice’s render is timed; a voice over budget three blocks running, or one that faults, is muted while the others play. A render core that misses 20 ms is fatal: a clean stop and a reboot. A hardware watchdog covers core 0.
  • SD boot: the card holds sdboot.img, a small loader patched from Circle’s serial bootloader, and engine.img (the kernel with a checked header). sdboot checks the image and starts it after a 1 s window in which a development flasher can take over. Boot to the first audio: about 11.5 s.

The Teensy 4.1 build, the Sidecar Mini, is frozen at 0.1.0: it runs the same core in one Arduino sketch and is not part of the current releases. Its documentation is in the 0.2 docs.

The mods patch the Rytm’s MAIN OS 1.74 image (Sidecar 0.5.0 is built for OS 1.74 only; 0.4.4 and older also had a build for OS 1.73) and nothing else (the bootloader, FPGA and other sections are untouched; the build checks they come back byte-identical).

  • elekloader provides the code space: its Rytm core (core-ar2) appends a blob to the OS that is copied at early boot into a fixed 128 KB DDR area, where the larger mods live. Each mod is built as an elekloader module whose patch sites are pinned to the stock bytes they replace.
  • Patch sites, conceptually: small detours at a few firmware entry points hand control to mod code: a hidden machine slot becomes an EXT machine (its source silenced, its trig and knob values reported); a page’s key press cycles to an extra page; the sample browser’s directory model gains the SIDECAR folder; the SysEx router passes our messages to the mods; the screen and key path gain the remote page. Reports go out over the Rytm’s own USB MIDI sender, without waiting on a busy USB link.
Mod What
0021 ext the EXT machines, their pages and reports, the user slots and the slot menu, sound fingerprints
0022 router the host-link SysEx router (from the looper experiment)
0023 drive the SIDECAR folder in the sample browser, the per-project pool
0025 sendfx report sends the send levels and the FX values to the host; stores the effect knobs
0026 remote UI the remote pages: frames, text in the Rytm’s fonts (3D / 3E), local echo (3F), catch mask (37), hello and connect screen (35 / 36), machine reports (33), trig LEDs (34), active kit (3B), UP + LFO (TRK + LFO before rui1046), the SRC view (29 / 2A)
0014 hidden machines, 0028 hello, 0030 FX in the hidden machine slots, the Rytm’s hello to the host, the FX return on IN L/R (26 / 27)
0027 elekloader builds the image with elekloader’s core and DDR area
0029 sendfx UI AMPLITUDE 2 and the SEND FX 1/2 pages, labels and stepped knobs

Every claim on code space and every patch site is recorded in a registry with the stock bytes it expects, so a wrong address or a collision stops the build instead of patching the wrong place.