# Audio frequency modulation algorithm

I have a digital audio signal (float samples). I need to apply the Vibrato effect to a signal. "Vibrato" is no common term, but it is the same as the frequency modulation.
So, I need to modulate my audio signal by a low-frequency sinusoid. I need to set two parameters for the modulation: "amplitude" and period. In this case, "amplitude" of freq modulation is a maximum shift of signal frequency, for example 10 Hz. Period is just a period of the sinusoid.
So, I need a C/C++ function for such modulation.

The related article, but I cannot quite understand it: https://christianfloisand.wordpress.com/2012/05/01/shaking-it-up-with-vibrato-2/

• I found this : stackoverflow.com/questions/8611722/… Mar 3, 2016 at 12:39
• @MaximGi, as I understand, FM synthesis is a different task Mar 3, 2016 at 12:56
• Yes, I was giving this link to provide some hints, because doing an (digital) FM modulation on a raw signal is not easy in terms of coding Mar 3, 2016 at 13:04

You need to build a time varying delay, where you can modulate the delay amount over time.

The peak delay modulation is a function of your maximum desired frequency shift and the modulation frequency.

This is not trivial since it will require fractional sample delays with some kind of interpolation algorithm. You can't round to the nearest integer delay without "zipper" noise. The best interpolation method depends on the specific requirements of your application (tolerance for noise, input spectrum, MIPS & memory available, etc.)

• Can you see these sources of Vibrato? It is simple and it works, but it uses integer indexes for a delay buffer. Do you have some idea how to make an interpolation? Mar 4, 2016 at 7:46
• Mar 5, 2016 at 12:47

After much searching and asking questions, I have written my own realization for the vibrato effect: https://github.com/Bershov/Vibrato-effect. The code is not hard for understanding and works fine. In fact, the vibrato is a kind of frequency modulation. Its key concepts: variable delay, low-frequency oscillation and intelpolation.