Perceptual spectral centroid

Perceptually-informed spectral centroid.
945 download
Aggiornato 5 mag 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

Cita come

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

Compatibilità della release di MATLAB
Creato con R2014a
Compatibile con qualsiasi release
Compatibilità della piattaforma
Windows macOS Linux
Categorie
Scopri di più su Simulation, Tuning, and Visualization in Help Center e MATLAB Answers

Community Treasure Hunt

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

Start Hunting!

Le versioni che utilizzano il ramo predefinito di GitHub non possono essere scaricate

Versione Pubblicato Note della release
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

Per visualizzare o segnalare problemi su questo componente aggiuntivo di GitHub, visita GitHub Repository.
Per visualizzare o segnalare problemi su questo componente aggiuntivo di GitHub, visita GitHub Repository.