6 Commits

Author SHA1 Message Date
Mike Oliphant 34c7628202 Bump version to 0.1.3 2023-10-16 08:17:06 -07:00
Mike Oliphant 8384827981 Removed test value. 2023-10-15 18:12:27 -07:00
Mike Oliphant e3c5b6bd4f Update for normalization->loudness in NAM core. 2023-10-15 18:11:36 -07:00
Mike Oliphant eb46377d71 Update to latest NAM core. Handle model normalization with output gain. 2023-10-15 12:09:52 -07:00
Mike Oliphant b22f02c84e Update NAM core. Switch to new simplified NAM process method. 2023-10-06 11:51:30 -07:00
Mike Oliphant 52810a3f9c Switched to AudioDSPTools for highpass filter implementation 2023-10-02 08:12:33 -07:00
7 changed files with 26 additions and 17 deletions
+3
View File
@@ -8,3 +8,6 @@
path = deps/NeuralAmpModelerCore
url = https://github.com/mikeoliphant/NeuralAmpModelerCore
branch = devel
[submodule "deps/AudioDSPTools"]
path = deps/AudioDSPTools
url = https://github.com/sdatkinson/AudioDSPTools
+2 -2
View File
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.10)
project(NeuralAmpModelerLv2 VERSION 0.1.2)
project(NeuralAmpModelerLv2 VERSION 0.1.3)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
@@ -23,7 +23,7 @@ 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/NeuralAmpModelerCore)
include_directories(SYSTEM deps/AudioDSPTools)
include_directories(SYSTEM deps/json)
include_directories(SYSTEM deps/denormal)
Vendored Submodule
+1
Submodule deps/AudioDSPTools added at 37f73d9ea6
+4 -4
View File
@@ -17,10 +17,10 @@ set(NAM_SOURCES ../deps/NeuralAmpModelerCore/NAM/activations.h
../deps/NeuralAmpModelerCore/NAM/convnet.cpp
../deps/NeuralAmpModelerCore/NAM/convnet.h)
set(DSP_SOURCES ../deps/NeuralAmpModelerCore/dsp/dsp.h
../deps/NeuralAmpModelerCore/dsp/dsp.cpp
../deps/NeuralAmpModelerCore/dsp/RecursiveLinearFilter.h
../deps/NeuralAmpModelerCore/dsp/RecursiveLinearFilter.cpp)
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})
+15 -8
View File
@@ -113,17 +113,13 @@ namespace NAM {
model = get_dsp(msg->path).release();
// Enable model loudness normalization
model->SetNormalize(true);
// Pre-run model to ensure all needed buffers are allocated in advance
if (const int32_t numSamples = nam->maxBufferSize)
{
float* buffer = new float[numSamples];
memset(buffer, 0, numSamples * sizeof(float));
std::unordered_map<std::string, double> params = {};
model->process(&buffer, &buffer, 1, numSamples, 1.0, 1.0, params);
model->process(buffer, buffer, numSamples);
model->finalize_(numSamples);
delete[] buffer;
@@ -242,6 +238,7 @@ namespace NAM {
ports.audio_out[i] = ports.audio_in[i] * level;
}
inputLevel = level;
}
else
@@ -256,21 +253,30 @@ namespace NAM {
float** outputPtrs = &ports.audio_out;
float modelLoudnessAdjustmentDB = 0;
if (currentModel != nullptr)
{
currentModel->process(&ports.audio_out, &ports.audio_out, 1, n_samples, 1.0, 1.0, mNAMParams);
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
modelLoudnessAdjustmentDB = -18 - currentModel->GetLoudness();
}
}
// convert output level from db
float desiredOutputLevel = powf(10, *(ports.output_level) * 0.05f);
// Convert output level from db
float desiredOutputLevel = powf(10, (*(ports.output_level) + modelLoudnessAdjustmentDB) * 0.05f);
if (fabs(desiredOutputLevel - outputLevel) > SMOOTH_EPSILON)
{
level = outputLevel;
for (unsigned int i = 0; i < n_samples; i++)
{
// do very basic smoothing
@@ -278,6 +284,7 @@ namespace NAM {
ports.audio_out[i] = outputPtrs[0][i] * outputLevel;
}
outputLevel = level;
}
else
-2
View File
@@ -75,8 +75,6 @@ namespace NAM {
std::string currentModelPath;
recursive_linear_filter::HighPass mHighPass;
std::unordered_map<std::string, double> mNAMParams = {};
Plugin();
~Plugin();