class_docstr: Adds an audio backdoor trigger to a set of audio examples. Works for a single example or a batch of examples.
docstr: Initialize a CacheAudioTrigger instance.
  
  :param sampling_rate: Positive integer denoting the sampling rate for x.
  :param backdoor_path: The path to the audio to insert as a trigger.
  :param duration: Duration of the trigger in seconds. Default `None` if full trigger is to be used.
code: def __init__(
      self,
      sampling_rate: int = 16000,
      backdoor_path: str = "../../../utils/data/backdoors/cough_trigger.wav",
      duration: Optional[float] = None,
      **kwargs,
  ):
      """
      Initialize a CacheAudioTrigger instance.
  
      :param sampling_rate: Positive integer denoting the sampling rate for x.
      :param backdoor_path: The path to the audio to insert as a trigger.
      :param duration: Duration of the trigger in seconds. Default `None` if full trigger is to be used.
      """
      trigger, bd_sampling_rate = librosa.load(
          backdoor_path, mono=True, sr=None, duration=duration
      )
  
      if sampling_rate != bd_sampling_rate:
          print(
              f"Backdoor sampling rate {bd_sampling_rate} does not match with the sampling rate provided."
              "Resampling the backdoor to match the sampling rate."
          )
          trigger, _ = librosa.load(
              backdoor_path,
              mono=True,
              sr=sampling_rate,
              duration=duration,
          )
      super().__init__(trigger, **kwargs)
  
file_path: adversarial-robustness-toolbox/art/attacks/poisoning/perturbations/audio_perturbations.py
imports: from typing import Optional
  import librosa
  import numpy
label_desc: Use image node_id 1 to create a new CacheAudioTrigger object from inherited base classes: CacheTrigger with example: obj = CacheAudioTrigger(sampling_rate, backdoor_path, duration)