babycat_WaveformArgs

Struct members

struct babycat_WaveformArgs

Specifies what transformations to apply to the audio during the decoding process.

The default value for this struct will tell Babycat to decode audio as-is and not change anything.

Public Members

uintptr_t start_time_milliseconds

We discard any audio before this millisecond offset. By default, this does nothing and the audio is decoded from the beginning. Negative offsets are invalid.

uintptr_t end_time_milliseconds

We discard any audio after this millisecond offset. By default, this does nothing and the audio is decoded all the way to the end. If is specified, then must be greater.

uint32_t frame_rate_hz

A destination frame rate to resample the audio to. Do not specify this parameter if you wish Babycat to preserve the audio’s original frame rate. This does nothing if is equal to the audio’s original frame rate.

uint16_t num_channels

Set this to a positive integer n to select the first n channels stored in the audio file. By default, Babycat will return all of the channels in the original audio. This will raise an exception if you specify a greater than the actual number of channels in the audio.

bool convert_to_mono

Set to true to average all channels into a single monophonic (mono) channel. If num_channels = n is also specified, then only the first n channels will be averaged. Note that cannot be set to true while also setting num_channels = 1.

bool zero_pad_ending

If you set this to true, Babycat will zero-pad the ending of the decoded waveform to ensure that the output waveform’s duration is exactly end_time_milliseconds - start_time_milliseconds. By default, zero_pad_ending = false, in which case the output waveform will be shorter than end_time_milliseconds - start_time_milliseconds if the input audio is shorter than end_time_milliseconds. Note that setting zero_pad_ending = true is mutually exclusive with setting repeat_pad_ending = true.

bool repeat_pad_ending

If you set this to true, Babycat will repeat the audio waveform to ensure that the output waveform’s duration is exactly end_time_milliseconds - start_time_milliseconds. By default, repeat_pad_ending = false, in which case the output waveform will be shorter than end_time_milliseconds - start_time_milliseconds if the input audio is shorter than end_time_milliseconds. Note that setting repeat_pad_ending = true is mutually exclusive with setting zero_pad_ending = true.

uint32_t resample_mode

Sets which resampling method is used if you have set . This usually defaults to the highest-accuracy resampler compiled into Babycat. The available choices are:

  • [RESAMPLE_MODE_LIBSAMPLERATE](crate::constants::RESAMPLE_MODE_LIBSAMPLERATE)

  • [RESAMPLE_MODE_BABYCAT_LANCZOS](crate::constants::RESAMPLE_MODE_BABYCAT_LANCZOS)

  • [RESAMPLE_MODE_BABYCAT_SINC](crate::constants::RESAMPLE_MODE_BABYCAT_SINC)

uint32_t decoding_backend

Sets which audio decoding backend to use. Currently the only available decoding backend is [DECODING_BACKEND_SYMPHONIA](crate::constants::DECODING_BACKEND_SYMPHONIA), which corresponds to the [SymphoniaDecoder](crate::decoder::SymphoniaDecoder), which is a wrapper for the library.

Relevant functions