Module: core/wapi

WAPI, Web audio API. A programmatic DAW. Call it whatever. Mostly a toy, maybe it will grow. No-one knows. But it is very much a work-in-progress.

Source:
Example
var wapi = new Wapi();

// Create a new Wapi track
var bassTrack = wapi.createTrack();

// Create a bass from the ElectroSynthBass plugin and add it to the track.
var bass = new ElectroSynthBass(wapi.context);
bassTrack.addPlugin(bass);

// Create a MIDI sequence.
var sequence = function(time, beatIndex) {
  var notes = [];
  if (beatIndex % 4 == 0) {
    notes.push('C4');
  }
  if (beatIndex % 8 == 0) {
    notes.push('D4');
  }
  return notes;
}

// Add the sequence to Wapi.
bassTrack.addSequence(sequence);

wapi.play();

Members

(static) this.context

The AudioContext instance that is used to interface with the Web Audio API. All audio plugins use the same context for creating audio nodes, filters, etc.

Source:

(static) this.master

The master track. Instruments should always connect to this node instead of the context destination because the master goes through a dynamic compressor that helps mitigate clipping issues when multiple sounds are playing at the same time.

Source:

(static, constant) this.NOTES

An object containing 8 octaves of pre-calculated notes (C0-B7) within the equal tempered scale where A4 = 440 hertz.

Source:
Example
var myNote = Wapi.NOTES.C4;

Methods

(static) this.play()

Starts playback

Source:

(static) this.rewind()

Rewind playback to the beginning.

Source:

(static) this.stop()

Stops playback.

Source: