Home > ACA-Code > FeatureSpectralSkewness.m

FeatureSpectralSkewness

PURPOSE ^

computes the spectral skewness from the magnitude spectrum

SYNOPSIS ^

function [vssk] = FeatureSpectralSkewness (X, f_s)

DESCRIPTION ^

computes the spectral skewness from the magnitude spectrum
> called by ::ComputeFeature
>
> @param X: spectrogram (dimension FFTLength X Observations)
> @param f_s: sample rate of audio data (unused)
>
> @retval v spectral skewness
 ======================================================================

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 %computes the spectral skewness from the magnitude spectrum
0002 %> called by ::ComputeFeature
0003 %>
0004 %> @param X: spectrogram (dimension FFTLength X Observations)
0005 %> @param f_s: sample rate of audio data (unused)
0006 %>
0007 %> @retval v spectral skewness
0008 % ======================================================================
0009 function [vssk] = FeatureSpectralSkewness (X, f_s)
0010 
0011     % compute 'mean' and 'standard deviation'
0012     mu_X = FeatureSpectralCentroid(X, f_s) * 2 / f_s * (size(X, 1)-1);
0013     std_X = FeatureSpectralSpread(X, f_s) * 2 / f_s * (size(X, 1)-1);
0014     tmp = repmat(0:size(X, 1)-1, size(X, 2), 1) - repmat(mu_X, size(X, 1), 1)';
0015 
0016     vssk = sum((tmp.^3)'.*X)' ./ (std_X'.^3 .* sum(X, 1)'*size(X, 1));
0017 
0018     vssk = vssk';
0019        
0020     % avoid NaN for silence frames
0021     vssk (sum(X, 1) == 0) = 0;
0022     
0023 end

Generated on Fri 22-Apr-2022 20:59:51 by m2html © 2005