Class: Transport

Tone. Transport

new Transport()

oscillator-based transport allows for simple musical timing supports tempo curves and time changes

Source:

Extends

Members

input :GainNode

default input of the ToneNode

Type:
  • GainNode
Inherited From:
Source:

loop :boolean

Type:
  • boolean
Source:

output :GainNode

default output of the ToneNode

Type:
  • GainNode
Inherited From:
Source:

state :TransportState

Type:
  • TransportState
Source:

Methods

_processBuffer(event)

called when a buffer is ready

Parameters:
Name Type Description
event AudioProcessingEvent
Source:

chain()

connect together all of the arguments in series

Parameters:
Type Argument Description
AudioParam | Tone <repeatable>
Inherited From:
Source:

clearInterval(rmInterval) → {boolean}

clear an interval from the processing array

Parameters:
Name Type Description
rmInterval number

the interval to remove

Source:
Returns:

true if the event was removed

Type
boolean

clearIntervals()

removes all of the intervals that are currently set

Source:

clearTimeline(timelineID) → {boolean}

clear the transportTimeline event from the

Parameters:
Name Type Description
timelineID number
Source:
Returns:

true if it was removed

Type
boolean

clearTimelines()

remove all events from the timeline

Source:

clearTimeout(timeoutID) → {boolean}

clear the timeout based on it's ID

Parameters:
Name Type Description
timeoutID number
Source:
Returns:

true if the timeout was removed

Type
boolean

clearTimeouts()

removes all of the timeouts that are currently set

Source:
To Do:
  • (optionally) remove events after a certain time

connect(unit)

connect the output of a ToneNode to an AudioParam, AudioNode, or ToneNode

Parameters:
Name Type Description
unit Tone | AudioParam | AudioNode
Inherited From:
Source:

dbToGain(db) → {number}

convert db scale to gain scale (0-1)

Parameters:
Name Type Description
db number
Inherited From:
Source:
Returns:
Type
number

defaultArg(given, fallback) → {*}

if a the given is undefined, use the fallback

Parameters:
Name Type Description
given *
fallback *
Inherited From:
Source:
Returns:
Type
*

disconnect()

disconnect the output

Inherited From:
Source:

<virtual> dispose()

a dispose method

Inherited From:
Source:

equalPowerScale(percent) → {number}

equal power gain scale good for cross-fading

Parameters:
Name Type Description
percent number

(0-1)

Inherited From:
Source:
Returns:

output gain (0-1)

Type
number

expScale(gain) → {number}

Parameters:
Name Type Description
gain number

(0-1)

Inherited From:
Source:
Returns:

gain (decibel scale but betwee 0-1)

Type
number

frequencyToSeconds(freq) → {number}

convert a frequency into seconds accepts both numbers and strings i.e. 10hz or 10 both equal .1

Parameters:
Name Type Description
freq number | string
Inherited From:
Source:
Returns:
Type
number

gainToDb(gain) → {number}

convert gain scale to decibels

Parameters:
Name Type Description
gain number

(0-1)

Inherited From:
Source:
Returns:
Type
number

getBpm() → {number}

return the current BPM

Source:
Returns:
Type
number

getTimeSignature() → {number}

return the time signature as just the numerator over 4 is assumed. for example 4/4 would return 4 and 6/8 would return 3

Source:
Returns:
Type
number

getTransportTime() → {string}

get the transport time

Source:
Returns:

in transportTime format (measures:beats:sixteenths)

Type
string

interpolate(input, outputMin, outputMax) → {number}

interpolate the input value (0-1) to be between outputMin and outputMax

Parameters:
Name Type Description
input number
outputMin number
outputMax number
Inherited From:
Source:
Returns:
Type
number

logScale(gain) → {number}

Parameters:
Name Type Description
gain number

(0-1)

Inherited From:
Source:
Returns:

gain (decibel scale but betwee 0-1)

Type
number

noGC()

makes a connection to ensure that the node will not be garbage collected until 'dispose' is explicitly called

use carefully. circumvents JS and WebAudio's normal Garbage Collection behavior

Inherited From:
Source:

normalize(input, inputMin, inputMax) → {number}

normalize the input to 0-1 from between inputMin to inputMax

Parameters:
Name Type Description
input number
inputMin number
inputMax number
Inherited From:
Source:
Returns:
Type
number

notationToSeconds(notation, bpm, timeSignature) → {number}

convert notation format strings to seconds

Parameters:
Name Type Argument Description
notation string
bpm number <optional>
timeSignature number <optional>
Inherited From:
Source:
Returns:
Type
number

now() → {number}

Inherited From:
Source:
Returns:

the currentTime from the AudioContext

Type
number

pause(time)

pause the transport and all sources synced to the transport

Parameters:
Name Type Description
time Tone.Time
Source:

receive(channelName)

recieve the input from the desired channelName to the input gain of 'this' node.

Parameters:
Name Type Description
channelName string
Inherited From:
Source:

samplesToSeconds(samples) → {number}

convert a sample count to seconds

Parameters:
Name Type Description
samples number
Inherited From:
Source:
Returns:
Type
number

secondsToFrequency(seconds) → {number}

convert a number in seconds to a frequency

Parameters:
Name Type Description
seconds number
Inherited From:
Source:
Returns:
Type
number

send(channelName, amount) → {GainNode}

send signal to a channel name

Parameters:
Name Type Description
channelName string
amount number
Inherited From:
Source:
Returns:
Type
GainNode

setBpm(bpm, rampTime)

set the BPM optionally ramp to the bpm over some time

Parameters:
Name Type Argument Description
bpm number
rampTime Tone.Time <optional>
Source:

setInterval(callback, interval, ctx) → {number}

intervals are recurring events

Parameters:
Name Type Description
callback function
interval Tone.Time
ctx Object

the context the function is invoked in

Source:
Returns:

the id of the interval

Type
number

setLoopEnd(endPosition)

set the loop start position

Parameters:
Name Type Description
endPosition Tone.Time
Source:

setLoopPoint(startPosition, endPosition)

shorthand loop setting

Parameters:
Name Type Description
startPosition Tone.Time
endPosition Tone.Time
Source:

setLoopStart(startPosition)

set the loop start position

Parameters:
Name Type Description
startPosition Tone.Time
Source:

setTimeline(callback, timeout, ctx) → {number}

Timeline events are synced to the transportTimeline of the Transport Unlike Timeout, Timeline events will restart after the Transport has been stopped and restarted.

Parameters:
Name Type Description
callback function
timeout Tome.Time
ctx Object

the context in which the funtion is called

Source:
Returns:

the id for clearing the transportTimeline event

Type
number

setTimeout(callback, time, ctx) → {number}

set a timeout to occur after time from now

Parameters:
Name Type Description
callback function
time Tone.Time
ctx Object

the context to invoke the callback in

Source:
Returns:

the id of the timeout for clearing timeouts

Type
number

setTimeSignature(numerator, denominator)

set the time signature

Parameters:
Name Type Argument Description
numerator number
denominator number <optional>

defaults to 4

Source:
Example
 this.setTimeSignature(4); //for 4/4
 
 

setTransportTime(progress)

set the transport time, jump to the position right away

Parameters:
Name Type Description
progress Tone.Time
Source:

start(time)

start the transport and all sources synced to the transport

Parameters:
Name Type Description
time Tone.Time
Source:

stop(time)

stop the transport and all sources synced to the transport

Parameters:
Name Type Description
time Tone.Time
Source:

toFrequency(time) → {number}

convert a time to a frequency

Parameters:
Name Type Description
time Tone.Time
Inherited From:
Source:
Returns:

the time in hertz

Type
number

toMaster()

connect 'this' to the master output

Inherited From:
Source:

toSamples(time) → {number}

convert a time into samples

Parameters:
Name Type Description
time Tone.time
Inherited From:
Source:
Returns:
Type
number

toSeconds(time, now) → {number}

convert Tone.Time to seconds

this is a simplified version which only handles numbers and 'now' relative numbers. If the Transport is included this method is overridden to include many other features including notationTime, Frequency, and transportTime

Parameters:
Name Type Argument Description
time Tone.Time
now number <optional>

if passed in, this number will be used for all 'now' relative timings

Inherited From:
Source:
Returns:

seconds in the same timescale as the AudioContext

Type
number

toSeconds(time, now) → {number}

convert Tone.Time into seconds.

unlike the method which it overrides, this takes into account transporttime and musical notation

Parameters:
Name Type Argument Description
time Tone.Time
now number <optional>

if passed in, this number will be used for all 'now' relative timings

Inherited From:
Source:
Returns:
Type
number

toTicks(time) → {number}

turns the time into

Parameters:
Name Type Description
time Tone.Time
Source:
Returns:
Type
number

unsync(source)

remove the source from the list of Synced Sources

Parameters:
Name Type Description
source Tone.Source

[description]

Source:
Tone No Tone Copyright © 2014.
Documentation generated on Mon Jun 23 2014 15:23:14 GMT-0400 (EDT).