-
Notifications
You must be signed in to change notification settings - Fork 175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Calculate in advance the number of samples needed for generating a fixed size #175
Comments
Hi @scjurgen . @SoapGentoo , @arthurt, do you have any ideas? |
If the internal SRC state is currently unbuffered, then perhaps this is the answer: int required_input_samples = round(desired_output_samples / src_ratio) This would seem to match the observed pattern you provided for the first few blocks of 64 output samples. Note that it's independent of the size of the sinc filter. As noted in similar discussion in #6, I'm not confident in my understanding of this since the source code is a bit intimidating. |
Thanks to a thread here on github by @arlofaria I started looking deeper into the implementation and
I used it than like this (fixed ratio only):
I tested this for all 3 SINC's and for various ratios and framesize. Some still have problems with not consuming all input data due to the handling in prepare_data where it loads data at the current end position. |
Hi @arlofaria I started with your approach, but soon I realised that the handling is a bit more complex. Your answer in the other thread was helpful to dig into it.
|
Nice! Great to see that someone is willing to dig deeper into this :-) |
Is there any (easy) possibility to obtain in advance the samples needed for generating a certain amount of data?
e.g.: Convert from 48000 to 44100 with SINC.
To obtain 64 samples I need to feed i.e. 69 or 70 samples (a sequence like 70,69,70,70,69,70,70).
I would like to know in advance how many samples I actually have to provide to obtain deterministic 64 samples without having too much buffering going on in the sinc filter it self.
This would save some buffering overhead in a host application and is needed to maintain parallel control data to the sample data in realtime applications. I know that I can obtain usable data by peeking into the filter:
The text was updated successfully, but these errors were encountered: