spectralcentroid
spectralcentroid(
@mode 0
) -> llll
Generates audio descriptor to calculate the spectral centroid of a buffer, defined as the 'center of mass' of the spectrum, in Hertz. Perceptually, it has a robust connection with the impression of 'brightness' of a sound, and therefore is used to characterize musical timbre. It is calculated as the weighted mean of the frequencies present in the signal, with their magnitudes as the weights. See analyze
.
The resulting buffer will be updated with the following keys:
spectralcentroid
info
spectralcentroid
is a mirror implementation of the same algorithm in the Essentia library.
For more details on the algorithm, please check the Essentia Algorithms reference.
Arguments
@mode
[int]: analysis mode. (default:0
).0
: global1
: time series2
: time-tagged time series3
: buffer
Output
spectralcentroid descriptor [llll]
Usage
spectralcentroid
is meant to be used with the analyze
function:
$buffer = importaudio('singing.wav'); ## input buffer
$descr = spectralcentroid(); ## generate spectralcentroid audio descriptor
$buffer.inspect('before analysis');
$buffer = $buffer.analyze($descr); ## apply analysis
$buffer.inspect('after analysis')