Is it possible to use the variable rate conversion when both input rate and output rates are the same? I intend to use libsoxr as drift compensation mechanism between 2 clock domains.
When I convert from 96KHz to 48KHz it works well, but when I convert from 48KHz to 48KHz it produces audible clicks in the audio.
Yes, it is possible to use the variable rate conversion when both input rate and output rates are the same. I've just run this simple test here, using one of the supplied examples, and all seems to work as expected: ./3-options-input-fn 48000 48000 2 0 0 4 20 < input.f32 > output.f32
Note that with variable-rate conversion, the sample-rates given in soxr_create determine the maximum I/O ratio that will be used. So if, for example, input_sample_rate & output_sample_rate are both given as 48kHz in soxr_create, then every subsequent call to soxr_set_io_ratio must have I/O ratio <= 1; if not then audible clicks can occur—could this explain what is happening in your case?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The thing you described about the maximum I/O ratio was indeed partly cause of the distortion (the other being an out of bound write of 1 byte in another part of my code).
Am I correct that when using variable rate conversion the ratio values used in soxr_create have no relation to the actual sample rates other than defining the maximum I/O? (tests suggest this is indeed the case, but I want to make sure I'm correct)
What are the limits of the skew value when setting soxr_set_io_ratio? Should the value always be smaller or bigger than the input or output block size?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Glad to hear that you're making progress!
1st question: Yes, that's right.
2nd question: I don't think that ther has to be any particular relationship between these values (and there are no specific limits), but where the rate is changing continuously (such as in the supplied example # 5), it may be convenient to make them them the same.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Things are going very well with libsoxr and variable rate conversion!
Hope you don't mind me asking another question.
Are there any effects of choosing a specific max IO ratio (other than setting is too low)?
Is there any relationship between speed and/or quality and the max IO ratio?
For example: assume frequency ranges between (and including) 44.1 KHz & 192 KHz, would it be sufficient to set the max IO ratio using those max/min values (or a ratio of 1000 to 1), even if the actual ratio is going to be smaller? Are there any drawbacks in that case?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The only effect of specifying a higher max. IO ratio than you actually end up using is that some memory allocated at soxr_create() time for processing the higher IO ratios will remain unused—but this shouldn't usually be much of a problem.
HTH, Rob.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thank you for this wonderfull library!
Is it possible to use the variable rate conversion when both input rate and output rates are the same? I intend to use libsoxr as drift compensation mechanism between 2 clock domains.
When I convert from 96KHz to 48KHz it works well, but when I convert from 48KHz to 48KHz it produces audible clicks in the audio.
I setup the resampler like this:
And then when the sample blocks flow in I do this:
Last edit: Ruurd Adema 2017-05-23
Yes, it is possible to use the variable rate conversion when both input rate and output rates are the same. I've just run this simple test here, using one of the supplied examples, and all seems to work as expected: ./3-options-input-fn 48000 48000 2 0 0 4 20 < input.f32 > output.f32
Note that with variable-rate conversion, the sample-rates given in soxr_create determine the maximum I/O ratio that will be used. So if, for example, input_sample_rate & output_sample_rate are both given as 48kHz in soxr_create, then every subsequent call to soxr_set_io_ratio must have I/O ratio <= 1; if not then audible clicks can occur—could this explain what is happening in your case?
Hi Rob,
Thank you for your response!
The thing you described about the maximum I/O ratio was indeed partly cause of the distortion (the other being an out of bound write of 1 byte in another part of my code).
soxr_create
have no relation to the actual sample rates other than defining the maximum I/O? (tests suggest this is indeed the case, but I want to make sure I'm correct)soxr_set_io_ratio
? Should the value always be smaller or bigger than the input or output block size?Glad to hear that you're making progress!
1st question: Yes, that's right.
2nd question: I don't think that ther has to be any particular relationship between these values (and there are no specific limits), but where the rate is changing continuously (such as in the supplied example # 5), it may be convenient to make them them the same.
Hi Rob,
Things are going very well with libsoxr and variable rate conversion!
Hope you don't mind me asking another question.
Are there any effects of choosing a specific max IO ratio (other than setting is too low)?
Is there any relationship between speed and/or quality and the max IO ratio?
For example: assume frequency ranges between (and including) 44.1 KHz & 192 KHz, would it be sufficient to set the max IO ratio using those max/min values (or a ratio of 1000 to 1), even if the actual ratio is going to be smaller? Are there any drawbacks in that case?
Hello again,
The only effect of specifying a higher max. IO ratio than you actually end up using is that some memory allocated at soxr_create() time for processing the higher IO ratios will remain unused—but this shouldn't usually be much of a problem.
HTH, Rob.
Thanks!