FX INTRODUCTION / 17

Formant voice: a vocoder-like color

Move a bank of resonances with an LFO to turn a sustained electronic tone into a talking or robotic texture. This is a formant-filter experiment, rather than an analysis/synthesis vocoder.

1. Listen first

Press Run to hear a fixed-pitch square wave through a moving vowel filter. The LFO moves the three formants together. Listen for the changing color without a corresponding melody.

In the embedded Playground, Run starts playback and Stop stops it. After editing during playback, press Run again to apply the updated code. Keep the same liveFx name to retain its filter state. For a fresh comparison, Stop and then Run. Stop other embedded Playgrounds before listening.

Open this code in a separate Playground tab ↗

2. A voice has a source and a resonant shape

The vocal folds provide a vibrating source. The vocal tract emphasizes some frequency regions. Those broad resonant regions are called formants. A filter can give an electronic source a similar spectral shape, even though it is not a human vocal tract.

harmonic-rich input
↘ band-pass F1 ↗
→ band-pass F2 → weighted sum → dry/wet mix → output
↗ band-pass F3 ↘

The three filters receive the same input in parallel. We add their outputs; the sound does not pass through F1, then F2, then F3 in series.

FormantA useful first approximation
F1Often relates to vowel openness: more open vowels tend to have higher F1.
F2Often relates to tongue front/back position: front vowels tend to have higher F2.
F3Adds further vowel and voice quality. It is not a separate anatomical control knob.

Actual formants depend on the speaker and articulation. These are illustrative targets for an experiment, not universal measurements of Japanese vowels. See the Oxford introduction to acoustic phonetics (source–filter theory and vowels).

Vowel / indexF1 (Hz)F2 (Hz)F3 (Hz)
a / 080012002500
i / 130023003000
u / 235012002500
e / 350019002600
o / 45009002400

3. Read the controls

SettingMeaning / unit
vowelVowel index, 0–4; fractions such as 0.5 blend adjacent vowels
autoVowelsAutomatically change the vowel target when true
vowelSecondsInterval between vowel targets, in elapsed seconds
transitionMsParameter-smoothing time scale, in milliseconds
lfoHz / lfoDepthLFO cycles per second / resonance shift in octaves
gain / mixWet-signal multiplier / wet proportion, 0–1
formantsTable of [F1, F2, F3] frequencies per vowel, in Hz
bandwidths / levelsWidth in Hz / mixing weight of each of the three bands

context contains settings passed to audio processing; state carries history to its next call. The vowel settings are names defined by this example, not new built-in FX APIs. Compare the numbers in the liveFx context with the process callback that transforms the input. Running the same-named code during playback sends the edited settings to the audio processor.

4. Move the voice color with an LFO

An LFO is a slow periodic oscillator used as a control signal. It is not mixed into the audible waveform here. lfoHz: 0.8 means 0.8 cycles per second, or one cycle every 1.25 seconds. This rate uses elapsed seconds and does not follow setBpm().

lfoDepth: 0.3 is a frequency shift in octaves. At the two extremes, each formant target is multiplied by 2 ** 0.3 or 2 ** -0.3. The carrier frequency is unchanged. The same shift is applied to F1, F2, and F3; transitionMs smooths the filter movement.

  1. Set lfoDepth: 0 to hear a stationary vowel. Keep autoVowels: false so automatic vowel changes do not obscure the comparison.
  2. Compare lfoHz: 0.2, 0.8, and 2. Watch the same motion at different speeds.
  3. Compare lfoDepth: 0.1, 0.3, and 0.6. Wider movement makes a more exaggerated voice color.
  4. Change vowel from 0 to 3, then compare mix: 0.5 and 1.

What differs from a vocoder?

A common channel vocoder analyzes a modulator, often a microphone signal, in multiple bands and applies those band envelopes to a separate carrier. This example has one input, no microphone or modulator analysis, and no envelope-detector bank. The resonances are controlled by numbers and an LFO.

“Vocoder-like” describes the electronic voice impression, not an equivalent signal-processing method. This is also not LPC chip emulation, speech recognition, or intelligible speech synthesis.

5. Keep the filter running smoothly

process(input, output, state, context) runs on the AudioWorklet audio thread. Each input[ch] is one audio channel, such as left or right; it is not a YM2612 musical channel. Each channel keeps its own three filter histories in state. Control position is shared so both sides move together.

The example uses trapezoidal state-variable band-pass filters, with coefficients calculated from the AudioWorklet's actual sampleRate. The same frequency settings work at 44.1 kHz and 48 kHz. See Cytomic's linear trapezoidal SVF derivation for the filter method.

The processor retains filter history across blocks and same-name code updates. It smooths target frequency, gain, and mix changes over time; transitionMs sets the movement time scale in milliseconds. It also bounds settings, rejects non-finite calculations, and limits output. Very large gain can still squash the sound; begin with the supplied settings.

This demonstration needs harmonics to shape. A sine wave has only one frequency component, so it cannot provide a convincing set of vowel resonances. The Sega PSG square wave contains odd harmonics. Its default clock also limits its lowest tone to about 109 Hz; try source frequencies around 110–260 Hz. It is a compact chip-based carrier, not a complete model of vocal-fold excitation.

6. Compare input and output in FX Monitor

After Run, open FX Monitor and choose formant-voice as the target. Blue is input and orange is output. Use View → Spectrum to compare the frequencies emphasized by the filter; use Oscilloscope for the waveform shape.

Keep a fixed Y range when comparing waveform heights. Input and output share the display scale. In Spectrum, look at the broad shape of the harmonic peaks: peaks sit near the carrier's harmonics, not necessarily exactly at F1, F2, and F3. A filter reshapes existing frequency content rather than generating a new oscillator at each formant.

The monitor is a short-time view. Listen over several cycles and compare the motion rather than expecting every frame to show three isolated peaks. The effect runs after the sound sources, so it also processes other audio you add to this Playground.

These are synthetic vowel-color experiments. They do not reproduce LPC hardware, recognize speech, add consonants, or promise a natural speaking voice. Audibility depends on the carrier, pitch, playback device, and listener. Compare at a comfortable level.

FX introduction index (work in progress)