We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3955 - New resampler: aliasing when downsampling
Summary: New resampler: aliasing when downsampling
Status: NEW
Alias: None
Product: SDL
Classification: Unclassified
Component: audio (show other bugs)
Version: 2.0.7
Hardware: x86 Other
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-11-11 18:44 UTC by Eric Wasylishen
Modified: 2017-11-11 18:44 UTC (History)
0 users

See Also:


Attachments
sine sweep test case (187.54 KB, audio/x-wav)
2017-11-11 18:44 UTC, Eric Wasylishen
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Wasylishen 2017-11-11 18:44:49 UTC
Created attachment 3084 [details]
sine sweep test case

The issue is SDL_ResampleAudio currently lowpass filters at 0.5*inrate, even in the case when outrate < inrate. In other words, the part of the "band-limited resampling" paper that says - "if rho < 1... the step-size through the filter table is reduced.." is not implemented.

Here is a test case with a 0-48kHz sine sweep sampled at 96kHz.

testresample sweep96k.wav sweep44100.wav 44100 1
sox sweep44100.wav -n spectrogram -o sweep44100.png
open sweep44100.png

(careful with the volume if you play these!)

It should be resampled as a single upward sweep that stops at the 22kHz nyquist limit with silence after that, but currently you get a siren effect due to the aliasing.
I have a patch in the works for this.