23 Commits

Author SHA1 Message Date
Mike Oliphant 94a48c2862 Create release.yml 2024-11-04 07:50:26 -08:00
Mike Oliphant 09166f198b Update CREDITS.md 2024-11-04 07:37:52 -08:00
Mike Oliphant ad593b4038 Bump version -> 0.1.5 2024-11-04 07:36:33 -08:00
Mike Oliphant 32f18a242a Handle model input gain adjustment 2024-11-04 07:35:34 -08:00
Mike Oliphant d48e4a4080 Update NeuralAudio (load non-LSTM RTNeural models, prewarm RTNeural models) 2024-11-04 07:20:56 -08:00
Mike Oliphant 5ed03b558c Update NeuralAudio 2024-11-03 15:47:52 -08:00
Mike Oliphant b9e6cf65ca Update NeuralAudio 2024-11-03 15:20:35 -08:00
Mike Oliphant a7d19ecfab Update NeuralAudio 2024-11-03 15:18:01 -08:00
Mike Oliphant be05479671 Update NeuralAudio - use RTNeural for NAM LSTM models. Support RTNeural keras/Aida-x LSTM models 2024-11-03 15:08:58 -08:00
Mike Oliphant 38456dae4a Fix linux build? 2024-10-31 13:51:09 -07:00
Mike Oliphant d2cc00186f fixed model loudness 2024-10-31 13:46:54 -07:00
Mike Oliphant ec34afb608 build shared library 2024-10-31 12:41:00 -07:00
Mike Oliphant 7326960e2a another try to get both linux and windows builds working 2024-10-31 10:54:04 -07:00
Mike Oliphant 000925228f try again 2024-10-31 10:47:22 -07:00
Mike Oliphant ecf21c6c62 Merge branch 'main' of https://github.com/mikeoliphant/neural-amp-modeler-lv2 2024-10-31 10:46:31 -07:00
Mike Oliphant 276dafd832 try to fixe linux build 2024-10-31 10:46:30 -07:00
Mike Oliphant 29b52ae3e9 Update CREDITS.md 2024-10-31 10:36:41 -07:00
Mike Oliphant b06904b56b Merge branch 'main' of https://github.com/mikeoliphant/neural-amp-modeler-lv2 2024-10-31 10:35:30 -07:00
Mike Oliphant 19d3abb12d Switch to NeuralAudio for model handling 2024-10-31 10:35:28 -07:00
Mike Oliphant 567719af61 Switch to NeuralAudio for model handling 2024-10-31 10:35:24 -07:00
Mike Oliphant eb5bd17f70 Update build.yml 2024-10-31 09:53:44 -07:00
Mike Oliphant 57f79945de Update build.yml 2024-10-31 09:52:49 -07:00
Mike Oliphant 4643e66e08 Removed dc blocker for now 2024-10-31 08:29:42 -07:00
14 changed files with 118 additions and 22956 deletions
+3 -3
View File
@@ -25,13 +25,13 @@ jobs:
cpack
- name: Upload binary
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v4
with:
name: neural_amp_modeler.lv2-linux-amd64
path: ${{github.workspace}}/build/neural_amp_modeler.lv2
# - name: Upload deb
# uses: actions/upload-artifact@v1
# uses: actions/upload-artifact@v4
# with:
# name: neural_amp_modeler.lv2-linux-deb-amd64
# path: ${{github.workspace}}/build/*.deb
@@ -51,7 +51,7 @@ jobs:
cmake --build . --config=release -j4
- name: Upload artifact
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v4
with:
name: neural_amp_modeler.lv2-win
path: ${{github.workspace}}/build/neural_amp_modeler.lv2
+57
View File
@@ -0,0 +1,57 @@
name: Release
on:
workflow_dispatch:
env:
BUILD_TYPE: Release
jobs:
create_release:
name: Create release
runs-on: ubuntu-latest
outputs:
upload_url: ${{steps.create_release.outputs.upload_url}}
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
draft: true
tag_name: ${{github.ref}}
release_name: Release ${{github.ref}}
build-windows:
name: Build Windows
needs: create_release
runs-on: windows-latest
steps:
- uses: actions/checkout@v3.3.0
with:
submodules: recursive
- name: Build Plugin
working-directory: ${{github.workspace}}/build
run: |
cmake.exe -G "Visual Studio 17 2022" -A x64 -T ClangCL ..
cmake --build . --config=release -j4
- name: Add LV2 Archive
run: Compress-Archive -Path ${{github.workspace}}\build\neural_amp_modeler.lv2 -Destination neural_amp_modeler.lv2.zip
- name: Upload Plugin Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ./neural_amp_modeler.lv2.zip
asset_name: neural_amp_modeler.lv2.zip
asset_content_type: application/zip
+3 -10
View File
@@ -1,13 +1,6 @@
[submodule "lv2"]
path = deps/lv2
url = https://github.com/lv2/lv2
[submodule "eigen"]
path = deps/eigen
url = https://gitlab.com/libeigen/eigen
[submodule "NeuralAmpModelerCore"]
path = deps/NeuralAmpModelerCore
url = https://github.com/mikeoliphant/NeuralAmpModelerCore
branch = devel
[submodule "deps/AudioDSPTools"]
path = deps/AudioDSPTools
url = https://github.com/sdatkinson/AudioDSPTools
[submodule "deps/NeuralAudio"]
path = deps/NeuralAudio
url = https://github.com/mikeoliphant/NeuralAudio
+1 -10
View File
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.10)
project(NeuralAmpModelerLv2 VERSION 0.1.4)
project(NeuralAmpModelerLv2 VERSION 0.1.5)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
@@ -20,15 +20,6 @@ endif()
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/json)
include_directories(SYSTEM deps/denormal)
add_definitions(-DNAM_SAMPLE_FLOAT)
add_definitions(-DDSP_SAMPLE_FLOAT)
add_subdirectory(src)
+3 -1
View File
@@ -1,9 +1,11 @@
This repository uses code from a number of sources:
https://github.com/sdatkinson/NeuralAmpModelerPlugin
https://github.com/sdatkinson/NeuralAmpModelerCore
https://gitlab.com/libeigen/eigen
https://github.com/jatinchowdhury18/RTNeural
https://github.com/lv2/lv2
In addition, the CMake structure and LV2 plugin structure are based on code from https://github.com/Dougal-s/Aether.
Vendored Submodule
+1
Submodule deps/NeuralAudio added at 2f6f136dc3
Vendored
-1
Submodule deps/eigen deleted from f78c37f0af
-22875
View File
File diff suppressed because it is too large Load Diff
+6 -4
View File
@@ -16,7 +16,7 @@
<@NAM_LV2_ID@#model>
a lv2:Parameter;
mod:fileTypes "nam,nammodel";
mod:fileTypes "nam,nammodel,json";
rdfs:label "Neural Model";
rdfs:range atom:Path.
@@ -39,11 +39,13 @@
opts:supportedOption <http://lv2plug.in/ns/ext/buf-size#maxBlockLength>;
rdfs:comment """
LV2 plugin for Neural Amp Modeler machine learning guitar amplifier simulation models
LV2 plugin for neural network machine learning guitar amplifier simulation models
Based on the Neural Amp Modeler Core codebase: https://github.com/sdatkinson/NeuralAmpModelerCore
Models supported:
Neural Amp Modeler (NAM): https://github.com/sdatkinson/neural-amp-modeler
RTNeural keras/Aida-x models: https://github.com/jatinchowdhury18/RTNeural
A large collection of .nam models is available at https://tonehunt.org
A large collection of models is available at https://tonehunt.org
""";
patch:writable <@NAM_LV2_ID@#model>;
+11 -16
View File
@@ -1,26 +1,21 @@
add_subdirectory(../deps/NeuralAudio NeuralAudio)
include_directories(SYSTEM ../deps/NeuralAudio)
include_directories(SYSTEM ../deps/lv2/include)
include_directories(SYSTEM ../deps/denormal)
set(SOURCES nam_lv2.cpp
nam_plugin.cpp
nam_plugin.h)
set(NAM_SOURCES ../deps/NeuralAmpModelerCore/NAM/activations.h
../deps/NeuralAmpModelerCore/NAM/activations.cpp
../deps/NeuralAmpModelerCore/NAM/version.h
../deps/NeuralAmpModelerCore/NAM/lstm.h
../deps/NeuralAmpModelerCore/NAM/lstm.cpp
../deps/NeuralAmpModelerCore/NAM/dsp.h
../deps/NeuralAmpModelerCore/NAM/dsp.cpp
../deps/NeuralAmpModelerCore/NAM/get_dsp.cpp
../deps/NeuralAmpModelerCore/NAM/util.cpp
../deps/NeuralAmpModelerCore/NAM/util.h
../deps/NeuralAmpModelerCore/NAM/wavenet.cpp
../deps/NeuralAmpModelerCore/NAM/wavenet.h
../deps/NeuralAmpModelerCore/NAM/convnet.cpp
../deps/NeuralAmpModelerCore/NAM/convnet.h)
set(NA_SOURCES ../deps/NeuralAudio/NeuralAudio/NeuralModel.h)
add_library(neural_amp_modeler MODULE ${SOURCES} ${NAM_SOURCES})
add_library(neural_amp_modeler SHARED ${SOURCES} ${NA_SOURCES})
target_link_libraries(neural_amp_modeler PRIVATE NeuralAudio)
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${SOURCES})
source_group(NAM ${CMAKE_CURRENT_SOURCE_DIR} FILES ${NAM_SOURCES})
source_group(NAM ${CMAKE_CURRENT_SOURCE_DIR} FILES ${NA_SOURCES})
option(DISABLE_DENORMALS "Disable floating point denormals" ON)
-3
View File
@@ -95,9 +95,6 @@ static const LV2_Descriptor descriptor =
LV2_SYMBOL_EXPORT const LV2_Descriptor* lv2_descriptor(uint32_t index)
{
if (index == 0) {
// Turn on fast tanh approximation
nam::activations::Activation::enable_fast_tanh();
return &descriptor;
}
+29 -28
View File
@@ -4,7 +4,6 @@
#include <cassert>
#include "nam_plugin.h"
#include <NAM/activations.h>
#define SMOOTH_EPSILON .0001f
@@ -88,7 +87,7 @@ namespace NAM {
auto msg = static_cast<const LV2LoadModelMsg*>(data);
auto nam = static_cast<NAM::Plugin*>(instance);
nam::DSP* model = nullptr;
NeuralAudio::NeuralModel* model = nullptr;
LV2SwitchModelMsg response = { kWorkTypeSwitch, {}, {} };
LV2_Worker_Status result = LV2_WORKER_SUCCESS;
@@ -107,19 +106,19 @@ namespace NAM {
{
lv2_log_trace(&nam->logger, "Staging model change: `%s`\n", msg->path);
model = nam::get_dsp(msg->path).release();
model = NeuralAudio::NeuralModel::CreateFromFile(msg->path);
// 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));
//if (const int32_t numSamples = nam->maxBufferSize)
//{
// float* buffer = new float[numSamples];
// memset(buffer, 0, numSamples * sizeof(float));
model->process(buffer, buffer, numSamples);
model->finalize_(numSamples);
// model->Process(buffer, buffer, numSamples);
// //model->finalize_(numSamples);
delete[] buffer;
}
// delete[] buffer;
//}
}
response.model = model;
@@ -221,8 +220,15 @@ namespace NAM {
float level;
float modelInputAdjustmentDB = 0;
if (currentModel != nullptr)
{
modelInputAdjustmentDB = currentModel->GetRecommendedInputDBAdjustment();
}
// convert input level from db
float desiredInputLevel = powf(10, *(ports.input_level) * 0.05f);
float desiredInputLevel = powf(10, (*(ports.input_level) + modelInputAdjustmentDB) * 0.05f);
if (fabs(desiredInputLevel - inputLevel) > SMOOTH_EPSILON)
{
@@ -251,14 +257,9 @@ namespace NAM {
if (currentModel != nullptr)
{
currentModel->process(ports.audio_out, ports.audio_out, n_samples);
currentModel->finalize_(n_samples);
currentModel->Process(ports.audio_out, ports.audio_out, n_samples);
if (currentModel->HasLoudness())
{
// Normalize model to -18dB
modelLoudnessAdjustmentDB = -18 - currentModel->GetLoudness();
}
modelLoudnessAdjustmentDB = currentModel->GetRecommendedOutputDBAdjustment();
}
// Convert output level from db
@@ -288,18 +289,18 @@ namespace NAM {
}
}
float dcBlockCoefficient = 1 - (220.0 / sampleRate);
//float dcBlockCoefficient = 1 - (220.0 / sampleRate);
for (unsigned int i = 0; i < n_samples; i++)
{
float dcInput = ports.audio_out[i];
//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 + dcBlockCoefficient * prevDCOutput;
// // dc blocker
// ports.audio_out[i] = ports.audio_out[i] - prevDCInput + dcBlockCoefficient * prevDCOutput;
prevDCInput = dcInput;
prevDCOutput = ports.audio_out[i];
}
// prevDCInput = dcInput;
// prevDCOutput = ports.audio_out[i];
//}
}
uint32_t Plugin::options_get(LV2_Handle, LV2_Options_Option*)
+4 -4
View File
@@ -21,7 +21,7 @@
#include <lv2/state/state.h>
#include <lv2/units/units.h>
#include <NAM/dsp.h>
#include <NeuralAudio/NeuralModel.h>
#define PlUGIN_URI "http://github.com/mikeoliphant/neural-amp-modeler-lv2"
#define MODEL_URI PlUGIN_URI "#model"
@@ -43,12 +43,12 @@ namespace NAM {
struct LV2SwitchModelMsg {
LV2WorkType type;
char path[MAX_FILE_NAME];
nam::DSP* model;
NeuralAudio::NeuralModel* model;
};
struct LV2FreeModelMsg {
LV2WorkType type;
nam::DSP* model;
NeuralAudio::NeuralModel* model;
};
class Plugin {
@@ -70,7 +70,7 @@ namespace NAM {
LV2_Log_Logger logger = {};
LV2_Worker_Schedule* schedule = nullptr;
nam::DSP* currentModel = nullptr;
NeuralAudio::NeuralModel* currentModel = nullptr;
std::string currentModelPath;
float prevDCInput = 0;
float prevDCOutput = 0;