athena.transform.feats.read_wav

The model reads audio sample from wav file.

Module Contents

Classes

ReadWav Read audio sample from wav file, return sample data and sample rate.

Functions

read_wav(wavfile, audio_channels=1) read wav from file
class athena.transform.feats.read_wav.ReadWav(config: dict)

Bases: athena.transform.feats.base_frontend.BaseFrontend

Read audio sample from wav file, return sample data and sample rate.

classmethod params(cls, config=None)

Set params. :param config: contains one optional parameters: audio_channels(int, default=1). :return: An object of class HParams, which is a set of hyperparameters as

name-value pairs.
call(self, wavfile, speed=1.0)

Get audio data and sample rate from a wavfile. :param wavfile: filepath of wav

speed: Speed of sample channels wanted (float, default=1.0)
Returns:2 values. The first is a Tensor of audio data. The second return value is the sample rate of the input wav file, which is a tensor with float dtype.
athena.transform.feats.read_wav.read_wav(wavfile, audio_channels=1)

read wav from file args: audio_channels = 1 returns: tf.squeeze(audio_data * 32768, axis=-1), tf.cast(sample_rate, dtype=tf.int32)