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

Allow processing square buffers. #347

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

psobot
Copy link
Member

@psobot psobot commented Jun 25, 2024

Fixes #336. (cc @mttbernardini)

This PR fixes the issue that occurs when passing a square (i.e.: (x, x)) buffer into a Plugin instance. Like #338, this PR adds caching of the last-detected channel layout to each Plugin instance, making the following example pass:

board = Pedalboard([Reverb(), Gain()])
with AudioFile("file_with_17_stereo_samples.wav") as f:
    while f.tell() < f.frames:
        # Read three frames at a time; but the last frame will
        # end up with only two samples in it.
        output = board(f.read(3), f.samplerate)

Prior to this PR, the above example would have failed as the last f.read(3) call would return an array of shape (2, 2).

@psobot psobot added the bug Something isn't working label Jun 25, 2024
@mttbernardini
Copy link

Hey @psobot, thank you for fixing this. Does this PR include the "memorization" feature as in the AudioFile scenario, i.e. process (n, 0) or (0, n) to hint the layout for the next buffer call?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Any Plugin cannot process stereo buffers containing only 2 samples
2 participants