def testNoteIntervalTreeToSequenceProto(self): example = np.load(self.musicnet_example_filename, encoding='latin1') note_interval_tree = example['test'][1] sequence = musicnet_io.note_interval_tree_to_sequence_proto( note_interval_tree, 44100) self.assertEqual(3, len(sequence.notes)) self.assertEqual(72, min(note.pitch for note in sequence.notes)) self.assertEqual(79, max(note.pitch for note in sequence.notes)) self.assertTrue(all(note.instrument == 0 for note in sequence.notes)) self.assertTrue(all(note.program == 41 for note in sequence.notes)) self.assertEqual(0.5, sequence.total_time)
def testNoteIntervalTreeToSequenceProto(self): # allow_pickle is required because the npz files contain intervaltrees. example = np.load(self.musicnet_example_filename, encoding='latin1', allow_pickle=True) note_interval_tree = example['test'][1] sequence = musicnet_io.note_interval_tree_to_sequence_proto( note_interval_tree, 44100) self.assertLen(sequence.notes, 3) self.assertEqual(72, min(note.pitch for note in sequence.notes)) self.assertEqual(79, max(note.pitch for note in sequence.notes)) self.assertTrue(all(note.instrument == 0 for note in sequence.notes)) self.assertTrue(all(note.program == 41 for note in sequence.notes)) self.assertEqual(0.5, sequence.total_time)