'Converts the LeadSheet to NoteSequence proto.
Args:
velocity: Midi velocity to give each melody note. Between 1 and 127
(inclusive).
instrument: Midi instrument to give each melody note.
sequence_start_time: A time in seconds (float) that the first note (and
chord) in the sequence will land on.
qpm: Quarter notes per minute (float).
Returns:
A NoteSequence proto encoding the melody and chords from the lead sheet.'

def to_sequence(self, velocity=100, instrument=0, sequence_start_time=0.0, qpm=120.0):

    sequence = self._melody.to_sequence(velocity=velocity, instrument=instrument, sequence_start_time=sequence_start_time, qpm=qpm)
    chord_sequence = self._chords.to_sequence(sequence_start_time=sequence_start_time, qpm=qpm)
    for text_annotation in chord_sequence.text_annotations:
        if (text_annotation.annotation_type == CHORD_SYMBOL):
            chord = sequence.text_annotations.add()
            chord.CopyFrom(text_annotation)
    return sequence
