# nbs.js

> Parse NBS (Note Block Song / Note Block Studio) files Pull Requests and issues are welcome!!

Latest version **1.0.3** (published 2021-08-19) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install nbs.js
pnpm add nbs.js
yarn add nbs.js
bun add nbs.js
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2021-08-19 |
| First published | 2021-02-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 9.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | alan404 |
| Maintainers | alan404 |
| Keywords | noteblock, studio, nbs, file, minecraft, song, noteblockstudio, noteblocksong |

## Links

- npm: https://www.npmjs.com/package/nbs.js
- Repository: https://github.com/thealan404/nbs.js
- Homepage: https://github.com/thealan404/nbs.js#readme
- Issues: https://github.com/thealan404/nbs.js/issues
- npm.io page: https://npm.io/package/nbs.js

## Dependencies (1)

- [bytebuffer](https://npm.io/package/bytebuffer.md) ^5.0.1

## Alternatives

- [unionfs](https://npm.io/package/unionfs.md) — 2.2M weekly downloads
- [path-starts-with](https://npm.io/package/path-starts-with.md) — 35.9K weekly downloads
- [redzip](https://npm.io/package/redzip.md) — 1.2K weekly downloads
- [vscode-anymatch](https://npm.io/package/vscode-anymatch.md) — 848 weekly downloads
- [@ledgerhq/coin-filecoin](https://npm.io/package/@ledgerhq/coin-filecoin.md) — 793 weekly downloads

## Recent versions

- 1.0.3 (latest) — 2021-08-19
- 1.0.2 — 2021-06-08
- 1.0.1 — 2021-02-22
- 1.0.0 — 2021-02-22

## README

# nbs.js
 Parse NBS (Note Block Song / Note Block Studio)  files
Pull Requests and issues are welcome!!

# Example

```js
const NBS = require("nbs.js")

let song = NBS.loadSong("./song.nbs")

console.log(song)
```

# API

## NBS.loadSong(filename)
Loads a song by given filename/path.
- filename : string
- **Returns:** Song

## NBS.parse(data)
Parses data and returns a new Song.
- data : buffer
- **Returns:** Song

## NBS.Song

### new Song([data])
These properties are added to the song:
- data : object
- data.title : string
- data.author : string
- data.description : string
- data.original_author : string
- data.imported_name : string
- data.tempo : number (ticks per second)
- data.length : number (length of song measured in ticks)
- data.songHeight : number (opennbs says its count of layers, but check song.layers for that)
- data.layers : object<Layer> (layers of the song)

## NBS.Layer

### new Layer()
Creates a new layer

### layer.name
Name of the layer

### layer.volume
Volume of the layer (between 0 and 100)

### layer.notes
Object containing Note. Object's keys are the tick position of the note.

### layer.setNote(tick, note)
Sets a note on tick.
- tick : number
- note : Note

## NBS.Note

### new Note(instrument, key)
These properties are also added to the note:
- instrument : number (0-15, can be found [here][https://opennbs.org/nbs])
- key : number (from 0-87, minecraft supports 33-57, [more info][https://opennbs.org/nbs])

### note.pitch
Decimal number representing the pitch for notchian clients, is set to 0 if _note.key_ is out of support range (33-57)

### note.packet
Returns a [minecraft-protocol][https://github.com/PrismarineJS/node-minecraft-protocol] packet data.
Send to client with name of "sound_effect" to play the note.

## NBS.keyToPitch
Object used for note.pitch, perhaps you can modify it for something

## NBS.instrumentIds
Object used to make minecraft-protocol packet data. Is 1.12.2 as far as i know. Maybe fix this later

---
_Source: https://npm.io/package/nbs.js · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
