class_docstr: Apply tanh (hyperbolic tangent) distortion to the audio. This technique is sometimes
  used for adding distortion to guitar recordings. The tanh() function can give a rounded
  "soft clipping" kind of distortion, and the distortion amount is proportional to the
  loudness of the input and the pre-gain. Tanh is symmetric, so the positive and
  negative parts of the signal are squashed in the same way. This transform can be
  useful as data augmentation because it adds harmonics. In other words, it changes
  the timbre of the sound.
  
  See this page for examples: http://gdsp.hf.ntnu.no/lessons/3/17/
code: def apply(self, samples: NDArray[np.float32], sample_rate: int):
      # Find out how much to pre-gain the audio to get a given amount of distortion
      percentile = 100 - 99 * self.parameters["distortion_amount"]
      threshold = np.percentile(abs(samples), percentile)
      gain_factor = 0.5 / (threshold + 1e-6)
  
      # Distort the audio
      distorted_samples = np.tanh(gain_factor * samples)
  
      # Scale the output so its loudness matches the input
      rms_before = calculate_rms(samples)
      if rms_before > 1e-9:
          rms_after = calculate_rms(distorted_samples)
          post_gain = rms_before / rms_after
          distorted_samples = post_gain * distorted_samples
  
      return distorted_samples
  
file_path: audiomentations/audiomentations/augmentations/tanh_distortion.py
imports: import random
  import numpy
  from numpy.typing import NDArray
  from audiomentations.core.transforms_interface import BaseWaveformTransform
  from audiomentations.core.utils import calculate_rms
label_desc: Use image node_id 3 for calling the TanhDistortion obj's underlying member method code with example usage: obj.apply(samples, sample_rate) and returns: distorted_samples