Documentations for using this library?
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!
Hello, thanks for your interest!
API documentation is a bit lacking, but here’s a quick overview of usage:
-
Create a
bms.BMSChartobject usingbms.Compilerconst bmsSource = `#00101:01\n...` const compileResult = bms.Compiler.compile(bmsSource) const chart = compileResult.chartThe BMSChart contains the raw BMS data (
headers,objects, andtimeSignatures) with minimal interpretation.Use
chart.measureToBeatto convert(measure, fractionInsideMeasure)to beat number. This is important as most functions work on beat number. -
To extract information from BMS, use the designated classes. These classes have a static method
fromBMSChartthat you can use.Information type Extraction Timing data
Handles BPM changes and stops
Convert between beats and secondsTiming.fromBMSChart(chart)Notes
Interpret notes (both playable, and autoplay)
Handles long notesNotes.fromBMSChart(chart)SongInfo
Interprets title, artist, level, …SongInfo.fromBMSChart(chart)Keysounds
Handles mapping from keysound ID to sound fileKeysounds.fromBMSChart(chart)Positioning
Handles on-screen placement of notes
Based on StepMania 5’s scroll segments
See: Bemuse’s BMS extensionsPositioning.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 extensionsSpacing.fromBMSChart(chart)To use these objects, I recommend trying playing with them in your JavaScript console!
Here are some resources that may help:
- An unfinished API docs. This lists the most important methods.
-
List of dependents — you can see how other projects uses this library.
- Snack-X/web-bms-viewer also uses this library.
- The tests for reading notes and timing data.
- The cucumber specs (bmspec) is implemented in the features directory.
- This file (features/support/bms.js) shows how a test environment is setup.
- Files in features/step_definitions implements the steps.
If you need specific help, feel free to ask. 😄