Configure FFmpeg Vocoder Bands and Carrier

This article provides a direct guide on how to configure the vocoder filter in FFmpeg, focusing specifically on adjusting the number of frequency bands and mapping the carrier and modulator audio streams. You will learn the exact command syntax, parameter values, and practical examples required to achieve the classic robotic voice effect.

Understanding the Vocoder Inputs

The FFmpeg vocoder filter requires two audio inputs to function:

  1. The Carrier: This is the instrument or sound that provides the pitch and tone (typically a synthesizer pad, a saw wave, or white noise). This must be the first input stream ([0:a]).
  2. The Modulator: This is the audio stream that shapes the sound, typically a human voice speaking or singing. This must be the second input stream ([1:a]).

Configuring the Parameters

The vocoder filter accepts specific parameters to customize the output sound:

  • bands: Sets the number of frequency bands used for spectral analysis and synthesis.
    • Range: 1 to 240 (Default is 40).
    • Behavior: Lower values (e.g., 10 to 20) result in a highly robotic, resonant, and classic lo-fi synth-voice effect. Higher values (e.g., 80 to 120) produce a much clearer, more intelligible voice that closely resembles the original speech.
  • amplify: Sets the amplification factor of the carrier signal.
    • Range: Float value (Default is 1.0).
    • Behavior: Adjust this if the output is too quiet or if you need to boost the presence of the synthesized carrier.

Practical Command Examples

Basic Configuration

To apply the vocoder using a synth pad as the carrier (carrier.wav) and a voice recording as the modulator (voice.wav) with 30 bands:

ffmpeg -i carrier.wav -i voice.wav -filter_complex "[0:a][1:a]vocoder=bands=30:amplify=1.0[out]" -map "[out]" output.wav

High-Clarity Configuration

If the spoken words are difficult to understand, increase the bands parameter to 100 to capture more vocal detail:

ffmpeg -i carrier.wav -i voice.wav -filter_complex "[0:a][1:a]vocoder=bands=100:amplify=1.2[out]" -map "[out]" output.wav

Vintage Robotic Sound

For an extreme, highly synthetic 80s sci-fi robot voice, reduce the bands to a low number like 12:

ffmpeg -i carrier.wav -i voice.wav -filter_complex "[0:a][1:a]vocoder=bands=12:amplify=1.5[out]" -map "[out]" output.wav