writeMidiFile: wrap EVENTS section names in brackets - #88
Open
elicwhite wants to merge 2 commits into
Open
Conversation
Moonscraper/Clone Hero's MIDI reader matches the literal prefix `[section ` and silently drops sections written as plain `section name`. Emit `[section <name>]` to match the .chart writer and the RBN convention; YARG accepts both forms.
The chart-format spec (Chart-File-Formats/chart-format/Format-Overview.md, "Basic Global Events" table + example) shows sections in .chart files written as plain `section <name>`. The Rock Band / GH1+2 MIDI Practice-Sections docs say parsers should accept both `[section <name>]` and plain `section <name>`. A scan of 15,525 charts in the wild confirms it: .chart 93,034 plain events, 0 bracketed (across 6,490 charts) .mid 9 plain events, 133,046 bracketed (across 9,047 charts) Updates: - chart-writer.ts: emit plain `section <name>`. Moonscraper / Clone Hero's .chart reader explicitly checks for `"section` (no leading bracket) at the start of the E-event payload — bracketed sections in .chart silently dropped on import. - chart-parser.ts: strict plain-only. Bracketed sections in .chart fall through to unrecognizedTextEvents instead of being promoted to typed sections. - midi-writer.ts (already in ec5668c) keeps emitting `[section …]`, the MIDI canonical form. - midi-parser.ts (unchanged) stays lenient on input — accepts both forms per the spec. - per-track-data.test.ts: pin the new .chart strictness.
elicwhite
force-pushed
the
wrap-section-events-in-brackets
branch
from
April 26, 2026 17:08
08a5714 to
6a03090
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
writeMidiFilenow emits practice sections as[section <name>]instead of the unwrappedsection <name>form.[sectionand silently drops the unwrapped form, so the prior output lost every section in CH for round-tripped MIDIs..chartwriter and the RBN/Rock Band MIDI convention; YARG accepts both forms viaNormalizeTextEvent+TryParseSectionEvent.Test plan
npx vitest runpasseswriteMidiFileand confirm sections appear in Clone Hero