Skip to content

Commit fe5e6e8

Browse files
authored
Release constraint on mir_eval package (#183)
* Release constraint on mir_eval package * restore previous lower bound
1 parent eee9fe0 commit fe5e6e8

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

basic_pitch/visualize.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
# See the License for the specific language governing permissions and
1616
# limitations under the License.
1717

18+
import logging
1819
import numpy as np
1920
import tensorflow as tf
2021
import mir_eval
@@ -188,12 +189,19 @@ def _array_to_sonification(array: tf.Tensor, max_outputs: int, clip: float = 0.3
188189
audio_list = []
189190

190191
for i, gram in enumerate(gram_batch):
192+
if gram.shape[1] != TIMES.shape[0]:
193+
logging.warning(
194+
f"Gram shape {gram.shape} does not match times shape {TIMES.shape}, times array will be truncated"
195+
)
196+
times_truncated = TIMES[: min(gram.shape[1], TIMES.shape[0])]
197+
else:
198+
times_truncated = TIMES
191199

192200
gram[gram < clip] = 0.0
193201
y = mir_eval.sonify.time_frequency(
194202
gram[:MAX_FREQ_INDEX, :],
195203
FREQS[:MAX_FREQ_INDEX],
196-
TIMES,
204+
times_truncated,
197205
fs=SONIFY_FS,
198206
)
199207
audio_list.append(y[:, np.newaxis])

pyproject.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ classifiers = [
2020
dependencies = [
2121
"coremltools; platform_system == 'Darwin'",
2222
"librosa>=0.8.0",
23-
# TODO: mir_eval 0.8.1+ introduces fixes to sonification that broke our tests
24-
# Likely we'd like to adapt the tests to release the constraint
25-
"mir_eval>=0.6,<=0.8.0",
23+
"mir_eval>=0.6.0",
2624
"numpy>=1.18",
2725
"onnxruntime; platform_system == 'Windows' and python_version < '3.11'",
2826
"pretty_midi>=0.2.9",

0 commit comments

Comments
 (0)