{"id":17189340,"url":"https://github.com/mikuroxina/bms-rs","last_synced_at":"2025-04-13T19:24:30.368Z","repository":{"id":45181193,"uuid":"376263350","full_name":"MikuroXina/bms-rs","owner":"MikuroXina","description":"The BMS format parser with Rust.","archived":false,"fork":false,"pushed_at":"2024-05-18T15:03:45.000Z","size":302,"stargazers_count":13,"open_issues_count":1,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-07-05T16:32:08.617Z","etag":null,"topics":["bms","game","music","parser"],"latest_commit_sha":null,"homepage":"https://docs.rs/bms-rs/latest/bms_rs/","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MikuroXina.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-06-12T10:35:54.000Z","updated_at":"2024-08-03T18:00:00.952Z","dependencies_parsed_at":"2023-11-09T11:45:04.742Z","dependency_job_id":"269cd812-2b19-46e3-82e9-61d539487ebc","html_url":"https://github.com/MikuroXina/bms-rs","commit_stats":{"total_commits":199,"total_committers":6,"mean_commits":"33.166666666666664","dds":0.1758793969849246,"last_synced_commit":"fcbaca10b30ebfe719c0e0c9ccb14c91fa0ba8e6"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MikuroXina%2Fbms-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MikuroXina%2Fbms-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MikuroXina%2Fbms-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MikuroXina%2Fbms-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MikuroXina","download_url":"https://codeload.github.com/MikuroXina/bms-rs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248766765,"owners_count":21158314,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bms","game","music","parser"],"created_at":"2024-10-15T01:11:21.360Z","updated_at":"2025-04-13T19:24:30.344Z","avatar_url":"https://github.com/MikuroXina.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bms-rs\n\nThe BMS format parser.\n\nBe-Music Source, called BMS for short, is a file format devised by Urao Yane in 1998 for a simulator of the game Beatmania by KONAMI. This describes what and when notes are arranged and its music metadata. It is a plain text file with some “command” lines starting with `#` character.\n\n## Usage\n\nAt first, you can get the tokens stream with `lex::parse`. Then pass it and the random generator to `parse::Bms::from_token_stream` to get the notes data. Because BMS format has some randomized syntax.\n\n```rs\nuse bms_rs::{\n    lex::parse,\n    parse::{rng::RngMock, Bms},\n};\n\nlet source = std::fs::read_to_string(\"tests/lilith_mx.bms\").unwrap();\nlet token_stream = parse(\u0026source).expect(\"must be parsed\");\nlet rng = RngMock([1]);\nlet bms = Bms::from_token_stream(\u0026token_stream, rng).expect(\"must be parsed\");\n```\n\n## About the format\n\n### Command\n\nEach command starts with `#` character, and other lines will be ignored. Some commands require arguments separated by whitespace character such as spaces or tabs.\n\n```\n#PLAYER 1\n#GENRE FUGA\n#TITLE BAR(^^)\n#ARTIST MikuroXina\n#BPM 120\n#PLAYLEVEL 6\n#RANK 2\n\n#WAV01 hoge.WAV\n#WAV02 foo.WAV\n#WAV03 bar.WAV\n\n#00211:0303030303\n```\n\n### Header command\n\nHeader commands are used to express the metadata of the music or the definition for note arrangement.\n\n### Message command\n\nMessage command starts with `#XXXYY:ZZ...`. `XXX` is the number of the measure, `YY` is the channel of the message, and `ZZ...` is the object id sequence.\n\nThe measure must start from 1, but some player may allow the 0 measure (i.e. Lunatic Rave 2).\n\nThe channel commonly expresses what the lane be arranged the note to.\n\nThe object id is formed by 2-digit of 36-radix (`[0-9a-zA-Z]`) integer. So the sequence length must be an even number. The 00 object id is the special id, expresses the rest (no object lies). The object lies on the position divided equally by how many the object is in the measure. For example:\n\n```\n#00211:0303000303\n```\n\nThis will be placed as:\n\n```\n003|--|--------------|\n   |  |03            |\n   |  |03            |\n   |  |              |\n   |  |03            |\n002|--|03------------|\n   |  |  []  []  []  |\n   |()|[]  []  []  []|\n   |-----------------|\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikuroxina%2Fbms-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmikuroxina%2Fbms-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikuroxina%2Fbms-rs/lists"}