def utterance_info_generator():
    """Yields utterance informations from each meeting.

    Utterance info is in the form of a 6-tuple:
      wav_path, diarization, spkidx, meeting_scale, start, gain.
    """
    default_diarization = np.zeros((max_dia_seg_per_utt, 2), dtype=np.int32)
    default_utt = ('0', default_diarization, -1, 0.0, 0, 0.0)
    for one_meeting in meeting_list:
      meeting_info = collections.defaultdict(list)
      sources_start_end = one_meeting['utterance_start_end']
      num_utt_in_meeting = len(sources_start_end)
      spk_num_in_meeting = {}
      new_spknum = 0
      spkids_in_meeting = []
      spk_utt_idx = collections.defaultdict(int)
      meeting_scale = float(one_meeting['meeting_scale'])
      for utt_idx in range(num_utt_in_meeting):
        start, end, spkid, wav_path = sources_start_end[utt_idx]
        spkidx = spkid2idx[spkid]
        if start >= samples:
          continue
        if end >= samples:
          end = samples
        if spkidx in spk_num_in_meeting:
          spknum = spk_num_in_meeting[spkidx]
        else:
          spknum = new_spknum
          if spknum > max_num_spk:
            continue
          spkids_in_meeting.append(spkidx)
          spk_num_in_meeting[spkidx] = spknum
          new_spknum += 1
        if use_relative_path:
          wav_path = os.path.join(base_path, wav_path)
        gain = one_meeting['utterance_gain'][utt_idx]
        # Make diarization_labels array.
        diarization = np.zeros((max_dia_seg_per_utt, 2), dtype=np.int32)
        spk_utt_idx[spknum] += 1
        diarization_info = \
            one_meeting['diarization_label'][spkid][spk_utt_idx[spknum] - 1]
        # Go over diarization segments in utterance.
        for i, segment_st_end in enumerate(diarization_info):
          segment_start, segment_end = segment_st_end
          if segment_start >= samples:
            continue
          if segment_end > samples:
            segment_end = samples
          adjusted_start = segment_start - start
          adjusted_end = segment_end - start
          diarization[i, 0] = adjusted_start
          diarization[i, 1] = adjusted_end
        meeting_info[spknum].append((wav_path, diarization, spkidx,
                                     meeting_scale, start, gain))
      for spknum in range(max_num_spk):
        if spknum in meeting_info:
          for utt in range(max_num_utt_per_spk):
            if utt < len(meeting_info[spknum]):
              yield meeting_info[spknum][utt]
            else:
              yield default_utt
        else:
          for utt in range(max_num_utt_per_spk):
            yield default_utt