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

Functions

 FeatureSpectralRolloff (X, f_s, kappa=0.85)
 computes the spectral rolloff from the magnitude spectrum
 

Function Documentation

◆ FeatureSpectralRolloff()

FeatureSpectralRolloff ( X,
f_s,
kappa = 0.85 )

computes the spectral rolloff from the magnitude spectrum

Parameters
Xspectrogram (dimension FFTLength X Observations)
f_ssample rate of audio data
kappacutoff ratio (default: 0.85)
Returns
vsr: spectral rolloff (in Hz)

Definition at line 13 of file FeatureSpectralRolloff.py.

13def FeatureSpectralRolloff(X, f_s, kappa=0.85):
14
15 norm = X.sum(axis=0, keepdims=True)
16 norm[norm == 0] = 1
17
18 X = np.cumsum(X, axis=0) / norm
19
20 vsr = np.argmax(X >= kappa, axis=0)
21
22 # convert from index to Hz
23 vsr = vsr / (X.shape[0] - 1) * f_s / 2
24
25 return vsr