[kik,fs] = audioread('Siren_Kik.wav'); %import kick sample

user_kik = normalizsig(kik); %normalise the kick sample so that the signal is between 1 and -1

%EQ the snare used for gating
in = user_kik;
%EQ band 1 input values
fc = 100;   % centre frequency
fb = 100;    % frequency band width
G = 4;      % gain factor
%EQ band 2 input values
fc2 = 5000; % centre frequency
fb2 = 400;  % frequency band width
G2 = 5;     % gain factor
%EQ band 3 input values
fc3 = 300;  %centre frequency
fb3 = 250;  %frequency band width
G3 = -7;    % gain factor

%3 band EQ process in steps (EQ1, EQ2, EQ3)
[EQ1kik] = EQ(in, fc, fs ,fb, G);
[EQ2kik] = EQ(EQ1kik, fc2, fs, fb2, G2);
[EQ3kik] = EQ(EQ2kik, fc3, fs, fb3, G3);

x = EQ3kik; %  Use the normalised kick sample to create the gated signal
holdtime = 0.07; % Time(secs) noise is below threshold before gate activated
ltrhold = 0.5; % threshold for activating gate
utrhold = 0.6; % threshold for deactivating gate
release = 0.4; % time(secs) before sound is zero after gate activated
attack = 0.3; % time (secs) before sound is equal to input after gate has been deactivated
a = 0.8; % The smoothing pole
fs = 44100; % sampling frequency of the sample
gatekik =noisegtabs(x,holdtime,ltrhold,utrhold,release,attack,a,fs); %call the noise gate function

mix = 0.3; % mix ratio of non-gated sample, to be summed with the gated kick

kikmaster = (mix*user_kik) + (gatekik'); % sum together a mix of the non-gated and gated kick sample to produce a punchy kick attack with a subtle element of the live mic.
kikmaster = kikmaster./max(max(abs(kikmaster))); % normalise the resulting signal
