mirror of
https://github.com/mikeoliphant/neural-amp-modeler-lv2.git
synced 2026-05-07 04:00:09 +02:00
Remove AudioDSPTools dependency. Do simple DC blocker instead of HPF.
This commit is contained in:
+1
-7
@@ -17,16 +17,10 @@ set(NAM_SOURCES ../deps/NeuralAmpModelerCore/NAM/activations.h
|
||||
../deps/NeuralAmpModelerCore/NAM/convnet.cpp
|
||||
../deps/NeuralAmpModelerCore/NAM/convnet.h)
|
||||
|
||||
set(DSP_SOURCES ../deps/AudioDSPTools/dsp/dsp.h
|
||||
../deps/AudioDSPTools/dsp/dsp.cpp
|
||||
../deps/AudioDSPTools/dsp/RecursiveLinearFilter.h
|
||||
../deps/AudioDSPTools/dsp/RecursiveLinearFilter.cpp)
|
||||
|
||||
add_library(neural_amp_modeler MODULE ${SOURCES} ${NAM_SOURCES} ${DSP_SOURCES})
|
||||
add_library(neural_amp_modeler MODULE ${SOURCES} ${NAM_SOURCES})
|
||||
|
||||
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${SOURCES})
|
||||
source_group(NAM ${CMAKE_CURRENT_SOURCE_DIR} FILES ${NAM_SOURCES})
|
||||
source_group(dsp ${CMAKE_CURRENT_SOURCE_DIR} FILES ${DSP_SOURCES})
|
||||
|
||||
option(DISABLE_DENORMALS "Disable floating point denormals" ON)
|
||||
|
||||
|
||||
+13
-11
@@ -24,10 +24,6 @@ namespace NAM {
|
||||
{
|
||||
this->sampleRate = sampleRate;
|
||||
|
||||
const double highPassCutoffFreq = 5.0;
|
||||
const recursive_linear_filter::HighPassParams highPassParams(sampleRate, highPassCutoffFreq);
|
||||
mHighPass.SetParams(highPassParams);
|
||||
|
||||
// for fetching initial options, can be null
|
||||
LV2_Options_Option* options = nullptr;
|
||||
|
||||
@@ -251,8 +247,6 @@ namespace NAM {
|
||||
}
|
||||
}
|
||||
|
||||
float** outputPtrs = &ports.audio_out;
|
||||
|
||||
float modelLoudnessAdjustmentDB = 0;
|
||||
|
||||
if (currentModel != nullptr)
|
||||
@@ -260,9 +254,6 @@ namespace NAM {
|
||||
currentModel->process(ports.audio_out, ports.audio_out, n_samples);
|
||||
currentModel->finalize_(n_samples);
|
||||
|
||||
// Apply a high pass filter at 5Hz to eliminate any DC offset
|
||||
outputPtrs = mHighPass.Process(outputPtrs, 1, n_samples);
|
||||
|
||||
if (currentModel->HasLoudness())
|
||||
{
|
||||
// Normalize model to -18dB
|
||||
@@ -282,7 +273,7 @@ namespace NAM {
|
||||
// do very basic smoothing
|
||||
level = (.99f * level) + (.01f * desiredOutputLevel);
|
||||
|
||||
ports.audio_out[i] = outputPtrs[0][i] * outputLevel;
|
||||
ports.audio_out[i] = ports.audio_out[i] * outputLevel;
|
||||
}
|
||||
|
||||
outputLevel = level;
|
||||
@@ -293,9 +284,20 @@ namespace NAM {
|
||||
|
||||
for (unsigned int i = 0; i < n_samples; i++)
|
||||
{
|
||||
ports.audio_out[i] = outputPtrs[0][i] * level;
|
||||
ports.audio_out[i] = ports.audio_out[i] * level;
|
||||
}
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < n_samples; i++)
|
||||
{
|
||||
float dcInput = ports.audio_out[i];
|
||||
|
||||
// dc blocker
|
||||
ports.audio_out[i] = ports.audio_out[i] - prevDCInput + 0.995 * prevDCOutput;
|
||||
|
||||
prevDCInput = dcInput;
|
||||
prevDCOutput = ports.audio_out[i];
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t Plugin::options_get(LV2_Handle, LV2_Options_Option*)
|
||||
|
||||
+2
-2
@@ -22,7 +22,6 @@
|
||||
#include <lv2/units/units.h>
|
||||
|
||||
#include <NAM/dsp.h>
|
||||
#include <dsp/RecursiveLinearFilter.h>
|
||||
|
||||
#define PlUGIN_URI "http://github.com/mikeoliphant/neural-amp-modeler-lv2"
|
||||
#define MODEL_URI PlUGIN_URI "#model"
|
||||
@@ -73,7 +72,8 @@ namespace NAM {
|
||||
|
||||
::DSP* currentModel = nullptr;
|
||||
std::string currentModelPath;
|
||||
recursive_linear_filter::HighPass mHighPass;
|
||||
float prevDCInput = 0;
|
||||
float prevDCOutput = 0;
|
||||
|
||||
Plugin();
|
||||
~Plugin();
|
||||
|
||||
Reference in New Issue
Block a user