FX INTRODUCTION / 12 / DRAFT
Flanger: move a short delay
Mix the original sound with a delayed copy whose read position slowly moves.
This article is a work in progress. The examples will be refined through listening. Run starts playback; Stop ends it. Use Apply after editing values. Stop the playing iframe before trying another one.
Listen with the built-in FX
| Setting | Meaning |
|---|---|
| time / depth | Base delay and modulation depth (seconds) |
| rate | One modulation cycle (beats), not Hz |
| mix | Wet signal proportion |
Select none in FX Monitor to see the waveform after the built-in FX. This pass-through effect makes input and output overlap; it does not compare the signal before and after the built-in FX.
How the PCM is processed
Continuously changing the delay also changes how quickly past audio is read. Reading only integer positions creates steps, so this example linearly interpolates between two neighboring samples. Interference between the short delay and the original creates a comb-shaped frequency response.
input[ch][i] is one input sample. ch identifies a left or right audio channel, not a physical FM voice. Store values carried between blocks in state. Since process cannot access outer variables, put settings in context.
Try it with liveFx
The 48000 in context.sampleRate is a placeholder. Match it to the actual output rate shown in FX Monitor. It is used to calculate times and frequencies; it does not change the browser's output sample rate.
This example uses resetState: true, so Apply clears stored audio and rebuilds the buffers, cutting off tails. Normally, a liveFx with the same name preserves state.
Open in a separate Playground tab ↗
Select flanger-lab in FX Monitor to compare the input and output of this process.
- Set depthMs to 0 and compare with a fixed delay.
- Compare lfoHz at 0.2 and 2.
- Set mix to 0, 0.5, and 1 to hear the difference when blending with the original signal.
Scope of this example
The learning example uses lfoHz in Hz, while the built-in rate is measured in beats; equal numbers do not give equal periods. This is a simple delay without feedback. Keep baseMs greater than depthMs, with their sum below 100 ms.
The waveform shows changes over time; Spectrum shows the strength of frequency components. A short display window or smoothing can hide some changes. Listen while changing one setting at a time.