(address . guix-patches@gnu.org)
* gnu/packages/music.scm (neural-amp-modeler-core): New variable.
Change-Id: Ia93c978dba936300e3d0493ee5764fc560a1cd3a
---
gnu/local.mk | 1 +
gnu/packages/music.scm | 57 +++++++++++++++++++
...l-amp-modeler-core-fix-eigen-methods.patch | 15 +++++
3 files changed, 73 insertions(+)
create mode 100644 gnu/packages/patches/neural-amp-modeler-core-fix-eigen-methods.patch
Toggle diff (103 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index cf42e2b6da..5adea82be4 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -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 \
diff --git a/gnu/packages/music.scm b/gnu/packages/music.scm
index bc2d7f62f1..e85d917222 100644
--- a/gnu/packages/music.scm
+++ b/gnu/packages/music.scm
@@ -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
diff --git a/gnu/packages/patches/neural-amp-modeler-core-fix-eigen-methods.patch b/gnu/packages/patches/neural-amp-modeler-core-fix-eigen-methods.patch
new file mode 100644
index 0000000000..bcac428a2a
--- /dev/null
+++ b/gnu/packages/patches/neural-amp-modeler-core-fix-eigen-methods.patch
@@ -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:
--
2.45.2