Skip to content

Add ADTOF drum transcription to MIDI pipeline#10

Open
kurtjcu wants to merge 3 commits intotsondo:mainfrom
kurtjcu:adtof-drum-midi
Open

Add ADTOF drum transcription to MIDI pipeline#10
kurtjcu wants to merge 3 commits intotsondo:mainfrom
kurtjcu:adtof-drum-midi

Conversation

@kurtjcu
Copy link
Copy Markdown

@kurtjcu kurtjcu commented Mar 20, 2026

Summary

  • Add dedicated Automatic Drum Transcription (ADT) using ADTOF-pytorch — drums were previously routed through BasicPitch (a pitched-instrument model) which produced poor/garbled results on unpitched percussion
  • New DrumMidiSpec in the model registry with 5-class output (kick, snare, tom, hi-hat, cymbal) mapped to GM MIDI note numbers
  • MIDI pipeline now detects drum stems and routes them through ADTOF instead of BasicPitch, with proper channel 10 output and fixed 60ms note duration
  • ADT model selector appears in the MIDI panel UI when drum stems are checked
  • 7 test files covering drum map, ADTOF backend protocol, registry spec, pipeline routing, loader integration, and API endpoints

What changed

Area Files What
Backend core utils/drum_map.py, pipelines/adtof_backend.py GM note mapping + ADTOF load/predict/evict
Registry models/registry.py DrumMidiSpec + adtof-drums entry
Pipeline wiring models/midi_loader.py, pipelines/midi_pipeline.py Lazy ADTOF loading, drum routing branch
API backend/api/midi.py adt_model param on extract, ADT models in /gm-programs
MIDI I/O utils/midi_io.py is_drum parameter for channel 10 + fixed duration
Frontend frontend/components/midi.js ADT model selector, visibility toggle
Tests 7 new test files Full coverage of the new drum path
Deps pyproject.toml, uv.lock adtof-pytorch dependency

Test plan

  • Run pytest tests/test_drum_map.py tests/test_drum_midi_spec.py tests/test_adtof_backend.py tests/test_midi_loader_drum.py tests/test_midi_pipeline_routing.py tests/test_drum_midi_integration.py tests/test_notes_to_midi_drum.py
  • Upload a track, separate stems, select drums in MIDI tab → verify ADT model dropdown appears
  • Extract MIDI from drum stem → verify channel 10 output with GM drum notes
  • Extract MIDI from a pitched stem → verify BasicPitch still used (no regression)

kurtjcu added 3 commits March 24, 2026 07:49
Introduce dedicated Automatic Drum Transcription (ADT) support using
ADTOF-pytorch. Drums were previously routed through BasicPitch (a
pitched-instrument model) which produced poor results on unpitched
percussion.

- Add DrumMidiSpec to model registry with 5-class ADTOF descriptor
- Add drum_map.py: GM MIDI note mapping for ADT class outputs
- Add adtof_backend.py: AdtofBackend with load/predict/evict lifecycle
- Extend notes_to_midi with is_drum parameter (channel 10, fixed 60ms
  note duration, no pitch bend)
- Add adtof-pytorch dependency
Route drum stems through ADTOF instead of BasicPitch in the MIDI
extraction pipeline. The existing FluidSynth render already handled
channel 10 correctly — this closes the transcription gap.

- Add ADTOF lazy loading and eviction to MidiModelLoader
- Add drum detection branch to MidiPipeline with 3-stage progress
- Extend ExtractRequest with adt_model parameter
- Add adt_models list to /api/midi/gm-programs response
Show an ADT model dropdown in the MIDI panel when drum stems are
selected. Add tests covering drum map, ADTOF backend protocol,
registry spec, pipeline routing, loader integration, and API
endpoint behavior.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant