diff --git a/CMakeLists.txt b/CMakeLists.txt index 0253fe0..5d56766 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,7 +23,6 @@ set(NAM_LV2_ID http://github.com/mikeoliphant/neural-amp-modeler-lv2) include_directories(SYSTEM deps/eigen) include_directories(SYSTEM deps/lv2/include) include_directories(SYSTEM deps/NeuralAmpModelerCore) -include_directories(SYSTEM deps/AudioDSPTools) include_directories(SYSTEM deps/json) include_directories(SYSTEM deps/denormal) diff --git a/deps/AudioDSPTools b/deps/AudioDSPTools deleted file mode 160000 index 37f73d9..0000000 --- a/deps/AudioDSPTools +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 37f73d9ea6698b1b56c5a54fbdfa453a84fbd0b9 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1dbc5ad..6ca6c97 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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) diff --git a/src/nam_plugin.cpp b/src/nam_plugin.cpp index 7248b1c..5f524f7 100644 --- a/src/nam_plugin.cpp +++ b/src/nam_plugin.cpp @@ -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*) diff --git a/src/nam_plugin.h b/src/nam_plugin.h index c22bd89..7bbefdf 100644 --- a/src/nam_plugin.h +++ b/src/nam_plugin.h @@ -22,7 +22,6 @@ #include #include -#include #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();