Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
Institute of Technical Acoustics (ITA)
ITAPropagationModels
Commits
740fea37
Commit
740fea37
authored
Jan 04, 2019
by
Dipl.-Ing. Jonas Stienen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improving propagation models and extending filter engine with material manager
parent
31f3d4d4
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
174 additions
and
269 deletions
+174
-269
CMakeLists.txt
CMakeLists.txt
+0
-2
include/ITAPropagationModels/FilterEngine.h
include/ITAPropagationModels/FilterEngine.h
+11
-4
include/ITAPropagationModels/FilterGenerator.h
include/ITAPropagationModels/FilterGenerator.h
+0
-80
src/ITAPropagationModels/FilterEngine.cpp
src/ITAPropagationModels/FilterEngine.cpp
+115
-106
src/ITAPropagationModels/FilterGenerator.cpp
src/ITAPropagationModels/FilterGenerator.cpp
+0
-25
tests/FilterEngine/FilterEngineTest.cpp
tests/FilterEngine/FilterEngineTest.cpp
+41
-52
tests/FilterEngine/stonewall.mat
tests/FilterEngine/stonewall.mat
+7
-0
No files found.
CMakeLists.txt
View file @
740fea37
...
...
@@ -20,14 +20,12 @@ set( ITAPropagationModelsHeader
"include/ITAPropagationModels/Definitions.h"
"include/ITAPropagationModels/DiffractionFilter.h"
"include/ITAPropagationModels/FilterEngine.h"
"include/ITAPropagationModels/FilterGenerator.h"
"include/ITAPropagationModels/Maekawa.h"
"include/ITAPropagationModels/Svensson.h"
"include/ITAPropagationModels/UTD.h"
)
set
(
ITAPropagationModelsSources
"src/ITAPropagationModels/FilterEngine.cpp"
"src/ITAPropagationModels/FilterGenerator.cpp"
"src/ITAPropagationModels/Maekawa.cpp"
"src/ITAPropagationModels/Svensson.cpp"
"src/ITAPropagationModels/UTD.cpp"
...
...
include/ITAPropagationModels/FilterEngine.h
View file @
740fea37
...
...
@@ -25,17 +25,18 @@
// ITA includes
#include <ITAGeo/Base.h>
#include <ITAGeo/Material//Manager.h>
#include <ITAHDFTSpectra.h>
#include <ITAHDFTSpectrum.h>
// STL includes
#include <vector>
namespace
ITAPropagationModels
{
using
namespace
std
;
//! Transfer function filter generator for propagation paths
/**
* Generates transfer functions in the frequency-domain that
...
...
@@ -98,7 +99,7 @@ namespace ITAPropagationModels
void
ApplyTransmissionModel
(
ITAGeo
::
CPropagationPathList
&
oPathList
,
int
iModel
=
-
1
);
// @todo
//! Generate multi-channel propagation path (for multi-channel receiver directivit
i
y)
//! Generate multi-channel propagation path (for multi-channel receiver directivity)
/**
* @todo AER
*/
...
...
@@ -112,6 +113,12 @@ namespace ITAPropagationModels
Generate
(
oPathList
,
oTF
);
};
//! Sets a connection to the material manager
void
SetMaterialManager
(
const
ITAGeo
::
CMaterialManager
*
pMaterialManager
);
// Returns pointer to material manager or null
const
ITAGeo
::
CMaterialManager
*
GetMaterialManager
()
const
;
private:
unique_ptr
<
ITABase
::
CHDFTSpectra
>
m_pAccumulatedSpectra
;
//!< Gathered propagation paths from list
...
...
@@ -128,7 +135,7 @@ namespace ITAPropagationModels
};
const
ITAGeo
::
CMaterialManager
*
m_pMaterialManager
;
const
double
m_dHumidity
=
80.0
;
const
double
m_dTemperature
=
20.0
;
...
...
include/ITAPropagationModels/FilterGenerator.h
deleted
100644 → 0
View file @
31f3d4d4
/*
* ----------------------------------------------------------------
*
* ITA geometrical acoustics
* (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2018
*
* ----------------------------------------------------------------
* ____ __________ _______
* // / //__ ___/ // _ |
* // / // / // /_| |
* // / // / // ___ |
* //__/ //__/ //__/ |__|
*
* ----------------------------------------------------------------
*
*/
#ifndef INCLUDE_WATCHER_ITA_PROPAGATION_MODELS_FILTER_GENERATOR
#define INCLUDE_WATCHER_ITA_PROPAGATION_MODELS_FILTER_GENERATOR
#include "Base.h"
#include "Definitions.h"
#include "DiffractionFilter.h"
// ITA includes
#include <ITAGeo/Base.h>
#include <ITAHDFTSpectra.h>
#include <ITAHDFTSpectrum.h>
// STL includes
#include <vector>
namespace
ITAPropagationModels
{
//! Transfer function filter generator for propagation paths
/**
* Generates transfer functions in the frequency-domain that
* can be used as filters, e.g. for auralization.
*/
class
ITA_PROPAGATION_MODELS_API
CTFGenerator
{
public:
//! Construct a generator with predetermined output channels, e.g. for binaural or SH filters
/**
* @param[in] iNumOutputChannels Number of output channels
* @param[in] iDFTSize Length of the DFT used to construct and combine filter components
* @param[in] fSamplingRate Filer sampling rate
*/
CTFGenerator
(
const
int
iNumOutputChannels
,
const
int
iDFTSize
=
128
,
const
float
fSamplingRate
=
44100.0
f
);
//! Cunstruct a generator with matching properties of a target spectrum
inline
CTFGenerator
(
const
ITABase
::
CHDFTSpectrum
&
pTransferFunction
)
:
CTFGenerator
(
1
,
pTransferFunction
.
GetDFTSize
(),
pTransferFunction
.
GetSampleRate
()
)
{
};
//! Cunstruct a generator with matching properties of multi-channel target spectra
CTFGenerator
(
const
ITABase
::
CHDFTSpectra
&
pTransferFunctions
)
:
CTFGenerator
(
pTransferFunctions
.
GetNumChannels
(),
pTransferFunctions
.
GetDFTSize
(),
pTransferFunctions
.
GetSampleRate
()
)
{
};
//! Generate a single-channel transfer function
inline
void
GenerateTF
(
ITABase
::
CHDFTSpectrum
&
pTransferFunction
)
{
const
std
::
vector
<
ITABase
::
CHDFTSpectrum
*
>
vpSpectra
=
{
&
(
pTransferFunction
)
};
ITABase
::
CHDFTSpectra
oTF
(
vpSpectra
);
GenerateTF
(
oTF
);
};
//! Generate a multi-channel transfer function
inline
void
GenerateTF
(
ITABase
::
CHDFTSpectra
&
pTransferFunctions
);
private:
};
}
#endif // INCLUDE_WATCHER_ITA_PROPAGATION_MODELS_FILTER_GENERATOR
src/ITAPropagationModels/FilterEngine.cpp
View file @
740fea37
This diff is collapsed.
Click to expand it.
src/ITAPropagationModels/FilterGenerator.cpp
deleted
100644 → 0
View file @
31f3d4d4
#include <ITAPropagationModels/FilterGenerator.h>
// ITA includes
#include <ITAException.h>
#include <ITAGeo/Halfedge/MeshModel.h>
// Vista includes
#include <VistaMath/VistaGeometries.h>
// STL includes
#include <assert.h>
#include <stdio.h>
using
namespace
ITAGeo
;
using
namespace
ITAPropagationModels
;
ITAPropagationModels
::
CTFGenerator
::
CTFGenerator
(
const
int
iNumOutputChannels
,
const
int
iDFTSize
/*= 128 */
,
const
float
fSamplingRate
)
{
}
void
ITAPropagationModels
::
CTFGenerator
::
GenerateTF
(
ITABase
::
CHDFTSpectra
&
pTransferFunctions
)
{
}
tests/FilterEngine/FilterEngineTest.cpp
View file @
740fea37
...
...
@@ -18,7 +18,10 @@
#include <ITAPropagationModels/FilterEngine.h>
#include <ITAGeo/Base.h>
#include <ITAGeo/Material/Manager.h>
#include <ITAFFTUtils.h>
#include <ITAISO9613.h>
...
...
@@ -28,80 +31,66 @@ using namespace ITAConstants;
using
namespace
ITAGeo
;
using
namespace
ITAPropagationModels
;
int
main
(
int
,
char
**
)
int
main
(
int
,
char
**
)
{
/*
|___x___|
/\
s \ r
\ /
___x___
|______|
// _______
// |___x___|
// / \
// s r
// \ /
// x______
// |______|
*/
auto
pSender
=
make_shared
<
CEmitter
>
(
VistaVector3D
(
-
2.0
f
,
0.0
f
,
0.0
f
)
);
auto
pReceiver
=
make_shared
<
CSensor
>
(
VistaVector3D
(
2.0
f
,
0.0
f
,
0.0
f
)
);
auto
pSender
=
make_shared
<
CEmitter
>
(
VistaVector3D
(
-
2.0
f
,
0.0
f
,
0.0
f
)
);
auto
pReceiver
=
make_shared
<
CSensor
>
(
VistaVector3D
(
2.0
f
,
0.0
f
,
0.0
f
)
);
auto
pReflection
=
make_shared
<
CSpecularReflection
>
(
VistaVector3D
(
0.0
f
,
2.0
f
,
0.0
f
));
auto
pDiffraction
=
make_shared
<
CITADiffractionOuterWedgeAperture
>
();
pDiffraction
->
v3AperturePoint
=
VistaVector3D
(
0.0
f
,
-
2.0
f
,
0.0
f
);
pDiffraction
->
v3VertextStart
=
VistaVector3D
(
0.0
f
,
-
2.0
f
,
1.0
f
);
pDiffraction
->
v3VertextEnd
=
VistaVector3D
(
0.0
f
,
-
2.0
f
,
-
1.0
f
);
pDiffraction
->
v3MainWedgeFaceNormal
=
VistaVector3D
(
-
1.0
f
,
0.0
f
,
0.0
f
);
pDiffraction
->
v3OppositeWedgeFaceNormal
=
VistaVector3D
(
0.0
f
,
1.0
f
,
0.0
f
);
CMaterialDirectory
oMaterialDirectory
(
"./"
);
auto
pReflection
=
make_shared
<
CSpecularReflection
>
(
VistaVector3D
(
0.0
f
,
2.0
f
,
0.0
f
)
);
pReflection
->
pAcousticMaterial
=
oMaterialDirectory
.
GetMaterial
(
"stonewall"
);
auto
pW
=
std
::
make_shared
<
CITADiffractionOuterWedgeAperture
>
();
pW
->
v3AperturePoint
.
SetValues
(
0.0
f
,
1.0
f
,
0.0
f
);
pW
->
v3MainWedgeFaceNormal
.
SetValues
(
-
1.0
f
,
1.0
f
,
.0
f
);
pW
->
v3AperturePoint
.
SetValues
(
0.0
f
,
1.0
f
,
0.0
f
);
pW
->
v3MainWedgeFaceNormal
.
SetValues
(
-
1.0
f
,
1.0
f
,
.0
f
);
pW
->
v3MainWedgeFaceNormal
.
Normalize
();
pW
->
v3OppositeWedgeFaceNormal
.
SetValues
(
1.0
f
,
1.0
f
,
.0
f
);
pW
->
v3OppositeWedgeFaceNormal
.
SetValues
(
1.0
f
,
1.0
f
,
.0
f
);
pW
->
v3OppositeWedgeFaceNormal
.
Normalize
();
pW
->
v3VertextStart
.
SetValues
(
.0
f
,
1.0
f
,
-
1.0
f
);
pW
->
v3VertextEnd
.
SetValues
(
.0
f
,
1.0
f
,
1.0
f
);
pW
->
v3VertextStart
.
SetValues
(
.0
f
,
1.0
f
,
-
1.0
f
);
pW
->
v3VertextEnd
.
SetValues
(
.0
f
,
1.0
f
,
1.0
f
);
CPropagationPath
oPathDirect
;
oPathDirect
.
push_back
(
pSender
);
oPathDirect
.
push_back
(
pReceiver
);
oPathDirect
.
push_back
(
pSender
);
oPathDirect
.
push_back
(
pReceiver
);
CPropagationPath
oPathReflection
;
oPathReflection
.
push_back
(
pSender
);
oPathReflection
.
push_back
(
pReflection
);
oPathReflection
.
push_back
(
pReceiver
);
oPathReflection
.
push_back
(
pSender
);
oPathReflection
.
push_back
(
pReflection
);
oPathReflection
.
push_back
(
pReceiver
);
CPropagationPath
oPathDiffraction
;
oPathDiffraction
.
push_back
(
pSender
);
oPathDiffraction
.
push_back
(
pW
);
oPathDiffraction
.
push_back
(
pReceiver
);
oPathDiffraction
.
push_back
(
pSender
);
oPathDiffraction
.
push_back
(
pW
);
oPathDiffraction
.
push_back
(
pReceiver
);
CPropagationPathList
oPathList
;
/*
oPathList.push_back(oPathDirect);
oPathList
.
push_back
(
oPathDirect
);
oPathList
.
push_back
(
oPathReflection
);
oPathList
.
push_back
(
oPathDiffraction
);
*/
oPathList
.
Load
(
"PropagationPathListExample.json"
);
CFilterEngine
oFilter
;
oFilter
.
ApplyAcousticModels
(
oPathList
);
CFilterEngine
oFilterEngine
;
oFilterEngine
.
SetMaterialManager
(
&
oMaterialDirectory
);
oFilterEngine
.
ApplyAcousticModels
(
oPathList
);
//Set filter length according to the maximum path length
const
float
fSpeedOfSound
=
ITAConstants
::
SPEED_OF_SOUND_F
;
//Approximation of speed of sound at ~20C
// Set filter length according to the maximum path length
const
float
fSpeedOfSound
=
SPEED_OF_SOUND_F
;
//Approximation of speed of sound at ~20C
const
float
fSampleRate
=
44.1e3
f
;
int
iFilterLengthSamples
=
(
int
)
(
oPathList
.
GetMaxLength
()
/
fSpeedOfSound
*
fSampleRate
);
iFilterLengthSamples
=
int
(
iFilterLengthSamples
*
1.5
f
);
int
iFilterLength
=
(
int
)(
oPathList
.
GetMaxLength
()
/
fSpeedOfSound
*
fSampleRate
);
iFilterLength
=
(
int
)
iFilterLength
*
1.5
;
ITABase
::
CHDFTSpectra
oSpectra
(
fSampleRate
,
pReceiver
->
iNumChannels
,
iFilterLength
);
oFilter
.
Generate
(
oPathList
,
oSpectra
);
ITABase
::
CHDFTSpectra
oTransmissionFilter
(
fSampleRate
,
pReceiver
->
iNumChannels
,
iFilterLengthSamples
);
oFilterEngine
.
Generate
(
oPathList
,
oTransmissionFilter
);
ITAFFTUtils
::
Export
(
oSpectra
[
0
]
,
"FilterEngine
_Example
.wav"
);
ITAFFTUtils
::
Export
(
&
oTransmissionFilter
,
"FilterEngine
Test
.wav"
);
// Exports in time domain as impulse response (IR)
}
tests/FilterEngine/stonewall.mat
0 → 100644
View file @
740fea37
[Material]
name= Steinwand
notes=
# 20 | 25 | 31.5 | 40 | 50 | 63 | 80 | 100 | 125 | 160 | 200 | 250 | 315 | 400 | 500 | 630 | 800 | 1000 | 1250 | 1600 | 2000 | 2500 | 3150 | 4000 | 5000 | 6300 | 8000 | 10000 | 12500 | 16000 | 20000
absorp= 0.02,0.02,0.02,0.0233333,0.0266667,0.03,0.03,0.03,0.03,0.03,0.03,0.03,0.03,0.03,0.03,0.0333333,0.0366667,0.04,0.0433333,0.0466667,0.05,0.0566667,0.0633333,0.07,0.07,0.07,0.07,0.0733333,0.0766667,0.08,0.08
scatter= 0.15,0.15,0.15,0.15,0.15,0.15,0.15,0.15,0.15,0.183333,0.216667,0.25,0.283333,0.316667,0.35,0.333333,0.316667,0.3,0.3,0.3,0.3,0.333333,0.366667,0.4,0.4,0.4,0.4,0.433333,0.466667,0.5,0.5
interpol= 1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment