new Oscillator(freq, type)
Oscillator
Oscilator with start, pause, stop and sync to Transport
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
freq |
number | string | starting frequency | |
type |
string |
<optional> |
type of oscillator (sine|square|triangle|sawtooth) |
Extends
Members
-
frequency :Tone.Signal
-
the frequency control signal
Type:
-
isFrequency
-
true if the input is in the format number+hz i.e.: 10hz
- Inherited From:
- Source:
-
isNotation
-
tests if a string is musical notation i.e.: 4n = quarter note 2m = two measures 8t = eighth-note triplet
- Inherited From:
- Source:
-
isTransportTime
-
tests if a string is transportTime i.e. : 1:2:0 = 1 measure + two quarter notes + 0 sixteenth notes
- Inherited From:
- Source:
-
oscillator :OscillatorNode
-
the main oscillator
Type:
- OscillatorNode
-
output :GainNode
-
unlike most ToneNodes, Sources only have an output and no input
Type:
- GainNode
- Inherited From:
- Source:
Methods
-
fadeTo(value, time)
-
Parameters:
Name Type Description value
number time
Tone.Time (relative to 'now') - Inherited From:
- Source:
-
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
-
<abstract> pause(time)
-
Parameters:
Name Type Description time
Tone.Time - Inherited From:
- 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:
-
send(channelName, amount) → {GainNode}
-
send signal to a channel name
Parameters:
Name Type Description channelName
string amount
number Returns:
- Type
- GainNode
-
setFrequency(val, rampTime)
-
exponentially ramp the frequency of the oscillator over the rampTime
Parameters:
Name Type Argument Description val
Tone.Time rampTime
Tone.Time <optional>
when the oscillator will arrive at the frequency -
setType(type)
-
set the oscillator type
Parameters:
Name Type Description type
string (sine|square|triangle|sawtooth) -
setVolume(value)
-
Parameters:
Name Type Description value
number - Inherited From:
- Source:
-
start(time)
-
start the oscillator
Parameters:
Name Type Description time
Tone.Time -
stop(time)
-
stop the oscillator
Parameters:
Name Type Argument Description time
Tone.Time <optional>
(optional) timing parameter -
sync()
-
Sync the oscillator to the transport the current ratio between the oscillator and the Transport BPM is fixed and any change to the Transport BPM will change this oscillator in that same ratio Transport start/pause/stop will also start/pause/stop the oscillator
-
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
-
toSeconds(time, bpm, timeSignature)
-
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 bpm
number <optional>
timeSignature
number <optional>
- Inherited From:
- Source:
-
toTransportTime(seconds, bpm, timeSignature) → {string}
-
Convert seconds to the closest transportTime in the form measures:quarters:sixteenths
Parameters:
Name Type Argument Description seconds
Tone.Time bpm
number <optional>
timeSignature
number <optional>
- Inherited From:
- Source:
Returns:
- Type
- string
-
transportTimeToSeconds(transportTime, bpm, timeSignature) → {number}
-
convert transportTime into seconds i.e.: 4:2:3 == 4 measures + 2 quarters + 3 sixteenths
Parameters:
Name Type Argument Description transportTime
string bpm
number <optional>
timeSignature
number <optional>
- Inherited From:
- Source:
Returns:
seconds- Type
- number
-
unsync()
-
unsync the oscillator from the Transport