class_docstr: Convolve the audio with a randomly selected impulse response.
  Impulse responses can be created using e.g. http://tulrich.com/recording/ir_capture/
  Impulse responses are represented as audio (ideally wav) files in the given ir_path.
class_docstr_tok: ["Convolve","the","audio","with","a","randomly","selected","impulse","response",".","Impulse","responses","can","be","created","using","e.g",".","http",":","\/\/tulrich.com\/recording\/ir_capture\/","Impulse","responses","are","represented","as","audio","(","ideally","wav",")","files","in","the","given","ir_path","."]
code: def apply(self, samples: NDArray[np.float32], sample_rate: int):
      ir, sample_rate2 = self.__load_ir(
          self.parameters["ir_file_path"], sample_rate
      )
      if sample_rate != sample_rate2:
          # This will typically not happen, as librosa should automatically resample the
          # impulse response sound to the desired sample rate
          raise Exception(
              "Recording sample rate {} did not match Impulse Response signal"
              " sample rate {}!".format(sample_rate, sample_rate2)
          )
  
      if samples.ndim > 1:
          signal_ir = []
          for i in range(samples.shape[0]):
              channel_conv = convolve(samples[i], ir)
              signal_ir.append(channel_conv)
          signal_ir = np.array(signal_ir, dtype=samples.dtype)
      else:
          signal_ir = convolve(samples, ir)
  
      max_value = max(np.amax(signal_ir), -np.amin(signal_ir))
      if max_value > 0.0:
          scale = 0.5 / max_value
          signal_ir *= scale
      if self.leave_length_unchanged:
          signal_ir = signal_ir[..., : samples.shape[-1]]
      return signal_ir
  
file_path: audiomentations/audiomentations/augmentations/apply_impulse_response.py
imports: import functools
  import random
  import warnings
  from pathlib import Path
  from typing import List, Union
  import numpy
  from numpy.typing import NDArray
  from scipy.signal import convolve
  from audiomentations.core.audio_loading_utils import load_sound_file
  from audiomentations.core.transforms_interface import BaseWaveformTransform
  from audiomentations.core.utils import find_audio_files_in_paths
label_desc: Use image node_id 4 for calling the ApplyImpulseResponse obj's underlying member method code with example usage: obj.apply(samples, sample_rate) and returns: signal_ir