ertk.preprocessing.AudioClipProcessor
- class ertk.preprocessing.AudioClipProcessor(config: ERTKConfig)
Bases:
InstanceProcessorProcesses raw audio data.
- __init__(config: ERTKConfig) None
Methods
process_file(path[, sr])Process individual audio file.
process_files(paths, batch_size[, sr])Process a set of files.
Inherited Methods
__init__(config)finish()Perform any cleanup necesasry (e.g.
friendly_name()Get the friendly name for this processor.
get_config_type()Get the configuration type for this processor.
get_default_config()Get the default configuration for this processor.
get_processor_class(name)Get the class for the named processor.
make_processor(name, config)Create an instance of the named processor.
process_all(xs, batch_size, **kwargs)Process all instances in batches.
process_batch(batch, **kwargs)Process a batch of instances.
process_instance(x, **kwargs)Process a single audio clip.
valid_processors()Get a list of all registered processor names.
Attributes
feature_namesThe names of the features produced by this processor.
- process_file(path: PathLike | str, sr: float | None = None) ndarray
Process individual audio file.
- Parameters:
- path: pathlike or str
The path to an audio file.
- sr: float, optional
Target sample rate. If not given, then each audio file is loaded with its native sample rate. Otherwise audio data is resampled to this sample rate.
- Returns:
- processed: np.ndarray
Processed instance.
- process_files(paths: Iterable[str | PathLike], batch_size: int, sr: float | None = None) Iterable[ndarray]
Process a set of files.
- Parameters:
- paths: iterables of path or iterable of str
Paths to audio files.
- batch_size: int
Batch size. Note that if
batch_size != 1then eithersrmust be given, or all files must have the same native sample rate.- sr: float, optional
Target sample rate. If not given, then each audio file is loaded with its native sample rate. Otherwise audio data is resampled to this sample rate.
- Returns:
- processed: iterable of np.ndarray
Iterable of processed instances.