def adjust_times(self, original_times, new_times):
        # Only include notes within start/end time of the provided times
        for instrument in self.instruments:
            valid_notes = []
            for note in instrument.notes:
                if note.start >= original_times[0] and \
                        note.end <= original_times[-1]:
                    valid_notes.append(copy.deepcopy(note))
            instrument.notes = valid_notes
        # Get array of note-on locations and correct them
        note_ons = np.array([note.start for instrument in self.instruments
                             for note in instrument.notes])
        aligned_note_ons = np.interp(note_ons, original_times, new_times)
        # Same for note-offs
        note_offs = np.array([note.end for instrument in self.instruments
                              for note in instrument.notes])
        aligned_note_offs = np.interp(note_offs, original_times, new_times)
        # Same for pitch bends
        pitch_bends = np.array([bend.time for instrument in self.instruments
                                for bend in instrument.pitch_bends])
        aligned_pitch_bends = np.interp(pitch_bends, original_times, new_times)
        ccs = np.array([cc.time for instrument in self.instruments
                        for cc in instrument.control_changes])
        aligned_ccs = np.interp(ccs, original_times, new_times)
        # Correct notes
        for n, note in enumerate([note for instrument in self.instruments
                                  for note in instrument.notes]):
            note.start = (aligned_note_ons[n] > 0)*aligned_note_ons[n]
            note.end = (aligned_note_offs[n] > 0)*aligned_note_offs[n]
        # After performing alignment, some notes may have an end time which is
        # on or before the start time.  Remove these!
        self.remove_invalid_notes()
        # Correct pitch changes
        for n, bend in enumerate([bend for instrument in self.instruments
                                  for bend in instrument.pitch_bends]):
            bend.time = (aligned_pitch_bends[n] > 0)*aligned_pitch_bends[n]
        for n, cc in enumerate([cc for instrument in self.instruments
                                for cc in instrument.control_changes]):
            cc.time = (aligned_ccs[n] > 0)*aligned_ccs[n]
Adjusts the timing of the events in the MIDI object.
dataset/ETHPy150Open craffel/pretty-midi/pretty_midi/pretty_midi.py/PrettyMIDI.adjust_times