%% Spectral Flux of Frequency-Domain Audio Data
% Read in an audio file and then calculate the mel spectrogram using the melSpectrogram function. Calculate the flux of the mel spectrogram over time. Plot the results.

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

[s,cf,t] = melSpectrogram(audioIn,fs);

flux = spectralFlux(s,cf);

plot(t,flux)
xlabel('Time (s)')
ylabel('Flux')

%
% Copyright 2018 The MathWorks, Inc.