babycat_DecodeArgs

Struct members

struct babycat_DecodeArgs

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

uint64_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.

uint64_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 start_time_milliseconds is specified, then end_time_milliseconds must be greater. The resulting

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 frame_rate_hz is equal to the audio’s original frame rate.

uint32_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 num_channels 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 convert_to_mono 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.

uint32_t resample_mode

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

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

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

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

uint32_t decoding_backend

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