| Summary: | New resampler: audible aliasing when upsampling 11k or 22k audio | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Eric Wasylishen <ewasylishen> |
| Component: | audio | Assignee: | Ryan C. Gordon <icculus> |
| Status: | ASSIGNED --- | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | sezeroz |
| Version: | HG 2.0 | ||
| Hardware: | x86 | ||
| OS: | Other | ||
| Attachments: |
11025Hz wav with 5kHz sine wave
Another test case Resampler w.i.p. |
||
Created attachment 3083 [details]
Another test case
Here is another test case I'm using, it's a sine sweep from 0 to 5.5kHz, at a 11025Hz sample rate. Cases to test are upsampling to e.g. 44100 or 48000.
If the resampler is performing correctly, the spectrogram of the resampled file should show nothing much above 5.5kHz.
I'm working on a patch for this that lowers the cutoff frequency (currently it is at 0.5*inrate which is too high).
(In reply to Eric Wasylishen from comment #1) > I'm working on a patch for this that lowers the cutoff frequency (currently > it is at 0.5*inrate which is too high). Did you ever make any progress on a patch? I'd like to get it into revision control. Thanks, --ryan. Sorry about neglecting this! Will try to dust off my patch later today or tomorrow and get back to you. Thanks, we're trying to get a 2.0.8 RC tomorrow and would like to include this. Created attachment 3178 [details] Resampler w.i.p. Here's what I have as of tonight.. On the plus side, it fixes this bug, https://bugzilla.libsdl.org/show_bug.cgi?id=3955 https://bugzilla.libsdl.org/show_bug.cgi?id=3956 and the quality seems good when resampling whole files using "testresample". Testing sine sweeps, upsampling and downsampling them, and looking at the spectrogram with sox. On the downside, this is more of a rewrite than a small patch. I broke streaming (clicking artifact when doing: SDL_AUDIODRIVER=disk SDL_DISKAUDIOFILE=44100.raw FREQ=44100 ./test/loopwave some-96k-input.wav using the patch to the disk driver from https://bugzilla.libsdl.org/show_bug.cgi?id=3848#c10 ), so the patch is not usable as-is. It's also ~2x as slow as what's currently in hg Aside from fixing streaming, it could use some more documentation / tests / assertions against buffer overflows. I can have a look on the weekend at fixing the streaming clicking problem and tidying it a bit more. Okay, we'll hold off on this for 2.0.8. Thanks! |
Created attachment 2981 [details] 11025Hz wav with 5kHz sine wave The new resampler seems to be letting too much aliasing through. Here is a test case to see the problem: testresample sine11025.wav sine44100.wav 44100 1 sox sine44100.wav -n spectrogram -o sine44100.png open sine44100.png You can hear the aliasing (warning, it's a loud / high pitched sine tone) - sine11025.wav contains a pure sine at 5kHz, but the resampled sine44100.wav will have an additional tone at 6kHz that's almost the same volume as the 5kHz one. (There are other test cases you can use - e.g. generate 1 second of white noise at 11025Hz in Audacity and upsample it with testresample, or upsample the 22.05kHz test/sample.wav from SDL to 44.1kHz)