Accepting request 1005935 from devel:languages:python:numeric
- Update to 0.9.2: * Fixed librosa.show_versions to match package dependencies. * Fixed a bug in librosa.effects.split when applied to multichannel data. * Removed test data from main repository and reduced the git attic. * Accept pre-constructed audioread objects in librosa.load. * Accelerate librosa.magphase. * Nearly full support for multi-channel processing. * Option to disable unicode characters in display functions. * Significantly expanded the library of example audio clips. * The default padding mode for most functions (including STFT) is now zero-padding. * librosa.load and librosa.stream can now operate directly on open soundfile objects. * librosa.display.specshow now uses centered coordinate grids. * librosa.iirt now exposes API control over resampling modes. * Maximum frequency is now correctly inferred as Nyquist in onset strength calculation. * librosa.effects.deemphasis no longer modifies the input signal in-place. * librosa.util.frame now correctly works for arbitrary memory layouts and numbers of axes. * Corrected a normalization error in inverse CQT. * ibrosa.cqt now supports arbitrary hop lengths. * Added a run-time check for minimally supported matplotlib versions. * Enhanced continuous integration testing for oldest and newest environments. * librosa.effects.deemphasis, inverse operation of librosa.effects.preemphasis. * librosa.display.waveshow, adaptively visualize waveforms by amplitude envelope when zoomed out, or raw sample values when zoomed in. - Add patch remove-contextlib2.patch: * No longer require contextlib2. OBS-URL: https://build.opensuse.org/request/show/1005935 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-librosa?expand=0&rev=9
This commit is contained in:
commit
976ecd08b6
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:2dfe1b17a5934d2e41a798cf371674fd216aa05d6da81d1a00b04b7983cbfed6
|
||||
size 4708189
|
3
librosa-0.9.2.tar.gz
Normal file
3
librosa-0.9.2.tar.gz
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:6bb5d527680c2ca733407dc69bfddfbe5cc8cc530b997c20aa288ede222d9d47
|
||||
size 1994373
|
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:aa4239679808fe7a814eb692ef58c9d1991b45e64ee3792c5dadc8f03baa79c4
|
||||
size 8934562
|
||||
oid sha256:76c5df68346e97aeb0f291d1c8b669d6d6679604079493a9bf655573b3fd08ca
|
||||
size 12256542
|
||||
|
@ -1,3 +1,40 @@
|
||||
-------------------------------------------------------------------
|
||||
Mon Sep 26 02:21:59 UTC 2022 - Steve Kowalik <steven.kowalik@suse.com>
|
||||
|
||||
- Update to 0.9.2:
|
||||
* Fixed librosa.show_versions to match package dependencies.
|
||||
* Fixed a bug in librosa.effects.split when applied to multichannel data.
|
||||
* Removed test data from main repository and reduced the git attic.
|
||||
* Accept pre-constructed audioread objects in librosa.load.
|
||||
* Accelerate librosa.magphase.
|
||||
* Nearly full support for multi-channel processing.
|
||||
* Option to disable unicode characters in display functions.
|
||||
* Significantly expanded the library of example audio clips.
|
||||
* The default padding mode for most functions (including STFT) is now
|
||||
zero-padding.
|
||||
* librosa.load and librosa.stream can now operate directly on open
|
||||
soundfile objects.
|
||||
* librosa.display.specshow now uses centered coordinate grids.
|
||||
* librosa.iirt now exposes API control over resampling modes.
|
||||
* Maximum frequency is now correctly inferred as Nyquist in onset strength
|
||||
calculation.
|
||||
* librosa.effects.deemphasis no longer modifies the input signal in-place.
|
||||
* librosa.util.frame now correctly works for arbitrary memory layouts and
|
||||
numbers of axes.
|
||||
* Corrected a normalization error in inverse CQT.
|
||||
* ibrosa.cqt now supports arbitrary hop lengths.
|
||||
* Added a run-time check for minimally supported matplotlib versions.
|
||||
* Enhanced continuous integration testing for oldest and newest environments.
|
||||
* librosa.effects.deemphasis, inverse operation of
|
||||
librosa.effects.preemphasis.
|
||||
* librosa.display.waveshow, adaptively visualize waveforms by amplitude
|
||||
envelope when zoomed out, or raw sample values when zoomed in.
|
||||
- Add patch remove-contextlib2.patch:
|
||||
* No longer require contextlib2.
|
||||
- Add patch skip-test-data-missing-tests.patch:
|
||||
* Due to removing the test data from the main repo, skip tests that require
|
||||
it, since it's quite large.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Jan 28 23:09:45 UTC 2021 - Ben Greiner <code@bnavigator.de>
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package python-librosa
|
||||
#
|
||||
# Copyright (c) 2021 SUSE LLC
|
||||
# Copyright (c) 2022 SUSE LLC
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@ -18,49 +18,51 @@
|
||||
|
||||
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
|
||||
%define skip_python2 1
|
||||
# SciPy 1.6.0 dropped support for Python 3.6, many packages from the NumPy family follow. (NEP 29)
|
||||
%define skip_python36 1
|
||||
Name: python-librosa
|
||||
Version: 0.8.0
|
||||
Version: 0.9.2
|
||||
Release: 0
|
||||
Summary: Python module for audio and music processing
|
||||
License: ISC AND CC-BY-3.0
|
||||
License: CC-BY-3.0 AND ISC
|
||||
URL: https://github.com/librosa/librosa
|
||||
# The github archive has the tests
|
||||
Source0: https://github.com/librosa/librosa/archive/%{version}.tar.gz#/librosa-%{version}.tar.gz
|
||||
Source1: librosa-create-pooch-cache.py
|
||||
# Test data. Use create librosa-create-pooch-cache.py to create this file
|
||||
# Pooch test data. Use librosa-create-pooch-cache.py to create this file
|
||||
Source2: librosa-pooch-cache.tar.gz
|
||||
BuildRequires: %{python_module SoundFile >= 0.9.0}
|
||||
BuildRequires: %{python_module audioread >= 2.0.0}
|
||||
BuildRequires: %{python_module decorator >= 3.0.0}
|
||||
BuildRequires: %{python_module joblib >= 0.12}
|
||||
BuildRequires: %{python_module numba >= 0.43.0}
|
||||
BuildRequires: %{python_module numpy >= 1.15.0}
|
||||
# PATCH-FIX-UPSTREAM gh#librosa/librosa#1551
|
||||
Patch0: remove-contextlib2.patch
|
||||
# PATCH-FIX-OPENSUSE Skip tests that require further test data that is ~180MiB
|
||||
Patch1: skip-test-data-missing-tests.patch
|
||||
BuildRequires: %{python_module SoundFile >= 0.10.2}
|
||||
BuildRequires: %{python_module audioread >= 2.1.9}
|
||||
BuildRequires: %{python_module decorator >= 4.0.0}
|
||||
BuildRequires: %{python_module joblib >= 0.14}
|
||||
BuildRequires: %{python_module numba >= 0.45.0}
|
||||
BuildRequires: %{python_module numpy >= 1.17.0}
|
||||
BuildRequires: %{python_module packaging >= 20.0}
|
||||
BuildRequires: %{python_module pooch >= 1.0}
|
||||
BuildRequires: %{python_module resampy >= 0.2.0}
|
||||
BuildRequires: %{python_module scikit-learn >= 0.14.0}
|
||||
BuildRequires: %{python_module scipy >= 1.0.0}
|
||||
BuildRequires: %{python_module scikit-learn >= 0.19.1}
|
||||
BuildRequires: %{python_module scipy >= 1.2.0}
|
||||
BuildRequires: %{python_module setuptools}
|
||||
BuildRequires: fdupes
|
||||
BuildRequires: python-rpm-macros
|
||||
Requires: python-SoundFile >= 0.9.0
|
||||
Requires: python-audioread >= 2.0.0
|
||||
Requires: python-decorator >= 3.0.0
|
||||
Requires: python-joblib >= 0.12
|
||||
Requires: python-numba >= 0.43.0
|
||||
Requires: python-numpy >= 1.15.0
|
||||
Requires: python-SoundFile >= 0.10.2
|
||||
Requires: python-audioread >= 2.1.9
|
||||
Requires: python-decorator >= 4.0.0
|
||||
Requires: python-joblib >= 0.14
|
||||
Requires: python-numba >= 0.45.0
|
||||
Requires: python-numpy >= 1.17.0
|
||||
Requires: python-packaging >= 20.0
|
||||
Requires: python-pooch >= 1.0
|
||||
Requires: python-resampy >= 0.2.0
|
||||
Requires: python-scikit-learn >= 0.14.0
|
||||
Requires: python-scipy >= 1.0.0
|
||||
Requires: python-scikit-learn >= 0.19.1
|
||||
Requires: python-scipy >= 1.2.0
|
||||
BuildArch: noarch
|
||||
# SECTION test requirements
|
||||
BuildRequires: %{python_module contextlib2}
|
||||
BuildRequires: %{python_module matplotlib >= 2.0}
|
||||
BuildRequires: %{python_module pytest-cov}
|
||||
BuildRequires: %{python_module pytest-mpl}
|
||||
# xdist not specified upstream but it uses resources more efficiently
|
||||
BuildRequires: %{python_module pytest-xdist}
|
||||
BuildRequires: %{python_module pytest}
|
||||
BuildRequires: %{python_module samplerate}
|
||||
BuildRequires: ffmpeg
|
||||
@ -73,7 +75,7 @@ the building blocks necessary to create music information retrieval
|
||||
systems.
|
||||
|
||||
%prep
|
||||
%setup -q -n librosa-%{version} -a 2
|
||||
%autosetup -p1 -n librosa-%{version} -a 2
|
||||
# Remove unneeded shebangs
|
||||
find librosa -name "*.py" -exec sed -i -e '/^#!\//, 1d' {} \;
|
||||
# don't measure test coverage
|
||||
@ -89,12 +91,22 @@ sed -i '/tool:pytest/,/addopts/ s/--cov-report.*--cov librosa//' setup.cfg
|
||||
%check
|
||||
export LIBROSA_DATA_DIR=$PWD/librosa-pooch-cache
|
||||
# test data files not packaged
|
||||
donttest+=" or (test_core and test_iirt)"
|
||||
donttest+=" or (test_core and test_iirt) or test_find_files"
|
||||
donttest+=" or (test_features and test_cens)"
|
||||
donttest+=" or (test_filters and test_semitone_filterbank)"
|
||||
# image files do not match without exact mpl version
|
||||
donttest+=" or test_display"
|
||||
%pytest -n auto -k "not (${donttest:4})"
|
||||
# soxr not in Tumbleweed
|
||||
donttest+=" or soxr"
|
||||
# fails with current Tumbleweed
|
||||
donttest+=" or test_pyin_multi_center"
|
||||
# Overflow on i586
|
||||
if [ $(getconf LONG_BIT) -eq 32 ]; then
|
||||
donttest+=" or test_tempo or test_hybrid_cqt or test_stft_winsizes"
|
||||
donttest+=" or test_istft_reconstruction or test_trim"
|
||||
donttest+=" or test_nnls_multiblock"
|
||||
fi
|
||||
%pytest -k "not (${donttest:4})"
|
||||
|
||||
%files %{python_files}
|
||||
%doc AUTHORS.md README.md
|
||||
|
154
remove-contextlib2.patch
Normal file
154
remove-contextlib2.patch
Normal file
@ -0,0 +1,154 @@
|
||||
From 1108bd9d23460c5e46744b873f6a7caf83089958 Mon Sep 17 00:00:00 2001
|
||||
From: Steve Kowalik <steven@wedontsleep.org>
|
||||
Date: Thu, 11 Aug 2022 16:53:46 +1000
|
||||
Subject: [PATCH] Drop use of contextlib2
|
||||
|
||||
As of Python 3.7, contextlib in the standard library now supports all
|
||||
functionality that this library requires. As a consequence, remove the
|
||||
external requirement, and switch to it. Drive by removing some now
|
||||
unneeded __future__ imports.
|
||||
---
|
||||
.github/environment-ci.yml | 1 -
|
||||
.github/environment-minimal.yml | 1 -
|
||||
librosa/version.py | 1 -
|
||||
setup.cfg | 1 -
|
||||
tests/test_beat.py | 4 +---
|
||||
tests/test_effects.py | 2 +-
|
||||
tests/test_filters.py | 2 +-
|
||||
tests/test_multichannel.py | 4 +---
|
||||
tests/test_onset.py | 3 +--
|
||||
9 files changed, 5 insertions(+), 14 deletions(-)
|
||||
|
||||
diff --git a/.github/environment-ci.yml b/.github/environment-ci.yml
|
||||
index 444898d1d3..5018ab6dde 100644
|
||||
--- a/.github/environment-ci.yml
|
||||
+++ b/.github/environment-ci.yml
|
||||
@@ -22,7 +22,6 @@ dependencies:
|
||||
- pytest-mpl
|
||||
- pytest-cov
|
||||
- pytest
|
||||
- - contextlib2
|
||||
- coverage
|
||||
- ffmpeg
|
||||
- pip:
|
||||
diff --git a/.github/environment-minimal.yml b/.github/environment-minimal.yml
|
||||
index 98ddc7b99c..12d24d36af 100644
|
||||
--- a/.github/environment-minimal.yml
|
||||
+++ b/.github/environment-minimal.yml
|
||||
@@ -22,7 +22,6 @@ dependencies:
|
||||
- pytest-mpl
|
||||
- pytest-cov
|
||||
- pytest
|
||||
- - contextlib2
|
||||
- coverage
|
||||
- ffmpeg
|
||||
- tomli<2.0
|
||||
diff --git a/librosa/version.py b/librosa/version.py
|
||||
index 14b00bf7de..4b979c2f11 100644
|
||||
--- a/librosa/version.py
|
||||
+++ b/librosa/version.py
|
||||
@@ -57,7 +57,6 @@ def show_versions():
|
||||
"matplotlib",
|
||||
"samplerate",
|
||||
"soxr",
|
||||
- "contextlib2",
|
||||
"presets",
|
||||
]
|
||||
|
||||
diff --git a/setup.cfg b/setup.cfg
|
||||
index ab848a79a2..f6b4ad2b3c 100644
|
||||
--- a/setup.cfg
|
||||
+++ b/setup.cfg
|
||||
@@ -77,7 +77,6 @@ tests =
|
||||
pytest-mpl
|
||||
pytest-cov
|
||||
pytest
|
||||
- contextlib2
|
||||
samplerate
|
||||
soxr
|
||||
display =
|
||||
diff --git a/tests/test_beat.py b/tests/test_beat.py
|
||||
index 0aad1bb1c0..4d38e71683 100644
|
||||
--- a/tests/test_beat.py
|
||||
+++ b/tests/test_beat.py
|
||||
@@ -2,8 +2,6 @@
|
||||
# CREATED:2013-03-11 18:14:30 by Brian McFee <brm2132@columbia.edu>
|
||||
# unit tests for librosa.beat
|
||||
|
||||
-from __future__ import print_function
|
||||
-
|
||||
# Disable cache
|
||||
import os
|
||||
|
||||
@@ -13,7 +11,7 @@
|
||||
pass
|
||||
|
||||
import pytest
|
||||
-from contextlib2 import nullcontext as dnr
|
||||
+from contextlib import nullcontext as dnr
|
||||
|
||||
import numpy as np
|
||||
import scipy.stats
|
||||
diff --git a/tests/test_effects.py b/tests/test_effects.py
|
||||
index f7d24130e7..2cdc65b08b 100644
|
||||
--- a/tests/test_effects.py
|
||||
+++ b/tests/test_effects.py
|
||||
@@ -11,7 +11,7 @@
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
-from contextlib2 import nullcontext as dnr
|
||||
+from contextlib import nullcontext as dnr
|
||||
import numpy as np
|
||||
import pytest
|
||||
|
||||
diff --git a/tests/test_filters.py b/tests/test_filters.py
|
||||
index 59e351d3e0..f2c1a344bd 100644
|
||||
--- a/tests/test_filters.py
|
||||
+++ b/tests/test_filters.py
|
||||
@@ -19,7 +19,7 @@
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
-from contextlib2 import nullcontext as dnr
|
||||
+from contextlib import nullcontext as dnr
|
||||
import glob
|
||||
import numpy as np
|
||||
import scipy.io
|
||||
diff --git a/tests/test_multichannel.py b/tests/test_multichannel.py
|
||||
index d927233321..94a5c72a99 100644
|
||||
--- a/tests/test_multichannel.py
|
||||
+++ b/tests/test_multichannel.py
|
||||
@@ -3,8 +3,6 @@
|
||||
# unit tests for multi-channel functionality
|
||||
#
|
||||
|
||||
-from __future__ import print_function
|
||||
-
|
||||
# Disable cache
|
||||
import os
|
||||
|
||||
@@ -21,7 +19,7 @@
|
||||
import warnings
|
||||
from unittest import mock
|
||||
|
||||
-from contextlib2 import nullcontext as dnr
|
||||
+from contextlib import nullcontext as dnr
|
||||
from test_core import srand
|
||||
|
||||
|
||||
diff --git a/tests/test_onset.py b/tests/test_onset.py
|
||||
index f74fe9e22d..91c97dc734 100644
|
||||
--- a/tests/test_onset.py
|
||||
+++ b/tests/test_onset.py
|
||||
@@ -2,9 +2,8 @@
|
||||
# CREATED:2013-03-11 18:14:30 by Brian McFee <brm2132@columbia.edu>
|
||||
# unit tests for librosa.onset
|
||||
|
||||
-from __future__ import print_function
|
||||
import pytest
|
||||
-from contextlib2 import nullcontext as dnr
|
||||
+from contextlib import nullcontext as dnr
|
||||
|
||||
# Disable cache
|
||||
import os
|
410
skip-test-data-missing-tests.patch
Normal file
410
skip-test-data-missing-tests.patch
Normal file
@ -0,0 +1,410 @@
|
||||
Index: librosa-0.9.2/tests/test_core.py
|
||||
===================================================================
|
||||
--- librosa-0.9.2.orig/tests/test_core.py
|
||||
+++ librosa-0.9.2/tests/test_core.py
|
||||
@@ -21,7 +21,7 @@ import numpy as np
|
||||
import scipy.io
|
||||
import pytest
|
||||
import warnings
|
||||
-from unittest import mock
|
||||
+from unittest import mock, SkipTest
|
||||
|
||||
|
||||
# -- utilities --#
|
||||
@@ -39,6 +39,11 @@ def srand(seed=628318530):
|
||||
def load(infile):
|
||||
return scipy.io.loadmat(infile, chars_as_strings=True)
|
||||
|
||||
+def _safe_load(fname, **kwargs):
|
||||
+ if not os.path.exists(fname):
|
||||
+ raise SkipTest()
|
||||
+ return librosa.load(fname, **kwargs)
|
||||
+
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"infile", files(os.path.join("tests", "data", "core-load-*.mat"))
|
||||
@@ -58,6 +63,8 @@ def test_load(infile):
|
||||
def test_load_soundfile():
|
||||
|
||||
fname = os.path.join("tests", "data", "test1_44100.wav")
|
||||
+ if not os.path.exists(fname):
|
||||
+ raise SkipTest()
|
||||
# Load from filename
|
||||
y, sr = librosa.load(fname, sr=None, mono=False)
|
||||
|
||||
@@ -72,7 +79,9 @@ def test_load_soundfile():
|
||||
|
||||
def test_load_audioread():
|
||||
fname = os.path.join("tests", "data", "test1_44100.wav")
|
||||
-
|
||||
+ if not os.path.exists(fname):
|
||||
+ raise SkipTest()
|
||||
+
|
||||
# Load using an existing audioread object
|
||||
reader = audioread.rawread.RawAudioFile(fname)
|
||||
y, sr = librosa.load(reader, sr=None)
|
||||
@@ -104,7 +113,7 @@ def test_segment_load():
|
||||
sample_len = 2003
|
||||
fs = 44100
|
||||
test_file = os.path.join("tests", "data", "test1_44100.wav")
|
||||
- y, sr = librosa.load(
|
||||
+ y, sr = _safe_load(
|
||||
test_file, sr=None, mono=False, offset=0.0, duration=sample_len / float(fs)
|
||||
)
|
||||
|
||||
@@ -129,9 +138,10 @@ def test_segment_load():
|
||||
)
|
||||
def resample_audio(request):
|
||||
infile = request.param
|
||||
- y, sr_in = librosa.load(
|
||||
- os.path.join("tests", "data", infile), sr=None, duration=5, mono=False
|
||||
- )
|
||||
+ file_ = os.path.join("tests", "data", infile)
|
||||
+ if not os.path.exists(file_):
|
||||
+ raise SkipTest()
|
||||
+ y, sr_in = librosa.load(file_, sr=None, duration=5, mono=False)
|
||||
return (y, sr_in)
|
||||
|
||||
|
||||
@@ -599,7 +609,7 @@ def test_reassigned_spectrogram_paramete
|
||||
|
||||
|
||||
def test_salience_basecase():
|
||||
- (y, sr) = librosa.load(os.path.join("tests", "data", "test1_22050.wav"))
|
||||
+ (y, sr) = _safe_load(os.path.join("tests", "data", "test1_22050.wav"))
|
||||
S = np.abs(librosa.stft(y))
|
||||
freqs = librosa.core.fft_frequencies(sr=sr)
|
||||
harms = [1]
|
||||
@@ -611,7 +621,8 @@ def test_salience_basecase():
|
||||
|
||||
|
||||
def test_salience_basecase2():
|
||||
- (y, sr) = librosa.load(os.path.join("tests", "data", "test1_22050.wav"))
|
||||
+ filename = os.path.join("tests", "data", "test1_22050.wav")
|
||||
+ (y, sr) = _safe_load(filename)
|
||||
S = np.abs(librosa.stft(y))
|
||||
freqs = librosa.core.fft_frequencies(sr=sr)
|
||||
harms = [1, 0.5, 2.0]
|
||||
@@ -684,13 +695,13 @@ def test_salience_aggregate():
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def y_22050():
|
||||
- y, sr = librosa.load(os.path.join("tests", "data", "test1_22050.wav"))
|
||||
+ y, sr = _safe_load(os.path.join("tests", "data", "test1_22050.wav"))
|
||||
return y
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def y_44100():
|
||||
- y, sr = librosa.load(os.path.join("tests", "data", "test1_44100.wav"), sr=None)
|
||||
+ y, sr = _safe_load(os.path.join("tests", "data", "test1_44100.wav"), sr=None)
|
||||
return y
|
||||
|
||||
|
||||
@@ -777,7 +788,7 @@ def test_istft_reconstruction(y_chirp_is
|
||||
"filename", files(os.path.join("tests", "data", "test1_22050.*"))
|
||||
)
|
||||
def test_load_options(filename, offset, duration, mono, dtype):
|
||||
- y, sr = librosa.load(
|
||||
+ y, sr = _safe_load(
|
||||
filename, mono=mono, offset=offset, duration=duration, dtype=dtype
|
||||
)
|
||||
|
||||
@@ -827,6 +838,8 @@ def test_get_duration_specgram(sr, dur,
|
||||
def test_get_duration_filename():
|
||||
|
||||
filename = os.path.join("tests", "data", "test2_8000.wav")
|
||||
+ if not os.path.exists(filename):
|
||||
+ raise SkipTest
|
||||
true_duration = 30.197625
|
||||
|
||||
duration_fn = librosa.get_duration(filename=filename)
|
||||
@@ -839,6 +852,8 @@ def test_get_duration_filename():
|
||||
|
||||
def test_get_duration_mp3():
|
||||
filename = os.path.join("tests", "data", "test1_22050.mp3")
|
||||
+ if not os.path.exists(filename):
|
||||
+ raise SkipTest()
|
||||
true_duration = 4.587528344671202
|
||||
|
||||
duration_fn = librosa.get_duration(filename=filename)
|
||||
@@ -999,13 +1014,11 @@ def pip_hop(request, pip_nfft):
|
||||
def pip_spec(y_22050, pip_nfft, pip_hop):
|
||||
return np.abs(librosa.stft(y_22050, n_fft=pip_nfft, hop_length=pip_hop))
|
||||
|
||||
-
|
||||
@pytest.mark.parametrize("fmin", [0, 100])
|
||||
@pytest.mark.parametrize("fmax", [4000, 8000, 11025])
|
||||
@pytest.mark.parametrize("threshold", [0.1, 0.2, 0.5])
|
||||
@pytest.mark.parametrize("ref", [None, 1.0, np.max])
|
||||
def test_piptrack_properties(pip_spec, pip_nfft, pip_hop, fmin, fmax, threshold, ref):
|
||||
-
|
||||
n_fft = pip_nfft
|
||||
hop_length = pip_hop
|
||||
S = pip_spec
|
||||
@@ -1061,7 +1074,10 @@ def test_yin_tone(freq):
|
||||
def test_yin_chirp():
|
||||
y = librosa.chirp(fmin=220, fmax=640, duration=1.0)
|
||||
f0 = librosa.yin(y, fmin=110, fmax=880, center=False)
|
||||
- target_f0 = np.load(os.path.join("tests", "data", "pitch-yin.npy"))
|
||||
+ filename = os.path.join("tests", "data", "pitch-yin.npy")
|
||||
+ if not os.path.exists(filename):
|
||||
+ raise SkipTest()
|
||||
+ target_f0 = np.load(filename)
|
||||
assert np.allclose(np.log2(f0), np.log2(target_f0), rtol=0, atol=1e-2)
|
||||
|
||||
|
||||
@@ -1138,7 +1154,10 @@ def test_pyin_chirp():
|
||||
y = librosa.chirp(fmin=220, fmax=640, duration=1.0)
|
||||
y = np.pad(y, (22050,))
|
||||
f0, voiced_flag, _ = librosa.pyin(y, fmin=110, fmax=880, center=False)
|
||||
- target_f0 = np.load(os.path.join("tests", "data", "pitch-pyin.npy"))
|
||||
+ filename = os.path.join("tests", "data", "pitch-pyin.npy")
|
||||
+ if not os.path.exists(filename):
|
||||
+ raise SkipTest
|
||||
+ target_f0 = np.load(filename)
|
||||
# test if correct frames are voiced
|
||||
assert np.array_equal(voiced_flag, target_f0 > 0)
|
||||
# test voiced frames are within one cent of the target
|
||||
@@ -1718,7 +1737,7 @@ def test_iirt():
|
||||
)["f_cqt"]
|
||||
|
||||
# There shouldn't be a load here, but test1_44100 was resampled for this fixture :\
|
||||
- y, sr = librosa.load(os.path.join("tests", "data", "test1_44100.wav"))
|
||||
+ y, sr = _safe_load(os.path.join("tests", "data", "test1_44100.wav"))
|
||||
|
||||
mut1 = librosa.iirt(y, sr=sr, hop_length=2205, win_length=4410, flayout="ba")
|
||||
|
||||
@@ -2137,6 +2156,8 @@ def test_griffinlim_momentum_warn():
|
||||
def test_get_samplerate(ext):
|
||||
|
||||
path = os.path.join("tests", "data", os.path.extsep.join(["test1_22050", ext]))
|
||||
+ if not os.path.exists(path):
|
||||
+ raise SkipTest()
|
||||
|
||||
sr = librosa.get_samplerate(path)
|
||||
assert sr == 22050
|
||||
@@ -2145,6 +2166,8 @@ def test_get_samplerate(ext):
|
||||
def test_get_samplerate_soundfile():
|
||||
|
||||
path = os.path.join("tests", "data", os.path.extsep.join(["test1_22050", "wav"]))
|
||||
+ if not os.path.exists(path):
|
||||
+ raise SkipTest()
|
||||
|
||||
sfo = soundfile.SoundFile(path)
|
||||
|
||||
@@ -2162,9 +2185,13 @@ def path(request):
|
||||
if request.param == "as_string":
|
||||
yield path
|
||||
elif request.param == "as_file":
|
||||
+ if not os.path.exists(path):
|
||||
+ raise SkipTest()
|
||||
with open(path, "rb") as f:
|
||||
yield f
|
||||
elif request.param == "as_sfo":
|
||||
+ if not os.path.exists(path):
|
||||
+ raise SkipTest()
|
||||
with soundfile.SoundFile(path) as f:
|
||||
yield f
|
||||
|
||||
@@ -2204,7 +2231,8 @@ def test_stream(
|
||||
fill_value,
|
||||
dtype,
|
||||
):
|
||||
-
|
||||
+ if not os.path.exists(path):
|
||||
+ raise SkipTest()
|
||||
stream = librosa.stream(
|
||||
path,
|
||||
block_length=block_length,
|
||||
Index: librosa-0.9.2/tests/test_beat.py
|
||||
===================================================================
|
||||
--- librosa-0.9.2.orig/tests/test_beat.py
|
||||
+++ librosa-0.9.2/tests/test_beat.py
|
||||
@@ -11,6 +11,7 @@ except:
|
||||
pass
|
||||
|
||||
import pytest
|
||||
+import unittest
|
||||
from contextlib import nullcontext as dnr
|
||||
|
||||
import numpy as np
|
||||
@@ -24,6 +25,8 @@ __EXAMPLE_FILE = os.path.join("tests", "
|
||||
|
||||
@pytest.fixture(scope="module", params=[22050, 44100])
|
||||
def ysr(request):
|
||||
+ if not os.path.exists(__EXAMPLE_FILE):
|
||||
+ raise unittest.SkipTest()
|
||||
return librosa.load(__EXAMPLE_FILE, sr=request.param)
|
||||
|
||||
|
||||
Index: librosa-0.9.2/tests/test_segment.py
|
||||
===================================================================
|
||||
--- librosa-0.9.2.orig/tests/test_segment.py
|
||||
+++ librosa-0.9.2/tests/test_segment.py
|
||||
@@ -15,6 +15,7 @@ import numpy as np
|
||||
import scipy
|
||||
from scipy.spatial.distance import cdist, pdist, squareform
|
||||
import pytest
|
||||
+import unittest
|
||||
|
||||
from test_core import srand
|
||||
|
||||
@@ -404,6 +405,8 @@ def test_timelag_filter_pos1():
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def ysr():
|
||||
+ if not os.path.exists(__EXAMPLE_FILE):
|
||||
+ raise unittest.SkipTest()
|
||||
return librosa.load(__EXAMPLE_FILE)
|
||||
|
||||
|
||||
Index: librosa-0.9.2/tests/test_onset.py
|
||||
===================================================================
|
||||
--- librosa-0.9.2.orig/tests/test_onset.py
|
||||
+++ librosa-0.9.2/tests/test_onset.py
|
||||
@@ -3,6 +3,7 @@
|
||||
# unit tests for librosa.onset
|
||||
|
||||
import pytest
|
||||
+from unittest import SkipTest
|
||||
from contextlib import nullcontext as dnr
|
||||
|
||||
# Disable cache
|
||||
@@ -26,6 +27,8 @@ __EXAMPLE_FILE = os.path.join("tests", "
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def ysr():
|
||||
+ if not os.path.exists(__EXAMPLE_FILE):
|
||||
+ raise SkipTest()
|
||||
return librosa.load(__EXAMPLE_FILE)
|
||||
|
||||
|
||||
Index: librosa-0.9.2/tests/test_effects.py
|
||||
===================================================================
|
||||
--- librosa-0.9.2.orig/tests/test_effects.py
|
||||
+++ librosa-0.9.2/tests/test_effects.py
|
||||
@@ -3,6 +3,7 @@
|
||||
"""Unit tests for the effects module"""
|
||||
import warnings
|
||||
|
||||
+from unittest import SkipTest
|
||||
# Disable cache
|
||||
import os
|
||||
|
||||
@@ -22,11 +23,15 @@ __EXAMPLE_FILE = os.path.join("tests", "
|
||||
@pytest.fixture(scope="module", params=["test1_44100.wav"])
|
||||
def y_multi(request):
|
||||
infile = request.param
|
||||
+ if not os.path.exists(__EXAMPLE_FILE):
|
||||
+ raise SkipTest()
|
||||
return librosa.load(os.path.join("tests", "data", infile), sr=None, mono=False)
|
||||
|
||||
|
||||
@pytest.fixture(scope="module", params=[22050, 44100])
|
||||
def ysr(request):
|
||||
+ if not os.path.exists(__EXAMPLE_FILE):
|
||||
+ raise SkipTest()
|
||||
return librosa.load(__EXAMPLE_FILE, sr=request.param)
|
||||
|
||||
|
||||
Index: librosa-0.9.2/tests/test_decompose.py
|
||||
===================================================================
|
||||
--- librosa-0.9.2.orig/tests/test_decompose.py
|
||||
+++ librosa-0.9.2/tests/test_decompose.py
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
# Disable cache
|
||||
import os
|
||||
+from unittest import SkipTest
|
||||
|
||||
try:
|
||||
os.environ.pop("LIBROSA_CACHE_DIR")
|
||||
@@ -100,7 +101,10 @@ def test_sorted_decompose():
|
||||
|
||||
@pytest.fixture
|
||||
def y22050():
|
||||
- y, _ = librosa.load(os.path.join("tests", "data", "test1_22050.wav"))
|
||||
+ filename = os.path.join("tests", "data", "test1_22050.wav")
|
||||
+ if not os.path.exists(filename):
|
||||
+ raise SkipTest()
|
||||
+ y, _ = librosa.load(filename)
|
||||
return y
|
||||
|
||||
|
||||
@@ -199,8 +203,10 @@ def test_nn_filter_mean_rec_sparse():
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def s_multi():
|
||||
- y, sr = librosa.load(os.path.join("tests", "data", "test1_44100.wav"),
|
||||
- sr=None, mono=False)
|
||||
+ filename = os.path.join("tests", "data", "test1_44100.wav")
|
||||
+ if not os.path.exists(filename):
|
||||
+ raise SkipTest()
|
||||
+ y, sr = librosa.load(filename, sr=None, mono=False)
|
||||
return np.abs(librosa.stft(y))
|
||||
|
||||
@pytest.mark.parametrize('useR,sparse', [(False, False), (True, False), (True, True)])
|
||||
Index: librosa-0.9.2/tests/test_multichannel.py
|
||||
===================================================================
|
||||
--- librosa-0.9.2.orig/tests/test_multichannel.py
|
||||
+++ librosa-0.9.2/tests/test_multichannel.py
|
||||
@@ -17,7 +17,7 @@ import numpy as np
|
||||
import scipy.io
|
||||
import pytest
|
||||
import warnings
|
||||
-from unittest import mock
|
||||
+from unittest import mock, SkipTest
|
||||
|
||||
from contextlib import nullcontext as dnr
|
||||
from test_core import srand
|
||||
@@ -26,7 +26,10 @@ from test_core import srand
|
||||
@pytest.fixture(scope="module", params=["test1_44100.wav"])
|
||||
def y_multi(request):
|
||||
infile = request.param
|
||||
- return librosa.load(os.path.join("tests", "data", infile), sr=None, mono=False)
|
||||
+ filename = os.path.join("tests", "data", infile)
|
||||
+ if not os.path.exists(filename):
|
||||
+ raise SkipTest()
|
||||
+ return librosa.load(filename, sr=None, mono=False)
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
Index: librosa-0.9.2/tests/test_features.py
|
||||
===================================================================
|
||||
--- librosa-0.9.2.orig/tests/test_features.py
|
||||
+++ librosa-0.9.2/tests/test_features.py
|
||||
@@ -4,6 +4,7 @@
|
||||
from __future__ import print_function
|
||||
import warnings
|
||||
import numpy as np
|
||||
+from unittest import SkipTest
|
||||
|
||||
import pytest
|
||||
|
||||
@@ -256,7 +257,10 @@ def test_spectral_rolloff_errors(S, pct)
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def y_ex():
|
||||
- return librosa.load(os.path.join("tests", "data", "test1_22050.wav"))
|
||||
+ filename = os.path.join("tests", "data", "test1_22050.wav")
|
||||
+ if not os.path.exists(filename):
|
||||
+ raise SkipTest()
|
||||
+ return librosa.load(filename)
|
||||
|
||||
|
||||
def test_spectral_contrast_log(y_ex):
|
||||
@@ -487,9 +491,10 @@ def test_tonnetz_cqt(y_ex):
|
||||
|
||||
def test_tonnetz_msaf():
|
||||
# Use pre-computed chroma
|
||||
- tonnetz_chroma = np.load(
|
||||
- os.path.join("tests", "data", "feature-tonnetz-chroma.npy")
|
||||
- )
|
||||
+ filename = os.path.join("tests", "data", "feature-tonnetz-chroma.npy")
|
||||
+ if not os.path.exists(filename):
|
||||
+ raise SkipTest()
|
||||
+ tonnetz_chroma = np.load(filename)
|
||||
tonnetz_msaf = np.load(os.path.join("tests", "data", "feature-tonnetz-msaf.npy"))
|
||||
|
||||
tonnetz = librosa.feature.tonnetz(chroma=tonnetz_chroma)
|
Loading…
Reference in New Issue
Block a user