function [output]=createFiltNoise(input,centreFreq,bandWidth,filterOrder,Fs)

% create filtered noise for bandwidth simulation
%
% Input:
%   - input: input to be filtered
%   - centreFreq: centre frequency or cutoff frequency
%   - bandWidth: width of filter
%   - filterOrder: order of butterworth filter (4)
%   - Fs: sampling frequency (44100)
%
% Output:
%   - output: array
%

% Developer:  - Alice Clifford (alice.clifford@eecs.qmul.ac.uk)



if centreFreq==0  %LOW PASS FILTER FOR CENTRE FREQ ==0
    
    cutoffFreq=bandWidth;
    
    normCutFreq=(cutoffFreq/(Fs/2));
    
    [b,a]=butter(filterOrder,normCutFreq,'low');
    
    output=filter(b,a,input);
    
    
    
elseif centreFreq==22050 %HIGH PASS FILTER FOR CENTREFREQ == FS/2
    
    cutoffFreq=(Fs/2)-bandWidth;
    
    normCutFreq=(cutoffFreq/(Fs/2));
    
    [b,a]=butter(filterOrder,normCutFreq,'high'); %HIGH PASS FILTER
    
    output=filter(b,a,input);
    
    
    
    
else% %BAND PASS - NEED LOW AND HIGH PASS
    
    lowBandFreq=centreFreq-(bandWidth/2);
    highBandFreq=centreFreq+(bandWidth/2);
    
    highNormBandFreq=(highBandFreq/(Fs/2));
    lowNormBandFreq=(lowBandFreq/(Fs/2));
    
    
    [b,a]=butter(filterOrder,[lowNormBandFreq highNormBandFreq]);
    
    
    
    output=filter(b,a,input);
    
end