FrequencyShifter
class Effect ↳ extends Effect<FrequencyShifterOptions>
FrequencyShifter can be used to shift all frequencies of a signal by a fixed amount. The amount can be changed at audio rate and the effect is applied in real time. The frequency shifting is implemented with a technique called single side band modulation using a ring modulator. Note: Contrary to pitch shifting, all frequencies are shifted by the same amount, destroying the harmonic relationship between them. This leads to the classic ring modulator timbre distortion. The algorithm will produces some aliasing towards the high end, especially if your source material contains a lot of high frequencies. Unfortunatelly the webaudio API does not support resampling buffers in real time, so it is not possible to fix it properly. Depending on the use case it might be an option to low pass filter your input before frequency shifting it to get ride of the aliasing. You can find a very detailed description of the algorithm here: https://larzeitlin.github.io/RMFS/
const input = new Tone.Oscillator(230, "sawtooth").start(); const shift = new Tone.FrequencyShifter(42).toDestination(); input.connect(shift);
Constructor
Section titled “Constructor”new FrequencyShifter(frequency?: Frequency)Parameters
-
frequency
FrequencyoptionalThe incoming signal is shifted by this frequency value.
new FrequencyShifter(options?: Partial<FrequencyShifterOptions>)Parameters
- options
Partial<FrequencyShifterOptions>optional
Properties
Section titled “Properties”frequency
Section titled “frequency”read-only
frequency: Signal<"frequency">The ring modulators carrier frequency. This frequency determines by how many Hertz the input signal will be shifted up or down. Default is 0.
↳ inherited from Effect
wet: Signal<"normalRange">The wet control is how much of the effected will pass through to the output. 1 = 100% effected signal, 0 = 100% dry signal.
Methods
Section titled “Methods”getDefaults()
Section titled “getDefaults()”static
getDefaults(): FrequencyShifterOptionsReturns all of the default options belonging to the class.
Returns FrequencyShifterOptions
Inherited members
Section titled “Inherited members”- From
ToneWithContext: context, blockTime, sampleTime, get(), immediate(), now(), set(), toFrequency(), toSeconds(), toTicks() - From
Tone: debug, version, disposed, toString() - From
ToneAudioNode: channelCount, channelCountMode, channelInterpretation, numberOfInputs, numberOfOutputs, chain(), connect(), disconnect(), fan(), toDestination(), toMaster()