pydiogment.augt

  • Description: time based augmentation techniques/manipulations for audio data.
pydiogment.augt.eliminate_silence(infile)[source]

Eliminate silence from voice file using ffmpeg library.

Args:
  • infile (str) : Path to get the original voice file from.
Returns:
list including True for successful authentication, False otherwise and a percentage value representing the certainty of the decision.
pydiogment.augt.random_cropping(infile, min_len=1)[source]

Crop the infile with an input minimum duration.

Args:
  • infile (str) : Input filename.
  • min_len (float) : Minimum duration for randomly cropped excerpt
pydiogment.augt.resample_audio(infile, sr)[source]

Resample the signal according a new input sampling rate with respect to the Nyquist-Shannon theorem.

Args:
  • infile (str) : input filename/path.
  • sr (int) : new sampling rate.
pydiogment.augt.reverse(infile)[source]

Inverses the input signal to play from the end to the beginning and writes it to an output file

Args:
  • infile (str): Input filename.
pydiogment.augt.shift_time(infile, tshift, direction)[source]

Augment audio data by shifting the time in the file. Signal can be shifted to the left or right.

Note:
Time shifting is simply moving the audio to left/right with a random second. If shifting audio to left (fast forward) with x seconds, first x seconds will mark as 0 (i.e. silence). If shifting audio to right (back forward) with x seconds, last x seconds will mark as 0 (i.e. silence).
Args:
  • infile (str) : Input filename.
  • tshift (int) : Signal time shift in seconds.
  • direction (str) : shift direction (to the left or right).
pydiogment.augt.slow_down(input_file, coefficient=0.8)[source]

Slow or stretch a wave.

Args:
  • infile (str) : Input filename.
  • coefficient (float) : coefficient caracterising the slowing degree.
pydiogment.augt.speed(input_file, coefficient=1.25)[source]

Speed or shrink a wave.

Args:
  • infile (str) : Input filename.
  • coefficient (float) : coefficient caracterising the speeding degree.