A lightweight yet powerful audio-to-MIDI converter with pitch bend detection
Python audiolightweightmachine-learningmidimusicpitch-detectionpolyphonicpythontranscriptiontypescript
Release constraint on `mir_eval` package (#183)
Pierre Tharyfe5e6e885ba1
diff --git a/basic_pitch/visualize.py b/basic_pitch/visualize.pyindex 2546d97..f9477f9 100644--- a/basic_pitch/visualize.py+++ b/basic_pitch/visualize.py@@ -15,6 +15,7 @@# See the License for the specific language governing permissions and# limitations under the License.+import loggingimport numpy as npimport tensorflow as tfimport mir_eval@@ -188,12 +189,19 @@ def _array_to_sonification(array: tf.Tensor, max_outputs: int, clip: float = 0.3audio_list = []for i, gram in enumerate(gram_batch):+ if gram.shape[1] != TIMES.shape[0]:+ logging.warning(+ f"Gram shape {gram.shape} does not match times shape {TIMES.shape}, times array will be truncated"+ )+ times_truncated = TIMES[: min(gram.shape[1], TIMES.shape[0])]+ else:+ times_truncated = TIMESgram[gram < clip] = 0.0y = mir_eval.sonify.time_frequency(gram[:MAX_FREQ_INDEX, :],FREQS[:MAX_FREQ_INDEX],- TIMES,+ times_truncated,fs=SONIFY_FS,)audio_list.append(y[:, np.newaxis])diff --git a/pyproject.toml b/pyproject.tomlindex 48e89cd..22f744b 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -20,9 +20,7 @@ classifiers = [dependencies = ["coremltools; platform_system == 'Darwin'","librosa>=0.8.0",- # TODO: mir_eval 0.8.1+ introduces fixes to sonification that broke our tests- # Likely we'd like to adapt the tests to release the constraint- "mir_eval>=0.6,<=0.8.0",+ "mir_eval>=0.6.0","numpy>=1.18","onnxruntime; platform_system == 'Windows' and python_version < '3.11'","pretty_midi>=0.2.9",