Crates.io Version Crates.io Dependents GitHub last commit GitHub Repo stars
A simple Rust library for working with .nbs files from Open Note Block Studio.
This library references pynbs and implements its basic functionality, aiming to serve as a fundamental NBS file processing library with a few extra utilities on top. Currently supports version 6 of the NBS standard.
It is also a concrete implementation of the formal reduction of redstone music, pioneeringly validating the feasibility of its formal logic and layout structures.
However, due to language differences, some adaptations have been made, so behavior may not always be consistent. Since this project is quite niche, it hasn't been thoroughly tested. If you encounter any issues or have feature requests, please submit an issue.
This library is in early development with a frequently changing API. Please pin your dependency to a specific version.
use rsnbs::note::{Instrument, Key, Note, Tone}; use rsnbs::song::Song; use rsnbs::types::{Position, Tick, TimeAnchor}; // example 1: iterating over a song's notes let song: Song = Song::open_nbs("fixtures/source.nbs").unwrap(); for (pos, note) in &song.notes { let tick: Tick = pos.into_tick(); let key: Key = note.tone.key; println!("tick: {tick}, key: {key}"); } // example 2: generating a new song programmatically let mut song: Song = Song::new(); song.header.is_loop = true; for i in 0..25 { let pos: Position = Position::new(i, 0); let key: Key = Key::from_minecraft_note(i).unwrap(); let tone: Tone = Tone::new(Instrument::Harp, key); song.notes.insert(pos, Note::new(tone)); } song.save_nbs("fixtures/generated_example.nbs").unwrap();
-
kemiamu: architect of the theoretical framework.
-
madSUNitist: contributed to the theory and the prototype code.
-
Chen JunFu: another early theoretical explorer.
-
Fadeorite: contributed to the prototype code.
-
John Bush: former repository maintainer.
-
Akitsuki: his song library was used as the corpus for tuning and testing.
-
Qianqiu: his layout structures were referenced.