Skip to content

A lightweight yet powerful audio-to-MIDI converter with pitch bend detection

Add some pre-generated outputs for prediction tests

David Rubinsteinca13028b4773
diff --git a/tests/resources/vocadito_10/model_output.npz b/tests/resources/vocadito_10/model_output.npz
new file mode 100644
index 0000000..8719f8a
Binary files /dev/null and b/tests/resources/vocadito_10/model_output.npz differ
diff --git a/tests/resources/vocadito_10/note_events.npz b/tests/resources/vocadito_10/note_events.npz
new file mode 100644
index 0000000..ffd860c
Binary files /dev/null and b/tests/resources/vocadito_10/note_events.npz differ
diff --git a/tests/test_inference.py b/tests/test_inference.py
index 23a477e..2bc1607 100644
--- a/tests/test_inference.py
+++ b/tests/test_inference.py
@@ -15,6 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+import json
import os
import pathlib
import tempfile
@@ -47,6 +48,18 @@ class TestPredict(unittest.TestCase):
assert all(note_pitch_max)
assert isinstance(note_events, list)
+ expected_model_output = np.load("tests/resources/vocadito_10/model_output.npz")
+ for k in expected_model_output.keys():
+ np.testing.assert_allclose(expected_model_output[k], model_output[k], atol=1e-4, rtol=0)
+
+ expected_note_events = np.load("tests/resources/vocadito_10/note_events.npz", allow_pickle=True)
+ expected_note_events = expected_note_events.get("arr_0")
+
+ assert len(expected_note_events) == len(note_events)
+ for expected, calculated in zip(expected_note_events, note_events):
+ for i in range(len(expected)):
+ np.testing.assert_allclose(expected[i], calculated[i], atol=1e-4, rtol=0)
+
def test_predict_with_saves(self) -> None:
test_audio_path = RESOURCES_PATH / "vocadito_10.wav"
with tempfile.TemporaryDirectory() as tmpdir: