cracked

cracked

Updates the internal selected nodes array with a collection of audio nodes matching the selector provided. Type, Class & Id selectors are supported.

//type selector using the node name, sets the frequency for all sines
__("sine").frequency(200);

//set the frequency for the node with id "foo"
__("#foo").frequency(200);

//set the frequency for any nodes with a class of "bar"
__(".bar").frequency(200);

//select all sines, any nodes with classname "bar" or id of "foo"
//and set their frequencies to 200
__("sine,.bar,#foo").frequency(200);

See more selector examples

If invoked without arguments, cracked() resets the selection/connection state, removing any record of previous nodes and effectively marking the start of a new connection chain. Since a new node will try to connect to any previous node, calling __() tells a node that there is no previous node to connect to. For example:

//Create & connect sine -> lowpass -> dac
__().sine();
__.lowpass();
__.dac();

//Create but don't connect
__().sine();
__().lowpass();
__().dac();

cracked is also the namespace for public methods and also can be written as a double underscore __

__("sine"); //same as cracked("sine")
Source:

Methods

Find

reset() → {cracked}

resets everything to its initial state

//reset state for the entire app
 cracked.reset();
Source:
Returns:
Type
cracked

exec(method, args, nodes) → {cracked}

executes a method with a specific set of selected nodes without modifying the internal selectedNodes array

//filter everything but the sines from currently selected nodes and
//execute the frequency method against the remaining sines.
//the internal _selectedNodes array remains unchanged
cracked.exec(
   "frequency",
   200,
   cracked.filter("sine")
);
Parameters:
Name Type Description
method String

method name

args Array

arguments to supply to the method

nodes Array

node array to execute against

Source:
Returns:
Type
cracked

each(type, fn) → {cracked}

iterate over the selectedNodes array, executing the supplied function for each element

__.each(type, function(node,index,array){
     //Loops over any selected nodes. Parameters are the
     //current node, current index, and the selectedNode array
});
Parameters:
Name Type Description
type String

string to be checked against the node type

fn function

function to be called on each node

Source:
Returns:
Type
cracked

filter(selector) → {Array}

Filter selected nodes with an additional selector returns node array that can used with exec()

//select any sine & sawtooth oscillators
__("sine,saw");

//filter out everything but the sines and
//execute the frequency method against those nodes.
//the internal _selectedNodes array remains unchanged
cracked.exec(
   "frequency",
   200,
   cracked.filter("sine")
);
Parameters:
Name Type Description
selector String

selector expression

Source:
Returns:
Type
Array

find(selector) → {Array}

Find nodes with a selector returns node array that can used with exec()

//find all the sines in the patch and
//execute the frequency method against those nodes.
//the internal _selectedNodes array remains unchanged
cracked.exec(
   "frequency",
   200,
   cracked.find("sine")
);
Parameters:
Name Type Description
selector String

selector expression

Source:
Returns:
Type
Array

Control

start()

Calls start() on the currently selected nodes. Throws no error if there aren't any selected nodes with a start method

//create and connect sine->lowpass->dac
__().sine().lowpass().dac();
//start the sine node
__("sine").start();

See more control examples

Source:

stop()

Calls stop() on the currently selected nodes. Throws no error if there are no selected nodes that have a stop method.

//create and connect sine->lowpass->dac
__().sine().lowpass().dac();
//stop the sine node
__("sine").stop();

See more control examples

Source:

ramp(target, timeToRamp, paramToRamp, initial, type)

Public method to ramp a parameter on currently selected nodes. Target & timeToRamp parameters can be numbers or arrays of numbers for multisegement ramps. Initial value param is optional, if omitted, then the current value is used as the initial value. If loop is running, then ramp start times are snapped to the sequencer grid.

//create and connect sine->lowpass->dac & play
__().sine().lowpass().dac().play();
//ramp the frequency of the sine. 220 to 880 in 5 seconds
__("sine").ramp(880,5,"frequency",220);

See more envelope examples

Parameters:
Name Type Description
target Number | Array

value to ramp to

timeToRamp Number | Array

length of ramp in seconds

paramToRamp String

name of parameter to ramp

initial Number

value to start the ramp at

type String

of ramp, "exp" is exponential. defaults to linear.

Source:

attr(userParams, userParams)

Set or get attribute values on a node. Takes an object with any number of key:value pairs to set. A string with the param name returns the current value of that param on the first selected node.

//create and connect sine->lowpass->dac & play
__().sine().lowpass().dac().play();
//set the frequency of the sine to 880
__("sine").attr({"frequency":880});

//get the frequency
__("sine").attr("frequency"); //880

See more control examples

Parameters:
Name Type Description
userParams Object

options object

Properties
Name Type Description
paramName String
paramValue
userParams String
Source:

Node

script(userParamsopt)

Native Script node

Parameters:
Name Type Attributes Description
userParams Object <optional>

map of optional values

Properties
Name Type Attributes Default Description
buffersize Number <optional>
4096
channels Number <optional>
1
fn function <optional>
defaultFunction
Source:

waveshaper(userParamsopt)

Native Waveshaper

Parameters:
Name Type Attributes Description
userParams Object <optional>

map of optional values

Properties
Name Type Attributes Default Description
drive Number <optional>
50
Source:

compressor(userParamsopt)

Native Compressor

Parameters:
Name Type Attributes Description
userParams Object <optional>

map of optional values

Properties
Name Type Attributes Default Description
threshold Number <optional>
-24

in decibels, nominal range of -100 to 0.

knee Number <optional>
30

in decibels, range of 0 to 40

ratio Number <optional>
12

nominal range of 1 to 20

attack Number <optional>
0.003

time in seconds, nominal range of 0 to 1

release Number <optional>
0.250

time in seconds, nominal range of 0 to 1

Source:

gain(userParamsopt)

Native Gain

Parameters:
Name Type Attributes Description
userParams Object <optional>

map of optional values

Properties
Name Type Attributes Default Description
threshold Number <optional>
-24

in decibels, nominal range of -100 to 0.

Source:

native_delay(userParamsopt)

Naming this with prefix native so I can use "delay" as a plugin name max buffer size three minutes

Parameters:
Name Type Attributes Description
userParams Object <optional>

map of optional values

Properties
Name Type Attributes Default Description
delay Number <optional>
0

in seconds.

Source:

osc(userParamsopt)

Native oscillator, used the oscillator plugins

Parameters:
Name Type Attributes Description
userParams Object <optional>

map of optional values

Properties
Name Type Attributes Default Description
frequency Number <optional>
440
detune Number <optional>
0
type String <optional>
sine
Source:

biquadFilter(userParamsopt)

Native biquad filter, used by filter plugins

Parameters:
Name Type Attributes Description
userParams Object <optional>

map of optional values

Properties
Name Type Attributes Default Description
frequency Number <optional>
440
q Number <optional>
0
gain String <optional>
0
type String <optional>
lowpass
Source:

channelMerger(userParamsopt)

Native channelMerger

Parameters:
Name Type Attributes Description
userParams Object <optional>

map of optional values

Source:

channelSplitter(userParamsopt)

Native channelSplitter

Parameters:
Name Type Attributes Description
userParams Object <optional>

map of optional values

Source:

convolver(userParamsopt)

Native convolver, used by reverb

Parameters:
Name Type Attributes Description
userParams Object <optional>

map of optional values

Properties
Name Type Attributes Description
path String <optional>

path to remote impulse

fn function <optional>

function to generate impulse

Source:

stereoPanner(userParamsopt)

Native stereo panner, used by panner

Parameters:
Name Type Attributes Description
userParams Object <optional>

map of optional values

Source:

destination(userParamsopt)

Native destination, used by the dac plugin

Parameters:
Name Type Attributes Description
userParams Object <optional>

map of optional values

Source:

origin(userParamsopt)

Native sound input node, used by the adc plugin origin = opposite of destination

Parameters:
Name Type Attributes Description
userParams Object <optional>

map of optional values

Source:

buffer(userParamsopt)

Native audio source node and buffer combined.

Parameters:
Name Type Attributes Description
userParams Object <optional>

map of optional values

Properties
Name Type Attributes Default Description
path String <optional>

path to remote file

speed Number <optional>
1

playback speed

start Number <optional>
0

play head start value in seconds

end Number <optional>
0

play head end value in seconds

loop Boolean <optional>
false

loop?

Source:

Sequence

loop(argopt, configopt) → {cracked}

main method for loop

//configure the loop: 8 steps, 100ms between steps
__.loop({steps:8,interval:100});

//start
__.loop("start");
//stop
__.loop("stop");
//reset the loop params
__.loop("reset");

See sequencing examples

Parameters:
Name Type Attributes Description
arg String <optional>

stop/start/reset commands

config Object <optional>

configuration object

Properties
Name Type Attributes Default Description
interval Number <optional>
100

step length in ms

Source:
Returns:
Type
cracked

bind(eventType, fn, data) → {cracked}

Listener - binds a set of audio nodes and a callback to loop step events

Parameters:
Name Type Description
eventType String

currently just "step"

fn function

callback to be invoked at each step

data Array

should the same length as the number of steps

Source:
Returns:
Type
cracked

unbind(eventType)

Remove any steps listeners registered on these nodes

Parameters:
Name Type Description
eventType String
Source:

Macro

begin(name, userParams)

start macro recording, add any user parameters (id,classname,etc) to the container macro

//define a simple macro named "microsynth"
__().begin("microsynth").sine().gain(0).dac().end("microsynth");
Parameters:
Name Type Description
name String

macro name

userParams Object

options object

Source:

end(name)

end macro recording

//define a simple macro named "microsynth"
__().begin("microsynth").sine().gain(0).dac().end("microsynth");
Parameters:
Name Type Description
name String

macro name

Source:

Midi

midi_supported() → {boolean}

Is midi supported?

if(__.midi_supported()) {
     //do midi stuff here
     //cuz you can
}
Source:
Returns:
Type
boolean

midi_init(callback)

Initialize midi. Callback is invoked when ready.

//when midi is ready...
__.midi_init(function(){
     //...call this function
});
Parameters:
Name Type Description
callback function
Source:

midi_receive(callback)

Midi input. Bind handler for the onMIDIMessage event.

//when midi is ready...
__.midi_init(function(){
     __.midi_receive(function(midiEvent){
         //handle incoming raw midi events here...
     });
});
Parameters:
Name Type Description
callback function
Source:

midi_noteon(callback)

Midi input. Shorthand binding for note ons

//when midi is ready...
__.midi_init(function(){
     //get midi noteon events
     __.midi_noteon(function(noteData){
         //note data = [status,pitch,velocity]
         //handle midi note ons...
     });
});
Parameters:
Name Type Description
callback function
Source:

midi_noteoff(callback)

Midi input. Shorthand binding for note offs

//when midi is ready...
__.midi_init(function(){
     //get midi noteoff events
     __.midi_noteoff(function(noteData){
         //note data = [status,pitch,velocity]
         //handle midi note offs...
     });
});
Parameters:
Name Type Description
callback function
Source:

midi_control(callback)

Midi input. Shorthand binding for midi control messages

//when midi is ready...
__.midi_init(function(){
     //get midi control events
     __.midi_control(function(noteData){
         //note data = [status,pitch,velocity]
         //handle midi control events...
     });
});
Parameters:
Name Type Description
callback function
Source:

Connect

connect(selector)

chainable method to connect nodes to previously instantiated nodes. Takes a selector to find the nodes to connect to.

//create and connect sine->lowpass->dac
__().sine().lowpass().dac();
//create a sawtooth and connect to the lowpass instantiated above
__().saw().connect("lowpass");
Parameters:
Name Type Description
selector String

selector expression

Source:
Returns:

cracked

remove(time)

chainable method to stop, disconnect and remove the currently selected nodes. Takes a time in ms to schedule the node removal.

//create and connect sine->lowpass->dac
__().sine().lowpass().dac();
//remove the lowpass instantiated above in 100ms
__("lowpass").remove(100);
Parameters:
Name Type Description
time Number

in ms to schedule node removal

Source:
Returns:

cracked

Debug

log()

log selected nodes to console if any.

//create and connect sine -> lowpass -> dac
__().sine().lowpass().dac();

//logs the [oscillatorNode] object to the console
__("sine").log()
Source:

size() → {Number}

return the length of selected nodes array

//create and connect sine -> lowpass -> dac
__().sine().lowpass().dac();

//returns 2
__("sine,lowpass").size();
Source:
Returns:
Type
Number

_dumpState()

dump the node lookup object to the console works in debug only

Source:

_getNode(uuid) → {*}

debug method to get a node with a uuid works in debug only

Parameters:
Name Type Description
uuid
Source:
Returns:
Type
*

Type

ifUndef(test, def)

Returns the 2nd argument if the 1st is undefined

Parameters:
Name Type Description
test *

thing to test for undefined

def *

default value to return if test is undefined

Source:

isNotUndef(test)

Returns true if not undefined

Parameters:
Name Type Description
test *

thing to test for undefined

Source:

isUndef(test)

Returns true if undefined

Parameters:
Name Type Description
test *

thing to test for undefined

Source:

isObj(obj)

Returns true if param is an object

Parameters:
Name Type Description
obj *

thing to test

Source:

isNum(num)

Returns true if param is a number

Parameters:
Name Type Description
num *

thing to test

Source:

isStr(str)

Returns true if param is a string

Parameters:
Name Type Description
str *

thing to test

Source:

isArr(arr)

Returns true if param is an array

Parameters:
Name Type Description
arr *

thing to test

Source:

isFun(fn)

Returns true if param is a function

Parameters:
Name Type Description
fn *

thing to test

Source:

Algorithmic

random_interval(callback, minTime, maxTime)

execute a callback at random intervals within a range

Parameters:
Name Type Description
callback function

to be invoked at every interval

minTime Number

minimum value for the random interval

maxTime Number

maximum value for the random interval

Source:

random_envelope(length) → {Array}

create a adsr envelope with random values scaled to a length

Parameters:
Name Type Description
length Number

in sec

Source:
Returns:
Type
Array

fill_array(size, fn) → {Array}

fill an array with some values

Parameters:
Name Type Description
size Number

of the array to be filled

fn function

to provide the value, if absent then array is filled with 0's.

Source:
Returns:
Type
Array

array_next(arr, offset, limit, callback)

advance thru array one step at a time. start over when arriving at the end

Parameters:
Name Type Description
arr Array

to loop over

offset Number

added to index

limit Number

upper bound to iteration

callback function

invoked when the count resets

Source:

chance(percentage) → {boolean}

Returns a boolean based on percentage.

Parameters:
Name Type Description
percentage Number
Source:
Returns:
Type
boolean

scales(type)

Returns a musical scale/mode based on type

Parameters:
Name Type Description
type String

scale type

Source:

chords(type)

Returns a musical scale/mode based on type

Parameters:
Name Type Description
type String

scale type

Source:

random_scale(scale, octave_lower, octave_upper)

Return a random series of frequencies from randomly selected octaves from a given scale

Parameters:
Name Type Description
scale String
octave_lower Number
octave_upper Number
Source:

random_arpeggio(chord, octave_lower, octave_upper)

Return a random series of frequencies from a randomly selected octave from a given chord

Parameters:
Name Type Description
chord String
octave_lower Number
octave_upper Number
Source:

shuffle(arr)

Takes a reference to an array, shuffles it and returns it

Parameters:
Name Type Description
arr Array
Source:

random(min, max)

Returns a random number between min & max

Parameters:
Name Type Description
min Number
max Number
Source:

throttle_factory(num)

Factory to create a throttling function that returns true when called every nth times

Parameters:
Name Type Description
num Number
Source:

sequence_factory(arr, fn)

Factory to create a sequencing function that returns true when called every nth times

Parameters:
Name Type Description
arr Array
fn function
Source:

sequence(name)

Sequence - create a series of steps that take a function to execute and a time in minutes for when to execute it

See more sampler examples

Parameters:
Name Type Description
name String

name of sequence

Source:

Delay

reverb(paramsopt)

Convolver Reverb

See more reverb examples

Parameters:
Name Type Attributes Description
params Object <optional>

map of optional values

Properties
Name Type Attributes Default Description
reverse Boolean <optional>
false

reverse reverb

path String <optional>

path to impulse file. if no path, impulse is generated.

seconds Number <optional>
3

if generated impulse, length in seconds.

decay Number <optional>
2

if generated impulse, length of decay in seconds

fn function <optional>
buildImpulse

custom function to generate an impulse buffer

Source:

delay(paramsopt)

Parameters:
Name Type Attributes Description
params Object <optional>

map of optional values

Properties
Name Type Attributes Default Description
delay Number <optional>
1

delay time in seconds

damping Number <optional>
0.84

feedback input gain

cutoff Number <optional>
1500

frequency of lowpass filtering on feedback loop

feedback Number <optional>
0.5

feedback gain output

Source:

comb(paramsopt)

Parameters:
Name Type Attributes Description
params Object <optional>

map of optional values

Properties
Name Type Attributes Default Description
delay Number <optional>
0.027

delay time in seconds

damping Number <optional>
0.84

feedback input gain

cutoff Number <optional>
3000

frequency of lowpass filtering on feedback loop

feedback Number <optional>
0.84

feedback gain output

Source:

Distortion

bitcrusher(paramsopt)

Parameters:
Name Type Attributes Description
params Object <optional>

map of optional values

Properties
Name Type Attributes Default Description
frequency Number <optional>
0.1
bits Number <optional>
6
Source:

ring(paramsopt)

Parameters:
Name Type Attributes Description
params Object <optional>

map of optional values

Properties
Name Type Attributes Default Description
distortion Number <optional>
1
frequency Number <optional>
30
Source:

overdrive(paramsopt)

Overdrive, waveshaper with additional parameters

See more overdrive examples

Parameters:
Name Type Attributes Description
params Object <optional>

map of optional values

Properties
Name Type Attributes Default Description
drive Number <optional>
0.5
color Number <optional>
800
postCut Number <optional>
3000
Source:

Envelope

adsr(userParamsopt, userParamsopt, userParamsopt, userParamsopt, userParamsopt)

Attack Decay Sustain Release envelope

See more adsr examples

Attack time is the time taken for initial run-up of level from nil to peak, beginning when the key is first pressed. Decay time is the time taken for the subsequent run down from the attack level to the designated sustain level. Sustain level is the level during the main sequence of the sound's duration, until the key is released. Release time is the time taken for the level to decay from the sustain level to zero after the key is released.

Parameters:
Name Type Attributes Default Description
userParams Array <optional>

5 values: attack,decay,sustain,hold,release

userParams Array <optional>

4 values: attack,decay,sustain,release

userParams Array <optional>

3 values: attack,decay,sustain (holds until released)

userParams String <optional>

"slow" or "fast"

userParams Number <optional>
0.5

length of the total envelope

Source:

Filter

lowpass(paramsopt)

Lowpass Filter

See more lowpass examples

Parameters:
Name Type Attributes Description
params Object <optional>

map of optional values

Properties
Name Type Attributes Default Description
frequency Number <optional>
440

frequency

q Number <optional>
0

Q

Source:

highpass(paramsopt)

Highpass Filter

See more highpass examples

Parameters:
Name Type Attributes Description
params Object <optional>

map of optional values

Properties
Name Type Attributes Default Description
frequency Number <optional>
440

frequency

q Number <optional>
0

Q

Source:

bandpass(paramsopt)

Bandpass Filter

See more bandpass examples

Parameters:
Name Type Attributes Description
params Object <optional>

map of optional values

Properties
Name Type Attributes Default Description
frequency Number <optional>
440

frequency

q Number <optional>
0

Q

Source:

lowshelf(paramsopt)

Lowshelf Filter

See more lowshelf examples

Parameters:
Name Type Attributes Description
params Object <optional>

map of optional values

Properties
Name Type Attributes Default Description
frequency Number <optional>
440

frequency

q Number <optional>
0

Q

gain Number <optional>
0

gain

Source:

highshelf(paramsopt)

Highshelf Filter

See more highshelf examples

Parameters:
Name Type Attributes Description
params Object <optional>

map of optional values

Properties
Name Type Attributes Default Description
frequency Number <optional>
440

frequency

q Number <optional>
0

Q

gain Number <optional>
0

gain

Source:

peaking(paramsopt)

Peaking Filter

See more peaking examples

Parameters:
Name Type Attributes Description
params Object <optional>

map of optional values

Properties
Name Type Attributes Default Description
frequency Number <optional>
440

frequency

q Number <optional>
0

Q

gain Number <optional>
0

gain

Source:

notch(paramsopt)

Parameters:
Name Type Attributes Description
params Object <optional>

map of optional values

Properties
Name Type Attributes Default Description
frequency Number <optional>
440

frequency

q Number <optional>
0

Q

Source:

allpass(paramsopt)

Allpass Filter

See more allpass examples

Parameters:
Name Type Attributes Description
params Object <optional>

map of optional values

Properties
Name Type Attributes Default Description
frequency Number <optional>
440

frequency

q Number <optional>
0

Q

Source:

Interaction

mouse_movement()

Passes mouse move events to a callback. Tracks the movement of the mouse. web audio

Source:

key_press()

Passes key press events to a callback. Tracks keyboard activity. web audio

Source:

Miscellaneous

clip()

Clips audio level at 1/-1

Source:

dac(paramsopt)

System out - destination with a master volume. Output is clipped if gain is 1 or less.

Parameters:
Name Type Attributes Default Description
params Number <optional>
1

system out gain

Source:

adc(paramsopt)

System in - input with a master volume

Parameters:
Name Type Attributes Default Description
params Number <optional>
1

system in gain

Source:

out(paramsopt)

System out - destination with a master volume Alias for dac

Parameters:
Name Type Attributes Default Description
params Number <optional>
1

system out gain

Source:

multi_out(userParamsopt)

System multi_out - destination with a master volume w/ multi-channel support

Parameters:
Name Type Attributes Description
userParams Object <optional>

map of optional values

Properties
Name Type Attributes Default Description
gain Number <optional>
1
channel Number <optional>
1
Source:

in(paramsopt)

System in - input with a master volume Alias for adc

Parameters:
Name Type Attributes Default Description
params Number <optional>
1

system in gain

Source:

panner(paramsopt)

Panner - simple stereo panner

Parameters:
Name Type Attributes Description
params Object <optional>

map of optional values

Source:

sampler(userParamsopt)

Sampler - sound file player

See more sampler examples

Parameters:
Name Type Attributes Description
userParams Object <optional>

map of optional values

Properties
Name Type Attributes Default Description
speed Number <optional>
1
start Number <optional>
1
end Number <optional>
1
path String <optional>
''

path to sound file to play

loop Boolean <optional>
false
Source:

Modulator

lfo(userParamsopt)

Low Frequency Oscillator

See more LFO examples

Parameters:
Name Type Attributes Description
userParams Object <optional>

map of optional values

Properties
Name Type Attributes Default Description
modulates String <optional>
frequency
type String <optional>
saw
frequency Number <optional>
6
gain Number <optional>
1000
Source:

stepper(paramsopt)

Stepper

fill an audio buffer with a series of discrete values.

Parameters:
Name Type Attributes Description
params Object <optional>

map of optional values

Properties
Name Type Attributes Default Description
modulates String <optional>
frequency
fn function <optional>
function to generate values (if not supplied, then random values between -1 & 1)
steps Number <optional>
number of steps in the buffer
length Number <optional>
length of the buffer in seconds
gain Number <optional>
1000
Source:

Noise

noise(paramsopt)

noise parametrized noise node

See more noise examples

Parameters:
Name Type Attributes Description
params Object <optional>

map of optional values

Properties
Name Type Attributes Default Description
type String <optional>
white
Source:

pink(paramsopt)

Parameters:
Name Type Attributes Description
params Object <optional>

map of optional values

Properties
Name Type Attributes Default Description
channels Number <optional>
1
length Number <optional>
1
Source:

white(paramsopt)

Parameters:
Name Type Attributes Description
params Object <optional>

map of optional values

Properties
Name Type Attributes Default Description
channels Number <optional>
1
length Number <optional>
1
Source:

brown(paramsopt)

Parameters:
Name Type Attributes Description
params Object <optional>

map of optional values

Properties
Name Type Attributes Default Description
channels Number <optional>
1
length Number <optional>
1
Source:

Oscillator

sine(paramsopt)

Sine Wave Oscillator

See more oscillator examples

Parameters:
Name Type Attributes Description
params Object <optional>

map of optional values

Properties
Name Type Attributes Default Description
frequency Number <optional>
440
detune Number <optional>
0
type String <optional>
sine
Source:

square(paramsopt)

Square Wave Oscillator

See more oscillator examples

Parameters:
Name Type Attributes Description
params Object <optional>

map of optional values

Properties
Name Type Attributes Default Description
frequency Number <optional>
440
detune Number <optional>
0
type String <optional>
sine
Source:

saw(paramsopt)

Sawtooth Wave Oscillator

See more oscillator examples

Parameters:
Name Type Attributes Description
params Object <optional>

map of optional values

Properties
Name Type Attributes Default Description
frequency Number <optional>
440
detune Number <optional>
0
type String <optional>
sine
Source:

triangle(paramsopt)

Triangle Wave Oscillator

See more oscillator examples

Parameters:
Name Type Attributes Description
params Object <optional>

map of optional values

Properties
Name Type Attributes Default Description
frequency Number <optional>
440
detune Number <optional>
0
type String <optional>
sine
Source:

Setters

frequency(userParam)

See more control examples

Frequency setter convenience method

Parameters:
Name Type Description
userParam Number

frequency to set

Source:

detune(userParam)

Detune setter convenience method

See more control examples

Parameters:
Name Type Description
userParam Number

detune frequency to set

Source:

type(userParam)

Type setter convenience method

See more control examples

Parameters:
Name Type Description
userParam String

oscillator type to set

Source:

volume(userParam)

Gain setter convenience method

See more control examples

Parameters:
Name Type Description
userParam Number

gain to set

Source:

fadeOut(userParam)

Fade out convenience method

See more control examples

Parameters:
Name Type Description
userParam Number

optional time to set in seconds. Defaults to 0.02

Source:

fadeIn(userParam)

Fade in convenience method

See more control examples

Parameters:
Name Type Description
userParam Number

optional time to set in seconds. Defaults to 0.02

Source:

time(userParam)

Delay time setter convenience method

See more control examples

Parameters:
Name Type Description
userParam Number

delay time to set

Source:

feedback(userParam)

Feedback setter convenience method

See more control examples

Parameters:
Name Type Description
userParam Number

feedback amount to set

Source:

speed(userParam)

Speed setter convenience method

See more control examples

Parameters:
Name Type Description
userParam Number

sampler speed to set

Source:

drive(userParam)

Drive setter convenience method

See more control examples

Parameters:
Name Type Description
userParam Number

drive distortion/waveshaper/etc to set

Source:

distortion(userParam)

Distortion setter convenience method

See more control examples

Parameters:
Name Type Description
userParam Number

distortion to set

Source:

q(userParam)

q setter convenience method

See more control examples

Parameters:
Name Type Description
userParam Number

q value to set

Source:

pan(userParam)

pan setter convenience method

See more control examples

Parameters:
Name Type Description
userParam Number

pan value (1 to -1) to set

Source:

Synth

gang_of_oscillators(paramsopt)

gang_of_oscillators

Just a bunch of oscillators

See more synth examples

Parameters:
Name Type Attributes Description
params Object <optional>

map of optional values

Source:

monosynth(paramsopt)

monosynth

Simple monophonic synth

See more synth examples

Parameters:
Name Type Attributes Description
params Object <optional>

map of optional values

Source:

polysynth(paramsopt)

polysynth

Simple polyphonic synth

See more synth examples

Parameters:
Name Type Attributes Description
params Object <optional>

map of optional values

Source:

Utility

play()

Convenient way to say start everything

See more control examples

Source:

scale(position, inMin, inMax, outMin, outMax, type)

Scale an input number between min & max to an output number between a min & max. Supports logarithmic or linear scaling.

Parameters:
Name Type Description
position Number
inMin Number
inMax Number
outMin Number
outMax Number
type String
Source:

sec2ms(second)

Converts a second value to millisecond value

Parameters:
Name Type Description
second Number
Source:

ms2sec(ms)

Converts a millisecond value to second value

Parameters:
Name Type Description
ms Number
Source:

ms2min(ms)

Converts a millisecond value to minute value

Parameters:
Name Type Description
ms Number
Source:

min2ms(minute)

Converts a minute value to a millisecond value

Parameters:
Name Type Description
minute Number
Source:

isSupported()

Returns a boolean true if the browser supports web audio

Source:

pitch2freq(pitch)

Converts a pitch value to frequency

Parameters:
Name Type Description
pitch Number
Source:

freq2pitch(freq)

Converts a frequency to a pitch value

Parameters:
Name Type Description
freq Number
Source: