Skip to content

Add writeMidiFile() with TEMPO/EVENTS/unrecognized-track emission - #72

Open
elicwhite wants to merge 1 commit into
chart-writer-tracksfrom
midi-writer-core
Open

Add writeMidiFile() with TEMPO/EVENTS/unrecognized-track emission#72
elicwhite wants to merge 1 commit into
chart-writer-tracksfrom
midi-writer-core

Conversation

@elicwhite

Copy link
Copy Markdown
Owner

Port of the core MIDI writer infrastructure:

  • writeMidiFile(chart) entry point: builds a Format-1 MIDI and returns
    Uint8Array via midi-file's writeMidi
  • TEMPO TRACK: trackName + setTempo (from chart.tempos) + timeSignature
    (from chart.timeSignatures), all at their absolute ticks
  • EVENTS track: trackName + section text events (unwrapped so YARG's
    NormalizeTextEvent doesn't strip names containing ]) + [end] events +
    global events (bracket-wrap when source is .chart so MIDI output
    follows convention) + [coda] derived from drumFreestyleSections when
    not already present in unrecognizedEvents
  • Unrecognized MIDI tracks: verbatim pass-through with abs-tick →
    delta-tick conversion; duplicate track names suffixed to keep the
    internal trackMap unique
  • finalizeMidiTrack helper: sorts by tick with a type-priority
    tiebreaker, converts absolute ticks to delta times, appends endOfTrack

Instrument tracks (PART DRUMS, PART GUITAR, …) and vocal tracks
(PART VOCALS, HARM1/2/3) land in follow-up PRs.

@elicwhite
elicwhite marked this pull request as ready for review April 20, 2026 04:16
@elicwhite
elicwhite force-pushed the chart-writer-tracks branch from d34492e to 6392059 Compare April 20, 2026 04:18
@elicwhite
elicwhite force-pushed the chart-writer-tracks branch from 6392059 to 384bfaf Compare April 20, 2026 04:40
@elicwhite
elicwhite force-pushed the chart-writer-tracks branch from 384bfaf to 6251e3a Compare April 20, 2026 04:45
@elicwhite
elicwhite force-pushed the chart-writer-tracks branch from 6251e3a to c88be8b Compare April 20, 2026 05:09
@elicwhite
elicwhite force-pushed the chart-writer-tracks branch from c88be8b to 88f54cf Compare April 20, 2026 05:10
@elicwhite
elicwhite force-pushed the chart-writer-tracks branch from 88f54cf to ae62751 Compare April 20, 2026 05:19
@elicwhite
elicwhite force-pushed the chart-writer-tracks branch from ae62751 to b9fc02c Compare April 21, 2026 04:29
@elicwhite
elicwhite force-pushed the midi-writer-core branch 2 times, most recently from 971638a to d6aac50 Compare April 21, 2026 04:47
@elicwhite
elicwhite force-pushed the chart-writer-tracks branch from b9fc02c to 0c2d229 Compare April 21, 2026 04:48
@elicwhite
elicwhite force-pushed the midi-writer-core branch 2 times, most recently from 656840c to eecc72b Compare April 21, 2026 16:35
@elicwhite
elicwhite force-pushed the chart-writer-tracks branch from 46def19 to 78f6b77 Compare April 21, 2026 16:38
@elicwhite
elicwhite force-pushed the midi-writer-core branch 2 times, most recently from 931507e to 206bb47 Compare April 21, 2026 16:51
@elicwhite
elicwhite force-pushed the chart-writer-tracks branch from 78f6b77 to 143d91d Compare April 21, 2026 16:51
Port of the core MIDI writer infrastructure:
- writeMidiFile(chart) entry point: builds a Format-1 MIDI and returns
  Uint8Array via midi-file's writeMidi
- TEMPO TRACK: trackName + setTempo (from chart.tempos) + timeSignature
  (from chart.timeSignatures), all at their absolute ticks
- EVENTS track: trackName + section text events (unwrapped so YARG's
  NormalizeTextEvent doesn't strip names containing ]) + [end] events +
  global events (bracket-wrap when source is .chart so MIDI output
  follows convention) + [coda] derived from drumFreestyleSections when
  not already present in unrecognizedEvents
- Unrecognized MIDI tracks: verbatim pass-through with abs-tick →
  delta-tick conversion; duplicate track names suffixed to keep the
  internal trackMap unique
- finalizeMidiTrack helper: sorts by tick with a type-priority
  tiebreaker, converts absolute ticks to delta times, appends endOfTrack

Instrument tracks (PART DRUMS, PART GUITAR, …) and vocal tracks
(PART VOCALS, HARM1/2/3) land in follow-up PRs.
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