code: def corrupt_phase(
      waveform,
      sample_rate,
      scale: float = 0.5,
      n_fft: float = 0.032,
      win_length: Optional[float] = None,
      hop_length: float = 0.008,
      window: Optional[str] = "hann",
  ):
      """Adding random noise to the phase of input waveform.
  
      Args:
          waveform (torch.Tensor): audio signal (..., time)
          sample_rate (int): sampling rate in Hz
          scale (float): scale factor for the phase noise
          n_fft (float): length of FFT (in second)
          win_length (float or None): The window length (in second) used for STFT
              If None, it is treated as equal to n_fft
          hop_length (float): The hop size (in second) used for STFT
          window (str or None): The windowing function applied to the signal after
              padding with zeros
  
      Returns:
          ret (torch.Tensor): phase-corrupted signal (..., time)
      """
      n_fft = int(sample_rate * n_fft)
      if hop_length is None:
          hop_length = n_fft // 4
      else:
          hop_length = int(sample_rate * hop_length)
      if win_length is None:
          win_length = n_fft
      if window is not None:
          window_func = getattr(torch, f"{window}_window")
          window = window_func(
              win_length, dtype=waveform.dtype, device=waveform.device
          )
      spec = torch.stft(
          waveform,
          n_fft,
          hop_length,
          win_length,
          window=window,
          return_complex=True,
      )
      phase = torch.angle(spec)
      phase = torch.randn_like(phase) * scale + phase
      spec = torch.abs(spec) * torch.exp(1j * phase)
      ret = torch.functional.istft(
          spec,
          n_fft,
          hop_length,
          win_length,
          window=window,
          length=waveform.size(-1),
      )
      return ret
  
imports: import math
  import random
  from typing import Dict, List, Optional, Tuple, Union
  import numpy
  import torch
  import torchaudio
label_desc: Use image node_id 17 for calling a global function with example usage: corrupt_phase(waveform, sample_rate, scale, n_fft, win_length, hop_length, window) and returns: ret