code: def testExtractMelodiesStatistics(self):
      music_testing_lib.add_track_to_sequence(
          self.note_sequence,
          0,
          [
              (12, 100, 2, 4),
              (11, 1, 6, 7),
              (10, 100, 8, 10),
              (9, 100, 11, 14),
              (8, 100, 16, 40),
              (7, 100, 41, 42),
          ],
      )
      music_testing_lib.add_track_to_sequence(
          self.note_sequence, 1, [(12, 127, 2, 4), (14, 50, 2, 8)]
      )
      music_testing_lib.add_track_to_sequence(
          self.note_sequence, 2, [(12, 127, 0, 1)]
      )
      music_testing_lib.add_track_to_sequence(
          self.note_sequence, 3, [(12, 127, 2, 4), (12, 50, 6, 8)]
      )
  
      quantized_sequence = sequences_lib.quantize_note_sequence(
          self.note_sequence, steps_per_quarter=1
      )
  
      _, stats = melody_pipelines.extract_melodies(
          quantized_sequence,
          min_bars=1,
          gap_bars=1,
          min_unique_pitches=2,
          ignore_polyphonic_notes=False,
      )
  
      stats_dict = dict((stat.name, stat) for stat in stats)
      self.assertEqual(
          stats_dict["polyphonic_tracks_discarded"].count, 1
      )
      self.assertEqual(
          stats_dict["melodies_discarded_too_short"].count, 1
      )
      self.assertEqual(
          stats_dict["melodies_discarded_too_few_pitches"].count, 1
      )
      self.assertEqual(
          stats_dict["melody_lengths_in_bars"].counters,
          {
              float("-inf"): 0,
              0: 0,
              1: 0,
              2: 0,
              10: 1,
              20: 0,
              30: 0,
              40: 0,
              50: 0,
              100: 0,
              200: 0,
              500: 0,
          },
      )
  
imports: from absl.testing import absltest
  from magenta.common import testing_lib
  from magenta.pipelines import melody_pipelines
  from note_seq import constants
  from note_seq import melodies_lib
  from note_seq import sequences_lib
  from note_seq import testing_lib
  from note_seq.protobuf import music_pb2
label_desc: Use image node_id 12 for calling the MelodyPipelinesTest obj's underlying member method code with example usage: obj.testExtractMelodiesStatistics() without return types