Commit efed9f77 authored by Dipl.-Ing. Jonas Stienen's avatar Dipl.-Ing. Jonas Stienen
Browse files

Fixing zero mag filtering, is now zero.

parent 91fa4f09
...@@ -80,7 +80,7 @@ void CITAThirdOctaveFilterbankIIR::Process( const float* pfInputSamples, float* ...@@ -80,7 +80,7 @@ void CITAThirdOctaveFilterbankIIR::Process( const float* pfInputSamples, float*
for( int j = 1; j < iLastBandIndex; j++ ) for( int j = 1; j < iLastBandIndex; j++ )
m_vBiquads[ i*m_nBiquadsPerBand + j ].Process( m_sfTempFilterBuf.GetData(), m_sfTempFilterBuf.GetData(), m_iBlockLength ); m_vBiquads[ i*m_nBiquadsPerBand + j ].Process( m_sfTempFilterBuf.GetData(), m_sfTempFilterBuf.GetData(), m_iBlockLength );
const float fGain = float( db10_to_ratio( oLatestMagnitudeUpdate.oMags[ i ] ) ); const float fGain = oLatestMagnitudeUpdate.oMags[ i ];
const int iOutputWriteMode = ( i == 0 ? CITABiquad::OUTPUT_OVERWRITE : CITABiquad::OUTPUT_ADD ); const int iOutputWriteMode = ( i == 0 ? CITABiquad::OUTPUT_OVERWRITE : CITABiquad::OUTPUT_ADD );
m_vBiquads[ i*m_nBiquadsPerBand + iLastBandIndex ].Process( m_sfTempFilterBuf.GetData(), m_pfTempOutputBuf.GetData(), m_iBlockLength, fGain, iOutputWriteMode ); m_vBiquads[ i*m_nBiquadsPerBand + iLastBandIndex ].Process( m_sfTempFilterBuf.GetData(), m_pfTempOutputBuf.GetData(), m_iBlockLength, fGain, iOutputWriteMode );
} }
...@@ -99,7 +99,7 @@ void CITAThirdOctaveFilterbankIIR::Process( const float* pfInputSamples, float* ...@@ -99,7 +99,7 @@ void CITAThirdOctaveFilterbankIIR::Process( const float* pfInputSamples, float*
// Letztes Biquad mit Gain: tmp => output // Letztes Biquad mit Gain: tmp => output
const float fGain1 = m_oMagnitudesInternal[ i ]; const float fGain1 = m_oMagnitudesInternal[ i ];
const float fGain2 = float( db10_to_ratio( oLatestMagnitudeUpdate.oMags[ i ] ) ); const float fGain2 = oLatestMagnitudeUpdate.oMags[ i ];
m_vBiquads[ i*m_nBiquadsPerBand + iLastBandIndex ].Process( m_sfTempFilterBuf.GetData(), m_pfTempOutputBuf.GetData(), m_iBlockLength, fGain1, fGain2, ( i == 0 ? CITABiquad::OUTPUT_OVERWRITE : CITABiquad::OUTPUT_ADD ) ); m_vBiquads[ i*m_nBiquadsPerBand + iLastBandIndex ].Process( m_sfTempFilterBuf.GetData(), m_pfTempOutputBuf.GetData(), m_iBlockLength, fGain1, fGain2, ( i == 0 ? CITABiquad::OUTPUT_OVERWRITE : CITABiquad::OUTPUT_ADD ) );
} }
} }
......
...@@ -49,7 +49,7 @@ void TestThirdOctaveFilterbankIIR() ...@@ -49,7 +49,7 @@ void TestThirdOctaveFilterbankIIR()
pIIRFilterbank->Clear(); pIIRFilterbank->Clear();
oMags.SetZero(); oMags.SetZero();
pIIRFilterbank->SetMagnitudes( oMags ); pIIRFilterbank->SetMagnitudes( oMags, false );
sw.start(); sw.start();
pIIRFilterbank->Process( x.GetData(), y.GetData() ); pIIRFilterbank->Process( x.GetData(), y.GetData() );
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
% Requires ITA Toolbox, see http://ita-toolbox.org % Requires ITA Toolbox, see http://ita-toolbox.org
iir_ident = ita_read( 'ITADSPThirdOctaveFilterbankTest_IIR_Identity.wav' ); iir_ident = ita_read( 'ITADSPThirdOctaveFilterbankTest_IIR_Identity.wav' );
iir_ident.signalType = 'energy'; %iir_ident.signalType = 'energy';
iir_ident.channelNames = { 'Identity' }; iir_ident.channelNames = { 'Identity' };
iir_ident.pf iir_ident.pf
...@@ -12,6 +12,11 @@ test_iir_ident = ita_normalize_dat( ita_merge( ita_demosound, ita_convolve( ita_ ...@@ -12,6 +12,11 @@ test_iir_ident = ita_normalize_dat( ita_merge( ita_demosound, ita_convolve( ita_
test_iir_ident2 = ita_normalize_spk( ita_merge( ita_demosound, ita_convolve( ita_demosound, iir_ident ) ), 'allchannels', true ); test_iir_ident2 = ita_normalize_spk( ita_merge( ita_demosound, ita_convolve( ita_demosound, iir_ident ) ), 'allchannels', true );
test_iir_ident2.play test_iir_ident2.play
iir_zeros = ita_read( 'ITADSPThirdOctaveFilterbankTest_IIR_Zeros.wav' );
iir_zeros.channelNames = { 'Zeros' };
iir_zeros.pf
fdatool fdatool
SOS = SOS =
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment