Perceptual spectral centroid

Perceptually-informed spectral centroid.
942 Downloads
Aktualisiert 5. Mai 2018

NOTE: this function is now available from the IoSR Matlab Toolbox as iosr.auditory.perceptualCentroid.
-------------------------
PCMEAN = PERCEPTUALCENTROID(X,FS) calculates the spectral centroid of
signal X, sampled at FS, with respect to mel-frequency.
The algorithm first calculates the spectrogram of X; each segment has
the maximum of length(X)/8 or 2048 samples, calculated with 50% overlap
and windowed with a hamming window. The spectrogram function is the
built-in Matlab function SPECTROGRAM. The centroid is calculated with
respect to mels by converting the FFT bin frequencies to mels. PCMEAN
is the mean of the perceptual spectral centroids calculated for each
segment. The perceptual spectral centroid can also be calculated using
ERBs, cents, or hertz (see below).

X can be a vector, matrix, or multidimensional array;
PERCEPTUALCENTROID will operate along the first non-signleton
dimension, and return a value for each corresponding row/column/etc.

PCmean = perceptualCentroid(x,fs,'parameter',value) allows numerous
parameters to be specified. These parameters are:-
'cref' : {27.5} | scalar
Specifies the reference frequency when calulating the centroid
in terms of cents.
'dim' : {first non-singleton dimension} | integer
Specify the dimension over which to calculate the perceptual
spectral centroid.
'loudness' : {'none'} | 'A' | 'B' | 'C' | 'D' | 'ISO-226'
Specifies whether loudness weighting is applied to the spectrum
prior to the centroid calculation. The default is for no
weighting to be applied. 'A', 'B', 'C', and 'D' correspond to
frequency weighting curves defined in IEC 61672:2003; 'ISO-226'
applies loudness weighting derived from ISO 226:2003.
'nfft' : {max([length(x)/2, 2048])} | integer
Specifies SPECTROGRAM's FFT size.
'noverlap' : {nfft/2} | integer
Specifies the number of samples over which SPECTROGRAM's
segments overlap.
'output' : {'units'} | 'hz'
Specifies whether the output data are in Hz ('hz') or in units
determined by the 'scale' option ('units') (default).
'phon' : {65} | scalar
Specifies the loudness level if using ISO 226:2003-based
loudness weighting.
'scale' : {'mel'} | 'linear' | 'erb' | 'cents'
Specifies frequency scale use to calculate the centroid. 'mel'
uses the mel-frequency scale, 'linear' uses a linear frequency
scale (corresponding to the traditional spectral centroid
measure), 'erb' uses the equivalent-rectangular-bandwidth-rate
scale, and cents uses a scale based on musical cents with
respect to A-1 (27.5 Hz).
'window' : {hamming(nfft)} | vector
Specifies the window applied to each SPECTROGRAM segment.

[PCmean,PCstd,PCmax,PCmin,N] = ... returns additional information:-
PCmean : as described above.
PCstd : the standard deviation of the perceptual spectral
centroids.
PCmax : the maximum of the perceptual spectral centroids.
PCmin : the minimum of the perceptual spectral centroids.
N : the sample size for each statistic.

For more information about the FFT calculation and its options, consult
the SPECTROGRAM documentation.

Examples

Example 1: Calculate the mel-frequency spectral centroid of random
noise:

fs = 44100;
x = randn(fs,1);
PC = perceptualCentroid(x,fs);

Example 2: Calculate the ERB-spaced spectral centroid of random
noise with the output in Hertz:

PC = perceptualCentroid(x,fs,'scale','erb','output','hz');

Example 3: Calculate the musically-spaced spectral centroid of
random noise using a 4096-point Hann window:

PC = perceptualCentroid(x,fs,'scale','cents',...
'window',hann(4096));

Authors: Chris Hummersone & Kirsten Hermes, 2014

Zitieren als

Christopher Hummersone (2024). Perceptual spectral centroid (https://github.com/IoSR-Surrey/MatlabToolbox), GitHub. Abgerufen .

Kompatibilität der MATLAB-Version
Erstellt mit R2014a
Kompatibel mit allen Versionen
Plattform-Kompatibilität
Windows macOS Linux
Kategorien
Mehr zu Simulation, Tuning, and Visualization finden Sie in Help Center und MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Versionen, die den GitHub-Standardzweig verwenden, können nicht heruntergeladen werden

Version Veröffentlicht Versionshinweise
1.6.0.0

Fixed bug whereby output dimensions would be incorrect for multidimensional array.
Migrated to GitHub.

1.5.0.0

Corrected title.

1.4.0.0

Uploaded correct file and updated description.

1.3.0.0

Added loudness weighting options.

1.2.0.0

Corrected title.

1.1.0.0

Made a number of changes: corrected error in method (no longer uses interpolation); removed fq output; added sample size N output; added 'cref' and 'output' options (default output is now it 'scale' units); simplified input parsing; updated help.

1.0.0.0

Um Probleme in diesem GitHub Add-On anzuzeigen oder zu melden, besuchen Sie das GitHub Repository.
Um Probleme in diesem GitHub Add-On anzuzeigen oder zu melden, besuchen Sie das GitHub Repository.