Skip to content
Tone.js

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. Unfortunately the Web Audio 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);
new FrequencyShifter(frequency?: Frequency)

Parameters

  • frequency Frequency optional

    The incoming signal is shifted by this frequency value.

new FrequencyShifter(options?: Partial<FrequencyShifterOptions>)

Parameters

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

input: Gain

The effect input node

read-only

name: string

The name of the class

Default: "FrequencyShifter"

↳ inherited from Effect

output: CrossFade

The effect output

↳ 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.

dispose(): this

Dispose and disconnect

Returns this

static

Returns all of the default options belonging to the class.

Returns FrequencyShifterOptions