botiverse.preprocessors.Vocalize package#

Submodules#

botiverse.preprocessors.Vocalize.Vocalize module#

class botiverse.preprocessors.Vocalize.Vocalize.Vocalize(words)[source]#

Bases: object

An interface for transforming words into audio files via Google’s Text-to-Speech API and adding noise to them.

Initialize the Vocalize transformer by setting the input words and making the dataset.

Parameters:

words (list) – A list of words to be transformed into audio files

make_dataset()[source]#

Make a dataset of audio files for the given words by using Google’s Text-to-Speech API to pronounce the word in australian, british, american, indian, and south african accents.

static corrupt_dataset(words=None, sample_rate=16000, traffic=False, force_download=False)[source]#

Given a folder ‘dataset’ with folders each containing audio files, this randomly adds noise to each audio file and saves it by applying specific noise introduction logic. If noise is not found locally, it is downloaded from Google Drive.

Parameters:
  • words (list) – A list of words to be transformed into audio files (i.e., the folder names)

  • sample_rate (int) – The sample rate of the audio files

  • traffic (bool) – Whether to add traffic noise to the audio files

  • force_download (bool) – Whether to force download the noise dataset even if it already exists.

Module contents#