(quantized_sequence, melodies)
return chord_progressions, list(stats.values())
Extracts a chord progression from the quantized NoteSequence for melodies.

  This function will extract the underlying chord progression (encoded as text
  annotations) from `quantized_sequence` for each monophonic melody in
  `melodies`.  Each chord progression will be the same length as its
  corresponding melody.

  Args:
    quantized_sequence: A quantized NoteSequence object.
    melodies: A python list of Melody instances.

  Returns:
    chord_progressions: A python list of ChordProgression instances, the same
        length as `melodies`. If a progression fails to be extracted for a
        melody, the corresponding list entry will be None.
    stats: A dictionary mapping string names to `statistics.Statistic` objects.
Extracts a chord progression from the quantized NoteSequence for melodies.
Extracts a chord progression from the quantized NoteSequence for melodies .
def extract_chords_for_melodies(quantized_sequence, melodies):
  """Extracts a chord progression from the quantized NoteSequence for melodies.

  This function will extract the underlying chord progression (encoded as text
  annotations) from `quantized_sequence` for each monophonic melody in
  `melodies`.  Each chord progression will be the same length as its
  corresponding melody.

  Args:
    quantized_sequence: A quantized NoteSequence object.
    melodies: A python list of Melody instances.

  Returns:
    chord_progressions: A python list of ChordProgression instances, the same
        length as `melodies`. If a progression fails to be extracted for a
        melody, the corresponding list entry will be None.
    stats: A dictionary mapping string names to `statistics.Statistic` objects.
  """
  chord_progressions = []
  stats = dict([('coincident_chords', statistics.Counter('coincident_chords'))])
  for melody in melodies:
    try:
      chords = ChordProgression()
      chords.from_quantized_sequence(
          quantized_sequence, melody.start_step, melody.end_step)
    except CoincidentChordsError:
      stats['coincident_chords'].increment()
      chords = None
    chord_progressions.append(chords)

  return chord_progressions, list(stats.values())
def extract_chords_for_melodies ( quantized_sequence , melodies ) : chord_progressions = [ ] stats = dict ( [ ( 'coincident_chords' , statistics . Counter ( 'coincident_chords' ) ) ] ) for melody in melodies : try : chords = ChordProgression ( ) chords . from_quantized_sequence ( quantized_sequence , melody . start_step , melody . end_step ) except CoincidentChordsError : stats [ 'coincident_chords' ] . increment ( ) chords = None chord_progressions . append ( chords ) return chord_progressions , list ( stats . values ( ) )