-
-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathNoveltyFlux.m
More file actions
19 lines (16 loc) · 579 Bytes
/
Copy pathNoveltyFlux.m
File metadata and controls
19 lines (16 loc) · 579 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
%computes the novelty measure per Spectral Flux
%> called by ::ComputeNoveltyFunction
%>
%> @param X: spectrogram (dimension FFTLength X Observations)
%> @param f_s: sample rate of audio data (unused)
%>
%> @retval d_flux novelty measure
% ======================================================================
function [d_flux] = NoveltyFlux(X, f_s)
% difference spectrum (set first diff to zero)
afDeltaX = diff([X(:, 1), X], 1, 2);
% half-wave rectification
afDeltaX(afDeltaX<0) = 0;
% flux
d_flux = sqrt(sum(afDeltaX.^2)) / size(X, 1);
end