Optionalfrequency: Unit.FrequencyThe starting frequency of the oscillator.
Optionaltype: ToneOscillatorTypeThe type of the carrier oscillator.
OptionalmodulationType: ToneOscillatorTypeThe type of the modulator oscillator.
Optionaloptions: Partial<FMConstructorOptions>ReadonlycontextThe context belonging to the node.
Set this debug flag to log all events that happen in this class.
ReadonlydetuneThe detune value in cents (100th of a semitone).
ReadonlyfrequencyThe frequency value of the oscillator
ReadonlyharmonicityHarmonicity is the frequency ratio between the carrier and the modulator oscillators. A harmonicity of 1 gives both oscillators the same frequency. Harmonicity = 2 means a change of an octave.
Sources have no inputs
ReadonlymodulationThe modulation index which is in essence the depth or amount of the modulation. In other terms it is the ratio of the frequency of the modulating signal (mf) to the amplitude of the modulating signal (ma) -- as in ma/mf.
ReadonlynameThe name of the class
The callback to invoke when the source is stopped.
The output node
The volume of the output in decibels.
StaticversionThe version number semver
channelCount is the number of channels used when up-mixing and down-mixing connections to any inputs to the node. The default value is 2 except for specific nodes where its value is specially determined.
channelCountMode determines how channels will be counted when up-mixing and down-mixing connections to any inputs to the node. The default value is "max". This attribute has no effect for nodes with no inputs.
channelInterpretation determines how individual channels will be treated when up-mixing and down-mixing connections to any inputs to the node. The default value is "speakers".
Indicates if the instance was disposed. 'Disposing' an instance means that all of the Web Audio nodes that were created for the instance are disconnected and freed for garbage collection.
The type of the modulator oscillator
'partialCount' offers an alternative way to set the number of used partials. When partialCount is 0, the maximum number of partials are used when representing the waveform using the periodicWave. When 'partials' is set, this value is not settable, but equals the length of the partials array. A square wave wave is composed of only odd harmonics up through the harmonic series. Partial count can limit the number of harmonics which are used to generate the waveform.
'partialCount' offers an alternative way to set the number of used partials. When partialCount is 0, the maximum number of partials are used when representing the waveform using the periodicWave. When 'partials' is set, this value is not settable, but equals the length of the partials array. A square wave wave is composed of only odd harmonics up through the harmonic series. Partial count can limit the number of harmonics which are used to generate the waveform.
The partials describes the relative amplitude of each of the harmonics of the oscillator. The first value in the array is the first harmonic (i.e. the fundamental frequency), the second harmonic is an octave up, the third harmonic is an octave and a fifth, etc. The resulting oscillator output is composed of a sine tone at the relative amplitude at each of the harmonic intervals.
Setting this value will automatically set the type to "custom". The value is an empty array when the type is not "custom".
The partials describes the relative amplitude of each of the harmonics of the oscillator. The first value in the array is the first harmonic (i.e. the fundamental frequency), the second harmonic is an octave up, the third harmonic is an octave and a fifth, etc. The resulting oscillator output is composed of a sine tone at the relative amplitude at each of the harmonic intervals.
Setting this value will automatically set the type to "custom". The value is an empty array when the type is not "custom".
The phase is the starting position within the oscillator's cycle. For example a phase of 180 would start halfway through the oscillator's cycle.
The duration in seconds of one sample.
Returns the playback state of the source, either "started" or "stopped".
The oscillator's type. Also capable of setting the first x number of partials of the oscillator. For example: "sine4" would set be the first 4 partials of the sine wave and "triangle8" would set the first 8 partials of the triangle wave.
The oscillator's type. Also capable of setting the first x number of partials of the oscillator. For example: "sine4" would set be the first 4 partials of the sine wave and "triangle8" would set the first 8 partials of the triangle wave.
Returns an array of values which represents the waveform.
The length of the waveform to return
Connect the output of this node to the rest of the nodes in series.
const player = new Tone.Player("https://tonejs.github.io/audio/drum-samples/handdrum-loop.mp3");
player.autostart = true;
const filter = new Tone.AutoFilter(4).start();
const distortion = new Tone.Distortion(0.5);
// connect the player to the filter, distortion and then to the master output
player.chain(filter, distortion, Tone.Destination);
connect the output of a ToneAudioNode to an AudioParam, AudioNode, or ToneAudioNode
The output to connect to
The output to connect from
The input to connect to
disconnect the output
Optionaldestination: InputNodeClean up.
connect the output of this node to the rest of the nodes in parallel.
const player = new Tone.Player("https://tonejs.github.io/audio/drum-samples/conga-rhythm.mp3");
player.autostart = true;
const pitchShift = new Tone.PitchShift(4).toDestination();
const filter = new Tone.Filter("G5").toDestination();
// connect a node to the pitch shift and filter in parallel
player.fan(pitchShift, filter);
Get the object's attributes.
Set multiple properties at once with an object.
Sync the source to the Transport so that all subsequent
calls to start and stop are synced to the TransportTime
instead of the AudioContext time.
Convert the incoming time to seconds. This is calculated against the current TransportInstance bpm
Staticget
FMOscillator implements a frequency modulation synthesis
Example