Subject: [bug#58208] [PATCH 7/7] gnu: Add nnls-chroma.

From: Lilah Tascheter <[email-masked]>
Date: Fri, 30 Sep 2022 19:22:40 -0500

* gnu/packages/audio.scm (nnls-chroma): New variable.
---
 gnu/packages/audio.scm | 43 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/gnu/packages/audio.scm b/gnu/packages/audio.scm
index 198e3cb7e8..c9a7829236 100644
--- a/gnu/packages/audio.scm
+++ b/gnu/packages/audio.scm
@@ -5942,6 +5942,49 @@ (define-public vamp-aubio-plugins
     (home-page "https://aubio.org/vamp-aubio-plugins/")
     (license license:gpl3+)))
 
+(define-public nnls-chroma
+  (package
+    (name "nnls-chroma")
+    (version "1.1")
+    (source (origin
+              (method url-fetch)
+              ;; These urls have an "attachment number" :/ which makes this url
+              ;; not generalizable across versions.
+              (uri (string-append
+                     "https://code.soundsoftware.ac.uk/attachments/download/"
+                     "1691/nnls-chroma-1.1.tar.gz"))
+              (sha256
+                (base32
+                  "06n66ff4w4a07rfz1kn0hq2g953dsx8a4cx1bhpvswqds1kb70md"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:tests? #f ;; no tests available
+       #:make-flags
+       (list "-f" "Makefile.linux"
+             (string-append "CC=" ,(cc-for-target))
+             (string-append "VAMP_SDK_DIR=" (assoc-ref %build-inputs "vamp")
+                            "/include/vamp-sdk"))
+       #:phases
+       ,#~(modify-phases %standard-phases
+            (delete 'configure) ;; no configure phase
+            (replace 'install ;; no install phase
+              (lambda _
+                (let ((outdir (string-append #$output "/lib/vamp"))
+                      (outfile "nnls-chroma.so"))
+                  (mkdir-p outdir)
+                  (copy-file outfile (string-append outdir "/" outfile))))))))
+    (inputs (list boost vamp))
+    (native-search-paths
+      (list (search-path-specification
+              (variable "VAMP_PATH")
+              (files '("lib/vamp")))))
+    (synopsis "VAMP plugins for audio transcription")
+    (description "A set of three VAMP plugins used for audio transcription: NNLS
+Chroma, providing chromatic transcription, Chordino, providing chord
+transcription, and Tuning, which estimates local and global tuning.")
+    (home-page "http://www.isophonics.net/nnls-chroma/")
+    (license license:gpl2+)))
+
 (define-public sonic-visualiser
   (package
     (name "sonic-visualiser")
-- 
2.37.2