Skip to content

writeMidiFile: emit PART DRUMS instrument tracks - #74

Open
elicwhite wants to merge 1 commit into
midi-writer-corefrom
midi-writer-drum
Open

writeMidiFile: emit PART DRUMS instrument tracks#74
elicwhite wants to merge 1 commit into
midi-writer-corefrom
midi-writer-drum

Conversation

@elicwhite

Copy link
Copy Markdown
Owner

Adds drum emission to writeMidiFile:

  • buildDrumTrack: groups one or more ParsedTrackData entries (one per
    difficulty) into a single PART DRUMS MIDI track. Emits trackName,
    delegates per-difficulty notes to emitDrumNotes, collects and dedupes
    instrument-wide star power (MIDI 116) / solo (MIDI 103) / activation
    lanes (MIDI 120), emits flex lanes (MIDI 126/127 with per-difficulty
    LDS velocity), passes through per-track text events and
    unrecognizedMidiEvents from the first difficulty.

  • emitDrumNotes: per-difficulty note emission with full modifier support:
    base drum notes (MIDI 96..100 expert / 84..88 hard / 72..76 medium /
    60..64 easy); double-kick as MIDI 95 only, emitted AFTER regular kick
    at the same tick (YARG insertion order quirk); tom markers (MIDI
    110/111/112) only in fourLanePro; accent (velocity 127) / ghost
    (velocity 1) encoding; one flam marker (MIDI 109) per group; 5-lane
    green+cymbal remapped to offset 4 (orange pad); blue-at-same-tick-as-
    green+cymbal remapped to offset 5 so fiveLane detection succeeds;
    fourLanePro green+tom fallback to offset 5 when a conflicting
    green+cymbal exists at the same tick across difficulties; disco-flip
    state-transition text events ([mix <diff> drums0[d|dnoflip]]).

  • fourLanePro sentinel greenTomMarker: when drumType=1 but no tom
    markers were emitted (all yellow/blue defaulted to cymbal, green-toms
    used offset-5 encoding), emit a MIDI 112 at a safe tick so scan-chart's
    drumType detection still picks fourLanePro.

  • [ENABLE_CHART_DYNAMICS] text event at tick 0 when any accent or ghost
    was emitted.

  • computeLengthOverrides: prevents scan-chart's trimSustains from
    collapsing adjacent short-sustain drum-note chains by attributing the
    combined chain length to the first note.

  • Shared helpers: addNoteOnOff, addNoteOnOffWithChannel (with
    zero-length seq-pairing to survive finalizeMidiTrack's sort),
    deduplicateSections, instrumentTrackNames table.

Fret tracks (PART GUITAR, GHL) and vocal tracks (PART VOCALS, HARM1/2/3)
remain no-ops until the follow-up PRs land — the writeMidiFile entry
iterates trackData but skips any non-drum instrument group.

Comment thread src/chart/midi-writer.ts Outdated
Adds drum emission to writeMidiFile:

- buildDrumTrack: groups one or more ParsedTrackData entries (one per
  difficulty) into a single PART DRUMS MIDI track. Emits trackName,
  delegates per-difficulty notes to emitDrumNotes, collects and dedupes
  instrument-wide star power (MIDI 116) / solo (MIDI 103) / activation
  lanes (MIDI 120), emits flex lanes (MIDI 126/127 with per-difficulty
  LDS velocity), passes through per-track text events and
  unrecognizedMidiEvents from the first difficulty.

- emitDrumNotes: per-difficulty note emission with full modifier support:
  base drum notes (MIDI 96..100 expert / 84..88 hard / 72..76 medium /
  60..64 easy); double-kick as MIDI 95 only, emitted AFTER regular kick
  at the same tick (YARG insertion order quirk); tom markers (MIDI
  110/111/112) only in fourLanePro; accent (velocity 127) / ghost
  (velocity 1) encoding; one flam marker (MIDI 109) per group; 5-lane
  green+cymbal remapped to offset 4 (orange pad); blue-at-same-tick-as-
  green+cymbal remapped to offset 5 so fiveLane detection succeeds;
  fourLanePro green+tom fallback to offset 5 when a conflicting
  green+cymbal exists at the same tick across difficulties; disco-flip
  state-transition text events (`[mix <diff> drums0[d|dnoflip]]`).

- fourLanePro sentinel greenTomMarker: when drumType=1 but no tom
  markers were emitted (all yellow/blue defaulted to cymbal, green-toms
  used offset-5 encoding), emit a MIDI 112 at a safe tick so scan-chart's
  drumType detection still picks fourLanePro.

- [ENABLE_CHART_DYNAMICS] text event at tick 0 when any accent or ghost
  was emitted.

- computeLengthOverrides: prevents scan-chart's trimSustains from
  collapsing adjacent short-sustain drum-note chains by attributing the
  combined chain length to the first note.

- Shared helpers: addNoteOnOff, addNoteOnOffWithChannel (with
  zero-length seq-pairing to survive finalizeMidiTrack's sort),
  deduplicateSections, instrumentTrackNames table.

Fret tracks (PART GUITAR, GHL) and vocal tracks (PART VOCALS, HARM1/2/3)
remain no-ops until the follow-up PRs land — the writeMidiFile entry
iterates trackData but skips any non-drum instrument group.
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