Skip to content

PlayableNote

Element118 edited this page Oct 6, 2016 · 1 revision

The PlayableNote is responsible for storing a single note.


startTime

Amount of time in milliseconds after the song starts it would take until this note starts playing.


frequency

Frequency of note played.


type

Stores the type, or instrument used. Possible values include "sine", "square", "sawtooth", "triangle", "custom", as well as instruments within PlayableNote.instruments.


wave

Stores the specific waveform data returned by AudioContext.createPeriodicWave().


length

Stores the length of the note in milliseconds.


volume

Stores the volume of the note.


oscillator

Stores the OscillatorNode which this note is playing when the note is playing.


PlayableNote.createInstruments()

Creates instruments from an object storing the waveform data.


PlayableNote.instruments

Stores the instruments that can be used by PlayableNotes


PlayableNote.prototype.start(audioContext, destination)

Starts the note now and ends it with the correct length. Uses audioContext to construct the notes, then connects them to destination.


PlayableNote.prototype.startAt(audioContext, destination, time[, speed])

Starts the note given the time time. Uses audioContext to construct the notes, then connects them to destination. speed is an optional parameter to change the speed of the note.


PlayableNote.prototype.stop()

Stops the note immediately.

Clone this wiki locally