Instrument are used to encapsulate the tuning and retrieving of midi keys and frequencies for notes
import { Instrument } from "musictheoryjs";
const instrument = new Instrument(); // default 440 tuning
a unique id for this instance
const instrument = new Instrument();instrument.id; // returns a unique id
const instrument = new Instrument();const copy = instrument.copy();console.log(instrument.equals(copy)); // true
a copy of this instance
the other object to compare
true if the other object is equal to this one
const instrument = new Instrument();instrument.getFrequency(new Note("C4")); // returns 261.6255653005986
the frequency of the given note
const instrument = new Instrument();instrument.getMidiKey(new Note("C4")); // returns 60
the midi key of the given note
const instrument = new Instrument();console.log(instrument.toString()); // returns "Instrument Tuning(440)"
the tuning as a string
Generated using TypeDoc
Instrument are used to encapsulate the tuning and retrieving of midi keys and frequencies for notes