GithubHelp home page GithubHelp logo

dannegm / nbs.js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from thealan404/nbs.js

0.0 0.0 0.0 13 KB

Parse NBS (Note Block Song / Note Block Studio) files

License: MIT License

JavaScript 100.00%

nbs.js's Introduction

nbs.js

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

Example

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 (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:

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

nbs.js's People

Contributors

thealan404 avatar thearmagan avatar kaffinpx avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.