Skip to content
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

Resampling on Read and Write #21

Closed
apps4uco opened this issue Jan 26, 2023 · 4 comments
Closed

Resampling on Read and Write #21

apps4uco opened this issue Jan 26, 2023 · 4 comments

Comments

@apps4uco
Copy link

Hi I just came upon creek today, the idea of the buffers and the ability to seek in realtime is excellent.

This may be a massive scope creep, however, for a project I need to do resampling (and looping).

I have used https://crates.io/crates/rubato to do sample interpolation in another project.
Would it be possible to create a Decoder/Encoder using rubato as a wrapper to the underlying Codec?

To enable seeking it would be great for there to be 2 different caches.

I imagine that there could be a pipeline something like

Data in File Format -> Cached Buffers of float -> Cached Resampled data (at different rate) - in chronological order -> Playback sampling (possibly in reverse issue #14, or sample accurate looping)

Is any of this currently possible?

Thanks

@apps4uco
Copy link
Author

Sorry, I just saw that you had already addressed resampling in #9, although being able to cache both the decode from disk and also the resampling would be excellent.

@Be-ing
Copy link
Collaborator

Be-ing commented Jan 27, 2023

I don't think this should be done in creek because creek doesn't know what sample rate to target. Depending on the application, the target sample rate can change, potentially continuously in real time as Moiré does. Caching resampled audio doesn't make sense in that case because the cache would have to be invalidated whenever the target sample rate changes, which would require creek to still keep the cache of the un-resampled audio and resample it. Resampling all of creek's cache doesn't make sense when the sample rate can change the next time the application reads data from creek.

@Be-ing
Copy link
Collaborator

Be-ing commented Jan 27, 2023

I do however think it should be easier to pass data from creek to rubato. I have been contributing to the audio crate to create a API to pass audio data between crates and have a work-in-progress branch of rubato using it. I asked the Symphonia maintainer about using the audio crate as well and they expressed some interest.

@Be-ing
Copy link
Collaborator

Be-ing commented Jul 10, 2023

Closing as out of scope

@Be-ing Be-ing closed this as completed Jul 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants