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 7788141c authored by Dipl.-Ing. Jonas Stienen's avatar Dipl.-Ing. Jonas Stienen
Browse files

Adding biquad test

parent 73086c76
#include <ITAThirdOctaveFIRFilterGenerator.h>
#include <ITAThirdOctaveFilterbank.h>
#include <ITAAudiofileWriter.h>
#include <ITAStringUtils.h>
#include <ITAStopWatch.h>
#include <ITASampleBuffer.h>
#include <ITASampleFrame.h>
#include <iostream>
using namespace std;
const double g_dSampleRate = 44100;
//const int g_iFilterLength = int( ceil( g_dSampleRate / CITAThirdOctaveMagnitudeSpectrum::GetCenterFrequencies()[ 0 ] ) );
const int g_iFilterLength = int( 10 * ceil( g_dSampleRate / CITAThirdOctaveMagnitudeSpectrum::GetCenterFrequencies()[ 0 ] ) );
void TestThirdOctaveFilterGeneratorFIRIdentity();
void TestThirdOctaveFilterGeneratorFIRZero();
void TestThirdOctaveFilterGeneratorFIRSingleBands();
int main( int, char** )
{
TestThirdOctaveFilterGeneratorFIRIdentity();
TestThirdOctaveFilterGeneratorFIRZero();
TestThirdOctaveFilterGeneratorFIRSingleBands();
return 255;
}
void TestThirdOctaveFilterGeneratorFIRIdentity()
{
CITAThirdOctaveGainMagnitudeSpectrum oMags;
oMags.SetIdentity();
ITASampleBuffer oFilter( g_iFilterLength );
CITAThirdOctaveFIRFilterGenerator oFilterGenerator( g_dSampleRate, g_iFilterLength );
oFilterGenerator.GenerateFilter( oMags, oFilter.GetData() );
string sFilePath = "ITADSPThirdOctaveFilterGeneratorTest_Identity_FIR.wav";
writeAudiofile( sFilePath, &oFilter, g_dSampleRate );
cout << "Exported result to " << sFilePath << endl;
}
void TestThirdOctaveFilterGeneratorFIRZero()
{
CITAThirdOctaveGainMagnitudeSpectrum oMags;
oMags.SetZero();
ITASampleBuffer oFilter( g_iFilterLength );
CITAThirdOctaveFIRFilterGenerator oFilterGenerator( g_dSampleRate, g_iFilterLength );
oFilterGenerator.GenerateFilter( oMags, oFilter.GetData() );
string sFilePath = "ITADSPThirdOctaveFilterGeneratorTest_Zero_FIR.wav";
writeAudiofile( sFilePath, &oFilter, g_dSampleRate );
cout << "Exported result to " << sFilePath << endl;
}
void TestThirdOctaveFilterGeneratorFIRSingleBands()
{
ITASampleFrame oFilter( CITAThirdOctaveMagnitudeSpectrum::GetNumBands(), g_iFilterLength, true );
CITAThirdOctaveFIRFilterGenerator oFilterGenerator( g_dSampleRate, g_iFilterLength );
CITAThirdOctaveGainMagnitudeSpectrum oMags;
for( int i = 0; i < CITAThirdOctaveMagnitudeSpectrum::GetNumBands(); i++ )
{
oMags.SetZero();
oMags[ i ] = 1.0f;
oFilterGenerator.GenerateFilter( oMags, oFilter[ i ].GetData() );
}
string sFilePath = "ITADSPThirdOctaveFilterGeneratorTest_SingleBands_FIR.wav";
writeAudiofile( sFilePath, &oFilter, g_dSampleRate );
cout << "Exported result to " << sFilePath << endl;
}
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