Tone
Tone is the base class of all other classes.
CONSTRUCTOR
new Tone ( )Members
Methods
.toTicks ( )
#Convert a time representation into ticks.
.receive ( )
#A named channel to send the signal to.
The channel to connect to
this
Receive the input from the desired channelName to the input
EXAMPLE
.send ( )
#A named channel to send the signal to.
The amount of the source to send to the bus.
The gain node which connects this node to the desired channel. Can be used to adjust the levels of the send.
Send this signal to the channel name.
EXAMPLE
.toFrequency ( )
#Convert a frequency representation into a number.
.toSeconds ( )
#Convert Time into seconds. Unlike the method which it overrides, this takes into account transporttime and musical notation. Time : 1.40 Notation: 4n or 1m or 2t Now Relative: +3n
Static Methods
.connectSeries ( )
#connect together all of the arguments in series
.defaultArg ( )
#If the given
parameter is undefined, use the fallback
. If both given
and fallback
are object literals, it will return a deep copy which includes all of the parameters from both objects. If a parameter is undefined in given, it will return the fallback property.
WARNING: if object is self referential, it will go into an an infinite recursive loop.
.defaults ( )
#The arguments array
The names of the arguments
An object composed of the defaults between the class’ defaults and the passed in arguments.
.equalPowerScale ( )
#(0-1)
output gain (0-1)
Equal power gain scale. Good for cross-fading.
.extend ( )
#(optional) parent to inherit from if no parent is supplied, the child will inherit from Tone
have a child inherit all of Tone’s (or a parent’s) prototype to inherit the parent’s properties, make sure to call Parent.call(this) in the child’s constructor based on closure library’s inherit function
.immediate ( )
#the currentTime from the AudioContext
Return the current time of the AudioContext clock without any lookAhead.
.intervalToFrequencyRatio ( )
#the number of semitones above the base note
the frequency ratio
Convert an interval (in semitones) to a frequency ratio.
EXAMPLE
.isArray ( )
#Test if the argument is an Array
.isBoolean ( )
#Test if the argument is a boolean.
.isDefined ( )
#Test if the arg is not undefined
.isFunction ( )
#Test if the arg is a function
.isNote ( )
#Test if the argument is in the form of a note in scientific pitch notation. e.g. “C4”
.isNumber ( )
#Test if the argument is a number.
.isObject ( )
#Test if the given argument is an object literal (i.e. {}
);
.isString ( )
#Test if the argument is a string.
.isUndef ( )
#Test if the arg is undefined
.loaded ( )
#Returns a Promise which resolves when all of the buffers have loaded
.now ( )
#the currentTime from the AudioContext
Return the current time of the AudioContext clock plus the lookAhead.
.start ( )
#This promise is resolved when the audio context is started.
Most browsers will not play any audio until a user clicks something (like a play button). Invoke this method on a click or keypress event handler to start the audio context. More about the Autoplay policy here
EXAMPLE
.Offline ( )
#All Tone.js nodes which are created and scheduled within this callback are recorded into the output Buffer.
the amount of time to record for.
The promise which is invoked with the Tone.Buffer of the recorded output.
Generate a buffer by rendering all of the Tone.js code within the callback using the OfflineAudioContext. The OfflineAudioContext is capable of rendering much faster than real time in many cases. The callback function also passes in an offline instance of Tone.Transport which can be used to schedule events along the Transport. NOTE OfflineAudioContext has the same restrictions as the AudioContext in that on certain platforms (like iOS) it must be invoked by an explicit user action like a click or tap.