Class Instrument

Represents an instrument of a Note.


import { Instrument, Song } from "@nbsjs/core";

const instrument = new Instrument({
"name": "Sandple",
"soundFile": "sand.ogg" // Just a string in nbs.js, no IO is performed
});

// Note Block Studio's built-in instruments are provided
console.dir(Instrument.builtIn);

// You'll want to add that instrument to a song, otherwise it won't do much!
const song = new Song();
song.instruments.add(instrument);

Properties

builtIn: BuiltIn = ...

Instruments built into Note Block Studio.

isBuiltIn: boolean = false

Whether the instrument is a built-in instrument.

key: number = defaultInstrumentOptions.key

Key of the sound file.

Just like note blocks, this ranges from 0-87.

Note#key

name?: string

Name of the instrument.

pressKey: boolean = defaultInstrumentOptions.pressKey

Whether the on-screen piano should visually press keys when these notes are played.

soundFile: string

Sound file of the instrument.

Relative to the Data/Sounds/ directory of Note Block Studio installations.

This property is not used within nbs.js for anything other than storage.

It only exists to work with other applications that implement functionality.

Constructors