code: def testStartCapture_Iterate_Signal(self):
      start_time = 1.0
      captor = self.midi_hub.start_capture(
          120,
          start_time,
          stop_signal=midi_hub.MidiSignal(
              type="control_change", control=1
          ),
      )
  
      for msg in self.capture_messages[:-1]:
          threading.Timer(
              0.2 * msg.time, self.port.callback, args=[msg]
          ).start()
  
      captured_seqs = []
      for captured_seq in captor.iterate(
          signal=midi_hub.MidiSignal(type="note_off")
      ):
          captured_seqs.append(captured_seq)
  
      self.assertLen(captured_seqs, 4)
  
      expected_seq = music_pb2.NoteSequence()
      expected_seq.tempos.add(qpm=120)
      expected_seq.total_time = 3
      testing_lib.add_track_to_sequence(
          expected_seq, 0, [Note(1, 64, 2, 3)]
      )
      self.assertProtoEquals(captured_seqs[0], expected_seq)
  
      expected_seq = music_pb2.NoteSequence()
      expected_seq.tempos.add(qpm=120)
      expected_seq.total_time = 4
      testing_lib.add_track_to_sequence(
          expected_seq, 0, [Note(1, 64, 2, 4), Note(2, 64, 3, 4)]
      )
      self.assertProtoEquals(captured_seqs[1], expected_seq)
  
      expected_seq = music_pb2.NoteSequence()
      expected_seq.tempos.add(qpm=120)
      expected_seq.total_time = 5
      testing_lib.add_track_to_sequence(
          expected_seq,
          0,
          [Note(1, 64, 2, 5), Note(2, 64, 3, 4), Note(3, 64, 4, 5)],
      )
      self.assertProtoEquals(captured_seqs[2], expected_seq)
  
      expected_seq = music_pb2.NoteSequence()
      expected_seq.tempos.add(qpm=120)
      expected_seq.total_time = 6
      testing_lib.add_track_to_sequence(
          expected_seq,
          0,
          [Note(1, 64, 2, 5), Note(2, 64, 3, 4), Note(3, 64, 4, 6)],
      )
      self.assertProtoEquals(captured_seqs[3], expected_seq)
  
imports: import collections
  import queue
  import threading
  import time
  from magenta.common import concurrency
  from magenta.interfaces.midi import midi_hub
  import mido
  from note_seq import testing_lib
  from note_seq.protobuf import music_pb2
  import tensorflow.compat.v1
label_desc: Use image node_id 19 for calling the MidiHubTest obj's underlying member method code with example usage: obj.testStartCapture_Iterate_Signal() without return types