From 653bcab96d70d25e98753681d48657fe6634f8c5 Mon Sep 17 00:00:00 2001 From: jgart Date: Wed, 24 Nov 2021 23:42:45 -0500 Subject: gnu: Add python-pysox. * gnu/packages/audio.scm (python-pysox): New variable. Signed-off-by: Arun Isaac --- gnu/packages/audio.scm | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) 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 ;;; Copyright © 2020, 2021 Vinicius Monego ;;; Copyright © 2020 Michael Rohleder +;;; Copyright © 2021 jgart ;;; ;;; 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") -- cgit v1.2.3