Closed AndrewBelt closed 6 years ago
Answered by mark4o on IRC. Summary:
I refer to a "frame" as N adjacent samples representing a moment in time for all N channels.
in_len
and out_len
are in units of frames.
speex_resampler_process_interleaved_*()
assumes that your interleaved samples have a stride of channels
samples, i.e. tightly packed frames.
To process interleaved samples with a certain stride, simply call speex_resampler_process_*()
for each channel, as such.
spx_uint32_t in_len_bak = *in_len;
spx_uint32_t out_len_bak = *out_len;
for (int i = 0; i < st->nb_channels; i++) {
*in_len = in_len_bak;
*out_len = out_len_bak;
speex_resampler_process_float(st, i, in + i, in_len, out + i, out_len);
}
How does
speex_resampler_set_input_stride
andspeex_resampler_set_output_stride
work? Is the stride intended to be the number of bytes or samples until the next frame inspeex_resampler_process_interleaved_float
? It doesn't look like it, since its default value is 1. I would expect it to benb_channels * sizeof(float)
.