One technique used by audio engineers with echo effects is to synchronize the delay time with the tempo of a song. This technique will create signal repetitions which line up with the rhythm of the performance, rather than having the echo “out of time.”
There are several options for a delay time to be synchronized, and are based on musical note durations. Therefore, the delay time is selected relative to a quarter note, eighth note, sixteenth note, half note, whole note, dotted eighth, etc.
To create a tempo-sync’d echo as a programmer, it is necessary to convert the song tempo to a number of delay samples. This involves several steps to convert the time units of Beats Per Minute (BPM) to time units of Samples Per Quarter Note or Samples Per Eighth, etc.