summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorjgart <jgart@dismail.de>2021-11-24 23:42:45 -0500
committerArun Isaac <arunisaac@systemreboot.net>2021-11-29 21:34:24 +0530
commit653bcab96d70d25e98753681d48657fe6634f8c5 (patch)
treeef579f1b999199dffa84f62a65c8ef2af1b9ccb3 /gnu
parent4883d7fe9ea68c2f4c2f9af01e350ec9c038b689 (diff)
downloadguix-653bcab96d70d25e98753681d48657fe6634f8c5.tar.gz
gnu: Add python-pysox.
* gnu/packages/audio.scm (python-pysox): New variable.

Signed-off-by: Arun Isaac <arunisaac@systemreboot.net>
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages/audio.scm55
1 files changed, 55 insertions, 0 deletions
diff --git a/gnu/packages/audio.scm b/gnu/packages/audio.scm
index 4b1a602804..e7bcf04ab3 100644
--- a/gnu/packages/audio.scm
+++ b/gnu/packages/audio.scm
@@ -34,6 +34,7 @@
 ;;; Copyright © 2020 Giacomo Leidi <goodoldpaul@autistici.org>
 ;;; Copyright © 2020, 2021 Vinicius Monego <monego@posteo.net>
 ;;; Copyright © 2020 Michael Rohleder <mike@rohleder.de>
+;;; Copyright © 2021 jgart <jgart@dismail.de>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -5532,6 +5533,60 @@ generator, generating audio signals out of Linux's /dev/dsp audio
 device.  There is support for mono and/or stereo and 8 or 16 bit samples.")
     (license license:gpl2)))
 
+(define-public python-pysox
+  ;; PyPi does not include the data folder containing audio files for testing.
+  (let ((commit "3d0053381c24ae3490f759d4de87194b85789d36")
+        (revision "0"))
+    (package
+      (name "python-pysox")
+      (version (git-version "1.4.2" revision commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://github.com/rabitt/pysox")
+               (commit commit)))
+         (file-name (git-file-name name version))
+         (sha256
+          (base32
+           "0i62jx92vfpcr2z7lp69yzqdi9idfs3pifl3rzm2akc2c4cr1mac"))))
+      (build-system python-build-system)
+      (arguments
+       `(#:phases
+         (modify-phases %standard-phases
+           (add-after 'unpack 'patch-sox
+             (lambda* (#:key inputs #:allow-other-keys)
+               (let* ((sox-store-path (assoc-ref inputs "sox"))
+                      (sox-bin (string-append sox-store-path "/bin/sox")))
+                 (substitute* "sox/__init__.py"
+                   (("sox -h")
+                    (string-append sox-bin " -h")))
+                 (substitute* "sox/core.py"
+                   (("\\['sox")
+                    (string-append "['" sox-bin))))))
+           (replace 'check
+             (lambda* (#:key inputs outputs tests? #:allow-other-keys)
+               (when tests?
+                 (add-installed-pythonpath inputs outputs)
+                 (invoke "pytest")))))))
+      (propagated-inputs
+       `(("python-numpy" ,python-numpy)
+         ("python-typing-extensions" ,python-typing-extensions)))
+      (native-inputs
+       `(("sox" ,sox)
+         ("python-pytest" ,python-pytest)
+         ("python-pytest-cov" ,python-pytest-cov)
+         ("python-soundfile" ,python-soundfile)))
+      (home-page "https://github.com/rabitt/pysox")
+      (synopsis "Python wrapper around SoX")
+      (description "@code{python-pysox} is a wrapper around the @command{sox}
+command line tool.  The API offers @code{Transformer} and @code{Combiner}
+classes that allow the user to incrementally build up effects and audio
+manipulations.  @code{python-pysox} also provides methods for querying audio
+information such as sample rate, determining whether an audio file is silent,
+and much more.")
+      (license license:bsd-3))))
+
 (define-public mda-lv2
   (package
     (name "mda-lv2")