pliers.filters.AudioResamplingFilter

class pliers.filters.AudioResamplingFilter(target_sr=44100, resample_type='kaiser_best', **librosa_kwargs)[source]

Bases: AudioFilter

Librosa-based audio resampling Filter.

Uses librosa.core.resample function.

Parameters
  • target_sr (float) – Target sampling rate (in Hz).

  • resample_type (str) – Type of resampling. Must be one of ‘kaiser_best’, ‘kaiser_fast’, ‘scipy’, ‘fft’ or ‘polyphase’. See librosa.core.resample documentation for more details.

  • librosa_kwargs – Optional keyword args passed onto the librosa resampling function.

__init__(target_sr=44100, resample_type='kaiser_best', **librosa_kwargs)[source]
transform(stims, validation='strict', *args, **kwargs)

Executes the transformation on the passed stim(s).

Parameters
  • stims (str, Stim, list) –

    One or more stimuli to process. Must be one of:

    • A string giving the path to a file that can be read in as a Stim (e.g., a .txt file, .jpg image, etc.)

    • A Stim instance of any type.

    • An iterable of stims, where each element is either a string or a Stim.

  • validation (str) –

    String specifying how validation errors should be handled. Must be one of:

    • ’strict’: Raise an exception on any validation error

    • ’warn’: Issue a warning for all validation errors

    • ’loose’: Silently ignore all validation errors

  • args – Optional positional arguments to pass onto the internal _transform call.

  • kwargs – Optional positional arguments to pass onto the internal _transform call.