Delay-based audio effects processor

72 Views Asked by At

I'm doing a script to implement flanger sound effect in octave. I'm having the following error at line 33: error: 'ampx' undefined near line 33, column 33 error: called from flanger at line 33 column 6

Can someone help me? I'll post script next. Thanks in advance

close all 
clear all
clc

%flanger.m
% Creates a single FIR delay with the delay time oscillating from
% Either 0-3 ms or 0-15 ms at 0.1 - 5 Hz
infile="acoustic.wav";
[som, fs]=audioread(infile);   %som-som, fs sampling rate
#outfile=audiowrite('out_flanger.wav');
% read the sample waveform
[som, fs] = audioread(infile);
% parameters to vary the effect %
max_time_delay=0.003; % 3ms max delay in seconds
rate=1; %rate of flange in Hz
index=1:length(som);
% sin reference to create oscillating delay
sin_ref = (sin(2*pi*index*(rate/fs)))';
%convert delay in ms to max delay in samples
max_samp_delay=round(max_time_delay*fs);
% create empty out vector
y = zeros(length(som),1);
% to avoid referencing of negative samples
y(1:max_samp_delay)=som(1:max_samp_delay);
% set amp suggested coefficient from page 71 DAFX
amp=0.7;
% for each sample
for i = (max_samp_delay+1):length(som),
cur_sin=abs(sin_ref(i)); %abs of current sin val 0-1
% generate delay from 1-max_samp_delay and ensure whole number
cur_delay=ceil(cur_sin*max_samp_delay);
% add delayed sample
y(i) = (ampx(i)) + amp*(som(i-cur_delay));           %%LINE 33!!!!!!!
end
% write output
audiowrite(outfile,y,Fs);
0

There are 0 best solutions below