code: def process_utterance(
      writer,
      wavscp,
      text,
      utt2spk,
      label,
      audio_dir,
      wav_dumpdir,
      segment,
      midi_mapping,
      tempos,
      tgt_sr=24000,
  ):
      (
          uid,
          lyrics,
          phns,
          midis,
          syb_dur,
          phn_dur,
          keep,
      ) = segment.strip().split("|")
      phns = phns.split(" ")
      midis = midis.split(" ")
      syb_dur = syb_dur.split(" ")
      phn_dur = phn_dur.split(" ")
      keep = keep.split(" ")
  
      # load tempo from midi
      id = uid[0:3]
      tempo = tempos[str(id)]
      song, piece, singer = uid.split("_")
      original_uid = uid
      uid = "_".join([singer, song, piece])
      # type convert
      phn_dur = [float(dur) for dur in phn_dur]
      syb_dur = [float(syb) for syb in syb_dur]
      keep = [int(k) for k in keep]
      note_list = create_score(uid, phns, midis, syb_dur, keep)
  
      text.write("{} {}\n".format(uid, " ".join(phns)))
      utt2spk.write("{} {}\n".format(uid, uid.split("_")[0]))
  
      # apply bit convert, there is a known issue in direct convert in format wavscp
      cmd = "sox {}.wav -c 1 -t wavpcm -b 16 -r {} {}/{}.wav".format(
          os.path.join(audio_dir, original_uid),
          tgt_sr,
          wav_dumpdir,
          uid,
      )
      os.system(cmd)
  
      wavscp.write("{} {}/{}.wav\n".format(uid, wav_dumpdir, uid))
  
      running_dur = 0
      assert len(phn_dur) == len(phns)
      label_entry = []
      for i in range(len(phns)):
          start = running_dur
          end = running_dur + phn_dur[i]
          label_entry.append(
              "{:.3f} {:.3f} {}".format(start, end, phns[i])
          )
          running_dur += phn_dur[i]
  
      label.write("{} {}\n".format(uid, " ".join(label_entry)))
      score = dict(
          tempo=tempo,
          item_list=["st", "et", "lyric", "midi", "phns"],
          note=note_list,
      )
      writer["{}".format(uid)] = score
  
imports: import argparse
  import glob
  import logging
  import os
  import re
  import shutil
  import subprocess
  import wave
  from typing import List, TextIO, Tuple
  import miditoolkit
  import numpy
  from local.pinyin_dict import PINYIN_DICT
  from tqdm import tqdm
  from espnet2.fileio.score_scp import SingingScoreWriter
label_desc: Use image node_id 11 for calling a global function with example usage: process_utterance(writer, wavscp, text, utt2spk, label, audio_dir, wav_dumpdir, segment, midi_mapping, tempos, tgt_sr) without return types