code: def segment_audio(info_list, dest_root, min_slice_duration):
      """
      Combines audio into >= min_slice_duration segments of the same speaker,
      and writes the combined transcripts into a manifest.
  
      Args:
          info_list: list of StmUtterance objects with transcript information.
          dest_root: path to output destination
          min_slice_duration: min number of seconds per output audio slice
      """
      info_list = sorted(
          info_list, key=attrgetter("speaker_id", "begin")
      )
  
      prev_id = None  # For checking audio concatenation
      id_count = 0
  
      sample_rate, audio_data = None, None
      transcript_buffer = ""
      audio_buffer = []
      buffer_duration = 0.0
  
      # Iterate through utterances to build segments
      for info in info_list:
          if info.speaker_id != prev_id:
              # Scrap the remainder in the buffers and start next segment
              prev_id = info.speaker_id
              id_count = 0
  
              sample_rate, audio_data = wavfile.read(
                  os.path.join(
                      dest_root,
                      "full_audio_wav",
                      info.filename + ".wav",
                  )
              )
              transcript_buffer = ""
              audio_buffer = []
              buffer_duration = 0.0
  
          # Append utterance info to buffers
          transcript_buffer += info.transcript
          channel = 0 if info.channel.lower() == "a" else 1
          audio_buffer.append(
              audio_data[
                  floor(info.begin * sample_rate) : ceil(
                      info.end * sample_rate
                  ),
                  channel,
              ]
          )
          buffer_duration += info.end - info.begin
  
          if buffer_duration < min_slice_duration:
              transcript_buffer += " "
          else:
              # Write out segment and transcript
              id_count += 1
              write_one_segment(
                  dest_root,
                  info.speaker_id,
                  id_count,
                  np.concatenate(audio_buffer, axis=0),
                  sample_rate,
                  buffer_duration,
                  transcript_buffer,
              )
  
              transcript_buffer = ""
              audio_buffer = []
              buffer_duration = 0.0
  
imports: import argparse
  import glob
  import json
  import os
  import re
  import subprocess
  import sys
  from collections import namedtuple
  from math import ceil, floor
  from operator import attrgetter
  import numpy
  import scipy.io.wavfile
  from tqdm import tqdm
label_desc: Use image node_id 6 for calling a global function with example usage: segment_audio(info_list, dest_root, min_slice_duration) without return types