Sure, of course an additive shouldn't have a problem analysing and resynthesising a sine, but I can't help but wonder if under deceptively simple circumstances some of them might crap out. I guess I was curious if some of them, using additive synthesis to build a wavetable, might end up interpolating from a single cycle as well over short distances.george wrote:If you synthesize a sine you shouldn't get any alias at all. I have put a example using Vertigo, and it should be about the same no matter what additive synth you use (if the waveforms are sinewaves, of course).
The aliasing thread
-
- KVRist
- 190 posts since 28 Nov, 2003
Last edited by autloc on Wed Sep 15, 2004 11:52 am, edited 1 time in total.
-
- KVRAF
- Topic Starter
- 5641 posts since 18 Jul, 2002
No additive synth using sinewaves should, under any circumstances related to main engine. However, if you apply something like sync or fm to the result you may end getting aliasing.autloc wrote:Sure, of course an additive shouldn't have a problem analysing and resynthesising a sine, but I can't help but wonder if under deceptively simple circumstances some of them might crap out.
-
- KVRist
- 190 posts since 28 Nov, 2003
Sure, adding modulation increases the risk of aliasing cropping up, but if the additive synth builds a wavetable (thinking of synths like Kubik, here) resynthesized from a target input, aliasing could easily crop just as it could it any wavetable-based synth that didn't use proper band-limited techniques. (?) I dunno, is everyone is adding up their sine waves per-sample or building per-note wavetables?No additive synth using sinewaves should, under any circumstances related to main engine. However, if you apply something like sync or fm to the result you may end getting aliasing.
-
- KVRAF
- Topic Starter
- 5641 posts since 18 Jul, 2002
I think we're getting a bit off topicautloc wrote:I dunno, is everyone is adding up their sine waves per-sample or building per-note wavetables?
-
- KVRist
- 190 posts since 28 Nov, 2003
yeah, i guess that is pretty off topic -- sorry
So who's going to do the test using OctaMED?
So who's going to do the test using OctaMED?
- u-he
- 30213 posts since 8 Aug, 2002 from Berlin
Ok, enough sleep, now on to first coffee...
The aliasing thing is very simple. A sine of 26kHz played back at 48kHz (24kHz bandwidth) will result in a sine of 22kHz. Latter is the "alias" (like in the tv series, someone you can see, but it is in fact another person, it only "pretends" to be someone). It is like, there are borders in the spectrum at 0Hz and Nyquist (1/2 sampling rate), and any frequency that lays outside of this range "bounces" between these borders until it fits inside.
A 50kHz sine becomes a 2kHz sine in a 48kHz sampling rate. It bounced at 24kHz and became "24kHz - 26kHz", becoming -2kHz (which is quite an imaginary frequency) and then it bounced at 0Hz and became 2kHz.
I think we should look at another end.
So, what happens in a sampler?
It's not just a simple playback, because then, even a 2kHz sine would show hilarious artifacts when pitched up (or down!) a semitone. But uh, what is a simple playback anyway? Is it like occasionally skipping or repeating samples of the original wav in a stochastic manner? Surely not. This would be like a S&H algorithm, and we've read above that this causes artifacts.
Resampling is a category of more or less complex processes. I guess there are virtually as many processes as there are samplers.
The inherent problem is, if you don't play back a sample at its original frequency, you have to "read between the samples". Thus, a resampler needs a strategy to not only access, say, sample 277 and then sample 278, but it needs to access an imaginary sample *between* 277 and 278, i.e. 277,333 which would roughly be 1/3 sample after 277.
One strategy would be plain interpolation. The resampling process would take a couple of samples that surrounds the desired "sample inbetween" and build a continuous curve through these points. The weakest way to do this is just building a line beween a and b (linear interpolation), the best way would be convolving this with a sinc interpolator (which is *very* expensive on cpu). Everything inbetween this (cubic, spline, Lagrange etc.) is a trade off between quality and performance.
Hence, depending on the interpolation algorithm, the resulting sample is more or less close to the perfect result that a reconstruction filter / sinc interpolator would provide.
Whatever one does, as sinc interpolation (and even if windowed reasonably, say across 512 points Hamming) is definately out of question, the output sample is WRONG.
The extent of being wrong is plain noise and has nothing to do with aliasing in the first place.
However, as most interpolators are certainly polynominal algorithms, the noise added shows a spectrum that is a multiple of the input spectrum from the original sample. Thus, the interpolation process adds "ghost spectrums" (nothing to do with aliasing!) at one, two, three, four, five etc. octaves above the input sample. This is much like the same thing as waveshaping with polynominal curves; it adds extra harmonics.
Now - and here I admit that some of my yesterday's observations have to be reconsidered - these additional spectrums (or are they called "spectra"?) do of course alias, if crossing the Nyquist boundary. I think I can say that to some extent this is what we see on the pictures.
But still, plain interpolation in order to gather an imaginary/fractional sample between two samples is only one method to build a resampler.
One could as well read *all* samples and lowpass these by an IIR with a steep rolloff (maybe even oversample this way), which of course might give good results in respect of "finding the right sample", but it would screw up the spectral phases, hence create a more or less smearing sound.
Other engines might use phase vocoders to change the pitch of a sample, which might be useless for sine waves but gives outstanding results on "natural" samples, for instance because while phase vocoding you can as well add formant correction in the same process.
Yet other engines might use combinations of processes, like creating a frequency domain representation of a sample, cutting out the frequencies that would alias, going back to time domain and then use cheap interpolation without risking to be too wrong. (This is in fact what I do, called "Mipmapped Wavetables" and no one has ever complained that anything bounced back into the audible range)
Yet another engine is the Melodyne engine, which I have no clue how they do it, but it can be used for realtime sample playback like any other sampler. I don't know how it does on sine waves, but as this delivers by far the most amazing results for stuff like voices or brass, how would one argue here?
My conclusion is, there's more to resampling than just measuring a very special phenomenon (which we yet don't know what it means, as we don't know how the samplers work), and so it might be something like comparing apples and pies.
The EXS plays back more voices on my machine than any other plugin, and none of the sample cds I own sounds gritty in the higher octaves. Kontakt can play back samples at different pitch with constant duration. VSampler costs way less than these two (if you negelect the fact that the EXS is free for Logic Pro users) and does its job. My Melodyne NFR (
) simply makes me cry.
Ok. Coffee is out. Back to work now
Cheers,
Urs
The aliasing thing is very simple. A sine of 26kHz played back at 48kHz (24kHz bandwidth) will result in a sine of 22kHz. Latter is the "alias" (like in the tv series, someone you can see, but it is in fact another person, it only "pretends" to be someone). It is like, there are borders in the spectrum at 0Hz and Nyquist (1/2 sampling rate), and any frequency that lays outside of this range "bounces" between these borders until it fits inside.
A 50kHz sine becomes a 2kHz sine in a 48kHz sampling rate. It bounced at 24kHz and became "24kHz - 26kHz", becoming -2kHz (which is quite an imaginary frequency) and then it bounced at 0Hz and became 2kHz.
I think we should look at another end.
So, what happens in a sampler?
It's not just a simple playback, because then, even a 2kHz sine would show hilarious artifacts when pitched up (or down!) a semitone. But uh, what is a simple playback anyway? Is it like occasionally skipping or repeating samples of the original wav in a stochastic manner? Surely not. This would be like a S&H algorithm, and we've read above that this causes artifacts.
Resampling is a category of more or less complex processes. I guess there are virtually as many processes as there are samplers.
The inherent problem is, if you don't play back a sample at its original frequency, you have to "read between the samples". Thus, a resampler needs a strategy to not only access, say, sample 277 and then sample 278, but it needs to access an imaginary sample *between* 277 and 278, i.e. 277,333 which would roughly be 1/3 sample after 277.
One strategy would be plain interpolation. The resampling process would take a couple of samples that surrounds the desired "sample inbetween" and build a continuous curve through these points. The weakest way to do this is just building a line beween a and b (linear interpolation), the best way would be convolving this with a sinc interpolator (which is *very* expensive on cpu). Everything inbetween this (cubic, spline, Lagrange etc.) is a trade off between quality and performance.
Hence, depending on the interpolation algorithm, the resulting sample is more or less close to the perfect result that a reconstruction filter / sinc interpolator would provide.
Whatever one does, as sinc interpolation (and even if windowed reasonably, say across 512 points Hamming) is definately out of question, the output sample is WRONG.
The extent of being wrong is plain noise and has nothing to do with aliasing in the first place.
However, as most interpolators are certainly polynominal algorithms, the noise added shows a spectrum that is a multiple of the input spectrum from the original sample. Thus, the interpolation process adds "ghost spectrums" (nothing to do with aliasing!) at one, two, three, four, five etc. octaves above the input sample. This is much like the same thing as waveshaping with polynominal curves; it adds extra harmonics.
Now - and here I admit that some of my yesterday's observations have to be reconsidered - these additional spectrums (or are they called "spectra"?) do of course alias, if crossing the Nyquist boundary. I think I can say that to some extent this is what we see on the pictures.
But still, plain interpolation in order to gather an imaginary/fractional sample between two samples is only one method to build a resampler.
One could as well read *all* samples and lowpass these by an IIR with a steep rolloff (maybe even oversample this way), which of course might give good results in respect of "finding the right sample", but it would screw up the spectral phases, hence create a more or less smearing sound.
Other engines might use phase vocoders to change the pitch of a sample, which might be useless for sine waves but gives outstanding results on "natural" samples, for instance because while phase vocoding you can as well add formant correction in the same process.
Yet other engines might use combinations of processes, like creating a frequency domain representation of a sample, cutting out the frequencies that would alias, going back to time domain and then use cheap interpolation without risking to be too wrong. (This is in fact what I do, called "Mipmapped Wavetables" and no one has ever complained that anything bounced back into the audible range)
Yet another engine is the Melodyne engine, which I have no clue how they do it, but it can be used for realtime sample playback like any other sampler. I don't know how it does on sine waves, but as this delivers by far the most amazing results for stuff like voices or brass, how would one argue here?
My conclusion is, there's more to resampling than just measuring a very special phenomenon (which we yet don't know what it means, as we don't know how the samplers work), and so it might be something like comparing apples and pies.
The EXS plays back more voices on my machine than any other plugin, and none of the sample cds I own sounds gritty in the higher octaves. Kontakt can play back samples at different pitch with constant duration. VSampler costs way less than these two (if you negelect the fact that the EXS is free for Logic Pro users) and does its job. My Melodyne NFR (
Ok. Coffee is out. Back to work now
Cheers,
-
tony tony chopper tony tony chopper https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=3103
- KVRAF
- 3561 posts since 20 Jun, 2002
I'm lead to believe than some (mipmap-based) resampling techniques can f**k up the loop points. Considering that looping is a critical feature in a sampler, I'd check that as well.
-
- KVRAF
- 4738 posts since 20 Feb, 2004 from Gothenburg, Sweden
WilliamK keeps on asking who would actually start pitching up a 15KHz sine.
Well. Basicly anyone using waveforms that are _not_ sines.
A normalised alias free square wave at 5KHz would have a 2nd harmonic at 15KHz at around -10dB. EQ / filters / other fx could easily bring this up in level, hence giving you plenty of aliasing noise if repitching (try bending some...).
Go down a bit in frequency of the square wave before sampling. A normalised alias free square wave at 4kHz would have a 3rd harmonic at _20KHz_ at around -14dB.
The problem exists. There are worse waveforms than the square wave. Try those, at musical notes (imo, 5
KHz is within the musical range), you will fore sure get very audible aliasing if you do not filter. If you'd like, I could tell you how to make a _very_ fast box filter (nothing fancy, but far better than nothing).
Well. Basicly anyone using waveforms that are _not_ sines.
A normalised alias free square wave at 5KHz would have a 2nd harmonic at 15KHz at around -10dB. EQ / filters / other fx could easily bring this up in level, hence giving you plenty of aliasing noise if repitching (try bending some...).
Go down a bit in frequency of the square wave before sampling. A normalised alias free square wave at 4kHz would have a 3rd harmonic at _20KHz_ at around -14dB.
The problem exists. There are worse waveforms than the square wave. Try those, at musical notes (imo, 5
KHz is within the musical range), you will fore sure get very audible aliasing if you do not filter. If you'd like, I could tell you how to make a _very_ fast box filter (nothing fancy, but far better than nothing).
Stefan H Singer
https://dropshotaudio.com/
https://dropshotaudio.com/
-
- KVRer
- 21 posts since 2 Oct, 2003
urs: rad post. basically, if i understand you correctly, calling this phenomenon "aliasing" would be incorrect. but it does happen, whether or not it's a valuable musical consideration or not. :0
-
- KVRist
- 190 posts since 28 Nov, 2003
Hmm, I think I have to disagree with Urs if that's what he's saying -- this is aliasing, but it just doesn't seem like it because by using linear/cubic/sinc interpolation we're taking a short cut instead of first upsampling by some integer amount and then downsampling again (using appropriate filters in the process to minimize the aliasing inherent) by an integer. Sampling is a multiplication in the time domain (of a train of unit impulses) which causes convolution in the frequency domain -- aliasing.
http://www.jhu.edu/~signals/sampling/
err, sorry, still trying to find a good link that illustrates what i'm so bad at articulating.
http://www.jhu.edu/~signals/sampling/
err, sorry, still trying to find a good link that illustrates what i'm so bad at articulating.
Last edited by autloc on Wed Sep 15, 2004 1:57 pm, edited 1 time in total.
-
- KVRist
- 453 posts since 16 Sep, 2002 from Malaga (Spain)
Hi
The point is that like someone already stated, there're zillion of samples containing hf components (and a lot above 15kHz), in that case, not proper resampling just end up in trebble band literally "seriously f**ked", this is, not properly reconstructed, wich is laterally say "bye bye trebbles" and distortion, for some ppl "inaudible" and doesnt matter and for some ppl is "shit".
Funny thread btw.
Let's see, the point of view of those comparatives is not that, we're not talking about 15kHz as fundamental tones we'll be using for music, in fact, most fundamentals in music lies about 100Hz and 1000Hz, (being midi middle C (60) about 261Hz), so talking about 15kHz fundamentals is plain pointless of course.That's what I'm trying to get here. From a musical point of view, who will use such high frequencies?
The point is that like someone already stated, there're zillion of samples containing hf components (and a lot above 15kHz), in that case, not proper resampling just end up in trebble band literally "seriously f**ked", this is, not properly reconstructed, wich is laterally say "bye bye trebbles" and distortion, for some ppl "inaudible" and doesnt matter and for some ppl is "shit".
Even in old days with fasttracker 2 (it used linear interpolation), most of ppl noticed that very high or low repitched notes sounded all but good. (I remember ,one good friend called it , the attack of the "metallic bitchez" from outer space).And aliasing, even with linear-interpolation, is very low, inaudible.
Funny thread btw.
-
- KVRian
- 1023 posts since 8 Apr, 2003 from Östersund
Goddamn.. that sounds like a very good movie. I'm gonna go look it up on imdbarguru wrote:The attack of the metallic bitchez from outer space
/Majken
-
- KVRist
- 453 posts since 16 Sep, 2002 from Malaga (Spain)
Cmon Williank, mate, but wtf are you showing here? Do u think really ppl does music using samples with a fundamental tone and 3 partials (because that sample you put has even inharmonic overtones).
That test is far from real music and resampler testing! (again). Most fundamental tones in -music- fall into 100Hz-1000Hz, usually this fact dont walk alone in the forest, this fact have a hairy friend called "most sounds used in music have a fundamental freq and a lot of overtones, harmonics, partials, and diverse creatures, wich are not just 3 crappy partials, unless u love -organ solo- tracks.
Try a clear (trivial) sawtooth for that test, compare agains SFZ or some other -good resampler- and maybe things change a bit.
PD: I can hear sfz72 improvement over WS in the audio examples.
That test is far from real music and resampler testing! (again). Most fundamental tones in -music- fall into 100Hz-1000Hz, usually this fact dont walk alone in the forest, this fact have a hairy friend called "most sounds used in music have a fundamental freq and a lot of overtones, harmonics, partials, and diverse creatures, wich are not just 3 crappy partials, unless u love -organ solo- tracks.
Try a clear (trivial) sawtooth for that test, compare agains SFZ or some other -good resampler- and maybe things change a bit.
PD: I can hear sfz72 improvement over WS in the audio examples.
Last edited by arguru on Wed Sep 15, 2004 2:26 pm, edited 2 times in total.
