class_docstr: Encodes a melody that is flattened into only rhythm (with velocity).
  
  TextMelodyEncoderAbsolute encodes the melody as a sequence of MELODY_NO_EVENT,
  MELODY_NOTE_OFF, and pitch ids. This representation contains no
  MELODY_NOTE_OFF events, and instead of pitch ids, uses velocity-bin ids. To
  take advantage of the MelodyOneHotEncoding, this class passes the velocity bin
  range to the parent __init__ in lieu of min_pitch and max_pitch.
class_docstr_tok: ["Encodes","a","melody","that","is","flattened","into","only","rhythm","(","with","velocity",")",".","TextMelodyEncoderAbsolute","encodes","the","melody","as","a","sequence","of","MELODY_NO_EVENT",",","MELODY_NOTE_OFF",",","and","pitch","ids",".","This","representation","contains","no","MELODY_NOTE_OFF","events",",","and","instead","of","pitch","ids",",","uses","velocity-bin","ids",".","To","take","advantage","of","the","MelodyOneHotEncoding",",","this","class","passes","the","velocity","bin","range","to","the","parent","__init__","in","lieu","of","min_pitch","and","max_pitch","."]
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):
          quantized_velocity = performance_lib.velocity_to_bin(
              note.velocity, self._num_velocity_bins
          )
  
          melody[note.quantized_start_step] = quantized_velocity
  
      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 2 for calling the FlattenedTextMelodyEncoderAbsolute obj's underlying member method code with example usage: obj.encode_note_sequence(ns) and returns: self