You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Apologies if I'm being dense here, but I can't figure out how to use the resampler of only parts of a continuous signal.
My use case: I have an audio-app that plays back a buffer and adds some FX. I only render e.g. 512 samples at a time but my internal sample-rate is always 44.1 kHz, whereas the audio-card may wants 48 kHz, or 96 kHz or whatever.
So I need to fill 512 samples at 96 kHz, and now I need to feed in 235.2 audio-samples into the resampler. What do I do with the 0.2 samples left over? I need to roll this into the next call, but the resampler-class doesn't know anything about that. I think it always assume that you resample an entire buffer, all in one go, instead of parts of it over multiple calls. Or does it's filters continue from their previous state?
Again: maybe I'm being dense here, but I can't figure out how to write a FIFO buffer for the KFR resampler.
I want to feed in as much data as required to get "N" output samples, and then do that over and over, feeding data in as needed.
The text was updated successfully, but these errors were encountered:
The resampler class can process signals split into buffers of different sizes by maintaining an internal state.
Note that you should use the same instance of the samplerate_converter class for all subsequent calls for the same continuous signal, rather than creating a new instance for every fragment. Therefore, you should create two instances (one per channel) for stereo audio.
In your case, simply call input_size_for_output, passing the desired output buffer length to get the required input buffer size for the next call to process.
It will return either 236 or 235 samples in your case.
The process function takes two parameters:
output: Output buffer. Pass a univector with the desired size (512).
input: Input buffer. Pass a univector of the size returned by input_size_for_output or greater. The resampler consumes as many samples as needed to produce 512 output samples and returns the number of input samples read as the result of the process call. Adjust the input accordingly to skip these samples.
Apologies if I'm being dense here, but I can't figure out how to use the resampler of only parts of a continuous signal.
My use case: I have an audio-app that plays back a buffer and adds some FX. I only render e.g. 512 samples at a time but my internal sample-rate is always 44.1 kHz, whereas the audio-card may wants 48 kHz, or 96 kHz or whatever.
So I need to fill 512 samples at 96 kHz, and now I need to feed in 235.2 audio-samples into the resampler. What do I do with the 0.2 samples left over? I need to roll this into the next call, but the resampler-class doesn't know anything about that. I think it always assume that you resample an entire buffer, all in one go, instead of parts of it over multiple calls. Or does it's filters continue from their previous state?
Again: maybe I'm being dense here, but I can't figure out how to write a FIFO buffer for the KFR resampler.
I want to feed in as much data as required to get "N" output samples, and then do that over and over, feeding data in as needed.
The text was updated successfully, but these errors were encountered: