Welcome to Tarteel ML’s documentation!

Indices and tables

utils.audio

Utility functions for processing audio.

utils.audio.convert_audio(audio_filepath: str, output_folder: str, bitrate: int = 16, sample_rate: int = 44100, use_cache: bool = True, verbose: bool = False) → str

Converts the given audio into raw audio with the given bitrate and sample rate.

Defaults are set to match Google Speech Recognition’s requirements.

Parameters:
  • audio_filepath – Relative file name of the audio file to process.
  • output_folder – Directory to put raw audio in
  • bitrate – Audio bitrate
  • sample_rate – Audio sampling rate in Hz
  • use_cache – Use the audio file already in the output directory if found
  • verbose – Talk a lot.
Returns:

Absolute filepath to the converted audio file.

Return type:

raw_audio_path

utils.audio.detect_audio_type(audio_filepath: str) → str

Returns the type of audio encoding.

Currently uses ffprobe to get this information.

Parameters:audio_filepath – Absolute path to the audio file to process.
Returns:The audio encoding type.
Return type:audio_type