Skip to content

Hi Hat Mode

delabrcd edited this page Jul 23, 2026 · 2 revisions

Hi-hat mode

By default the adapter is a pure note relay: the kit's note number decides which cymbal lane (including hi-hat open vs closed) fires. Hi-hat mode is an optional, build-gated alternative that instead tracks the hi-hat pedal position (a MIDI Control Change) and decides open/closed itself when a hi-hat note is struck — closer to how a real kit plays.

It is compiled out entirely unless you ask for it, so the default release is byte-identical to the plain relay.

The three levels

Set at build time via ORB_HIHAT_MODE (see enabling):

ORB_HIHAT_MODE Behaviour
0 (default) Off. Feature fully compiled out; pure note relay.
1 (discover) Parses the pedal CC and logs its value on the debug UART, but does not change output. Use this to learn your kit's pedal CC number and polarity.
2 (override) Level 1 + the actual open/closed override: a threshold + hysteresis state machine on the pedal value picks the lane on each hi-hat strike.

Configuration

Compile-time knobs in modules/service/hihat_config.h (a stopgap until the runtime configurator lands). Override any as -D<NAME>=<value>:

Knob Default Meaning
ORB_HIHAT_CC 4 Pedal Control-Change number to track.
ORB_HIHAT_THRESHOLD 64 Open/closed split point (0–127).
ORB_HIHAT_HYST 8 Hysteresis band around the threshold (anti-chatter).
ORB_HIHAT_INVERT 0 0 = a low CC value means open; 1 = inverted.
ORB_HIHAT_NOTES {22,26,42,46} Strike notes the override applies to (the pedal-chick note 44 is intentionally excluded).

The open/closed state machine lives in DrumEngine::control_change() / drums.cpp; a static_assert enforces HYST ≤ THRESHOLD and THRESHOLD + HYST ≤ 127.

Enabling

# Learn your kit's pedal CC# and polarity (watch the debug UART while you work the pedal):
cmake -B build -DORB_HIHAT_MODE=1
# Then turn on the actual override, tuning the knobs to what you saw:
cmake -B build -DORB_HIHAT_MODE=2 -DORB_HIHAT_CC=4 -DORB_HIHAT_THRESHOLD=64
cmake --build build

ORB_HIHAT_MODE is a normal CMake cache option (default 0) alongside the other build-time feature gates. Discovery logging requires a logging build (the default; the release preset has logging compiled out).

openrb-pico

Getting started

Features

Background

Repo

Clone this wiki locally