Skip to content

Add createEmptyChart() counterpart to parseChartAndIni#99

Open
elicwhite wants to merge 1 commit into
Geomitron:masterfrom
elicwhite:create-empty-chart
Open

Add createEmptyChart() counterpart to parseChartAndIni#99
elicwhite wants to merge 1 commit into
Geomitron:masterfrom
elicwhite:create-empty-chart

Conversation

@elicwhite
Copy link
Copy Markdown
Contributor

Context

Adds a programmatic builder for `ParsedChart` — the counterpart to `parseChartAndIni` for consumers who construct charts from scratch (e.g. generating a chart from ML-transcribed drum data) rather than parsing source bytes.

Shape

```ts
export function createEmptyChart(options?: {
format?: 'chart' | 'mid' // default 'chart'
resolution?: number // default 480
bpm?: number // default 120
timeSignature?: { numerator: number; denominator: number } // default 4/4
}): ParsedChart
```

Returns a minimal valid `ParsedChart` with defaults filled in: requested resolution, single tempo at tick 0, single time signature at tick 0, empty tracks/sections/vocalTracks/unrecognized events, `chartBytes` as an empty `Uint8Array` (no source), `iniChartModifiers` set to `defaultIniChartModifiers`.

Depends on

PRs #97 + #98 — stacked on the same line. Diff against master currently includes those changes; once they merge upstream, this diff becomes clean (~60 lines of new code + tests).

Builds a minimal valid ParsedChart from scratch: default 480 resolution,
120 BPM at tick 0, 4/4 time signature at tick 0, empty tracks/sections/
metadata/vocal parts/unrecognized events. chartBytes defaults to an empty
Uint8Array (no source bytes), format defaults to 'chart', iniChartModifiers
to the library defaults.

Options let callers override resolution, bpm, timeSignature, and format.

Useful for programmatic chart generation (e.g. downstream code that builds
charts up from scratch rather than parsing source bytes).
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