code: def testEncodeNoteSequence(self):
      encoder = music_encoders.CompositeScoreEncoder(
          [
              music_encoders.TextChordsEncoder(steps_per_quarter=4),
              music_encoders.TextMelodyEncoder(
                  steps_per_quarter=4, min_pitch=21, max_pitch=108
              ),
          ]
      )
  
      ns = note_seq.NoteSequence()
      ns.tempos.add(qpm=60)
      testing_lib.add_chords_to_sequence(ns, [("C", 0.5), ("Dm", 1.0)])
      testing_lib.add_track_to_sequence(
          ns,
          0,
          [
              (60, 127, 0.0, 0.25),
              (62, 127, 0.25, 0.75),
              (64, 127, 1.25, 2.0),
          ],
      )
      chord_ids, melody_ids = zip(*encoder.encode_note_sequence(ns))
  
      expected_chord_ids = [
          2,  # no-chord
          2,  # no-chord
          3,  # C major
          3,  # C major
          17,  # D minor
          17,  # D minor
          17,  # D minor
          17,  # D minor
      ]
  
      expected_melody_ids = [
          43,  # ON(60)
          45,  # ON(62)
          2,  # HOLD(62)
          3,  # OFF(62)
          2,  # REST
          47,  # ON(64)
          2,  # HOLD(64)
          2,  # HOLD(64)
      ]
  
      self.assertEqual(expected_chord_ids, list(chord_ids))
      self.assertEqual(expected_melody_ids, list(melody_ids))
  
imports: import tempfile
  from magenta.models.score2perf import music_encoders
  import note_seq
  from note_seq import testing_lib
  import tensorflow.compat.v1
label_desc: Use image node_id 1 for calling the CompositeScoreEncoderTest obj's underlying member method code with example usage: obj.testEncodeNoteSequence() without return types