def transpose(self, semitone):
        """
        Transpose the pianoroll by a number of semitones, where positive
        values are for higher key, while negative values are for lower key.

        Parameters
        ----------
        semitone : int
            The number of semitones to transpose the pianoroll.

        """
        if semitone > 0 and semitone < 128:
            self.pianoroll[:, semitone:] = self.pianoroll[:, :(128 - semitone)]
            self.pianoroll[:, :semitone] = 0
        elif semitone < 0 and semitone > -128:
            self.pianoroll[:, :(128 + semitone)] = self.pianoroll[:, -semitone:]
            self.pianoroll[:, (128 + semitone):] = 0