code: def get_whitenoise(
      *,
      sample_rate: int = 16000,
      duration: float = 1,  # seconds
      n_channels: int = 1,
      seed: int = 0,
      dtype: Union[str, torch.dtype] = "float32",
      device: Union[str, torch.device] = "cpu",
      channels_first=True,
      scale_factor: float = 1,
  ):
      """Generate pseudo audio data with whitenoise
      Args:
          sample_rate: Sampling rate
          duration: Length of the resulting Tensor in seconds.
          n_channels: Number of channels
          seed: Seed value used for random number generation.
              Note that this function does not modify global random generator state.
          dtype: Torch dtype
          device: device
          channels_first: whether first dimension is n_channels
          scale_factor: scale the Tensor before clamping and quantization
      Returns:
          Tensor: shape of (n_channels, sample_rate * duration)
      """
      if isinstance(dtype, str):
          dtype = getattr(torch, dtype)
      if dtype not in [
          torch.float64,
          torch.float32,
          torch.int32,
          torch.int16,
          torch.uint8,
      ]:
          raise NotImplementedError(f"dtype {dtype} is not supported.")
      # According to the doc, folking rng on all CUDA devices is slow when there are many CUDA devices,
      # so we only fork on CPU, generate values and move the data to the given device
      with torch.random.fork_rng([]):
          torch.random.manual_seed(seed)
          tensor = torch.randn(
              [n_channels, int(sample_rate * duration)],
              dtype=torch.float32,
              device="cpu",
          )
      tensor /= 2.0
      tensor *= scale_factor
      tensor.clamp_(-1.0, 1.0)
      if not channels_first:
          tensor = tensor.t()
  
      tensor = tensor.to(device)
  
      return convert_tensor_encoding(tensor, dtype)
  
file_path: audio/test/torchaudio_unittest/common_utils/data_utils.py
imports: import os.path
  from typing import Optional, Union
  import torch
label_desc: Use image node_id 3 for calling a global function with example usage: get_whitenoise() and returns: convert_tensor_encoding