namespaceWX
Source: waax.
Child class
Methods
Class
SimpleOsc
Namespaces
Log
PlugIn
Properties
staticnow
Returns current audio context time. (ECMA Script 5 Getter)
- Returns
-
NumberCurrent audio context time in seconds.
staticsrate
Returns current audio device sample rate. (ECMA Script 5 Getter)
- Returns
-
NumberCurrent sample rate.
staticTransport
Transport
Singleton instance of Transporter.
Methods
staticAnalyzer() → AudioNode
Creates an instance of WA Analyzer node.
- See also
- http://www.w3.org/TR/webaudio/#AnalyzerNode
- Returns
-
AudioNodeWA Analyzer node.
staticBuffer() → AudioNode
Creates an instance of WA Buffer object.
- See also
- http://www.w3.org/TR/webaudio/#Buffer
- Returns
-
AudioNodeWA Buffer object.
staticclamp(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
-
NumberClamped value
staticclone(source) → Object
Retunrs a clone of JS object. This returns shallow copy.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
source |
Object |
|
Object to be cloned |
- Returns
-
ObjectCloned object
staticComp() → AudioNode
Creates an instance of WA DynamicCompressor node.
- See also
- http://www.w3.org/TR/webaudio/#DynamicsCompressorNode
- Returns
-
AudioNodeWA DynamicsCompressor node.
staticConvolver() → AudioNode
Creates an instance of WA Convolver node.
- See also
- http://www.w3.org/TR/webaudio/#ConvolverNode
- Returns
-
AudioNodeWA Convolver node.
staticdbtolin(db) → Number
Converts decibel to linear amplitude. Useful for dBFS conversion.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
db |
Number |
|
Decibel |
- Returns
-
NumberLinear amplitude
staticdbtopow(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
-
NumberPower
staticdbtorms(db) → Number
Converts decibel to RMS(root-mean-square).
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
db |
Number |
|
Decibel |
- Returns
-
NumberRMS value
staticdefineParams(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. |
staticDelay() → AudioNode
Creates an instance of WA Delay node.
- See also
- http://www.w3.org/TR/webaudio/#DelayNode
- Returns
-
AudioNodeWA Delay node.
staticEnvelope(...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 can be repeated. |
- Returns
function()Envelope generator function.function(start time, scale factor)
staticextend(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
-
ObjectA merged object.
staticFilter() → AudioNode
Creates an instance of WA BiquadFilter node.
- See also
- http://www.w3.org/TR/webaudio/#BiquadFilterNode
- Returns
-
AudioNodeWA BiquadFilter node.
staticfindKeyByValue(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.
staticfindValueByKey(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.
staticftom(freq) → Number
Converts frequency to MIDI pitch.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
freq |
Number |
|
Frequency |
- Returns
-
NumberMIDI pitch
staticGain() → AudioNode
Creates an instance of WA Gain node.
- See also
- http://www.w3.org/TR/webaudio/#GainNode
- Returns
-
AudioNodeWA Gain node.
staticgetVersion() → Number
Returns WAAX API version number. (semantic version)
- See also
- http://semver.org/
- Returns
-
NumberWAAX API version number
statichasParam(param) → Boolean
Checks if a WAAX plug-in has a parameter
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
param |
String |
|
Parameter name |
- Returns
-
Boolean
staticisArray() → Boolean
Checks if an argument is a JS array.
- Returns
-
Boolean
staticisBoolean() → Boolean
Checks if the type of an argument is Boolean.
- Returns
-
Boolean
staticisFunction() → Boolean
Checks if an argument is a JS function.
- Returns
-
Boolean
staticisNumber() → Boolean
Checks if the type of an argument is Number.
- Returns
-
Boolean
staticisObject() → Boolean
Checks if an argument is a JS object.
- Returns
-
Boolean
staticlintodb(lin) → Number
Converts linear amplitude to decibel.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
lin |
Number |
|
Linear amplitude |
- Returns
-
NumberDecibel
staticloadClip(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. |
staticmbst2tick(Musical) → Number
Converts MBST(measure, beat, sixteenth, tick) format to tick.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
Musical |
|
time in MBST format. |
- Returns
-
NumberMusical time in tick.
staticMerger() → AudioNode
Creates an instance of WA Merger node.
- See also
- http://www.w3.org/TR/webaudio/#MergerNode
- Returns
-
AudioNodeWA Merger node.
staticmtof(midi) → Number
Converts a MIDI pitch number to frequency.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
midi |
Number |
|
MIDI pitch (0 ~ 127) |
- Returns
-
NumberFrequency (Hz)
staticNote(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
staticNoteClip() → NoteClip
Create a NoteClip instance.
- Returns
staticOSC() → AudioNode
Creates an instance of WA Oscillator node.
- See also
- http://www.w3.org/TR/webaudio/#OscillatorNode
- Returns
-
AudioNodeWA Oscillator node.
staticPanner() → AudioNode
Creates an instance of WA Panner node.
- See also
- http://www.w3.org/TR/webaudio/#PannerNode
- Returns
-
AudioNodeWA Panner node.
staticPeriodicWave() → AudioNode
Creates an instance of WA PerodicWave object.
- See also
- http://www.w3.org/TR/webaudio/#PeriodicWave
- Returns
-
AudioNodeWA PeriodicWave object.
staticpowtodb(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
-
NumberDecibel
staticrandom2(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
-
NumberAn integer random number
staticrandom2f(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
-
NumberA floating point random number
staticrmstodb(rms) → Number
Converts RMS(root-mean-square) to decibel.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
rms |
Number |
|
RMS value |
- Returns
-
NumberDecibel
staticSource() → AudioNode
Creates an instance of WA BufferSource node.
- See also
- http://www.w3.org/TR/webaudio/#BufferSourceNode
- Returns
-
AudioNodeWA BufferSource node.
staticSplitter() → AudioNode
Creates an instance of WA Splitter node.
- See also
- http://www.w3.org/TR/webaudio/#SplitterNode
- Returns
-
AudioNodeWA Splitter node.
statictick2mbst(tick) → MBST
Converts tick to MBST(measure, beat, sixteenth, tick) format.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
tick |
Number |
|
Tick. |
- Returns
-
MBSTMusical time in MBST format.
staticvalidateModel(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
staticveltoamp(velocity) → Number
Converts MIDI velocity to linear amplitude.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
velocity |
Number |
|
MIDI velocity |
- Returns
-
NumberLinear amplitude
staticWaveShaper() → AudioNode
Creates an instance of WA WaveShaper node.
- See also
- http://www.w3.org/TR/webaudio/#WaveShaperNode
- Returns
-
AudioNodeWA WaveShaper node.