Wolfram Language

Build a Vocoder Using STFT Transformations

Invented in the 1930s for telecommunication purposes, the vocoder has been used in musical contexts since the 1970s. The idea behind it is pretty simple: to impose the spectral envelope of a signal (the modulator) onto a carrier. This way the pitch of the carrier is preserved, but the articulation and the timbre are determined by the modulator.

Define the modulator signal using SpeechSynthesize.

Also define the carrier.

Make sure that the carrier has enough spectral content to be filtered by the modulator

Using MeanFilter, you can extract the spectral envelope of the magnitude spectrogram.

You can then modify the short-time Fourier transform of the carrier using the modulator.

And then reconstruct the audio using InverseShortTimeFourier.

Related Examples

de es fr ja ko pt-br zh