%% Spectral Decrease of Frequency-Domain Audio Data
% Read in an audio file and then calculate the mel spectrogram using the melSpectrogram function.

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

%
% Calculate the decrease of the mel spectrogram over time. Plot the results.

decrease = spectralDecrease(s,cf);

t = linspace(0,size(audioIn,1)/fs,size(decrease,1));
plot(t,decrease)
xlabel('Time (s)')
ylabel('Decrease')

%
% Copyright 2018 The MathWorks, Inc.