Instrument interface.
To create your own instrument just create a class that implement this simple interface.
import * as Audio from "@tspro/web-music-score/audio"; class MyCoolInstrument implements Audio.Instrument { constructor() { } getName() { return "My Cool Instrument"; } playNote(note: string, duration: number, linearVolume: number) { } stop() { } } // Add and use my cool instrument. Audio.addInstrument(new MyCoolInstrument()); Copy
import * as Audio from "@tspro/web-music-score/audio"; class MyCoolInstrument implements Audio.Instrument { constructor() { } getName() { return "My Cool Instrument"; } playNote(note: string, duration: number, linearVolume: number) { } stop() { } } // Add and use my cool instrument. Audio.addInstrument(new MyCoolInstrument());
Get instrument name.
Play a note.
Note to play (e.g. "C4").
Play duration in seconds.
Linear volume in range [0, 1].
Stop playback.
Instrument interface.
To create your own instrument just create a class that implement this simple interface.