class_docstr: Apply speed purturbation to (synthetic) Tensor data
class_docstr_tok: ["Apply","speed","purturbation","to","(","synthetic",")","Tensor","data"]
code: def __getitem__(self, index):
      speed = self.rng.uniform(0.5, 2.0)
      effects = [
          ["gain", "-n", "-10"],
          [
              "speed",
              f"{speed:.5f}",
          ],  # duration of data is 0.5 ~ 2.0 seconds.
          ["rate", f"{self.sample_rate}"],
          ["pad", "0", "1.5"],  # add 1.5 seconds silence at the end
          ["trim", "0", "2"],  # get the first 2 seconds
      ]
      tensor, sample_rate = self.signals[index]
      data, _ = torchaudio.sox_effects.apply_effects_tensor(
          tensor, sample_rate, effects
      )
      return data
  
imports: import os
  import platform
  import sys
  from concurrent.futures import ProcessPoolExecutor
  from typing import List, Tuple
  from unittest import skipIf
  import numpy
  import torch
  import torchaudio
  from torchaudio_unittest.common_utils import get_whitenoise, PytorchTestCase, save_wav, skipIfNoSox, TempDirMixin
label_desc: Use image node_id 2 for calling the RandomPerturbationTensor obj's underlying member method code with example usage: obj.__getitem__(index) and returns: data