The AudioContext instance which the WebAudioMidiOut is operating within.
Example: new shimi.WebAudioMidiOut(new AudioContext());
The AudioContext instance which the WebAudioMidiOut is operating within.
This event fires when the WebAudioMidiOut finishes.
Returns true if the WebAudioMidiOut has been instructed to stop everything by the finish()
method.
Provides a way of identifying a WebAudioMidiOut so it can be easily retrieved later
Returns the name of this type. This can be used rather than instanceof which is sometimes unreliable.
This method accepts an IMidiMessage object, which it interprets and performs the appropriate action. Currently this only supports Note On & Note Off messages.
The IMidiMessage object to be acted upon.
Calls the stop() method of all notes which have been added to the WebAudioMidiOut that meet the passed in criteria.
Define what sound to use for a specific MIDI channel number.
Returns the WebAudioMidiOut instance, to allow for chaining of operations.
The channel being defined, valid values range from 0 - 15.
The type of waveform being produced, valid values are: 'sine', 'square', 'triangle', or 'sawtooth'.
The amount of gain to be applied to the waveform. Default value is 0.1.
Automatically sets up all undefined channels with default sounds. It cycles through defining each channel with sine, square, sawtooth & triangle wave in turn, so that channels, 0, 4, 8 & 12 would be sine, 1, 5, 9 & 13 would be square, etc.
Example usage: const synth = new shimi.WebAudioMidiOut(new AudioContext()).withDefaultChannels();
Returns the WebAudioMidiOut instance, to allow for chaining of operations.
Provides a way for setting the ref through a chained function call. For example:
clock.addChild(new WebAudioMidiOut(context).withDefaultChannels().withRef('output'));
The calling object.
The ref to set on the object.
Generated using TypeDoc
The WebAudioMidiOut class is a very simple synthesizer implementation, built on top of the Web Audio API. It is intended to primarily be a quick and dirty way to get some sound out through the web browser. For more advanced sound generation, use either the ToneJSMidiOut for in-browser sounds, or MidiOut for working with external instruments.
The WebAudioMidiOut class implements the IMidiOut interface, so that you can very easily swap out the WebAudioMidiOut for external devices as and when needed.