On 05/22/2010 12:38 PM, Erik de Castro Lopo wrote:
Jörn Nettingsmeier wrote:
unfortunately, both zita-resampler and
libsamplerate seem to represent
the sample rate ratio internally as a fraction of two integers,
I haven't looked at the code for zita-resampler but for libsamplerate,
what you said above, is not correct.
Sepcifically :
a) The API has an src_ratio field which is of type double floating
point. Thats how you chose your resampling ratio.
b) Internally, the time distance between samples is also calcutated
in double floating point.
The only place integers are used for time offsets is in the calculation
of the indices into the filter table and the interpolation between two
adjacent values in the table.
sorry, i have now found the reasons for my confusion:
the console output of sndfile-resample contains a ratio in double, but
uses the default formatting of six decimals. however, the internal
precision is higher.
furthermore, sndfile-resample prints the source and target sampling
rates. however, these values are taken from libsndfile information (i.e.
the headers of the input and output files). in this context, sample
rates are limited to integers, so libsamplerate chooses the nearest
integer value to set the target sample rate in the output file header.
i found that this has nothing to do with the internal SRC state, which
is solely governed by the ratio (in double precision), not the source
and target sample rates.
sorry again for the noise, and thanks for all the helpful comments!
best,
jörn