@@ -1794,6 +1794,7 @@ dist_patch_DATA = \
%D%/packages/patches/netsurf-system-utf8proc.patch \
%D%/packages/patches/netsurf-y2038-tests.patch \
%D%/packages/patches/netsurf-longer-test-timeout.patch \
+ %D%/packages/patches/neural-amp-modeler-core-fix-eigen-methods.patch \
%D%/packages/patches/nhc98-c-update.patch \
%D%/packages/patches/nix-dont-build-html-doc.diff \
%D%/packages/patches/nfs4-acl-tools-0.3.7-fixpaths.patch \
@@ -7986,6 +7986,63 @@ (define-public le-biniou
visuals based on audio performances or existing tracks.")
(license license:gpl2+)))
+(define-public neural-amp-modeler-core
+ (package
+ (name "neural-amp-modeler-core")
+ (version "0.1.0")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/sdatkinson/NeuralAmpModelerCore")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "05gfva1qkcq7n7vhvksv1jj5ciag4dp9bbn22svy2xys85mxg0xv"))
+ (patches (search-patches
+ "neural-amp-modeler-core-fix-eigen-methods.patch"))
+ (modules '((guix build utils)))
+ (snippet #~(begin
+ (delete-file-recursively "Dependencies")
+ (substitute* (find-files "NAM" "\\.(h|cpp)$")
+ (("#include \"Eigen/")
+ "#include \"eigen3/Eigen/")
+ (("#include <Eigen/")
+ "#include <eigen3/Eigen/")
+ (("#include \"json.hpp\"")
+ "#include <nlohmann/json.hpp>"))
+ ;; Remove Clang flags
+ (substitute* "CMakeLists.txt"
+ (("-stdlib=libc\\+\\+")
+ "")
+ (("add_subdirectory\\(tools\\)")
+ "\
+file(GLOB_RECURSE NAM_SOURCES ./NAM/*.cpp ./NAM/*.c ./NAM/*.h)
+add_library(neural_amp_modeler SHARED ${NAM_SOURCES})"))))))
+ (build-system cmake-build-system)
+ (arguments
+ (list #:tests? #f ;no tests
+ #:phases #~(modify-phases %standard-phases
+ (replace 'install
+ (lambda _
+ (let ((inc (string-append #$output
+ "/include/NAM"))
+ (lib (string-append #$output "/lib")))
+ (for-each (lambda (file)
+ (install-file file lib))
+ (find-files "." "\\.so"))
+ (with-directory-excursion "../source/NAM"
+ (for-each (lambda (file)
+ (install-file file inc))
+ (find-files "." "\\.h")))))))))
+ (inputs (list eigen nlohmann-json))
+ (home-page "https://github.com/sdatkinson/NeuralAmpModelerCore")
+ (synopsis "DSP library for NeuralAmpModeler plugins")
+ (description
+ "This package provides the core DSP library for @acronym{NAM, Neural Amp
+Modeler} plugins.")
+ (license license:expat)))
+
;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above by existing packages with similar
new file mode 100644
@@ -0,0 +1,15 @@
+Author: Antero Mejr <mail@antr.me>
+
+diff --git a/NAM/lstm.h b/NAM/lstm.h
+index 6b02b18..8da207f 100644
+--- a/NAM/lstm.h
++++ b/NAM/lstm.h
+@@ -23,7 +23,7 @@ class LSTMCell
+ {
+ public:
+ LSTMCell(const int input_size, const int hidden_size, std::vector<float>::iterator& weights);
+- Eigen::VectorXf get_hidden_state() const { return this->_xh(Eigen::placeholders::lastN(this->_get_hidden_size())); };
++ Eigen::VectorXf get_hidden_state() const { return this->_xh.tail(this->_get_hidden_size()); };
+ void process_(const Eigen::VectorXf& x);
+
+ private: