-
Notifications
You must be signed in to change notification settings - Fork 95
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
Add getSampleRate() #24
base: default
Are you sure you want to change the base?
Conversation
This is a convenience function to allow applications to easily know what sample rate the stretcher was initalized with to check if it needs to be recreated.
I am in two minds about this one. The content of the commit of course looks fine, but I'm not convinced that it is worth adding to the API for. The stretcher has two sorts of construction parameters - fixed ones like sample rate and channel count, and variable ones like ratios and options. At the moment you can query the channel count after construction (even though it never changes), but not the sample rate, so there is undeniably an inconsistency there. However, I'm not entirely sure it is a good thing to be able to query the channel count either, and I slightly regret including that method already. I think the stretcher object should be contained (in application code) in a context that fixes these construction parameters, so its sample rate and channel count are known explicitly, rather than expecting to query these values and make a new stretcher if they don't match - which may be prone to cause hard-to-diagnose errors. Can you persuade me otherwise? |
Hi. Thank you for your thoughtful consideration. I implemented a filter wrapper for rubberband in the MLT framework. In that framework, a filter does not know the sample rate of the audio that it will be receiving at construction time. So the filter needs to detect the rate when it receives its first audio. In some cases, for example, if the user changes the project configuration, the filter could spontaneously receive audio frames with different channel count or sampling frequency. Here is the line of code that runs with every frame to detect the changing conditions: I understand that it is not difficult or expensive to keep a member variable to remember the frequency. So this change is only a convenience in this scenario. From my perspective, the reason to accept the patch would be:
I do not feel strongly about the patch. I only offer it because it was easy for me to produce and test in my environment. So if you reject the patch, my application will still be fine. But if you accept it, I will probably change my code to use the new function. |
Any verdict on this ? |
This is a convenience function to allow applications to easily know
what sample rate the stretcher was initalized with to check if it
needs to be recreated.