pyACA: Documentation 0.3.1
Source Code for Audio Content Analysis
Loading...
Searching...
No Matches
Functions
pyACA.NoveltyFlux Namespace Reference

Functions

 NoveltyFlux (X, f_s)
 computes the novelty measure per Spectral Flux
 

Function Documentation

◆ NoveltyFlux()

NoveltyFlux ( X,
f_s )

computes the novelty measure per Spectral Flux

Parameters
Xspectrogram (dimension FFTLength X Observations)
f_ssample rate of audio data
Returns
d_flux: novelty measure

Definition at line 12 of file NoveltyFlux.py.

12def NoveltyFlux(X, f_s):
13
14 isSpectrum = X.ndim == 1
15 if isSpectrum:
16 X = np.expand_dims(X, axis=1)
17
18 # difference spectrum (set first diff to zero)
19 X = np.c_[X[:, 0], X]
20 afDeltaX = np.diff(X, 1, axis=1)
21
22 # half-wave rectification
23 afDeltaX[afDeltaX < 0] = 0
24
25 # flux
26 d_flux = np.sqrt((afDeltaX**2).sum(axis=0)) / X.shape[0]
27
28 return np.squeeze(d_flux) if isSpectrum else d_flux