-
Notifications
You must be signed in to change notification settings - Fork 72
fix: aliasing in sinc downsampling #197
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
base: master
Are you sure you want to change the base?
Conversation
Add rate-dependent configuration to Interpolator and use it in Sinc to apply an anti-aliasing bandwidth when downsampling. The Interpolator trait now exposes set_hz_to_hz, set_playback_hz_scale, and set_sample_hz_scale (default no-ops); Converter methods call them automatically. Fixes #174
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.
Pull request overview
This PR fixes aliasing issues in the Sinc interpolator during downsampling by introducing rate-dependent configuration. The changes allow the Sinc interpolator to automatically adjust its anti-aliasing bandwidth based on the sample rate conversion ratio.
Changes:
- Extended the
Interpolatortrait with three rate configuration methods (set_hz_to_hz,set_playback_hz_scale,set_sample_hz_scale) with default no-op implementations - Modified the
Sincinterpolator to store and apply a bandwidth parameter for anti-aliasing - Updated
Convertermethods to automatically configure interpolators with rate information - Added a test to verify anti-aliasing works correctly during downsampling
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| dasp_interpolate/src/lib.rs | Added rate configuration methods to the Interpolator trait with comprehensive documentation |
| dasp_interpolate/src/sinc/mod.rs | Added bandwidth field and implemented rate configuration methods to apply anti-aliasing |
| dasp_signal/src/interpolate.rs | Modified from_hz_to_hz constructor and setter methods to call interpolator rate configuration |
| dasp_signal/tests/interpolate.rs | Added test verifying anti-aliasing filters out frequencies above Nyquist during downsampling |
| CHANGELOG.md | Documented the changes and additions to the API |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Converted to draft: spectrogram reveals that it's got some issues. |
395163e to
f2f0197
Compare
|
There, that should be better. |
f2f0197 to
9668870
Compare
a38546d to
b94688e
Compare
Add rate-dependent configuration to
Interpolatorand use it in Sinc to apply an anti-aliasing bandwidth when downsampling. TheInterpolatortrait now exposesset_hz_to_hz,set_playback_hz_scale, andset_sample_hz_scale(default no-ops). TheConvertermethods call them automatically, without API breakage.Fixes #174