Skip to main content

ClikaRT::processor::AudioProcessor

class

Header: ClikaRT/processor/processor.h

A config-driven audio feature processor. Move-only.

One parameterized pipeline (selected by the config's feature type) turns audio into features: the raw waveform, a log-mel spectrogram, or a log-mel filterbank. Every fallible operation returns Result<T>; the library never throws.

Static member functions

from_huggingface()

static AudioProcessor from_huggingface(std::string_view path, StreamOrDevice where = {})

Load a HuggingFace audio preprocessor (preprocessor_config.json). path is the model directory OR the json file itself. where binds the default placement. path is copied, not retained.

Declared in ClikaRT/processor/processor.h, line 242

from_directory()

static AudioProcessor from_directory(std::string_view path, StreamOrDevice where = {})

Load from a model directory, detecting the preprocessor format present (currently HuggingFace). path is copied, not retained.

Declared in ClikaRT/processor/processor.h, line 247

from_config()

static AudioProcessor from_config(const AudioProcessorConfig& config, StreamOrDevice where = {})

Build from an explicit config; no config file needed. config is read during the call.

Declared in ClikaRT/processor/processor.h, line 252

from_args()

static AudioProcessor from_args(
    std::optional<std::int64_t> sampling_rate = {},
    std::optional<std::int64_t> feature_size = {},
    std::optional<std::int64_t> n_fft = {},
    std::optional<std::int64_t> hop_length = {},
    StreamOrDevice where = {}
)

Build directly from the COMMON log-mel knobs: no config file, no config object. Pass {} for any knob to take its default (16 kHz / 80 mel bins / n_fft 400 / hop 160). For the full STFT/mel/normalization surface, build an AudioProcessorConfig and use from_config.

Declared in ClikaRT/processor/processor.h, line 259

Member functions

AudioProcessor()

AudioProcessor(AudioProcessor&&) noexcept

move-construct (the source becomes an empty shell)

Declared in ClikaRT/processor/processor.h, line 274

operator=()

AudioProcessor& operator=(AudioProcessor&&) noexcept

move-assign

Declared in ClikaRT/processor/processor.h, line 275

~AudioProcessor()

~AudioProcessor()

destructor

Declared in ClikaRT/processor/processor.h, line 276

process(string_view, StreamOrDevice)

Tensor process(std::string_view path, StreamOrDevice where = {}) const

Decode an audio file, resample to the configured rate + downmix to mono, then compute features → a Float32 Tensor (shape per the configured feature type). where overrides the bound placement.

Declared in ClikaRT/processor/processor.h, line 282

process(Span< uint8_t>, StreamOrDevice)

Tensor process(ClikaRT::Span<const std::uint8_t> bytes, StreamOrDevice where = {}) const

Decode an audio file, resample to the configured rate + downmix to mono, then compute features → a Float32 Tensor (shape per the configured feature type). where overrides the bound placement.

Declared in ClikaRT/processor/processor.h, line 285

process(Span< float>, int, StreamOrDevice)

Tensor process(
    ClikaRT::Span<const float> waveform,
    int sample_rate,
    StreamOrDevice where = {}
) const

Decode an audio file, resample to the configured rate + downmix to mono, then compute features → a Float32 Tensor (shape per the configured feature type). where overrides the bound placement.

Declared in ClikaRT/processor/processor.h, line 289

process(Tensor, int, StreamOrDevice)

Tensor process(
    const Tensor& waveform,
    int sample_rate,
    StreamOrDevice where = {}
) const

Decode an audio file, resample to the configured rate + downmix to mono, then compute features → a Float32 Tensor (shape per the configured feature type). where overrides the bound placement.

Declared in ClikaRT/processor/processor.h, line 295

process(string_view, AudioProcessOptions, StreamOrDevice)

Tensor process(
    std::string_view path,
    const AudioProcessOptions& options,
    StreamOrDevice where = {}
) const

Decode an audio file, resample to the configured rate + downmix to mono, then compute features → a Float32 Tensor (shape per the configured feature type). where overrides the bound placement.

Declared in ClikaRT/processor/processor.h, line 303

process(Span< uint8_t>, AudioProcessOptions, StreamOrDevice)

Tensor process(
    ClikaRT::Span<const std::uint8_t> bytes,
    const AudioProcessOptions& options,
    StreamOrDevice where = {}
) const

Decode an audio file, resample to the configured rate + downmix to mono, then compute features → a Float32 Tensor (shape per the configured feature type). where overrides the bound placement.

Declared in ClikaRT/processor/processor.h, line 306

process(Span< float>, int, AudioProcessOptions, StreamOrDevice)

Tensor process(
    ClikaRT::Span<const float> waveform,
    int sample_rate,
    const AudioProcessOptions& options,
    StreamOrDevice where = {}
) const

Decode an audio file, resample to the configured rate + downmix to mono, then compute features → a Float32 Tensor (shape per the configured feature type). where overrides the bound placement.

Declared in ClikaRT/processor/processor.h, line 310

process(Tensor, int, AudioProcessOptions, StreamOrDevice)

Tensor process(
    const Tensor& waveform,
    int sample_rate,
    const AudioProcessOptions& options,
    StreamOrDevice where = {}
) const

Decode an audio file, resample to the configured rate + downmix to mono, then compute features → a Float32 Tensor (shape per the configured feature type). where overrides the bound placement.

Declared in ClikaRT/processor/processor.h, line 315