Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.

Poll

Which resampler to do you use most often, in general?

None (blep synthesis)
[ 5 ] (31.3%)
Linear interpolation
[ 2 ] (12.5%)
Cubic interpolation
[ 3 ] (18.8%)
Lanczos sinc interpolation
[ 6 ] (37.5%)

Total Members Voted: 25

Topic: DUMB resampling preferences (Read 4904 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

DUMB resampling preferences

I've been told that the Lanczos sinc interpolation sounds like crap compared to linear interpolation. I would like some honest feedback.

I would also welcome contributions to replace the Lanczos resampler, if there's something better which is about as fast, and also low latency. It does not need to be minimum phase, but it needs to be able to change its sample rate at a moment's notice without any effect on the waveform, and it needs to have a latency no higher than ~1ms. Integrated low pass filtering where increment rate is > 1.0 is welcome. Optional SIMD acceleration would be great as well.

I say this because the new modplay library, which handles S3M and XM playback by default, uses this Lanczos filter exclusively, and if you set interpolation to "None", then it oversamples the input to the filter by 32x and increases the playback rate accordingly.

I've updated the frequency plots, this time with multiple window types, and basic plots for the cheaper resamplers. I also decided to stick with a filter half size of 16 samples for the sinc resampler.

Upsampling a 1-22050Hz sweep to 48000Hz:
Zero order hold
Linear interpolation
Cubic interpolation
Lanczos windowed sinc
Blackman windowed sinc
Nuttal 3 term windowed sinc
C.R.Helmrich's 2 term windowed sinc

Downsampling a 1-24000Hz sweep to 44100Hz:
Zero order hold
Linear interpolation
Cubic interpolation
Lanczos windowed sinc
Blackman windowed sinc
Nuttal 3 term windowed sinc
C.R.Helmrich's 2 term windowed sinc

And for the one I picked out of the lot, the Nuttal 3 term, being fed a 256 sample wide sine wave, which is then swept linearly from 256Hz to 5644800Hz. (Or, in terms of the original sine wave, 1Hz to 22050Hz.) In other words, a severe torture test.
Nuttal 3 term torture test

DUMB resampling preferences

Reply #1
I find myself returning to cubic interpolation every time I try one of the others. But the Lanczos one is particularly bad in that it makes most parts sound "numb", but here and there you can hear a bit that sounds almost unfiltered. Also it seems to over-amplify some isolated beats so they sound like a very present crackling even though they blend in very well with the other interpolation options.
And another issue, that is most annoying in lower quality tracks, is that it seems to shape the white background noise of certain samples to match the pitch of the sample. The other interpolation options seem to get rid of (or at least not shape) that background noise reasonably well.

DUMB resampling preferences

Reply #2
Yeah, I've heard that opinion twice now. I would like something better. I don't like the idea of using linear interpolation, that chokes out any time the sample ratio exceeds 1.0.

DUMB resampling preferences

Reply #3
I'm convinced sinc is the way to go; it's the most mathematically accurate. Perhaps there are other kernels worth considering though? Have you tried asking Garf or one of our other DSP gurus?

DUMB resampling preferences

Reply #4
I posted a topic in General Audio to get some attention here, and also included references to the source code. Yeah, I know, crossposting is bad, but that is also a general low latency resampling question.

DUMB resampling preferences

Reply #5
I don't use dumb much, even though I have it in my foobar2000 installation. My usual "players" for mods are schismtracker or xmplay (or my own Psycle tracker).

I've posted on your question about the problem with the lanczos resampler, but I would like to expand on the modules side of the subject:

When listening to module files, sound accuracy is not always the expected result.

MOD format files used to be composed either on hardware (amiga, either with an added filter, or simply limited by the resampler playback speed), or on ZOH (no interpolation) resamplers. During the 90's, they were also composed on PC's, but generally with either ZOH or linear interpolation resampling.

Now, there are also two types of MOD files, chiptunes (or SID like tunes), and module songs. Chiptunes use very small samples, that generally are expected to sound with aliasing, because they mimic better what they emulate.  Song tunes on the other hand, don't usually expect big aliasing, but since usually the samples were recorded at  8Khz, 12Khz, 16Khz, when played out of a sinc resampler, they sound very different to how they were composed.  This is especially true with some bass lines, and quite important in some snares and hihats. I have experienced that some snares and hihats actually sound louder with sinc resampling (out of Psycle) than with linear resampling, and that is because they have very strong signals near the nyquist frequency that when played with linear of cubic resampling, are smeared.
So, mathematically, the sinc is correct, but acoustically, that's not how it was meant to be.
(I am including in this group the many variations of 4 and 8 channel mods, not only the .mod extension)

Then, moving on to S3M and XM,  S3M files made with soundblasters are either expected to be played with ZOH (when only composed with Scream tracker), or linear interpolation (when the composer liked to play them on programs like cubic player, or simply because they were unplayable on scream tracker, like a couple of 32 tracks S3M files that I have that were really composed in Stream tracker). S3M files made in GUS, are expected to be played with linear interpolation or cubic interpolation, but I don't really know what better mimics the output of a Gravis.
The quality of the samples varies a lot, because S3M format had a size limit and because many times, samples were obtained from other mods. That's why sometimes S3M files will sound bad with sinc interpolation (like MODs), and some others will benefit.
As an example, I have the S3M files from purple motion for the game Death Rally (they are freely available). In the game, they played in mono at 22Khz and with ZOH. A couple of them play nicely with sinc, but others sound strange because a couple of samples had quite a low samplerate.

XM files are most of the time expected to be played with linear interpolation or better. If they sound good on sinc or not depends exclusively of the quality of the samples (i.e. their recorded samplerate). Usually they aren't as bad as MOD in this regard. Said that, this is applicable to songs made really with FastTracker. Files made with MadTracker, MilkyTracker or Modplug tracker might sound better on sinc.

IT modules could be grouped in three types: Those that were composed with software linear interpolation, those that were composed on hardware (AWE32, GUS), and those that were composed with the filter engine.
The first group should be treated similar to XM files. The second group should be playable with sinc interpolation, and the third group would probably play better with sinc interpolation.


So, the conclusion is that playback accuracy is very file dependant. I was thinking that probably the best way to play MOD files is with a ZOH, AND with a resampler working at 22Khz or 32Khz. I remember seeing this feature in one player, but I can't remember anymore which one it was.

For S3M files, i would default to linear interpolation, but the user could want to play specific modules like the MODs described above.
For XM files, i would not default to sinc, but maybe depending on the size of the samples, choose it.
For IT files, i would default to cubic, but could choose sinc depending if the file uses filters or not, and maybe depending also in the sample sizes/samplerate.

DUMB resampling preferences

Reply #6
You may be happy to know that the modplay (st3play and ft2play) portions now obey resampler settings, instead of forcing either zoh or sinc.

DUMB resampling preferences

Reply #7
I agree wit JAZ. As much as I love sinc (or at least try to love it), it sounds really...weird, for lack of a better term, when used with lower quality samples. Cubic doesn't necessarily sound better in these cases, it just reduces the noise shaping artifacts (Can dithering solve this?).

For example, I have a MOD file and an XM that I chose to illustrate the point - the MOD file has some aliasing when played with cubic, but there is significantly lower noise audible in each sample. The XM on the other hand has aliasing with cubic in the beginning, but sinc resampling shines here; it is clearly better with higher quality samples.

XM file
MOD file

I disabled playptmod/modplay and chip-o-matic, and I use sinc anyway because I'd much rather have noise artifacts than aliasing. It sounds interesting and "smooth", at least in my opinion anyway.