class_docstr: Reader class for 'xml.scp'.
  
  Examples:
      key1 /some/path/a.xml
      key2 /some/path/b.xml
      key3 /some/path/c.xml
      key4 /some/path/d.xml
      ...
  
      >>> reader = XMLScpReader('xml.scp')
      >>> tempo, note_list = reader['key1']
class_docstr_tok: ["Reader","class","for","'xml.scp","'",".","Examples",":","key1","\/some\/path\/a.xml","key2","\/some\/path\/b.xml","key3","\/some\/path\/c.xml","key4","\/some\/path\/d.xml","...",">",">",">","reader","=","XMLScpReader","(","'xml.scp","'",")",">",">",">","tempo",",","note_list","=","reader","[","'key1","'","]"]
code: def __getitem__(self, key):
      score = m21.converter.parse(self.data[key])
      m = score.metronomeMarkBoundaries()
      tempo = int(m[0][2].number)
      part = score.parts[0].flat
      notes_list = []
      prepitch = -1
      st = 0
      for note in part.notesAndRests:
          dur = note.seconds
          if not note.isRest:  # Note or Chord
              lr = note.lyric
              if (
                  lr is None or lr == "" or lr == "ー"
              ):  # multi note in one syllable
                  if note.pitch.midi == prepitch:  # same pitch
                      notes_list[-1].et += dur
                  else:  # different pitch
                      notes_list.append(
                          NOTE("—", note.pitch.midi, st, st + dur)
                      )
              else:  # normal note for one syllable
                  lrs = split_lyric(
                      lr
                  )  # split lyrics into single syllable
                  for syb in lrs:
                      notes_list.append(
                          NOTE(syb, note.pitch.midi, st, st + dur)
                      )
              prepitch = note.pitch.midi
              for (
                  arti
              ) in note.articulations:  # <br> is tagged as a notation
                  if arti.name in ["breath mark"]:  # up-bow?
                      notes_list.append(NOTE("B", 0, st, st))  # , 0))
          else:  # rest note
              if prepitch == 0:
                  notes_list[-1].et += dur
              else:
                  notes_list.append(NOTE("P", 0, st, st + dur))
              prepitch = 0
          st += dur
      # NOTE(Yuning): implicit rest at the end of xml file should be removed.
      if notes_list[-1].midi == 0 and notes_list[-1].lyric == "P":
          notes_list.pop()
      return tempo, notes_list
  
imports: import argparse
  import math
  import os
  import sys
  import music21
  import numpy
  from typeguard import check_argument_types
  from espnet2.fileio.read_text import read_2columns_text
  from espnet2.fileio.score_scp import NOTE, SingingScoreWriter
label_desc: Use image node_id 2 for calling the XMLReader obj's underlying member method code with example usage: obj.__getitem__(key) and returns: tempo,  notes_list