Skip to content

Issues to be addressed with NBS format version 6 #307

@Bentroen

Description

@Bentroen

Overview

Since the transition from MCNBS to ONBS, many updates to the .nbs format have been released. While those updates were necessary to support new features being added to the program, new NBS versions have been, so far, released on an "as necessary" basis, without any specific criteria or public notice prior to the official release.

Ideally, releasing a new version of a widely adopted format should be preceded by public discussions with its users. In the case of the NBS format, these would include plugin developers, as well as anyone creating software based on the format. The release schedule should also include an adaptation period, so developers have enough time to update plugins to comply with the new version.

In practice, this was never the case with the format versions released to this date. This impairs the widespread adoption of the format and causes plugins to be automatically outdated as a new version is released, to the detriment of their users and the NBS ecosystem as a whole.

Starting in NBS version 6, the project should strive to be as clear and transparent as possible about the upcoming changes, as well as take community input into consideration as much as possible. This way, future changes to the format can be bundled up in fewer version updates released as sparingly as possible.

This issue is an attempt to gather all the current issues with the NBS format as of version 5, as well as suggestions for new features that could potentially be included in version 6. Keep in mind this is only an overview of the current issues -- where necessary, more detailed write-ups on each of these issues may be written, including their possible workarounds.

If you're a developer creating something based on the .nbs format and would like to suggest a change, feel free to send it in the comments below!

Format issues

  • Instruments have no property to link them to Minecraft sound events. Currently, what many plugins (and even the built-in data pack export) do is to use the 'Instrument name' property as a sound event. This usage is not documented in the NBS specification.
  • No way to specify the loop end, which may be at the end of the bar or at the last note block according to the user's preferences. This makes the behavior of a particular NBS file non-deterministic/ambiguous across different installations.
  • As the song tempo is stored in ticks per second, there's not enough granularity to store precise values in beats per minute (BPM). Currently, only multiples of 0.15 BPM are stored properly, so values such as 110 get rounded to 109.95 on song load. (0.01 t/s = 0.15 BPM) (see BPM changes when project loaded #306)
  • It's not possible to pick which Minecraft version a song is aimed at, so the number of default instruments is always reliant on the Note Block Studio version that the song was saved in. This can be worked around by implementing "Future instruments" (to support opening newer songs in an older version), and allowing the Minecraft save version to be picked per song (unlocking access to 5, 10, or 16 custom instruments).
  • Note Block Studio currently allows 240 custom instruments. With the 16 default instruments, this occupies the full range of the unsigned byte data type (0-255). When new vanilla instruments are added to Minecraft, the instrument ID of songs nearing the maximum custom instrument size will overflow, preventing them from being saved on newer versions unless the numeric range for instrument IDs is increased.
  • The current way strings are encoded can only store ASCII characters. Non-ASCII characters only have the first byte of their UTF-16 representation written to the file, causing mojibake to appear when the song is reloaded. When the byte written to the file lies within the ASCII charset (0x00-0x7F), the equivalent ASCII character is displayed; otherwise, the displayed character is whatever ANSI character Windows maps that codepoint to. This can be fixed by encoding strings in UTF-8. Once this issue is fixed, the documentation should indicate how invalid ASCII characters should be treated in versions 0-5.
  • The binary nature of NBS files causes any change in the file structure to render the file incompatible with existing parsers. As .nbs files were never intended to be versioned, they don't conform to any particular standard, such as JSON or NBT; as such, it's not possible to "know" what's ahead without tightly following the most recent NBS specification. Ideally, a way should exist to "skip" unknown fields so any future .nbs files can be read by existing implementations. It's a technical challenge to make the format future-proof while avoiding major changes to the file structure.

Documentation issues

  • The 'Layer lock' field, originally intended to be a boolean, may actually assume values 0-2 (0= unlocked, 1=locked, 2=solo). This is currently undocumented in the NBS specification, and is caused by an incorrect variable (one that takes solo into account) being saved to the file.
  • Formally, there's no restriction put in place to the number of instruments, layers or ticks a song can have. Each version of the program, however, has limits regarding that count (e.g. songs with >200 layers, >18 custom instruments or >32,000 ticks can possibly crash certain versions of NBS). A survey must be made regarding the soft and hard limits of each Note Block Studio version, and, if deemed necessary, these limits should be enforced in the NBS specification.
  • The documentation marks all fields as signed, even though some of them don't fit in signed data types (e.g. layer panning = 0-200, instrument ID = 0-255). The signedness should be specified in every field to avoid ambiguities.
  • There are some features of the NBS format that are implemented in a particular manner by Note Block Studio, but aren't officially part of the specification. Some of these should be mentioned there, in order to standardize the way NBS and other implementations calculate some attributes of the song. These include:
    • How layer/note panning and volume should be weighted into the actual volume and panning values (implemented here)
    • How pitch is applied to the key in order to determine the final pitch of a note (and how to convert it to Minecraft's pitch values)
    • How the pitch value of custom instruments affects the final pitch of a note
  • Some fields (auto-save and auto-save duration) are deprecated, but there's no official recommendation in what to set those values to on newly created songs.

Feature suggestions

Metadata

Metadata

Assignees

No one assigned

    Labels

    C: Info/DiscussionAn informative post or extended discussion about future proposed improvements.C: NBS format changeSuggestions or issues that require changes to the NBS format

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions