Home > ACA-Code > FeatureSpectralFlatness.m

FeatureSpectralFlatness

PURPOSE ^

computes the spectral flatness from the magnitude spectrum

SYNOPSIS ^

function [vtf] = FeatureSpectralFlatness (X, f_s)

DESCRIPTION ^

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

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 %computes the spectral flatness 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 vtf spectral flatness
0008 % ======================================================================
0009 function [vtf] = FeatureSpectralFlatness (X, f_s)
0010 
0011     % replace product sum with log/exp
0012     XLog = log(X + 1e-20);
0013     vtf = exp(mean(XLog, 1)) ./ (mean(X, 1));
0014    
0015     % avoid NaN for silence frames
0016     vtf (min(X, [], 1) == 0) = 0;
0017     
0018 end
0019 
0020

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