Skip to content

Fix stereo signal processing within audiofilters.Filter#11025

Open
relic-se wants to merge 1 commit into
adafruit:mainfrom
relic-se:audiofilters_filter_stereo
Open

Fix stereo signal processing within audiofilters.Filter#11025
relic-se wants to merge 1 commit into
adafruit:mainfrom
relic-se:audiofilters_filter_stereo

Conversation

@relic-se
Copy link
Copy Markdown

@relic-se relic-se commented May 23, 2026

Previously, left and right channels of stereo audio data were being treated as mono when processing through audiofilters.Filter. This update properly handles stereo data within this class by separating channel sample data into filter_states and filter_buffer.

For interest, @gamblor21 @todbot

Fixes #11024

Copy link
Copy Markdown
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there any tests you could expand to test this?

@relic-se
Copy link
Copy Markdown
Author

@tannewt Using the example code provided in #11024 (comment), here are the results of that test:

Screenshot 2026-05-26 at 5 06 47 PM

The stereo waveform graph above adheres to the following settings:

# Recording 1
FILTER = False
FILTER_BYPASS = True

# Recording 2
FILTER = True
FILTER_BYPASS = True

# Recording 3
FILTER = True
FILTER_BYPASS = False

Here's the same test but with varying filter frequencies:

Screenshot 2026-05-26 at 5 10 16 PM
Recording Filter Frequency (hertz)
1 22050 (nyquist of sample rate)
2 1000
3 100

I can come up with a more objective test if desired. In my subjective opinion, it sounds significantly better in stereo and mono is unaffected.

@relic-se
Copy link
Copy Markdown
Author

@tannewt The code I have provided does work, but I think there is room for optimization if you or someone else is willing to dive into it in a review.

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

Successfully merging this pull request may close these issues.

Stereo audio panning with audiofilters.Filter

2 participants