Aliasing in most samplers

Hi there!

I noticed that all samplers except the ones from NYSTHI alias when pitching the sample. I thought I just bring this to your attention and I would suggest @synthi to reveal to the other developers how aliasing can be avoided.
I’m not a coder myself so I don’t know what is going on when pitching a sample, but I hope that there’s an easy way to improve the quality of all those nice samplers in Rack, and that developers share their insights to provide Rack with the highest quality DSP.
In most cases you might not notice the aliasing, but take a long 808 kick sample and change the pitch a little and you will hear it quite clearly with all those samplers.

would be nice to see a video comparison

The techniques are well known, but the problem is that many VCV devs aren’t great at DSP, and modules don’t get called out often enough for their terrible aliasing. I’ve posted a few things about this, but of course it looks a bit suspect coming from a “competing” dev. I’d advise you to look at the aliasing on the spectrum analyzer (like the Bogaudio one), take some screen shots showing the aliasing, and post them.

Oh - how to get rid of it. You need to do a good enough job interpolating between samples, or even a small shift will make a terrible racket. I think most must do this OK, or the thing is unusable. But some people do it better than other. If you see aliasing or other junk at very small pitch shifts (like a semitone) it’s probably the quality of the interpolation filter. I’ve seen everything for a simple linear interpolation up the a high order FIR brick-wall filter.

Then for large pitch shifts upward you need a sharp lowpass filter before you shift it up, or high harmonics will shift above fs/2 and come back as aliasing.

I would guess interpolation gets tougher for large shifts downward, but I don’t have a ton of experience with this.

4 Likes

BTW, If you want to see an aliasing obsession in action, look at our Facebook page. If you go back to may and earlier you will see a lot of posts about aliasing in VCOs, waveshapers and others.

Is the short answer “use a library, like libresample or libsamplerate,” or is it not that simple?

Seconding this. It’s good to know what mathematical methods to use, but you definitely don’t need to because the problem of resampling has been solved 100 times for you in various libraries. Use libspeexdsp (included in Rack and wrapped with dsp/resampler.hpp) if you have a fixed resampling ratio or libsamplerate if the ratio is variable over time, or Rubberband or SoundTouch if you need pitch/time stretching.

2 Likes

Is Fundamental, perhaps, going to get a sample player sometime?

No plans for that.

So could all those bad samplers be fixed by including libsamplerate and sound would be fine?

A good example for various modes of bad interpolation is given with the “Advanced Sampler” from “Lomas” - it has four interpolation modes to choose from, and they all sound terrible, and actually all sound quite the same to me - almost like applying a bitcrusher. I love everything else about this sampler, it would just be a good example of a great sampler if it could be fixed with something like that… same for “cf Play” for example - would love to use this if it sounded good :slight_smile:

Sure. They can either resample offline or real-time, the latter allowing real-time rate changes.

1 Like

They all use a dependency called dr_wav.

well, I’m not super familiar with that library. If it has a wide choice of quality vs. speed, then sure. Just remember - A sampler is not a mastering SR converter than needs to have all artifacts -120 db, have bandwidth all the way to (almost) fs/2, and have linear phase. Often a real simple interpolator will be good enough, and use less CPU. But it the library lets you hit the sweet spot you are going for, then that’s great.

Probably the most important thing is to be aware of what your sound quality is, and then tweak with your goals in mind. For example, there are sawtooth VCOs out there with no alias reduction at all. Did the author intend to make a light-weight VCO, and not care about distortion? It’s difficult to tell - I have yet to see a manual for a module with high aliasing that mentions it at all. Which leads a user to wonder …

2 Likes

VCV will release a “high-aliasing” oscillator in a month or two. (One internet point to anyone who can guess what oscillator in history it’s similar to.) But you’re right, I haven’t seen an oscillator that advertises it as a feature yet.

4 Likes

The interpolation on my sampler is very basic. But maybe there is a bug because in my test I can listen the improvements when using linear interpolation over no interpolation.

I got the interpolation algorithms from that Stackoverflo question with some linked papers that talk about s/n ratio. I will link it when I am at home.

PPG Wave?

P.S. vcvrack.com FR: Add “Internet Points” to Library Checkout payment options :sunglasses:

2 Likes

I totally lied - I ran into a really nice sounding VCO recently, and the manual did says something to the effect of “the aliasing is quite high, but it sounds good anyway. hope to reduce it in the future”. I was quite pleased.

I’m going to guess that it either aliases intentionally, or that it sounds so insanely good that it doesn’t matter. Because you have proven you can do oversampling and min-blep very well :wink:

In my experience the difference between linear interpolation and no interpolation is HUGE. And the difference between linear interpolation and much better interpolation is more difficult to hear. Where you will see (and hear) a difference is when you are pitch shifting signals that are very high in frequency. I tend to measure in the range between 1k and 2k, as it’s high enough to alias a lot but low enough to hear easily. But for a real torture test feed in some sines between 10k and 20k.

maybe it is a bug then… it all sounds the same to me here (at 44,1kHz on windows 7)

I think you mean the WCO, I also experienced it as good sounding so far.

With the oscillators it’s a bit of the same story, although not as bad as with the samplers and usually only on high notes… only Lindenberg Research and Vult Oscillators seem to be completely aliasing free. Oh and Blamsoft XFX Wave of course, this thing is truly free of any aliasing… but I suspect it works on an additive engine.

aliasing is a bit… frustrating :slight_smile: