audiomate.corpus.conversion

This module contains classes to convert the data of a corpus. It is for example used to convert all audio data to wav files.

Audio File Conversion

class audiomate.corpus.conversion.AudioFileConverter(sampling_rate=16000, separate_file_per_utterance=False, force_conversion=False)[source]

Base class for converters that convert all audio to a specific format. A converter creates a new instance of a corpus, so that all audio files meet given requirements.

Parameters:
  • sampling_rate (int) – Target sampling rate to convert audio to.
  • separate_file_per_utterance (bool) – If True, every utterance in the resulting corpus is in a separate file. If False, the file/utt structure will be preserved.
  • force_conversion (bool) – If True, all utterances will be converted whether or not it already matches the target format. If False, only utterances not matching the target format will be converted. Others are reference to the original files.
convert(corpus, target_audio_path)[source]

Convert the given corpus.

Parameters:
  • corpus (Corpus) – The input corpus.
  • target_audio_path (str) – The path where the audio files of the converted corpus should be saved.
Returns:

The newly created corpus.

Return type:

Corpus

class audiomate.corpus.conversion.WavAudioFileConverter(num_workers=4, sampling_rate=16000, separate_file_per_utterance=False, force_conversion=False)[source]

Class that creates a new instance of a corpus, so that all audio files meet given requirements.

convert(corpus, target_audio_path)

Convert the given corpus.

Parameters:
  • corpus (Corpus) – The input corpus.
  • target_audio_path (str) – The path where the audio files of the converted corpus should be saved.
Returns:

The newly created corpus.

Return type:

Corpus