Home > ACA-Code > FeatureSpectralRolloff.m

FeatureSpectralRolloff

PURPOSE ^

computes the spectral rolloff from the magnitude spectrum

SYNOPSIS ^

function [vsr] = FeatureSpectralRolloff (X, f_s, kappa)

DESCRIPTION ^

computes the spectral rolloff from the magnitude spectrum
> called by ::ComputeFeature
>
> @param X: spectrogram (dimension FFTLength X Observations)
> @param f_s: sample rate of audio data 
> @param kappa: cutoff ratio
>
> @retval vsr spectral rolloff (in Hz)
 ======================================================================

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 %computes the spectral rolloff 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
0006 %> @param kappa: cutoff ratio
0007 %>
0008 %> @retval vsr spectral rolloff (in Hz)
0009 % ======================================================================
0010 function [vsr] = FeatureSpectralRolloff (X, f_s, kappa)
0011 
0012     % initialize parameters
0013     if (nargin < 3)
0014         kappa = 0.85;
0015     end
0016     
0017     % allocate memory
0018     vsr = zeros(1, size(X,2));
0019   
0020     % compute rolloff
0021     afSum = sum(X, 1);
0022     for n = 1:length(vsr)
0023         vsr(n) = find(cumsum(X(:, n)) >= kappa*afSum(n), 1)-1; 
0024     end
0025     
0026     % convert from index to Hz
0027     vsr = vsr / (size(X, 1)-1) * f_s / 2;
0028 end

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