Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ITADSP
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Institute of Technical Acoustics (ITA)
ITADSP
Commits
a04aa5a6
Commit
a04aa5a6
authored
5 years ago
by
Dipl.-Ing. Jonas Stienen
Browse files
Options
Downloads
Patches
Plain Diff
wip
parent
58e98c4c
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
tests/dspfilters/NativeDspFiltersTest.cpp
+8
-2
8 additions, 2 deletions
tests/dspfilters/NativeDspFiltersTest.cpp
tests/pd/ITADSP_pd_jet_engine.cpp
+22
-11
22 additions, 11 deletions
tests/pd/ITADSP_pd_jet_engine.cpp
tests/pd/ITADSP_pd_jet_engine.m
+1
-1
1 addition, 1 deletion
tests/pd/ITADSP_pd_jet_engine.m
with
31 additions
and
14 deletions
tests/dspfilters/NativeDspFiltersTest.cpp
+
8
−
2
View file @
a04aa5a6
...
...
@@ -20,14 +20,15 @@
#include
<DspFilters/Butterworth.h>
#include
<ITAAudioSample.h>
#include
<ITAConstants.h>
#include
<ITAFiniteImpulseResponse.h>
#include
<ITAStopWatch.h>
#include
<cassert>
#include
<iostream>
#include
<cmath>
#include
<vector>
#include
"ITAAudioSample.h"
#include
"VistaTools/VistaRandomNumberGenerator.h"
using
namespace
std
;
...
...
@@ -208,7 +209,8 @@ void live_coeff_change_test()
oBPFStatic
.
setup
(
iOrder
,
fSampleRate
,
fMidCenterFrequency
,
fMidCenterFrequency
/
fQ
);
CITAAudioSample
sbCoeffChangeTest
(
3
,
int
(
fSampleRate
*
10
),
fSampleRate
);
ITAStopWatch
sw
;
for
(
int
n
=
0
;
n
<
sbCoeffChangeTest
.
GetLength
();
n
++
)
{
float
fRandomSample
=
VistaRandomNumberGenerator
::
GetStandardRNG
()
->
GenerateFloat
(
-
1.0
f
,
1.0
f
);
...
...
@@ -218,7 +220,9 @@ void live_coeff_change_test()
float
fModulatedCenterFrequency
=
fMidCenterFrequency
+
600.0
f
*
sin
(
ITAConstants
::
TWO_PI_F
*
n
/
float
(
sbCoeffChangeTest
.
GetLength
()
)
*
10
);
sbCoeffChangeTest
[
2
][
n
]
=
(
fModulatedCenterFrequency
-
fMidCenterFrequency
)
/
2.0
f
/
fMidCenterFrequency
;
sw
.
start
();
oBPFDynamic
.
setup
(
iOrder
,
fSampleRate
,
fModulatedCenterFrequency
,
fModulatedCenterFrequency
/
fQ
);
sw
.
stop
();
// takes about 30us on Intel i7 3GHZ from 2015 in debug mode .. not entirely irrelevant :/
float
*
pfSampleAliasDynamic
=
&
sbCoeffChangeTest
[
0
][
n
];
oBPFDynamic
.
process
(
1
,
&
pfSampleAliasDynamic
);
...
...
@@ -227,5 +231,7 @@ void live_coeff_change_test()
oBPFStatic
.
process
(
1
,
&
pfSampleAliasStatic
);
}
cout
<<
"SimpleFilter setup routine stats: "
<<
sw
<<
endl
;
sbCoeffChangeTest
.
Store
(
"NativeDspFiltersTest_LiveCoeffChangeTest.wav"
);
}
This diff is collapsed.
Click to expand it.
tests/pd/ITADSP_pd_jet_engine.cpp
+
22
−
11
View file @
a04aa5a6
...
...
@@ -31,7 +31,7 @@ namespace ITADSP
class
CJetEngine
{
public:
inline
CJetEngine
(
float
RPMInit
=
500.0
f
)
inline
CJetEngine
(
float
RPMInit
=
500.0
f
)
{
m_vfTurbineModeFrequencies
=
{
3097.0
f
,
4495.0
f
,
5588.0
f
,
7414.0
f
,
11000.0
f
};
m_vfTurbineModeAmplitudes
=
{
0.25
f
,
0.25
f
,
1.0
f
,
0.4
f
,
0.4
f
};
...
...
@@ -55,7 +55,7 @@ namespace ITADSP
inline
virtual
~
CJetEngine
()
{};
virtual
void
SetRPM
(
float
f
InletValue
);
virtual
void
SetRPM
(
float
f
NewRPM
);
virtual
void
Process
(
float
*
pfOutputBuffer
,
int
iNumSamples
);
protected
:
...
...
@@ -79,11 +79,22 @@ int main( int, char** )
{
ITASampleBuffer
oOutputBuffer
(
g_iOutputLengthSamples
);
float
fRPM
=
1100.
f
;
ITADSP
::
PD
::
CJetEngine
oPatch
(
fRPM
);
oPatch
.
Process
(
oOutputBuffer
.
GetData
(),
g_iOutputLengthSamples
);
string
sFilePath
=
"ITADSP_pd_jet_engine_out_rpm1100.wav"
;
vector
<
float
>
vfRPMs
=
{
700.
f
,
800.0
f
,
600.0
f
,
1100.0
f
,
2500.0
f
,
4000.0
f
,
4200.0
f
,
4000.0
f
,
3000.0
f
,
2800.0
f
};
ITADSP
::
PD
::
CJetEngine
oPatch
(
vfRPMs
[
0
]
);
int
iTimeSeriesLeg
=
g_iOutputLengthSamples
/
(
int
)
vfRPMs
.
size
();
int
iTotalSamples
=
0
;
for
(
auto
m
=
0
;
m
<
vfRPMs
.
size
();
m
++
)
{
oPatch
.
SetRPM
(
vfRPMs
[
m
]
);
int
iProcessSamples
=
std
::
min
(
iTimeSeriesLeg
,
oOutputBuffer
.
GetLength
()
-
m
*
iTimeSeriesLeg
);
oPatch
.
Process
(
oOutputBuffer
.
GetData
()
+
iTotalSamples
,
iProcessSamples
);
iTotalSamples
+=
iProcessSamples
;
}
assert
(
iTotalSamples
==
oOutputBuffer
.
GetLength
()
);
string
sFilePath
=
"ITADSP_pd_jet_engine_out.wav"
;
writeAudiofile
(
sFilePath
,
&
oOutputBuffer
,
g_dSampleRate
,
ITAQuantization
::
ITA_FLOAT
);
cout
<<
"Exported result to "
<<
sFilePath
<<
endl
;
...
...
@@ -119,7 +130,7 @@ void ITADSP::PD::CJetEngine::UpdateTurbine( float fRPM )
// Normalize input
const
float
fNormalizedTurbineControl
=
std
::
max
(
0.1
f
,
fValidRPM
/
m_vfRPMRange
[
1
]
);
for
(
auto
&
v
:
m_vfTurbineModeFrequencies
)
v
*=
fNormalizedTurbineControl
;
}
...
...
@@ -150,7 +161,7 @@ void ITADSP::PD::CJetEngine::Process( float* pfOutputBuffer, int iNumSamples )
fCurrentSample
=
m_fTempSample
;
// override buffer
// Turbine (adds to output buffer)
m_fTempSample
=
0.0
f
;
...
...
@@ -164,7 +175,7 @@ void ITADSP::PD::CJetEngine::Process( float* pfOutputBuffer, int iNumSamples )
const
int
iPeriodLengthSamples
=
(
int
)
round
(
g_dSampleRate
/
fFrequency
);
const
float
t
=
fmodf
(
ITAConstants
::
TWO_PI_F_L
/
float
(
iPeriodLengthSamples
)
*
float
(
n
),
ITAConstants
::
TWO_PI_F
);
m_fTempSample
+=
fAmplitude
*
sin
(
t
+
fPhaseShift
);
// all osc~ and *~
}
...
...
@@ -175,7 +186,7 @@ void ITADSP::PD::CJetEngine::Process( float* pfOutputBuffer, int iNumSamples )
m_fTempSample
*=
0.5
f
;
// *~ 0.5
const
float
fManualBalance
=
0.2
/
0.5
;
// Manual modifier [NOT INCLUDED IN PD PATCH]
const
float
fManualBalance
=
0.2
f
/
0.5
f
;
// Manual modifier [NOT INCLUDED IN PD PATCH]
fCurrentSample
+=
fManualBalance
*
m_fTempSample
;
// combine turbine and flame from jet engine patch (with a manual balance that sound better)
m_oJetEngineLP1
.
process
(
1
,
&
pfTempSampleAlias
);
// ~lop 11000
...
...
This diff is collapsed.
Click to expand it.
tests/pd/ITADSP_pd_jet_engine.m
+
1
−
1
View file @
a04aa5a6
jet_engine = ita_read( 'ITADSP_pd_jet_engine_out.wav' )
jet_engine.p
t
jet_engine.p
lot_spectrogram
jet_engine.play
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment