mirror of
https://github.com/mikeoliphant/neural-amp-modeler-lv2.git
synced 2026-06-12 23:32:12 +02:00
Compare commits
44 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 844766e614 | |||
| 437b8cc254 | |||
| 02ad319440 | |||
| 8ee50ccdbf | |||
| 4d4f613be9 | |||
| 01642fa580 | |||
| f774aad19d | |||
| cab4b549d7 | |||
| 4047eea241 | |||
| 1072326eb1 | |||
| fe172b94b5 | |||
| d15d078b23 | |||
| 2ae1cb7a05 | |||
| 6896f40711 | |||
| a19b9bab8b | |||
| 17dc4edff2 | |||
| a8ba46997b | |||
| aca77c2590 | |||
| d35db9c0c1 | |||
| fcbe0a24db | |||
| 1b98cb8891 | |||
| 8493866b21 | |||
| 2e103a104b | |||
| c7d55312c0 | |||
| 8ac44e3ee0 | |||
| b4dbac6042 | |||
| 5a5865a8a4 | |||
| 5880267d49 | |||
| 6cd11a9e57 | |||
| 513a537d43 | |||
| 1193da70ca | |||
| 2f81ad2b81 | |||
| eeaeeecf24 | |||
| 0fd82dc816 | |||
| d998b95e45 | |||
| 42d9d8b4c3 | |||
| b5b934d4e7 | |||
| c3bcac7085 | |||
| 94d86f5bc6 | |||
| 4b5f7d9051 | |||
| 91259b8eb6 | |||
| 4c8c341fdd | |||
| ccfa2e3882 | |||
| 2fdabf74ce |
@@ -20,7 +20,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
CXX: clang++
|
CXX: clang++
|
||||||
run: |
|
run: |
|
||||||
cmake .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DBUILD_UTILS=ON -DBUILD_NAMCORE=ON -DBUILD_STATIC_RTNEURAL=ON
|
cmake .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DBUILD_UTILS=ON -DBUILD_INTERNAL_STATIC_WAVENET=ON -DBUILD_INTERNAL_STATIC_LSTM=ON -DBUILD_NAMCORE=ON -DBUILD_STATIC_RTNEURAL=ON
|
||||||
cmake --build . --config $BUILD_TYPE -j4
|
cmake --build . --config $BUILD_TYPE -j4
|
||||||
cpack
|
cpack
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ jobs:
|
|||||||
- name: Build Plugin
|
- name: Build Plugin
|
||||||
working-directory: ${{github.workspace}}/build
|
working-directory: ${{github.workspace}}/build
|
||||||
run: |
|
run: |
|
||||||
cmake.exe -G "Visual Studio 17 2022" -A x64 -DBUILD_UTILS=ON -DBUILD_NAMCORE=ON -DBUILD_STATIC_RTNEURAL=ON -T ClangCL ..
|
cmake.exe -G "Visual Studio 17 2022" -A x64 -DBUILD_UTILS=ON -DBUILD_INTERNAL_STATIC_WAVENET=ON -DBUILD_INTERNAL_STATIC_LSTM=ON -DBUILD_NAMCORE=ON -DBUILD_STATIC_RTNEURAL=ON -T ClangCL ..
|
||||||
cmake --build . --config=release -j4
|
cmake --build . --config=release -j4
|
||||||
|
|
||||||
- name: Run ModelTest
|
- name: Run ModelTest
|
||||||
|
|||||||
@@ -31,7 +31,12 @@ jobs:
|
|||||||
build-linux-x64:
|
build-linux-x64:
|
||||||
name: Build Linux x64
|
name: Build Linux x64
|
||||||
needs: create_release
|
needs: create_release
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
native_arch: [ON, OFF]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
ARCHIVE_NAME: neural_amp_modeler_lv2_linux_x64${{ matrix.native_arch == 'ON' && 'v3' || '' }}.tgz
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3.3.0
|
- uses: actions/checkout@v3.3.0
|
||||||
with:
|
with:
|
||||||
@@ -42,12 +47,12 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
CXX: clang++
|
CXX: clang++
|
||||||
run: |
|
run: |
|
||||||
cmake .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DLSTM_PREFER_NAM=OFF -DWAVENET_PREFER_NAM=OFF
|
cmake .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DUSE_NATIVE_ARCH=${{ matrix.native_arch }} -DBUILD_NAMCORE=ON -DBUILD_INTERNAL_STATIC_WAVENET=ON -DBUILD_INTERNAL_STATIC_LSTM=ON
|
||||||
cmake --build . --config $BUILD_TYPE -j4
|
cmake --build . --config $BUILD_TYPE -j4
|
||||||
|
|
||||||
- name: Add LV2 Archive
|
- name: Add LV2 Archive
|
||||||
working-directory: ${{github.workspace}}/build
|
working-directory: ${{github.workspace}}/build
|
||||||
run: tar -czf neural_amp_modeler_lv2_linux_x64.tgz neural_amp_modeler.lv2
|
run: tar -czf ${{ env.ARCHIVE_NAME }} neural_amp_modeler.lv2
|
||||||
|
|
||||||
- name: Upload Plugin Asset
|
- name: Upload Plugin Asset
|
||||||
uses: actions/upload-release-asset@v1
|
uses: actions/upload-release-asset@v1
|
||||||
@@ -55,14 +60,21 @@ jobs:
|
|||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
with:
|
with:
|
||||||
upload_url: ${{ needs.create_release.outputs.upload_url }}
|
upload_url: ${{ needs.create_release.outputs.upload_url }}
|
||||||
asset_path: ./build/neural_amp_modeler_lv2_linux_x64.tgz
|
asset_path: ./build/${{ env.ARCHIVE_NAME }}
|
||||||
asset_name: neural_amp_modeler_lv2_linux_x64.tgz
|
asset_name: ${{ env.ARCHIVE_NAME }}
|
||||||
asset_content_type: application/tgz
|
asset_content_type: application/tgz
|
||||||
|
|
||||||
build-linux-x64v3:
|
build-rpi:
|
||||||
name: Build Linux x64v3
|
name: Build Raspberry Pi
|
||||||
needs: create_release
|
needs: create_release
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
native_arch: [rpi4, rpi5]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: ghcr.io/tttapa/docker-arm-cross-toolchain:aarch64-rpi3-linux-gnu-gcc12
|
||||||
|
env:
|
||||||
|
ARCHIVE_NAME: neural_amp_modeler_lv2_${{ matrix.native_arch }}.tgz
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3.3.0
|
- uses: actions/checkout@v3.3.0
|
||||||
with:
|
with:
|
||||||
@@ -70,15 +82,13 @@ jobs:
|
|||||||
|
|
||||||
- name: Build Plugin
|
- name: Build Plugin
|
||||||
working-directory: ${{github.workspace}}/build
|
working-directory: ${{github.workspace}}/build
|
||||||
env:
|
|
||||||
CXX: clang++
|
|
||||||
run: |
|
run: |
|
||||||
cmake .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DUSE_NATIVE_ARCH=ON -DLSTM_PREFER_NAM=OFF -DWAVENET_PREFER_NAM=OFF
|
cmake .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DBUILD_NAMCORE=ON -DBUILD_INTERNAL_STATIC_WAVENET=ON -DBUILD_INTERNAL_STATIC_LSTM=ON -DCMAKE_TOOLCHAIN_FILE=/home/develop/opt/x-tools/aarch64-rpi3-linux-gnu/aarch64-${{ matrix.native_arch }}-linux-gnu.toolchain.cmake
|
||||||
cmake --build . --config $BUILD_TYPE -j4
|
cmake --build . --config $BUILD_TYPE -j4
|
||||||
|
|
||||||
- name: Add LV2 Archive
|
- name: Add LV2 Archive
|
||||||
working-directory: ${{github.workspace}}/build
|
working-directory: ${{github.workspace}}/build
|
||||||
run: tar -czf neural_amp_modeler_lv2_linux_x64v3.tgz neural_amp_modeler.lv2
|
run: tar -czf ${{ env.ARCHIVE_NAME }} neural_amp_modeler.lv2
|
||||||
|
|
||||||
- name: Upload Plugin Asset
|
- name: Upload Plugin Asset
|
||||||
uses: actions/upload-release-asset@v1
|
uses: actions/upload-release-asset@v1
|
||||||
@@ -86,14 +96,19 @@ jobs:
|
|||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
with:
|
with:
|
||||||
upload_url: ${{ needs.create_release.outputs.upload_url }}
|
upload_url: ${{ needs.create_release.outputs.upload_url }}
|
||||||
asset_path: ./build/neural_amp_modeler_lv2_linux_x64v3.tgz
|
asset_path: ./build/${{ env.ARCHIVE_NAME }}
|
||||||
asset_name: neural_amp_modeler_lv2_linux_x64v3.tgz
|
asset_name: ${{ env.ARCHIVE_NAME }}
|
||||||
asset_content_type: application/tgz
|
asset_content_type: application/tgz
|
||||||
|
|
||||||
build-windows:
|
build-windows:
|
||||||
name: Build Windows
|
name: Build Windows
|
||||||
needs: create_release
|
needs: create_release
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
native_arch: [ON, OFF]
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
|
env:
|
||||||
|
ARCHIVE_NAME: neural_amp_modeler_lv2_win_x64${{ matrix.native_arch == 'ON' && 'v3' || '' }}.zip
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3.3.0
|
- uses: actions/checkout@v3.3.0
|
||||||
with:
|
with:
|
||||||
@@ -102,11 +117,11 @@ jobs:
|
|||||||
- name: Build Plugin
|
- name: Build Plugin
|
||||||
working-directory: ${{github.workspace}}/build
|
working-directory: ${{github.workspace}}/build
|
||||||
run: |
|
run: |
|
||||||
cmake.exe -G "Visual Studio 17 2022" -A x64 -T ClangCL -DLSTM_PREFER_NAM=OFF -DWAVENET_PREFER_NAM=OFF ..
|
cmake.exe -G "Visual Studio 17 2022" -A x64 -T ClangCL -DUSE_NATIVE_ARCH=${{ matrix.native_arch }} -DBUILD_NAMCORE=ON -DBUILD_INTERNAL_STATIC_WAVENET=ON -DBUILD_INTERNAL_STATIC_LSTM=ON ..
|
||||||
cmake --build . --config=release -j4
|
cmake --build . --config=release -j4
|
||||||
|
|
||||||
- name: Add LV2 Archive
|
- name: Add LV2 Archive
|
||||||
run: Compress-Archive -Path ${{github.workspace}}\build\neural_amp_modeler.lv2 -Destination neural_amp_modeler_lv2_win_x64.zip
|
run: Compress-Archive -Path ${{github.workspace}}\build\neural_amp_modeler.lv2 -Destination ${{ env.ARCHIVE_NAME }}
|
||||||
|
|
||||||
- name: Upload Plugin Asset
|
- name: Upload Plugin Asset
|
||||||
uses: actions/upload-release-asset@v1
|
uses: actions/upload-release-asset@v1
|
||||||
@@ -114,34 +129,6 @@ jobs:
|
|||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
with:
|
with:
|
||||||
upload_url: ${{ needs.create_release.outputs.upload_url }}
|
upload_url: ${{ needs.create_release.outputs.upload_url }}
|
||||||
asset_path: ./neural_amp_modeler_lv2_win_x64.zip
|
asset_path: ./${{ env.ARCHIVE_NAME }}
|
||||||
asset_name: neural_amp_modeler_lv2_win_x64.zip
|
asset_name: ${{ env.ARCHIVE_NAME }}
|
||||||
asset_content_type: application/zip
|
|
||||||
|
|
||||||
build-windows-x64v3:
|
|
||||||
name: Build Windows x64v3
|
|
||||||
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 -DUSE_NATIVE_ARCH=ON -DLSTM_PREFER_NAM=OFF -DWAVENET_PREFER_NAM=OFF -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_win_x64v3.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_win_x64v3.zip
|
|
||||||
asset_name: neural_amp_modeler_lv2_win_x64v3.zip
|
|
||||||
asset_content_type: application/zip
|
asset_content_type: application/zip
|
||||||
|
|||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
cmake_minimum_required(VERSION 3.10)
|
cmake_minimum_required(VERSION 3.10)
|
||||||
|
|
||||||
project(NeuralAmpModelerLv2 VERSION 0.1.9)
|
project(NeuralAmpModelerLv2 VERSION 0.2.0)
|
||||||
|
|
||||||
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
|
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
|
||||||
set(LIB_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/lib CACHE PATH "The library install dir (default: lib)")
|
set(LIB_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/lib CACHE PATH "The library install dir (default: lib)")
|
||||||
@@ -12,7 +12,7 @@ set(CMAKE_CXX_EXTENSIONS OFF)
|
|||||||
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||||
include_directories(SYSTEM /usr/local/include)
|
include_directories(SYSTEM /usr/local/include)
|
||||||
elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
link_libraries(stdc++fs)
|
link_libraries( "$<$<AND:$<CXX_COMPILER_ID:GNU>,$<VERSION_LESS:$<CXX_COMPILER_VERSION>,9.0>>:-lstdc++fs>" )
|
||||||
elseif (CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
elseif (CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||||
add_compile_definitions(NOMINMAX WIN32_LEAN_AND_MEAN)
|
add_compile_definitions(NOMINMAX WIN32_LEAN_AND_MEAN)
|
||||||
else()
|
else()
|
||||||
|
|||||||
@@ -1,27 +1,28 @@
|
|||||||
# neural-amp-modeler-lv2
|
# neural-amp-modeler-lv2
|
||||||
|
|
||||||
LV2 plugin for using neural network machine learning amp models.
|
LV2 plugin for neural network machine learning amp model playback using the [NeuralAudio](https://github.com/mikeoliphant/NeuralAudio) engine.
|
||||||
|
|
||||||
**There is no custom plugin user interface**. Setting the model to use requires that your LV2 host supports atom:Path parameters. Reaper does as of v6.82. Carla and Ardour do. If your favorite LV2 host does not support atom:Path, let them know you want it.
|
**There is no custom plugin user interface**. Setting the model to use requires that your LV2 host supports atom:Path parameters. Reaper does as of v6.82. Carla and Ardour do. If your favorite LV2 host does not support atom:Path, let them know you want it.
|
||||||
If you are looking for a GUI version, @brummer10 [has one here](https://github.com/brummer10/neural-amp-modeler-ui) that works for Linux and Windows. You may also be interested in the the version shipped with the [MOD Desktop App](https://github.com/moddevices/mod-desktop-app), or my digital pedalboard app [Stompbox](https://github.com/mikeoliphant/StompboxUI).
|
If you are looking for a GUI version, @brummer10 [has one here](https://github.com/brummer10/neural-amp-modeler-ui) that works for Linux and Windows. You may also be interested in the the version shipped with the [MOD Desktop App](https://github.com/moddevices/mod-desktop-app), or my digital pedalboard app [Stompbox](https://github.com/mikeoliphant/Stompbox).
|
||||||
|
|
||||||
To get the intended behavior, **you must run your audio host at the same sample rate the model was trained at** (usually 48kHz) - no resampling is done by the plugin.
|
To get the intended behavior, **you must run your audio host at the same sample rate the model was trained at** (usually 48kHz) - no resampling is done by the plugin.
|
||||||
|
|
||||||
For amp-only models (the most typical), **you will need to run an impulse reponse after this plugin** to model the cabinet.
|
For amp-only models (the most typical), **you will need to run an impulse reponse after this plugin** to model the cabinet.
|
||||||
|
|
||||||
## Models and Performance
|
## Models Supported
|
||||||
|
|
||||||
The plugin supports both [Neural Amp Modeler (NAM)](https://github.com/sdatkinson/neural-amp-modeler) models and [RTNeural keras json models](https://github.com/jatinchowdhury18/RTNeural) (like those used by [Aida-X](https://github.com/AidaDSP/AIDA-X)).
|
The plugin supports both [Neural Amp Modeler (NAM)](https://github.com/sdatkinson/neural-amp-modeler) models and [RTNeural keras json models](https://github.com/jatinchowdhury18/RTNeural) (like those used by [Aida-X](https://github.com/AidaDSP/AIDA-X)).
|
||||||
|
|
||||||
The best source of models is [ToneHunt](https://tonehunt.org/).
|
The best source of models is [Tone3000](https://www.tone3000.com/).
|
||||||
|
|
||||||
|
For more information on model type support, see the [NeuralAudio](https://github.com/mikeoliphant/NeuralAudio) repository, which is where the model handling code lives.
|
||||||
|
|
||||||
|
## Performance
|
||||||
|
|
||||||
NAM WaveNet models are generally quite expensive to run. This isn't (much of) an issue on modern PCs, but you may have trouble running on less powerful hardware.
|
NAM WaveNet models are generally quite expensive to run. This isn't (much of) an issue on modern PCs, but you may have trouble running on less powerful hardware.
|
||||||
|
|
||||||
A Raspberry Pi 4 running a 64bit OS can run "standard" NAM models with plenty of room to spare for a cabinet IR and some effects. It is also capable of running two "standard" NAM models, but with less headroom for other effects.
|
If you are having trouble running a "standard" model, try looking for "feather", or even "nano" (the least expensive) models. You can find a list of ["feather"-tagged models on Tone3000](https://www.tone3000.com/search?sizes=feather). Note that tagging models is up to the submitter, so not all "feather" models are tagged as such - you should be able to find more if you dig around.
|
||||||
|
|
||||||
If you are having trouble running a "standard" model, try looking for "feather", or even "nano" (the least expensive) models. You can find a list of ["feather"-tagged models on ToneHunt](https://tonehunt.org/models?tags%5B0%5D=feather-mdl). Note that tagging models is up to the submitter, so not all "feather" models are tagged as such - you should be able to find more if you dig around.
|
|
||||||
|
|
||||||
For more information on model type support, see the [NeuralAudio](https://github.com/mikeoliphant/NeuralAudio) repository, which is where the model handling code lives.
|
|
||||||
|
|
||||||
## Input Calibration
|
## Input Calibration
|
||||||
|
|
||||||
@@ -57,4 +58,6 @@ After building, the plugin will be in **build/neural_amp_modeler.lv2**.
|
|||||||
|
|
||||||
```-DUSE_NATIVE_ARCH=ON```: If you have a relatively modern x64 processor, you can pass ```-DUSE_NATIVE_ARCH=ON``` on your cmake command line to enable certain processor-specific optimizations.
|
```-DUSE_NATIVE_ARCH=ON```: If you have a relatively modern x64 processor, you can pass ```-DUSE_NATIVE_ARCH=ON``` on your cmake command line to enable certain processor-specific optimizations.
|
||||||
|
|
||||||
|
```-DSMART_BYPASS_ENABLED=ON```: If enabled, this will bypass model processing if input has been silent (below -100 dB by default) for a sufficient number of samples (determined by the model's receptive field size).
|
||||||
|
|
||||||
Also see the [NeuralAudio CMake options](https://github.com/mikeoliphant/NeuralAudio#cmake-options) - adding these to your neural-amp-modeler-lv2 cmake will pass them to the NeuralAudio build.
|
Also see the [NeuralAudio CMake options](https://github.com/mikeoliphant/NeuralAudio#cmake-options) - adding these to your neural-amp-modeler-lv2 cmake will pass them to the NeuralAudio build.
|
||||||
|
|||||||
Vendored
+1
-1
Submodule deps/NeuralAudio updated: 4c9d20ee1c...3ad5806370
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
These are some sample NAM models designed to be used for performance testing on CPU-limited devices. They are all based on a [LiveSpice model of a Boss SD-1 pedal](https://blog.nostatic.org/2023/04/this-boss-sd-1-pedal-does-not-exist.html).
|
These are some sample NAM models designed to be used for performance testing on CPU-limited devices. They are all based on a [LiveSpice model of a Boss SD-1 pedal](https://blog.nostatic.org/2023/04/this-boss-sd-1-pedal-does-not-exist.html). They are provided here under the [CC BY-NC-ND 4.0 license](https://creativecommons.org/licenses/by-nc-nd/4.0/deed.en).
|
||||||
|
|
||||||
All models were trained for 300 epochs using the NAM "v1_1_1.wav" capture signal.
|
All models were trained for 300 epochs using the NAM "v1_1_1.wav" capture signal.
|
||||||
|
|
||||||
|
|||||||
@@ -101,4 +101,12 @@ A large collection of models is available at https://tonehunt.org
|
|||||||
lv2:minimum -20.0;
|
lv2:minimum -20.0;
|
||||||
lv2:maximum 20.0;
|
lv2:maximum 20.0;
|
||||||
units:unit units:db;
|
units:unit units:db;
|
||||||
|
], [
|
||||||
|
a lv2:ControlPort, lv2:InputPort;
|
||||||
|
lv2:index 6;
|
||||||
|
lv2:symbol "quality_scale";
|
||||||
|
lv2:name "Quality";
|
||||||
|
lv2:default 1.0;
|
||||||
|
lv2:minimum 0.0;
|
||||||
|
lv2:maximum 1.0;
|
||||||
].
|
].
|
||||||
|
|||||||
@@ -54,6 +54,12 @@ if (DISABLE_DENORMALS)
|
|||||||
add_definitions(-DDISABLE_DENORMALS)
|
add_definitions(-DDISABLE_DENORMALS)
|
||||||
endif (DISABLE_DENORMALS)
|
endif (DISABLE_DENORMALS)
|
||||||
|
|
||||||
|
option(SMART_BYPASS_ENABLED "Enable auto-bypass on silence" OFF)
|
||||||
|
|
||||||
|
if (SMART_BYPASS_ENABLED)
|
||||||
|
add_definitions(-DSMART_BYPASS_ENABLED)
|
||||||
|
endif (SMART_BYPASS_ENABLED)
|
||||||
|
|
||||||
set_target_properties(neural_amp_modeler
|
set_target_properties(neural_amp_modeler
|
||||||
PROPERTIES
|
PROPERTIES
|
||||||
CXX_VISIBILITY_PRESET hidden
|
CXX_VISIBILITY_PRESET hidden
|
||||||
|
|||||||
+70
-2
@@ -7,12 +7,18 @@
|
|||||||
|
|
||||||
#define SMOOTH_EPSILON .0001f
|
#define SMOOTH_EPSILON .0001f
|
||||||
|
|
||||||
|
#ifndef BYPASS_DB_THRESHOLD
|
||||||
|
#define BYPASS_DB_THRESHOLD -100
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace NAM {
|
namespace NAM {
|
||||||
Plugin::Plugin()
|
Plugin::Plugin()
|
||||||
{
|
{
|
||||||
// prevent allocations on the audio thread
|
// prevent allocations on the audio thread
|
||||||
currentModelPath.reserve(MAX_FILE_NAME + 1);
|
currentModelPath.reserve(MAX_FILE_NAME + 1);
|
||||||
|
|
||||||
|
bypassThresholdLinear = powf(10, BYPASS_DB_THRESHOLD * 0.05f);
|
||||||
|
|
||||||
// NeuralAudio::NeuralModel::SetLSTMLoadMode(
|
// NeuralAudio::NeuralModel::SetLSTMLoadMode(
|
||||||
//#ifdef LSTM_PREFER_NAM
|
//#ifdef LSTM_PREFER_NAM
|
||||||
// NeuralAudio::PreferNAMCore
|
// NeuralAudio::PreferNAMCore
|
||||||
@@ -122,7 +128,7 @@ namespace NAM {
|
|||||||
{
|
{
|
||||||
lv2_log_trace(&nam->logger, "Staging model change: `%s`\n", msg->path);
|
lv2_log_trace(&nam->logger, "Staging model change: `%s`\n", msg->path);
|
||||||
|
|
||||||
model = NeuralAudio::NeuralModel::CreateFromFile(msg->path);
|
model = nam->loader.CreateFromFile(msg->path);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (model != nullptr)
|
if (model != nullptr)
|
||||||
@@ -181,6 +187,18 @@ namespace NAM {
|
|||||||
nam->currentModelPath = msg->path;
|
nam->currentModelPath = msg->path;
|
||||||
assert(nam->currentModelPath.capacity() >= MAX_FILE_NAME + 1);
|
assert(nam->currentModelPath.capacity() >= MAX_FILE_NAME + 1);
|
||||||
|
|
||||||
|
if (nam->currentModel != nullptr)
|
||||||
|
{
|
||||||
|
int receptiveFieldSize = nam->currentModel->GetReceptiveFieldSize();
|
||||||
|
|
||||||
|
if (receptiveFieldSize > -1)
|
||||||
|
{
|
||||||
|
// A newly loaded model is prewarmed to have a silent sample history
|
||||||
|
nam->silentSamples = receptiveFieldSize;
|
||||||
|
nam->smartBypassed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// send reply
|
// send reply
|
||||||
nam->schedule->schedule_work(nam->schedule->handle, sizeof(reply), &reply);
|
nam->schedule->schedule_work(nam->schedule->handle, sizeof(reply), &reply);
|
||||||
|
|
||||||
@@ -194,7 +212,7 @@ namespace NAM {
|
|||||||
{
|
{
|
||||||
maxBufferSize = size;
|
maxBufferSize = size;
|
||||||
|
|
||||||
NeuralAudio::NeuralModel::SetDefaultMaxAudioBufferSize(size);
|
loader.SetDefaultMaxAudioBufferSize(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Plugin::process(uint32_t n_samples) noexcept
|
void Plugin::process(uint32_t n_samples) noexcept
|
||||||
@@ -234,6 +252,18 @@ namespace NAM {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (*(ports.quality_scale) != qualityScale)
|
||||||
|
{
|
||||||
|
qualityScale = *(ports.quality_scale);
|
||||||
|
|
||||||
|
loader.SetDefaultQualityScaleFactor(qualityScale);
|
||||||
|
|
||||||
|
if (currentModel != nullptr)
|
||||||
|
{
|
||||||
|
currentModel->SetQualityScaleFactor(qualityScale);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
float level;
|
float level;
|
||||||
|
|
||||||
float modelInputAdjustmentDB = 0;
|
float modelInputAdjustmentDB = 0;
|
||||||
@@ -241,6 +271,44 @@ namespace NAM {
|
|||||||
if (currentModel != nullptr)
|
if (currentModel != nullptr)
|
||||||
{
|
{
|
||||||
modelInputAdjustmentDB = currentModel->GetRecommendedInputDBAdjustment();
|
modelInputAdjustmentDB = currentModel->GetRecommendedInputDBAdjustment();
|
||||||
|
|
||||||
|
#ifdef SMART_BYPASS_ENABLED
|
||||||
|
int receptiveFieldSamples = currentModel->GetReceptiveFieldSize();
|
||||||
|
|
||||||
|
if (receptiveFieldSamples > -1)
|
||||||
|
{
|
||||||
|
for (unsigned int i = 0; i < n_samples; i++)
|
||||||
|
{
|
||||||
|
if (abs(ports.audio_in[i]) <= bypassThresholdLinear)
|
||||||
|
{
|
||||||
|
silentSamples++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
silentSamples = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (silentSamples >= (uint32_t)receptiveFieldSamples)
|
||||||
|
{
|
||||||
|
silentSamples = (uint32_t)receptiveFieldSamples; // Prevent silentSamples growing and eventually overflowing uint32
|
||||||
|
|
||||||
|
if (smartBypassed)
|
||||||
|
{
|
||||||
|
for (unsigned int i = 0; i < n_samples; i++)
|
||||||
|
{
|
||||||
|
ports.audio_out[i] = ports.audio_in[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
smartBypassed = true; // If we aren't already, we'll be bypassed on the next process call
|
||||||
|
}
|
||||||
|
else
|
||||||
|
smartBypassed = false;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// convert input level from db
|
// convert input level from db
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ namespace NAM {
|
|||||||
float* audio_out;
|
float* audio_out;
|
||||||
float* input_level;
|
float* input_level;
|
||||||
float* output_level;
|
float* output_level;
|
||||||
|
float* quality_scale;
|
||||||
};
|
};
|
||||||
|
|
||||||
Ports ports = {};
|
Ports ports = {};
|
||||||
@@ -70,16 +71,19 @@ namespace NAM {
|
|||||||
LV2_Log_Logger logger = {};
|
LV2_Log_Logger logger = {};
|
||||||
LV2_Worker_Schedule* schedule = nullptr;
|
LV2_Worker_Schedule* schedule = nullptr;
|
||||||
|
|
||||||
|
NeuralAudio::NeuralModelLoader loader;
|
||||||
NeuralAudio::NeuralModel* currentModel = nullptr;
|
NeuralAudio::NeuralModel* currentModel = nullptr;
|
||||||
std::string currentModelPath;
|
std::string currentModelPath;
|
||||||
float prevDCInput = 0;
|
float prevDCInput = 0;
|
||||||
float prevDCOutput = 0;
|
float prevDCOutput = 0;
|
||||||
|
float qualityScale = 1.0f;
|
||||||
|
|
||||||
Plugin();
|
Plugin();
|
||||||
~Plugin();
|
~Plugin();
|
||||||
|
|
||||||
bool initialize(double rate, const LV2_Feature* const* features) noexcept;
|
bool initialize(double rate, const LV2_Feature* const* features) noexcept;
|
||||||
void set_max_buffer_size(int size) noexcept;
|
void set_max_buffer_size(int size) noexcept;
|
||||||
|
void activate() noexcept;
|
||||||
void process(uint32_t n_samples) noexcept;
|
void process(uint32_t n_samples) noexcept;
|
||||||
|
|
||||||
void write_current_path();
|
void write_current_path();
|
||||||
@@ -120,5 +124,8 @@ namespace NAM {
|
|||||||
float inputLevel = 0;
|
float inputLevel = 0;
|
||||||
float outputLevel = 0;
|
float outputLevel = 0;
|
||||||
int32_t maxBufferSize = 512;
|
int32_t maxBufferSize = 512;
|
||||||
|
float bypassThresholdLinear = 0;
|
||||||
|
uint32_t silentSamples = 0;
|
||||||
|
bool smartBypassed = true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user