-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix audio resampling functionality #7858
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
Open
sakertooth
wants to merge
113
commits into
LMMS:master
Choose a base branch
from
sakertooth:fix-resampling
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
+467
−715
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AudioResampler
6bb4aed
to
0ede71a
Compare
…cate buffers unnecessarily
messmerd
reviewed
Jun 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quick review
Appreciate the review 👍 |
Keeping some of the review unresolved because I consider them to bring up outstanding issues we should eventually resolve, maybe before merge. |
Was not used
… output sample rates
To avoid lifetime issues
Adding a disclaimer that certain plugins may not work well (or at all) with certain sample rates is a better option than doing the resampling directly in LADSPA. Most times it wont be necessary and adds more complexity.
Pretty much done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR improves the usage of libsamplerate when resampling.
Changes:
Redirect all libsamplerate usage to
AudioResampler
. This ensures we are always using libsamplerate with the same resampling logic, preventing bugs.Call
src_process
as many times as necessary to resample all of the source audio we need to fill up the destination buffer. Before, LMMS was only callingsrc_process
once, and assumed that libsamplerate always read all of the input data it gave it, which isn't necessarily true and can cause input frames to be dropped. Any input frames not read in the current iteration are stored within a small array inAudioResampler
and will be used on the next call tosrc_process
.Remove the use of buffer margins. This was needed to accommodate for libsamplerate's transport delay, but this involved expensive copies and allocations, and the margin added may not be adequate depending on how long the transport delay needs to be, which wasn't accounted for. To fix this, we allow the transport delay to occur on the onset of when
AudioResampler
is first used, which then the delay will be removed on subsequent resampling.