Aufgrund einer Störung des s3 Storage, könnten in nächster Zeit folgende GitLab Funktionen nicht zur Verfügung stehen: LFS, Container Registry, Job Artifacs, Uploads (Wiki, Bilder, Projekt-Exporte). Wir bitten um Verständnis. Es wird mit Hochdruck an der Behebung des Problems gearbeitet. Weitere Informationen zur Störung des Object Storage finden Sie hier: https://maintenance.itc.rwth-aachen.de/ticket/status/messages/59-object-storage-pilot

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

Adding FIR filter bank tests.

parent 4e113117
......@@ -12,7 +12,7 @@ const double g_dSampleRate = 44100;
const int g_iFilterLength = 512;
void TestThirdOctaveFilterbankIIR();
void TestThirdOctaveFilterbankFIR() {};
void TestThirdOctaveFilterbankFIR();
int main( int, char** )
{
......@@ -47,10 +47,10 @@ void TestThirdOctaveFilterbankIIR()
y.Zero();
pIIRFilterbank->Clear();
oMags.SetZero();
pIIRFilterbank->SetMagnitudes( oMags, false );
sw.start();
pIIRFilterbank->Process( x.GetData(), y.GetData() );
sw.stop();
......@@ -81,3 +81,64 @@ void TestThirdOctaveFilterbankIIR()
delete pIIRFilterbank;
}
void TestThirdOctaveFilterbankFIR()
{
const int iSampleLength = ( 1 << 17 );
CITAThirdOctaveFilterbank* pIIRFilterbank = CITAThirdOctaveFilterbank::Create( g_dSampleRate, iSampleLength, CITAThirdOctaveFilterbank::FIR_SPLINE_LINEAR_PHASE );
ITASampleBuffer x( iSampleLength );
x[ 0 ] = 1.0f;
CITAThirdOctaveGainMagnitudeSpectrum oMags;
oMags.SetIdentity();
pIIRFilterbank->SetMagnitudes( oMags, false );
ITASampleBuffer y( iSampleLength );
ITAStopWatch sw;
sw.start();
pIIRFilterbank->Process( x.GetData(), y.GetData() );
sw.stop();
cout << "Runtime identity magnitudes:" << sw.ToString() << endl;
y.Normalize();
writeAudiofile( "ITADSPThirdOctaveFilterbankTest_FIR_Identity.wav", &y, g_dSampleRate );
y.Zero();
pIIRFilterbank->Clear();
oMags.SetZero();
pIIRFilterbank->SetMagnitudes( oMags, false );
sw.start();
pIIRFilterbank->Process( x.GetData(), y.GetData() );
sw.stop();
cout << "Runtime zero magnitude:" << sw.ToString() << endl;
y.Normalize();
writeAudiofile( "ITADSPThirdOctaveFilterbankTest_FIR_Zeros.wav", &y, g_dSampleRate );
pIIRFilterbank->Clear();
// dB values
oMags[ 3 ] = 3.0f;
oMags[ 10 ] = -3.0f;
oMags[ 11 ] = -6.0f;
oMags[ 12 ] = -9.0f;
oMags[ 13 ] = -9.0f;
oMags[ 14 ] = -7.0f;
pIIRFilterbank->SetMagnitudes( oMags );
sw.start();
pIIRFilterbank->Process( x.GetData(), y.GetData() );
sw.stop();
cout << "Runtime real magnitudes:" << sw.ToString() << endl;
y.Normalize();
writeAudiofile( "ITADSPThirdOctaveFilterbankTest_FIR_SomeBands.wav", &y, g_dSampleRate );
delete pIIRFilterbank;
}
......@@ -16,28 +16,28 @@ test_iir_ident2.play
iir_zeros = ita_read( 'ITADSPThirdOctaveFilterbankTest_IIR_Zeros.wav' );
iir_zeros.channelNames = { 'Zeros' };
iir_zeros.pf
fdatool
SOS =
1.0000 0 -1.0000 1.0000 0.2606 0.8247
1.0000 0 -1.0000 1.0000 -0.8148 0.8398
1.0000 0 -1.0000 1.0000 -0.5621 0.6067
1.0000 0 -1.0000 1.0000 0.0527 0.5859
1.0000 0 -1.0000 1.0000 -0.2483 0.5095
G
G =
0.2843
0.2843
0.2544
0.2544
0.2452
1.0000
%
% fdatool
%
% SOS =
%
% 1.0000 0 -1.0000 1.0000 0.2606 0.8247
% 1.0000 0 -1.0000 1.0000 -0.8148 0.8398
% 1.0000 0 -1.0000 1.0000 -0.5621 0.6067
% 1.0000 0 -1.0000 1.0000 0.0527 0.5859
% 1.0000 0 -1.0000 1.0000 -0.2483 0.5095
%
% G
%
% G =
%
% 0.2843
% 0.2843
% 0.2544
% 0.2544
% 0.2452
% 1.0000
%
ITADSPThirdOctaveFilterbankTest_IIR_Zeros = ita_read( 'ITADSPThirdOctaveFilterbankTest_IIR_Zeros.wav' );
......@@ -48,3 +48,21 @@ ITADSPThirdOctaveFilterbankTest_IIR_Zeros.channelNames = { 'Zero' };
ITADSPThirdOctaveFilterbankTest_IIR_Zeros.pf
ITADSPThirdOctaveFilterbankTest_IIR_SomeBands.pf
%% FIR
fir_zeros = ita_read( 'ITADSPThirdOctaveFilterGeneratorTest_Zero_FIR.wav' );
fir_zeros.signalType = 'power';
fir_unity = ita_read( 'ITADSPThirdOctaveFilterGeneratorTest_Identity_FIR.wav' );
fir_unity.signalType = 'power';
fir_sb = ita_read( 'ITADSPThirdOctaveFilterGeneratorTest_SingleBands_FIR.wav' );
fir_sb.signalType = 'power';
fir_sb_unity = fir_sb.ch( 1 );
for n = 2:fir_sb.nChannels
fir_sb_unity = fir_sb_unity + fir_sb.ch( n );
end
fir_all = ita_merge( fir_zeros, fir_unity, fir_sb );
fir_all.pf
Markdown is supported
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