RPE Chart Utils
    Preparing search index...

    Class ChartBuilder

    Fluent wrapper around an RpeJson object.

    All mutating methods return this for chaining. Use .data to access the underlying raw chart at any time.

    • ChartBuilder.empty(bpm?, name?) — create a new chart
    • ChartBuilder.from(chart) — wrap an existing RpeJson
    Category Methods
    Lines .line(), .lines(), .getLine(), .removeLine(), .duplicateLine()
    BPM .bpm(), .setBpm(), .removeBpm()
    Transforms .offset(), .mirror(), .merge()
    Metadata .setName(), .setCharter(), .setComposer(), .setLevel(), .setOffset(), .setBackground(), .setSong()
    Iterators .notes(), .lineIterator(), .events()
    Stats .stats(), .validate(), .serialize()
    const chart = ChartBuilder.empty(120, 'My Chart')
    .setCharter('Me')
    .bpm(16, 140) // tempo change at beat 16
    .offset(8); // shift everything 8 beats forward

    const line = chart.line({ name: 'Main' });
    line.moveX(0, 4, 0, 675, 'cubicOut').addNote(2);

    const json = chart.data; // access raw RpeJson
    Index

    Constructors

    Properties

    data: RpeJson

    The underlying chart data. Direct mutations are fine.

    Accessors

    • get lineCount(): number

      Number of lines in the chart.

      Returns number

    Methods

    • Create a new empty chart and wrap it.

      Parameters

      • bpm: number = 120

        Initial BPM (default: 120).

      • name: string = "Untitled"

        Chart name (default: 'Untitled').

      Returns ChartBuilder

    • Remove a line by index. Updates parent references automatically.

      Parameters

      • index: number

      Returns this

    • Remove a BPM change at the given index (cannot remove index 0).

      Parameters

      • index: number

      Returns this

    • Duplicate a line by index and return the new LineBuilder.

      Parameters

      • index: number
      • includeNotes: boolean = true

      Returns LineBuilder

    • Set the chart to a single constant BPM, replacing all existing BPM entries.

      Parameters

      • bpm: number

      Returns this

    • Add a BPM change at beat.

      Parameters

      • beat: number
      • bpm: number

      Returns this

    • Offset the entire chart by beatOffset beats.

      Parameters

      • beatOffset: number

      Returns this

    • Mirror the entire chart horizontally.

      Returns this

    • Set the chart name.

      Parameters

      • name: string

      Returns this

    • Set the chart offset (in milliseconds).

      Parameters

      • offsetMs: number

      Returns this

    • Set the level string (e.g. 'SP Lv.15').

      Parameters

      • level: string

      Returns this

    • Set the charter (chart author) name.

      Parameters

      • charter: string

      Returns this

    • Set the composer name.

      Parameters

      • composer: string

      Returns this

    • Set the background image path.

      Parameters

      • background: string

      Returns this

    • Set the song audio file path.

      Parameters

      • song: string

      Returns this

    • Serialize the chart to a JSON string.

      Parameters

      • pretty: boolean = true

      Returns string

    • Add a BPM change at beat. Alias for .bpm(beat, bpm).

      Parameters

      • beat: number
      • bpm: number

      Returns this