Commit 88863707 authored by Armin Erraji's avatar Armin Erraji

In FilterEngineTest exports the spectrum after its calculation to a .wav file.

parent 7edae76d
......@@ -278,7 +278,7 @@ void CFilterEngine::Generate(const ITAGeo::CPropagationPathList & oPathList, ITA
oThirdOctMagnitudes.SetIdentity();
//Include sound energy decrease due to the length of the path
fScalarMagnitude *= 1.0f / pow(fPathLength,2);
fScalarMagnitude /= pow(fPathLength,2);
//Subtract air attenuation according to ISO9613-1
ITABase::CThirdOctaveFactorMagnitudeSpectrum oThirdOctAbsorption;
......
......@@ -19,6 +19,7 @@
#include <ITAPropagationModels/FilterEngine.h>
#include <ITAGeo/Base.h>
#include <ITAFFTUtils.h>
#include <ITAISO9613.h>
......@@ -60,6 +61,9 @@ int main(int, char**)
pW->v3VertextStart.SetValues(.0f, 1.0f, -1.0f);
pW->v3VertextEnd.SetValues(.0f, 1.0f, 1.0f);
CPropagationPath oPathDirect;
oPathDirect.push_back(pSender);
oPathDirect.push_back(pReceiver);
CPropagationPath oPathReflection;
oPathReflection.push_back(pSender);
......@@ -72,24 +76,31 @@ int main(int, char**)
oPathDiffraction.push_back(pReceiver);
CPropagationPathList oPathList;
oPathList.push_back(oPathReflection);
oPathList.push_back(oPathDiffraction);
//oPathList.push_back(oPathDirect);
//oPathList.push_back(oPathReflection);
//oPathList.push_back(oPathDiffraction);
oPathList.Load("PropagationPathListExample.json");
CFilterEngine oFilter;
oFilter.ApplyAcousticModels(oPathList);
//Set filter length according to the maximum path length
const float fSpeedOfSound = 344.0f; //Approximation of speed of sound at ~20C
const float fSampleRate = 44.1e3;
const float fSampleRate = 44.1e3f;
const int iFilterLength = (int)(oPathList.GetMaxLength()/ fSpeedOfSound * fSampleRate ) + 1024;
const int iFilterLength = (int)(oPathList.GetMaxLength()/ fSpeedOfSound * fSampleRate );
ITABase::CHDFTSpectra oSpectra(fSampleRate, pReceiver->iNumChannels, iFilterLength);
oFilter.Generate(oPathList, oSpectra);
ITAFFTUtils::Export(oSpectra[0], "ImageSource_Example.wav");
}
This diff is collapsed.
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