(self, ns)
return self._encode_melody_events(melody)
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.
Transform a NoteSequence into a list of melody event indices.
Transform a NoteSequence into a list of melody event indices .
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)
def encode_note_sequence ( self , ns ) : 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 )