'Populate self with the chords from the given quantized NoteSequence.
A chord progression is extracted from the given sequence starting at time
step `start_step` and ending at time step `end_step`.
The number of time steps per bar is computed from the time signature in
`quantized_sequence`.
Args:
quantized_sequence: A quantized NoteSequence instance.
start_step: Start populating chords at this time step.
end_step: Stop populating chords at this time step.
Raises:
NonIntegerStepsPerBarException: If `quantized_sequence`\'s bar length
(derived from its time signature) is not an integer number of time
steps.
CoincidentChordsException: If any of the chords start on the same step.'

def from_quantized_sequence(self, quantized_sequence, start_step, end_step):

    sequences_lib.assert_is_relative_quantized_sequence(quantized_sequence)
    self._reset()
    steps_per_bar_float = sequences_lib.steps_per_bar_in_quantized_sequence(quantized_sequence)
    if ((steps_per_bar_float % 1) != 0):
        raise events_lib.NonIntegerStepsPerBarException(('There    are    %f    timesteps    per    bar.    Time    signature:    %d/%d' % (steps_per_bar_float, quantized_sequence.time_signature.numerator, quantized_sequence.time_signature.denominator)))
    self._steps_per_bar = int(steps_per_bar_float)
    self._steps_per_quarter = quantized_sequence.quantization_info.steps_per_quarter
    chords = sorted([a for a in quantized_sequence.text_annotations if (a.annotation_type == CHORD_SYMBOL)], key=(lambda chord: chord.quantized_step))
    prev_step = None
    prev_figure = NO_CHORD
    for chord in chords:
        if (chord.quantized_step >= end_step):
            break
        elif (chord.quantized_step < start_step):
            prev_step = chord.quantized_step
            prev_figure = chord.text
            continue
        if (chord.quantized_step == prev_step):
            if (chord.text == prev_figure):
                continue
            else:
                self._reset()
                raise CoincidentChordsException(('chords    %s    and    %s    are    coincident' % (prev_figure, chord.text)))
        if (chord.quantized_step > start_step):
            if (prev_step is None):
                start_index = 0
            else:
                start_index = (max(prev_step, start_step) - start_step)
            end_index = (chord.quantized_step - start_step)
            self._add_chord(prev_figure, start_index, end_index)
        prev_step = chord.quantized_step
        prev_figure = chord.text
    if ((prev_step is None) or (prev_step < end_step)):
        if (prev_step is None):
            start_index = 0
        else:
            start_index = (max(prev_step, start_step) - start_step)
        end_index = (end_step - start_step)
        self._add_chord(prev_figure, start_index, end_index)
    self._start_step = start_step
    self._end_step = end_step
