class_docstr: Add isotropic noise
class_docstr_tok: ["Add","isotropic","noise"]
code: def __call__(self, x, uttid=None, train=True):
      if not train:
          return x
      x = x.astype(numpy.float32)
  
      # 1. Get ratio of noise to signal in sound pressure level
      if uttid is not None and self.utt2ratio is not None:
          ratio = self.utt2ratio[uttid]
      else:
          ratio = self.state.uniform(self.lower, self.upper)
  
      if self.dbunit:
          ratio = 10 ** (ratio / 20)
      scale = ratio * numpy.sqrt((x**2).mean())
  
      # 2. Get noise
      if self.utt2noise is not None:
          # Get noise from the external source
          if uttid is not None:
              noise, rate = self.utt2noise[uttid]
          else:
              # Randomly select the noise source
              noise = self.state.choice(list(self.utt2noise.values()))
          # Normalize the level
          noise /= numpy.sqrt((noise**2).mean())
  
          # Adjust the noise length
          diff = abs(len(x) - len(noise))
          offset = self.state.randint(0, diff)
          if len(noise) > len(x):
              # Truncate noise
              noise = noise[offset : -(diff - offset)]
          else:
              noise = numpy.pad(
                  noise, pad_width=[offset, diff - offset], mode="wrap"
              )
  
      else:
          # Generate white noise
          noise = self.state.normal(0, 1, x.shape)
  
      # 3. Add noise to signal
      return x + noise * scale
  
imports: import librosa
  import numpy
  import scipy
  import soundfile
  from espnet.utils.io_utils import SoundHDF5File
label_desc: Use image node_id 3 for calling the NoiseInjection obj's underlying member method code with example usage: obj.__call__(x, uttid, train) and returns: unknown, x