trim(s: string) → string
| arg | type | description |
|---|
| s | string | |
stripComment(s: string) → string
| arg | type | description |
|---|
| s | string | |
number(s: string) → number
A beat or a length: "12", "12.5", "25/2", "12+1/3", "-1".
| arg | type | description |
|---|
| s | string | |
tempoMap(tempos: { any }, offset: number) → void
Tempo map
Build the tempo map: segments { beat, bpm, time } with time measured in
seconds of audio (beat 0 sits at `offset`).
| arg | type | description |
|---|
| tempos | { any } | |
| offset | number | |
segAtBeat(segs: ?, beat: number) → void
| arg | type | description |
|---|
| segs | ? | |
| beat | number | |
segAtTime(segs: ?, t: number) → void
| arg | type | description |
|---|
| segs | ? | |
| t | number | |
beatToTime(segs: ?, beat: number) → number
| arg | type | description |
|---|
| segs | ? | |
| beat | number | |
timeToBeat(segs: ?, t: number) → number
| arg | type | description |
|---|
| segs | ? | |
| t | number | |
bpmAt(segs: ?, beat: number) → number
| arg | type | description |
|---|
| segs | ? | |
| beat | number | |
problem(list: ?, line: number, col: number?, msg: string, src: string?, severity: string?) → void
Parsing
| arg | type | description |
|---|
| list | ? | |
| line | number | |
| col | number? | |
| msg | string | |
| src | string? | |
| severity | string? | |
parseLanes(s: string, lanes: number) → void
| arg | type | description |
|---|
| s | string | |
| lanes | number | |
beatLabel(b: number) → string
| arg | type | description |
|---|
| b | number | |
parse(src: string, opts: any?) → void
Parse chart text. Returns (chart, problems). `chart` is nil when any
problem is an error; `problems` lists every error and warning with its
line, the source text and a readable `text`.
| arg | type | description |
|---|
| src | string | |
| opts | any? | |
beatOf(tok: string) → number
| arg | type | description |
|---|
| tok | string | |
build(meta: any, tempos: { any }, notes: { any }) → any
Build a chart from header values, tempo changes ({ beat, bpm }) and notes
({ beat, lane, hold }). Used by `parse`, by `fold` and by code that writes
charts. Notes are sorted and given ids, times, chord sizes and end times.
| arg | type | description |
|---|
| meta | any | |
| tempos | { any } | |
| notes | { any } | |
toTime(chart: ?, beat: number) → number return Chart
| arg | type | description |
|---|
| chart | ? | |
| beat | number | |
toBeat(chart: ?, t: number) → number return Chart
| arg | type | description |
|---|
| chart | ? | |
| t | number | |
bpm(chart: ?, beat: number) → number return Chart
| arg | type | description |
|---|
| chart | ? | |
| beat | number | |
fold(chart: ?, to: number) → any
Fold a chart onto fewer lanes (a 4-lane chart on a 2-lane taiko track or a
1-lane strip). Lanes split into `to` even groups, left to right. Notes that
land together in one lane become one note (a hold wins over a tap); a note
that lands inside a hold shortens the hold to end a quarter beat before it,
or turns the hold into a tap when there is no room.
| arg | type | description |
|---|
| chart | ? | |
| to | number | |
map(l: number) → number
| arg | type | description |
|---|
| l | number | |
serialize(chart: ?) → string
Write a chart (from `parse` or `build`) back out as chart text.
report(problems: { any }) → string
Every problem as one readable block, for a log or an error.
| arg | type | description |
|---|
| problems | { any } | |
load(text: string) → any
Parse or raise: the error message lists every problem with its line.
| arg | type | description |
|---|
| text | string | |
fromAsset(ref: any) → any
Load a chart from a rhythmChart asset ref (the caller looks the asset up by
its literal name, so it can be pinned for publishing) or from a chart.txt path.