bacpipe.core.audio_processor
Classes
|
Helper class for all methods related to loading and padding audio. |
|
PurePath subclass that can make system calls. |
- class bacpipe.core.audio_processor.AudioHandler(model, padding, audio_dir, bool_slowdown=False, slowdown_rate=None, **kwargs)[source]
Bases:
objectHelper class for all methods related to loading and padding audio.
- __init__(model, padding, audio_dir, bool_slowdown=False, slowdown_rate=None, **kwargs)[source]
Helper class for all methods related to loading and padding audio.
- Parameters:
model (Model object) – has attributes for all the model characteristics like sample rate, segment length etc. as well as the methods to run the model
padding (str) – padding function to use for where padding is necessary
audio_dir (pathlib.Path object) – path to audio dir
- prepare_audio(sample)[source]
Use bacpipe pipeline to load audio file, window it according to model specific window length and preprocess the data, ready for batch inference computation. Also log file length and shape for metadata files.
- Parameters:
sample (pathlib.Path or str) – path to audio file
- Returns:
audio frames preprocessed with model specific preprocessing
- Return type:
torch.Tensor