-
Notifications
You must be signed in to change notification settings - Fork 24
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
Enable resampling #1
Comments
I agree that some kind of resampling behaviour would be desirable. But I don't think it needs to be tied up in the Reader class. It could be provided by a utility class instead. Even as a sperate class, sample rate conversion actually seems quite involved (to do it right), just based on a bit of reading on wikipedia. |
I guess this is hard to do in plain Ruby, anyway. But libsamplerate (http://www.mega-nerd.com/SRC/) looks promising! |
That does look like a good library, and I bet the code could be ported to Ruby without too much trouble. Unfortunately, the license is GPL, which is rather restrictive and I think totally incompatible with MIT. Too bad... |
This paper looks pretty promising: |
Actually, this one looks even better: The paper discusses a hybrid solution of first oversampling audio with discrete methods (FIR filter) and then interpolate with a polynomial interpolator. I think I'll try to get such a hybrid method implemented as part of https://github.com/jamestunnell/spcore |
I added resampling functions to my all-ruby signal processing library, spcore (see https://github.com/jamestunnell/spcore). With a little bit of application logic you could add a resampling feature without too much trouble. |
To celebrate the 10th anniversary of this issue being opened I thought I would chime in! 😉 This issue raises a good point - I agree it's confusing that it's possible to convert the channel count or sample format of a sample buffer, but not the sample rate. However, in my opinion I don't think adding support for resampling would be the right thing to do. My understanding (not an expert) is that there's not a single canonical way to resample, and that it is somewhat complicated compared to changing the number of channels or sample format. I wouldn't want to make an assumption about what resampling method to use or add the relatively large amount of code that would have to be maintained and that I wouldn't be 100% confident about getting right. Although a 3rd party library like That said, that ship has sailed and I don't think it would be a good idea to remove the conversion functionality that already exists. Perhaps in the future a different API could be added that makes it more clear that the sample rate is an informational field (like the I'll keep this issue open in case anyone has any further comments, and if there is no response after some amount of time will close it. |
Consider the following code:
I would assume to get 22050 samples instead of 44100, thus a resampled version of the file. Am i the only one feeling this way?
The text was updated successfully, but these errors were encountered: