2.6 Delay-based Audio Effects
2.6.1 Vibrato
When a car is passing by, we hear a pitch deviation due to the Doppler effect [Dut91]. This effect will be explained in another chapter, but we can keep in mind that the pitch variation is due to the fact that the distance between the source and our ears is being varied. Varying the distance is, for our application, equivalent to varying the time delay. If we keep on varying periodically the time delay we will produce a periodical pitch variation. This is precisely a vibrato effect. For that purpose we need a delay line and a low-frequency oscillator to drive the delay time parameter. We should only listen to the delayed signal. Typical values of the parameters are 5 to 10 ms as the average delaytime and 5 to 14 Hz rate for the low-frequency oscillator (see Figure 2.32) [And95, Whi93]. M-file 2.8 shows the implementation for vibrato [Dis99].
M-file 2.8 (vibrato.m)
function y=vibrato(y,SAMPLERATE,Modfreq,Width)
% Author: S. Disch
ya_alt=0;
Delay=Width; % basic delay of input sample in sec
DELAY=round(Delay*SAMPLERATE); % basic delay in # samples
WIDTH=round(Width*SAMPLERATE); % modulation width in # samples
if WIDTH>DELAY
error(’delay greater than basic delay !!!’);
return;
end
MODFREQ=Modfreq/SAMPLERATE; % modulation frequency in # samples
LEN=length(x); % # of samples in WAV-file
L=2+DELAY+WIDTH*2; % length of the entire delay
Delayline=zeros(L,1); % memory allocation for delay
y=zeros(size(x)); % memory allocation for output vector ...
Get DAFX: Digital Audio Effects, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.