The API provides high-level interface for reading and editing note block songs, even creating new songs from scratch.
The library's release as well as its source code can be found. You can also check out .
This section describes general usage of the library. For a detailed description of classes and functions, as well as the syntax, refer to.
Creating a new song
A song can be made from scratch by invoking the constructor
Song. The parameters are described in the table below.
|length||short||The length of the song. Deprecated as the length is now determined by the note table.|
|name||String||The name of the song.|
|author||String||The author of the song. Can ba the one made this file.|
|originalAuthor||String||The original author of the song (if any).|
|description||String||The description of the song.|
|tempo||short||The tempo of the song. Must be a multiple of 25 and from 25 to 2000. The song will play at a rate of tempo:100 ticks per second.|
|autoSave||boolean||Whether the song is automatically saved after a specified interval when open in Minecraft Note Block Studio.|
|autoSaveDuration||byte||The time in minutes that when passed Minecraft Note Block Studio will save the file.|
|timeSignature||byte||The number of notes per beat.|
|minutesSpent||int||The corresponding stat.|
|MidiSchematicFile||String||The name of the file (MIDI, schematic) that the song was imported from.|
|songBoard||List<Layer>||The main part of the song; containing all of the notes. Enter |
Reading a song from file
A song can be read from A .nbs file. Invoke the constructor
Reading/Editing song metadata
All of the metadata can be read by calling
getX(), where X is the name of a parameter above.
They can also be edited by invoking
Editing song board
The song board contains all of the notes in the song. It consists of layers as rows, each layer contains a series of notes on that row.
A layer is a "row" of the song board.
Creating a layer
There are two constructors for a
Layer(): An empty layer with default settings (name = ""; volume = 100).
Layer(String name, byte volume): An empty layer with a name and volume.
A layer has two properties:
String name: The name of the layer.
byte volume: The volume of the layer. Must be from 0 (muted) to 100 (maximum volume).
They are get/setable with approriate methods.
The main part of a layer is a list of notes, which is a HashMap and is retrievable by invoking
getNoteList(). The keys are integers specifying a tick, and the values are notes at those ticks.
Each note contains two attributes:
- instrument: Specifies the sound when the note is played. Can be one of these:
- pitch: A number from 0 to 87 specifying the pitch of the note.
Saving the song
A song can be saved to a file by invoking one of the following:
writeSongToFile(File file): Writes the song to the specified file in .nbs format.
writeSongToMidiFile(File file): Writes the song to the specified file as MIDI. Each channel stores note for an instrument in the song.