Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentations for using this library? #26

Open
xxbidiao opened this issue Nov 16, 2017 · 1 comment
Open

Documentations for using this library? #26

xxbidiao opened this issue Nov 16, 2017 · 1 comment

Comments

@xxbidiao
Copy link

Hi, I'm looking for using this in a project, yet finding difficulties looking for what I need.

Are there any documentations / sample code for using them? Thanks!

@dtinth
Copy link
Member

dtinth commented Nov 17, 2017

Hello, thanks for your interest!

API documentation is a bit lacking, but here’s a quick overview of usage:

  1. Create a bms.BMSChart object using bms.Compiler

    const bmsSource = `#00101:01\n...`
    const compileResult = bms.Compiler.compile(bmsSource)
    const chart = compileResult.chart

    The BMSChart contains the raw BMS data (headers, objects, and timeSignatures) with minimal interpretation.

    Use chart.measureToBeat to convert (measure, fractionInsideMeasure) to beat number. This is important as most functions work on beat number.

  2. To extract information from BMS, use the designated classes. These classes have a static method fromBMSChart that you can use.

    Information type Extraction
    Timing data
    Handles BPM changes and stops
    Convert between beats and seconds
    Timing.fromBMSChart(chart)
    Notes
    Interpret notes (both playable, and autoplay)
    Handles long notes
    Notes.fromBMSChart(chart)
    SongInfo
    Interprets title, artist, level, …
    SongInfo.fromBMSChart(chart)
    Keysounds
    Handles mapping from keysound ID to sound file
    Keysounds.fromBMSChart(chart)
    Positioning
    Handles on-screen placement of notes
    Based on StepMania 5’s scroll segments
    See: Bemuse’s BMS extensions
    Positioning.fromBMSChart(chart)
    Spacing
    Handles dynamic speed changes
    Based on StepMania 5’s speed segments
    Inspired from gimmicks in Pump It Up games
    See: Bemuse’s BMS extensions
    Spacing.fromBMSChart(chart)

    To use these objects, I recommend trying playing with them in your JavaScript console!

Here are some resources that may help:

If you need specific help, feel free to ask. 😄

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

No branches or pull requests

2 participants