'Construct a PianorollSequence.
Exactly one of `quantized_sequence` or `steps_per_quarter` must be supplied.
At most one of `quantized_sequence` and `events_list` may be supplied.
Args:
quantized_sequence: an optional quantized NoteSequence proto to base
PianorollSequence on.
events_list: an optional list of Pianoroll events to base
PianorollSequence on.
steps_per_quarter: how many steps a quarter note represents. Must be
provided if `quanitzed_sequence` not given.
start_step: The offset of this sequence relative to the
beginning of the source sequence. If a quantized sequence is used as
input, only notes starting after this step will be considered.
min_pitch: The minimum valid pitch value, inclusive.
max_pitch: The maximum valid pitch value, inclusive.
split_repeats: Whether to force repeated notes to have a 0-state step
between them when initializing from a quantized NoteSequence.
shift_range: If True, assume that the given events_list is in the full
MIDI pitch range and needs to be shifted and filtered based on
`min_pitch` and `max_pitch`.'

def __init__(self, quantized_sequence=None, events_list=None, steps_per_quarter=None, start_step=0, min_pitch=MIN_MIDI_PITCH, max_pitch=MAX_MIDI_PITCH, split_repeats=True, shift_range=False):

    assert ((quantized_sequence, steps_per_quarter).count(None) == 1)
    assert ((quantized_sequence, events_list).count(None) >= 1)
    self._min_pitch = min_pitch
    self._max_pitch = max_pitch
    if quantized_sequence:
        sequences_lib.assert_is_relative_quantized_sequence(quantized_sequence)
        self._events = self._from_quantized_sequence(quantized_sequence, start_step, min_pitch, max_pitch, split_repeats)
        self._steps_per_quarter = quantized_sequence.quantization_info.steps_per_quarter
    else:
        self._events = []
        self._steps_per_quarter = steps_per_quarter
        if events_list:
            for e in events_list:
                self.append(e, shift_range)
    self._start_step = start_step
