Skip to content

Epic: MIDI drum input — per-piece calibration + live scoring #2

Closed
7 of 7 issues completed
Closed

Description

@cchacs

Goal

Let a user play drum charts with any MIDI device (keyboard, generic pad controller, or electronic drum kit module) by calibrating which physical trigger maps to which drum piece in the song, then reading those triggers during playback to score hits against the chart.

This is an input + scoring plugin, not a visualization plugin. It feeds highway.setNoteStateProvider() so whichever renderer is active (default 2D, drum_highway_3d, a future 2D drums viz) lights up gems — same contract notedetect uses for pitched instruments. It does not own its own highway/canvas.

Why now / prior art found in the codebase

  • lib/drums.py (core) already defines the canonical piece vocabulary (kick, snare, hh_closed/hh_open/hh_pedal, toms, cymbals, …) with default GM MIDI notes, category, shape, color — our mapping keys must line up with these piece-ids 1:1, not invent a new vocabulary.
  • The drum_tab/drum_hits WS messages (lib/routers/ws_highway.py) already stream a song's drum chart (kit legend + timed hits {t, p, v, g?, f?, k?}), including multi-drum-part support (song_info.drum_parts, ?drum_part=<id>).
  • Core already ships a midi-input capability domain (static/capabilities/midi-input.js, window.feedBack.midiInput) as the single device-access boundary — one permission prompt, one source list, works uniformly across keyboards/pad controllers/e-kits since Web MIDI abstracts them identically. plugins/input_setup and plugins/drum_highway_3d already consume it; we must too, not call navigator.requestMIDIAccess() ourselves.
  • plugins/input_setup already does a "pick a MIDI device + hit a pad to confirm it's alive" onboarding step for drums — but only a liveness check, not a per-piece mapping. This plugin is the next layer in: once a device is selected, map which pad hits which piece.
  • plugins/drum_highway_3d has a comment admitting its MIDI_TO_PIECE map is a hardcoded GM table standing in for "the 2D drums plugin['s] user-editable mapping" — which doesn't exist anywhere yet. This plugin is meant to be (or become) that real, user-editable mapping owner.

Sub-issues

  • Device access via the core midi-input domain
  • Per-piece kit-profile calibration wizard
  • Kit profile persistence (settings.server_files)
  • Drum chart consumption (drum_tab/drum_hits, multi-part support)
  • Live hit matching / scoring engine
  • setNoteStateProvider integration for renderer-agnostic visual feedback
  • Settings screen: kit profile management UI

Explicitly out of scope for v1

  • Owning a highway/canvas renderer — this plugin reads input and scores; it does not draw.
  • The reserved midi-control domain (CC/note→action routing) — stays dormant until a concrete consumer justifies promoting it; building straight against midi-input is simpler for v1.
  • Updating drum_highway_3d to read this plugin's calibrated mapping instead of its own hardcoded GM table — real, valuable follow-up, but a change to a different repo, tracked separately.

Sub-issues

Sub-issues

7 of 7 Issues completed
Loading 7 sub-issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions