(self, ns)
return self._encode_chord_symbols(chords)
Transform a NoteSequence into a list of chord event indices.

    Args:
      ns: NoteSequence proto containing the chords to encode (as text
          annotations).

    Returns:
      ids: List of chord event indices.
Transform a NoteSequence into a list of chord event indices.
Transform a NoteSequence into a list of chord event indices .
def encode_note_sequence(self, ns):
    """Transform a NoteSequence into a list of chord event indices.

    Args:
      ns: NoteSequence proto containing the chords to encode (as text
          annotations).

    Returns:
      ids: List of chord event indices.
    """
    qns = note_seq.quantize_note_sequence(ns, self._steps_per_quarter)

    chords = []
    current_chord = note_seq.NO_CHORD
    current_step = 0
    for ta in sorted(qns.text_annotations, key=lambda ta: ta.time):
      if ta.annotation_type != CHORD_SYMBOL:
        continue
      chords += [current_chord] * (ta.quantized_step - current_step)
      current_chord = ta.text
      current_step = ta.quantized_step
    chords += [current_chord] * (qns.total_quantized_steps - current_step)

    return self._encode_chord_symbols(chords)
def encode_note_sequence ( self , ns ) : qns = note_seq . quantize_note_sequence ( ns , self . _steps_per_quarter ) chords = [ ] current_chord = note_seq . NO_CHORD current_step = 0 for ta in sorted ( qns . text_annotations , key = lambda ta : ta . time ) : if ta . annotation_type != CHORD_SYMBOL : continue chords += [ current_chord ] * ( ta . quantized_step - current_step ) current_chord = ta . text current_step = ta . quantized_step chords += [ current_chord ] * ( qns . total_quantized_steps - current_step ) return self . _encode_chord_symbols ( chords )