FX INTRODUCTION / 18

Pitch and vowels: control them independently

Pitch and vowel color are two different parts of a voice-like sound. Change the source frequency and the formant filter separately, then combine them.

1. Listen first

Start with experiment A: the carrier stays at 130 Hz while the vowel changes. Edit the first setting to B for a fixed vowel with a changing source pitch, or C to move both. Stop before changing experiments if you want each comparison to begin from the start.

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. Three experiments

experimentSource pitchFormantsListen and look for
"A"Fixed at carrierHzCycle through five vowelsSame pitch; changing spectral envelope
"B"Plays a repeating frequency patternFixed at fixedVowelChanging pitch; stationary resonance targets
"C"Plays the same frequency patternCycle through five vowelsBoth kinds of motion together

carrierHz is in hertz. The source-frequency loop changes the PSG tone in B and C. fixedVowel chooses the filter target in B; it does not change the PSG frequency. The source loop and liveFx have separate jobs.

  1. Run A, then set experiment = "B" and run the edited code again. Compare what changes in the sound.
  2. In A, try carrierHz = 110, 130, and 180. Keep the formant table unchanged.
  3. In B, change fixedVowel from 0 to 1. The same pitch pattern now uses a different vowel.
  4. Run C. Slow the vowel cycle with vowelSeconds: 2.5 to hear how the two controls combine.

What independence means here

In A, harmonic spacing remains the same while resonant regions move. In B, harmonic spacing changes while the resonant targets remain fixed. Individual spectral peaks can move or change strength in both cases: a filter can emphasize only the harmonics present in its input.

Changing the pitch also changes which harmonics lie near a resonance, so perceived vowel color will not be perfectly constant. High fundamentals have fewer harmonics in the vowel region and can make the differences harder to hear. This separates source pitch from filter control; it is not a pitch shifter for an arbitrary recording.

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-pitch 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)