Hey, Frank — I use four-point, third-order hermite resampling everywhere. It's fast, relatively simple, and as good as will be necessary for most applications. Linear resampling can introduce some perceptible harmonic distortion into higher frequencies. This will be especially noticeable when slowing down or upsampling audio with high-frequency content.
Aliasing in audio occurs when frequencies outside the representable range are generated, by resampling, synthesis or other sources of harmonic distortion. Aliased frequencies "wrap around"; generating a 1700hz frequency in a signal with 1000hz nyquist will result in a 300hz frequency. As a rule of thumb, when speeding up audio, you first filter out those frequencies which will be pushed over Nyquist and wrap around; when slowing it down, you afterward filter out those frequencies which should not exist (but come into existence because of harmonic distortion). I made a great improvement in a resampling-heavy soundscape application by implementing fourth-order butterworth filters in my pitch-shifters, which had formerly implemented no antialiasing; a great deal of "harshness" was eliminated in one sweep. Here is a wonderful, very skimmable paper that tells you everything you could ever want to know about resampling and provides example code for many techniques: http://yehar.com/blog/wp-content/uploads/2009/08/deip.pdf – Evan Balster creator of imitone <http://imitone.com> On Fri, Jun 1, 2018 at 1:03 PM, Frank Sheeran <fshee...@gmail.com> wrote: > Hi Kevin. > > I'm the least-expert guy here I'm sure, but as a fellow newbie I might > have some newbie-level ideas for you. > > Just to mention something simple: linear interpolating between samples is > a huge improvement in reducing aliasing over not interpolating. For > instance if your playback math says to get sample 171.25 out of the buffer, > use .75 of sample 171 and .25 of sample 172. I don't know the math but my > listening tests of tricky test waveforms (eg, a waveform with a fundamental > at 100Hz and a 60th harmonic at 6kHz pumped up to 10, 20,30x the power, > showed aliasing reduced by about the same amount that quadrupling the > buffer sample rate did. > > I looked into other interpolations besides linear, and they didn't seem > effective enough to bother programming. Just to give a feeling for it, if > linear eliminated 90% of aliasing, then then more complex interpolation > might eliminate 95%. So they might reduce it by half compared to linear, > but only a tiny bit better compared to none at all. (The percentages are > just meant to be illustrative and actually everything totally depends on > your input data.) > > Another thing is to make sure your input data has been filtered out such > that there's no frequencies over the Nyquist frequency. But if you're > dealing with a PC or smart phone I'd imagine the computer hardware handles > that for you. Once the data is in memory you cannot filter it out, as it > will already have morphed into an alias in your input buffer and be "baked > in" no matter how you try to play the data back. > > Finally, listen with good headphones; you'll hear things you probably > won't in a room even if you have a good amp and speakers. > > Frank > http://moselle-synth.com/ > > _______________________________________________ > dupswapdrop: music-dsp mailing list > email@example.com > https://lists.columbia.edu/mailman/listinfo/music-dsp >
_______________________________________________ dupswapdrop: music-dsp mailing list firstname.lastname@example.org https://lists.columbia.edu/mailman/listinfo/music-dsp