Search guides and the APICtrl K
  1. API reference
  2. DSP

vocoder.h

The channel vocoder and the formant filter.

#include <sonore/vocoder.h>
On this page

Design notes

Both are banks of bandpass filters; what differs is who sets the levels. In the vocoder a second signal does -- the modulator's energy in each band is measured and imposed on the carrier's band, and a synth "talks". In the formant filter a vowel does -- five resonances at the frequencies a human vocal tract puts them, with the bandwidths and levels measured from singers, and a saw "sings" an A.

The formant table is the classic one from the Csound manual (the soprano set, five formants per vowel, frequency / level / bandwidth), which traces back to the measurements used in the CHANT vocal synthesiser at IRCAM. It is here as data rather than as five hand-picked numbers because the third, fourth and fifth formants are what make a vowel sound like a voice rather than like a wah pedal, and nobody remembers them.

One detail that decides whether the levels mean anything: the SVF's bp output is Simper's un-normalised band, whose peak gain is Q. A band at Q = 10 read straight off it sits 20 dB hot, and two in cascade 40 dB. Both banks here scale each stage by 1/Q so every band peaks at unity -- which is what makes the formant table's decibels come out as the decibels in the table, and the vocoder's output land at (modulator level × carrier level) instead of at a number nobody chose.

Included by dsp.h.

Types 2

template <int Bands = 16> class ChannelVocoder

Bands are log-spaced across the range, constant-Q, each a pair of state- variable bandpasses in cascade (a single one is too broad for speech to stay intelligible). The modulator's per-band envelope drives the carrier's per-band level; attack and release are the intelligibility knobs -- fast enough to follow consonants, slow enough not to buzz on the pitch. The bands meet at about -3 dB, so a flat carrier through open bands comes out near flat.

Five resonances per vowel; setVowel takes a position 0..4 across A, E, I, O, U and interpolates the formants between neighbours, so a knob sweeps through the vowels the way a mouth does. The first formant peaks at unity; the rest sit at the table's levels below it.

↑↓ to move↵ to openEvery public name in the headers, and every guide