Skip to content

simple#

audioclass.batch.simple #

Module for providing a simple audio batch iterator.

Attributes#

Classes#

SimpleIterator(recordings, samplerate, input_samples, batch_size=BATCH_SIZE, audio_dir=None) #

Bases: BaseIterator

A straightforward iterator for processing audio recordings in batches.

This iterator loads and preprocesses audio recordings one at a time, then groups them into batches for efficient processing by machine learning models.

It's ideal for smaller datasets.

Notes

For larger datasets or situations requiring parallel processing, consider using alternative iterators like TFDatasetIterator or a custom implementation.

Parameters:

Name Type Description Default
recordings List[Recording]

A list of Recording objects representing the audio files to be processed.

required
samplerate int

The target sample rate for resampling the audio data (in Hz).

required
input_samples int

The number of samples per audio frame.

required
batch_size int

The number of audio frames per batch. Defaults to BATCH_SIZE.

BATCH_SIZE
audio_dir Optional[Path]

The directory containing the audio files. Defaults to None.

None

Functions#