[x,fs] = wavread('soundfile.wav'); %identify soundfile and it's sample rate refer it as x which is the input

lt1 = input('limiter threshold 1?'); %specifying the limiter threshold. using input would prompt a dialogue to provide flexibilites of the limiter threshold
lt2 = input('limiter threshold 2?'); %specifying the limiter threshold. using input would prompt a dialogue to provide flexibilites of the limiter threshold
lt3 = input('limiter threshold 3?'); %specifying the limiter threshold. using input would prompt a dialogue to provide flexibilites of the limiter threshold

%at = 9; % setting up the limiter attack time (ms)
%rt = 500; % setting up the limiter release time (ms)

y = multi_band_limiter(x, lt1, lt2, lt3, fs);% to call out the function

figure(1),clf; % instruct matlab that it's a figure code
h = plot(x,'k-'); % calling it's as avariable h  to plot the figure, variables (x)and the colour of the plotted graph
set(h,'linewidth',1.); % setting the line width needed.
set(gca,'fontsize',16.);% setting the font size
grid on; % adding grid lines to the plot
h = title('limited soundfile');% stating the title of the graph
h = ylabel('Amplitude'); % labeling the y axis
h = xlabel('Time'); % labeling x axis
hold on; % to combine other variables in the same graph
h = plot(y,'r-'); %plotting the y variable to the graph
set(h,'linewidth',1.); % again setting up the line width 

hold on;


sound(y,fs); % generate the sound output
wavwrite(y,fs,'limitedsoundfile.wav'); % printing the sound output to wave file
