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 #9

Closed
Be-ing opened this issue Jan 22, 2022 · 2 comments
Closed

resampling #9

Be-ing opened this issue Jan 22, 2022 · 2 comments

Comments

@Be-ing
Copy link
Collaborator

Be-ing commented Jan 22, 2022

It would be really convenient if creek could do automatic resampling to a specified sample rate. When JACK is running at 44100 Hz, I want to be able to play 48000 kHz files at the correct pitch. This could already be done by the user after getting audio data from creek. However, that is not trivial because resampling changes the rate at which creek needs to read from the file to get the desired number of frames at the desired sample rate. This could be done with rubato.

@Be-ing
Copy link
Collaborator Author

Be-ing commented Jan 22, 2022

Implementing this could lay the groundwork for realtime timestreching which also requires changing the rate at which data is read from the filesystem. Unfortunately there are not any Rust libraries for timestretching (yet).

@Be-ing
Copy link
Collaborator Author

Be-ing commented Jan 27, 2022

I was under the mistaken impression that variable speed playback required reading data from files at different speeds. I took a closer look at how it works in Mixxx and the code that reads audio from files only uses the playback rate to determine the direction. Mixxx uses a fixed block size which is assumed to be good enough for any settings of playback sample rate, audio file sample rate, and buffer size that a user may want. In practice this works. I cannot recall any bugs reported for Mixxx that were are result of that block size being too small. creek's default block size is already twice Mixxx's block size. If an application developer finds that is insufficient, they can already adjust the block size when initializing the ReadDiskStream.

So I don't think resampling should be within creek's scope. It is up to the code using creek to resample the audio from the file. For variable speed playback, the application can already request to read however many frames it needs from creek then resample those to the output buffer length.

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

1 participant