%% Specify Nondefault Parameters
% Read in an audio file.

[audioIn,fs] = audioread('Counting-16-44p1-mono-15secs.wav');

%
% Calculate the slope of the magnitude spectrum over time. Calculate the slope for 50 ms Hamming windows of data with 25 ms overlap. Use the range from 62.5 Hz to fs/2 for the slope calculation. Plot the results.

slope = spectralSlope(audioIn,fs, ...
                    'Window',hamming(round(0.05*fs)), ...
                    'OverlapLength',round(0.025*fs), ...
                    'Range',[62.5,fs/2]);
                        
t = linspace(0,size(audioIn,1)/fs,size(slope,1));
plot(t,slope)
xlabel('Time (s)')
ylabel('Slope')

%
% Copyright 2018 The MathWorks, Inc.