def testSequenceNoteFrames(self): sequence = music_pb2.NoteSequence() testing_lib.add_track_to_sequence(sequence, 0, [(60, 100, 0.5, 2.0), (62, 100, 1.0, 1.25)]) pitches, has_onsets, has_notes, event_times = ( melody_inference.sequence_note_frames(sequence)) expected_pitches = [60, 62] expected_has_onsets = [[0, 0], [1, 0], [0, 1], [0, 0]] expected_has_notes = [[0, 0], [1, 0], [1, 1], [1, 0]] expected_event_times = [0.5, 1.0, 1.25] self.assertEqual(expected_pitches, pitches) self.assertEqual(expected_has_onsets, has_onsets.tolist()) self.assertEqual(expected_has_notes, has_notes.tolist()) self.assertEqual(expected_event_times, event_times)
def testSequenceNoteFrames(self): sequence = music_pb2.NoteSequence() testing_lib.add_track_to_sequence( sequence, 0, [(60, 100, 0.5, 2.0), (62, 100, 1.0, 1.25)]) pitches, has_onsets, has_notes, event_times = ( melody_inference.sequence_note_frames(sequence)) expected_pitches = [60, 62] expected_has_onsets = [[0, 0], [1, 0], [0, 1], [0, 0]] expected_has_notes = [[0, 0], [1, 0], [1, 1], [1, 0]] expected_event_times = [0.5, 1.0, 1.25] self.assertEqual(expected_pitches, pitches) self.assertEqual(expected_has_onsets, has_onsets.tolist()) self.assertEqual(expected_has_notes, has_notes.tolist()) self.assertEqual(expected_event_times, event_times)