def encode_transposition()

in transformer-xl/utils/performance_event_repo.py [0:0]


    def encode_transposition(self, input_midi):
        """
        Augment and transform a MIDI file into a list of performance event indices.
        Args:
          input_midi: Path to input MIDI file
        Returns:
          ids: List of performance event indices.
        """
        if input_midi:
            ns = note_seq.midi_file_to_sequence_proto(input_midi)
            ns = note_seq.sequences_lib.apply_sustain_control_changes(ns)
            del ns.control_changes[:]
        else:
            ns = note_seq.protobuf.music_pb2.NoteSequence()

        for augment_fn in self.augment_fns:
            # Augment and encode the performance.
            try:
                # print(augment_fn)
                augmented_performance_sequence = augment_fn(ns)
            except DataAugmentationError:
                # print(DataAugmentationError)
                continue
            yield self.encode_note_sequence(augmented_performance_sequence)