Files
2025-08-21 07:27:52 +02:00

45 lines
518 B
Matlab
Executable File

function eval_lfo()
L = 10000;
fs = 44100;
fstart = 44;
fend = 400;
df = (fend-fstart)/L;
ip = 0 % phase of the first output sample in radians
% Init
% Loop
f = fstart;
fchg = 1;
y1=sin(ip-f*pi / fs);
y2=sin(ip-2*f*pi / fs);
for n=1:L,
if fchg == 1,
b1 = 2.0 * cos(f*pi / fs);
fchg = 1000;
end;
y0 = b1*y1 - y2;
y2 = y1;
y1 = y0;
fchg = fchg - 1;
lfo(n) = y0;
f = f + df;
close all
end;
figure;
plot(1:L, lfo); grid;
wavwrite(0.5*lfo, fs, 'lfo.wav');