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 = int(uid[0:4])
      tempo = tempos[id]
  
      # note to midi index
      midis = [
          midi_mapping[note] if note != "rest" else 0 for note in midis
      ]
  
      # 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("opencpop_{} {}\n".format(uid, " ".join(phns)))
      utt2spk.write("opencpop_{} {}\n".format(uid, "opencpop"))
  
      # apply bit convert, there is a known issue in direct convert in format wavscp
      cmd = "sox {}.wav -c 1 -t wavpcm -b 16 -r {} {}/opencpop_{}.wav".format(
          os.path.join(audio_dir, uid),
          tgt_sr,
          wav_dumpdir,
          uid,
      )
      os.system(cmd)
  
      wavscp.write(
          "opencpop_{} {}/opencpop_{}.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("opencpop_{} {}\n".format(uid, " ".join(label_entry)))
      score = dict(
          tempo=tempo,
          item_list=["st", "et", "lyric", "midi", "phns"],
          note=note_list,
      )
      writer["opencpop_{}".format(uid)] = score
  
file_path: espnet/egs2/opencpop/svs1/local/data_prep.py
imports: import argparse
  import os
  import shutil
  import librosa
  import miditoolkit
  import numpy
  from espnet2.fileio.score_scp import SingingScoreWriter
label_desc: Use image node_id 5 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