# Vocoder

> Channel vocoder: a modulator on Key imposes its band envelopes on the carrier through 8 to 32 band-pass filters, with formant shift and sibilance.

Source: https://docs.tune.toys/nodes/std.vocoder/

Make any sound speak: a voice, drum or noise on Key shapes the spectrum of a synth or chord on Audio, band by band.

## What it does

The vocoder splits both signals into the same set of bands, spaced evenly in pitch from Low band to High band. For each band it follows the level of the modulator (the `key` input) and sets the level of that band of the carrier (the `audio` input) to match. The carrier supplies the pitch and the tone; the modulator supplies the moving shape of vowels and consonants. Each band is a pair of band-pass filters, and the envelopes rise with Attack and fall with Release. There is no added latency.

With nothing on Key, the vocoder uses its own input as the modulator, which turns it into a smooth band-envelope filter. A one-lane modulator drives every lane of a wider carrier. The level is set so a broadband modulator at about −12 dBFS RMS leaves a broadband carrier near its own level, whatever the band count and width.

## When to use it

Use it for robot voices, talking synths and pads, drums that "speak" through a chord, or rhythmic gating of a sustained sound by another part. Put the sound with the pitch on Audio and the sound with the rhythm or words on Key. For one moving resonance rather than a whole bank, use the [Filter](https://docs.tune.toys/nodes/std.svf/).

## Ports

<!-- ports:start -->

| Port    | Direction | Signal | Lanes                   |
| ------- | --------- | ------ | ----------------------- |
| `audio` | Input     | Audio  | Inferred from the cable |
| `key`   | Input     | Audio  | Inferred from the cable |
| `audio` | Output    | Audio  | Inferred from the cable |

<!-- ports:end -->

## Parameters

<!-- parameters:start -->

| Parameter    | Label      | Range        | Default | Unit | Scale  | Notes                                                                                                                                        |
| ------------ | ---------- | ------------ | ------- | ---- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------- |
| `bands`      | Bands      | 0 to 4       | 2       |      | linear | Number of bands, spaced evenly in pitch from Low band to High band. More bands make speech clearer. Choices: 0 8, 1 12, 2 16, 3 24, 4 32.    |
| `low_hz`     | Low band   | 20 to 2000   | 100     | Hz   | log    | Centre of the lowest band.                                                                                                                   |
| `high_hz`    | High band  | 500 to 16000 | 8000    | Hz   | log    | Centre of the highest band, kept at least an octave above Low band and below 0.45 times the sample rate.                                     |
| `width`      | Band width | 0.5 to 2     | 1       | ×    | log    | Band width relative to the band spacing: 1 makes neighbouring bands cross at −3 dB, lower is narrower and more resonant.                     |
| `attack_ms`  | Attack     | 0.5 to 100   | 4       | ms   | log    | How fast each band envelope follows a rise in the modulator.                                                                                 |
| `release_ms` | Release    | 5 to 1000    | 60      | ms   | log    | How fast each band envelope falls after the modulator drops.                                                                                 |
| `sibilance`  | Sibilance  | 0 to 1       | 0.2     | %    | linear | Level of the modulator itself above High band, so consonants such as s and t stay audible. Stored as a fraction; shown ×100 as a percentage. |
| `formant`    | Formant    | -12 to 12    | 0       | st   | linear | Shifts the carrier bands up or down against the modulator bands, in semitones, for a smaller or larger voice.                                |
| `mix`        | Mix        | 0 to 1       | 1       | %    | linear | Blend from the dry carrier to the vocoded signal. Stored as a fraction; shown ×100 as a percentage.                                          |
| `output`     | Output     | -24 to 24    | 0       | dB   | linear | Output trim after the mix.                                                                                                                   |

<!-- parameters:end -->

### Bands (`bands`)

8, 12, 16, 24 or 32 bands. Few bands sound vintage and blurry; many bands make words clearer. Changing the count crossfades over 5 ms.

### Low band and High band (`low_hz`, `high_hz`)

The centres of the lowest and highest bands. The bank always spans at least an octave and stays under 0.45 times the sample rate. Most of a voice sits between 100 Hz and 8 kHz.

### Band width (`width`)

How wide each band is relative to the spacing between bands. At 1, neighbours cross at −3 dB. Lower values make narrow, resonant, metallic bands; higher values overlap them for a smoother sound.

### Attack and Release (`attack_ms`, `release_ms`)

How fast each band follows the modulator when it gets louder and when it gets quieter. Short attacks keep consonants crisp; longer releases smear words into pads.

### Sibilance (`sibilance`)

Mixes in the modulator itself above the top band, through a 12 dB/oct high-pass. Consonants like s, t and f have little to vocode in most carriers; this keeps them audible.

### Formant (`formant`)

Moves the carrier bands up or down against the modulator bands, from −12 to +12 semitones. Down sounds like a larger voice, up like a smaller one. The pitch of the carrier does not change.

### Mix and Output (`mix`, `output`)

Mix blends from the dry carrier to the vocoded signal. Output trims the level after the mix.

## Tips

- A bright, harmonically rich carrier works best: a saw, a pulse, a chord or noise. A sine has nothing to vocode.
- Keep the modulator dry and up front. A voice with reverb on it smears every band.
- Raise Sibilance when words lose their edges, and lower it if the hiss is distracting.
- For a whisper, put noise on Audio.

## See also

[Oscillator](https://docs.tune.toys/nodes/std.oscillator/), [Noise](https://docs.tune.toys/nodes/std.noise/), [Filter](https://docs.tune.toys/nodes/std.svf/), [Parametric EQ](https://docs.tune.toys/nodes/std.eq/).
