Child class

Namespaces

Properties

Class

Namespaces

Properties

static
now

Returns current audio context time. (ECMA Script 5 Getter)

Returns

Number Current audio context time in seconds.

static
srate

Returns current audio device sample rate. (ECMA Script 5 Getter)

Returns

Number Current sample rate.

static
Transport  Transport

Singleton instance of Transporter.

Methods

static
Analyzer() → AudioNode

Creates an instance of WA Analyzer node.

See also
http://www.w3.org/TR/webaudio/#AnalyzerNode
Returns

AudioNode WA Analyzer node.

static
Buffer() → AudioNode

Creates an instance of WA Buffer object.

See also
http://www.w3.org/TR/webaudio/#Buffer
Returns

AudioNode WA Buffer object.

static
clamp(value, min, max) → Number

Clamps a number into a range specified by min and max.

Parameters

Name Type Optional Description

value

Number

 

Value to be clamped

min

Number

 

Range minimum

max

Number

 

Range maximum

Returns

Number Clamped value

static
clone(source) → Object

Retunrs a clone of JS object. This returns shallow copy.

Parameter

Name Type Optional Description

source

Object

 

Object to be cloned

Returns

Object Cloned object

static
Comp() → AudioNode

Creates an instance of WA DynamicCompressor node.

See also
http://www.w3.org/TR/webaudio/#DynamicsCompressorNode
Returns

AudioNode WA DynamicsCompressor node.

static
Convolver() → AudioNode

Creates an instance of WA Convolver node.

See also
http://www.w3.org/TR/webaudio/#ConvolverNode
Returns

AudioNode WA Convolver node.

static
dbtolin(db) → Number

Converts decibel to linear amplitude. Useful for dBFS conversion.

Parameter

Name Type Optional Description

db

Number

 

Decibel

Returns

Number Linear amplitude

static
dbtopow(db) → Number

Converts decibel to power. Note that it is off by 100dB to make it easy to use MIDI velocity to change volume. This is the same convention that PureData uses. This behaviour might change in the future.

Parameter

Name Type Optional Description

db

Number

 

Decibel

Returns

Number Power

static
dbtorms(db) → Number

Converts decibel to RMS(root-mean-square).

Parameter

Name Type Optional Description

db

Number

 

Decibel

Returns

Number RMS value

static
defineParams(plugin, paramOptions)

Defines parameters by specified options.

Example

WX.defineParams(this, {
  oscFreq: {
    type: 'Generic',
    name: 'Freq',
    default: WX.mtof(60),
    min: 20.0,
    max: 5000.0,
    unit: 'Hertz'
  },
  ...
};

Parameters

Name Type Optional Description

plugin

Object

 

WAAX Plug-in

paramOptions

Object

 

A collection of parameter option objects . See GenericParam, ItemizedParam and BooleanParam for available parameter options.

static
Delay() → AudioNode

Creates an instance of WA Delay node.

See also
http://www.w3.org/TR/webaudio/#DelayNode
Returns

AudioNode WA Delay node.

static
Envelope(...array) → function()

Create an envelope generator function for WA audioParam.

Example

// build an envelope generator with relative data points
var env = WX.Envelope([0.0, 0.0], [0.8, 0.01, 1], [0.0, 0.3, 2]);
// changes gain with an envelope starts at 2.0 sec with 1.2
  amplification.
synth.set('gain', env(2.0, 1.2));

Parameter

Name Type Optional Description

array

Array

 

Data points of [value, offset time, ramp type]

Value can be repeated.

Returns

function() Envelope generator function. function(start time, scale factor)

static
extend(target, source) → Object

Extends target object with the source object. If two objects have duplicates, properties in target object will be overwritten.

Parameters

Name Type Optional Description

target

Object

 

Object to be extended

source

Object

 

Object to be injected

Returns

Object A merged object.

static
Filter() → AudioNode

Creates an instance of WA BiquadFilter node.

See also
http://www.w3.org/TR/webaudio/#BiquadFilterNode
Returns

AudioNode WA BiquadFilter node.

static
findKeyByValue(model, value) → (String or null)

Finds a key from a model by a value.

Parameters

Name Type Optional Description

model

Array

 

WAAX model

value

any type

 

Value in model

See also
WX.Model for WAAX model specification.
Returns

(String or null) Key or null when not found.

static
findValueByKey(model, key) → (any type or null)

Finds a value from a model by a key.

Parameters

Name Type Optional Description

model

Array

 

WAAX model

key

String

 

Key in model

See also
WX.validateModel for WAAX model specification.
Returns

(any type or null) Value or null when not found.

static
ftom(freq) → Number

Converts frequency to MIDI pitch.

Parameter

Name Type Optional Description

freq

Number

 

Frequency

Returns

Number MIDI pitch

static
Gain() → AudioNode

Creates an instance of WA Gain node.

See also
http://www.w3.org/TR/webaudio/#GainNode
Returns

AudioNode WA Gain node.

static
getVersion() → Number

Returns WAAX API version number. (semantic version)

See also
http://semver.org/
Returns

Number WAAX API version number

static
hasParam(param) → Boolean

Checks if a WAAX plug-in has a parameter

Parameter

Name Type Optional Description

param

String

 

Parameter name

Returns

Boolean 

static
isArray() → Boolean

Checks if an argument is a JS array.

Returns

Boolean 

static
isBoolean() → Boolean

Checks if the type of an argument is Boolean.

Returns

Boolean 

static
isFunction() → Boolean

Checks if an argument is a JS function.

Returns

Boolean 

static
isNumber() → Boolean

Checks if the type of an argument is Number.

Returns

Boolean 

static
isObject() → Boolean

Checks if an argument is a JS object.

Returns

Boolean 

static
lintodb(lin) → Number

Converts linear amplitude to decibel.

Parameter

Name Type Optional Description

lin

Number

 

Linear amplitude

Returns

Number Decibel

static
loadClip(clip, oncomplete, onprogress)

Loads WAAX clip by XHR loading

Example

// Creates a WAAX clip on the fly.
var clip = {
  name: 'Cool Sample',
  url: 'http://mystaticdata.com/samples/coolsample.wav',
  buffer: null
};
// Loads the clip and assign the buffer to a sampler plug-in.
WX.loadClip(clip, function (clip) {
  mySampler.setBuffer(clip.buffer);
});

Parameters

Name Type Optional Description

clip

Object

 

WAAX Clip

oncomplete

callback_loadClip_oncomplete

 

Function called when completed.

onprogress

callback_loadClip_onprogress

 

Optional. Callback for progress report.

static
mbst2tick(Musical) → Number

Converts MBST(measure, beat, sixteenth, tick) format to tick.

Parameter

Name Type Optional Description

Musical

MBST

 

time in MBST format.

Returns

Number Musical time in tick.

static
Merger() → AudioNode

Creates an instance of WA Merger node.

See also
http://www.w3.org/TR/webaudio/#MergerNode
Returns

AudioNode WA Merger node.

static
mtof(midi) → Number

Converts a MIDI pitch number to frequency.

Parameter

Name Type Optional Description

midi

Number

 

MIDI pitch (0 ~ 127)

Returns

Number Frequency (Hz)

static
Note(pitch, velocity, start, duration) → Note

Creates a Note instance.

Parameters

Name Type Optional Description

pitch

Number

 

MIDI pitch (0~127)

velocity

Number

 

MIDI velocity (0~127)

start

Number

 

Note start time in tick.

duration

Number

 

Note durtion in tick.

Returns

Note 

static
NoteClip() → NoteClip

Create a NoteClip instance.

Returns

NoteClip 

static
OSC() → AudioNode

Creates an instance of WA Oscillator node.

See also
http://www.w3.org/TR/webaudio/#OscillatorNode
Returns

AudioNode WA Oscillator node.

static
Panner() → AudioNode

Creates an instance of WA Panner node.

See also
http://www.w3.org/TR/webaudio/#PannerNode
Returns

AudioNode WA Panner node.

static
PeriodicWave() → AudioNode

Creates an instance of WA PerodicWave object.

See also
http://www.w3.org/TR/webaudio/#PeriodicWave
Returns

AudioNode WA PeriodicWave object.

static
powtodb(power) → Number

Converts power to decibel. Note that it is off by 100dB to make it easy to use MIDI velocity to change volume. This is the same convention that PureData uses. This behaviour might change in the future.

Parameter

Name Type Optional Description

power

Number

 

Power

Returns

Number Decibel

static
random2(min, max) → Number

Generates an integer random number between min and max.

Parameters

Name Type Optional Description

min

Number

 

Range minimum

max

Number

 

Range maximum

Returns

Number An integer random number

static
random2f(min, max) → Number

Generates a floating point random number between min and max.

Parameters

Name Type Optional Description

min

Number

 

Range minimum

max

Number

 

Range maximum

Returns

Number A floating point random number

static
rmstodb(rms) → Number

Converts RMS(root-mean-square) to decibel.

Parameter

Name Type Optional Description

rms

Number

 

RMS value

Returns

Number Decibel

static
Source() → AudioNode

Creates an instance of WA BufferSource node.

See also
http://www.w3.org/TR/webaudio/#BufferSourceNode
Returns

AudioNode WA BufferSource node.

static
Splitter() → AudioNode

Creates an instance of WA Splitter node.

See also
http://www.w3.org/TR/webaudio/#SplitterNode
Returns

AudioNode WA Splitter node.

static
tick2mbst(tick) → MBST

Converts tick to MBST(measure, beat, sixteenth, tick) format.

Parameter

Name Type Optional Description

tick

Number

 

Tick.

Returns

MBST Musical time in MBST format.

static
validateModel(model) → Boolean

Validates a WAAX model. This verifies if all the keys in the model is unique. WAAX model is a collection of key-value pairs that is useful for data binding or templating.

Example

// Example WAAX model for waveform types
var model = [
  { key:'Sine', value:'sine' },
  { key:'Sawtooth', value:'sawtooth' }
  ...
];

Parameter

Name Type Optional Description

model

Array

 

WAAX model

Returns

Boolean 

static
veltoamp(velocity) → Number

Converts MIDI velocity to linear amplitude.

Parameter

Name Type Optional Description

velocity

Number

 

MIDI velocity

Returns

Number Linear amplitude

static
WaveShaper() → AudioNode

Creates an instance of WA WaveShaper node.

See also
http://www.w3.org/TR/webaudio/#WaveShaperNode
Returns

AudioNode WA WaveShaper node.