class_docstr: Convert melody sequences to integer indices, abstract base class.
class_docstr_tok: ["Convert","melody","sequences","to","integer","indices",",","abstract","base","class","."]
docstr: Transform a NoteSequence into a list of melody event indices.
  
  Args:
    ns: NoteSequence proto containing the melody to encode.
  
  Returns:
    ids: List of melody event indices.
code: def encode_note_sequence(self, ns):
      """Transform a NoteSequence into a list of melody event indices.
  
      Args:
        ns: NoteSequence proto containing the melody to encode.
  
      Returns:
        ids: List of melody event indices.
      """
      qns = self._quantize_note_sequence(ns)
  
      melody = [note_seq.MELODY_NO_EVENT] * qns.total_quantized_steps
      for note in sorted(qns.notes, key=lambda note: note.start_time):
          melody[note.quantized_start_step] = note.pitch
          if note.quantized_end_step < qns.total_quantized_steps:
              melody[note.quantized_end_step] = note_seq.MELODY_NOTE_OFF
  
      return self._encode_melody_events(melody)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import tempfile
  import note_seq
  from note_seq import performance_lib
  import pygtrie
  from tensor2tensor.data_generators import text_encoder
label_desc: Use image node_id 5 for calling the TextMelodyEncoderBase obj's underlying member method code with example usage: obj.encode_note_sequence(ns) and returns: self