>> - 63 harmonics is waaaaay not enough - I actually have a harmonic based
>> generator, which uses 256 harmonics and can convert from/to "shape". So
>> example if I draw a "perfect" sawtooth and convert it to 256 harmonics
>> synthesize it back it sounds different. Not very, but it is clearly
>> the highest harmonics if the pitch is low enough.
>what frequencies are those higher harmonics at?
>think about it, middle C and the 256th harmonic.
>then find yourself a good analog synth with a sawtooth you think is
>"perfect", and play that back through a brick-wall filter (if you can
>get something that approximates it) set to 20 kHz. and tell me then if
>you hear the difference. if you say you can, then it's time for blind
>you see, we don't hear "perfect" sawtooths. we hear the portion of
>those perfect sawtooths that fall within our range of hearing.
Yes, but with the pitch of say 70Hz, a nice dubstep subbass :), you are at
70 * 256 = almost 18k, which is still audible. And for rendering drums or
even "bassier" tones, we can easily get to 40-50Hz. So even 256 harmonics
are not enough to represent all harmonics.
>> - 1024 samples wavetable is not good enough. You kinda got me
>> :), so I was doing some measurements. With linear interpolation even
>> samples was doing much more distortion than 8192.
>what's the highest non-zero harmonic?
That depends of course, for sawtooth it is unlimited, right?
>> It was probably beyond
>> hearing limits (like -120dB or something), but with some postprocessing
>> can easily get audible.
>be specific. what post processing?
It can be absolutely anything. Different kinds of distortion, filtering,
level compression... It's really easy to amplify the "dirt" in the signal.
Many do it intentionally.
>> However it got much better with cubic interpolation.
>which cubic interpolation? Lagrange? Hermite? B-spline?
I think it is hermite.
>what is the oversampling ratio? (which is half the wavetable size
>divided by the index of the highest non-zero harmonic. and how loud
>*is* that harmonic?)
I use 8192 point wavetables, which may either be rendered using 256
harmonics, or directly by "shape", so it can be a "perfect" sawtooth, with
all harmonics. We could say that I'm going to accept minimum pitch of say
40Hz. With 20k high limit, there needs to be 500 harmonics then.
Anyway some more tests:
Sawtooth wave, 171Hz (C4), 44kHz sampling rate, analysed using FFT 65536
points, hann window, checking up to -150dB:
1) bandlimited (1 per oct), 3x oversampling (to exceed 96k), downsampling
using minphase 72dB/oct
cubic interpolation => crystal clear
linear interpolation => alias (probably), e.g. 670Hz, -110dB
2) bandlimited (1 per oct), no oversampling
cubic interpolation => clear, allias can be measured as the residue from
the top octave in the bandlimited wavetable, but I don't hear a difference
linear interpolation => same as cubic, but an additional line of aliased
frequencies, e.g. again 670Hz, -110dB
3) no bandlimit
cubic & linear interpolation cannot be really distinguished in all that
alias, e.g. 150Hz, -50dB
So the linear interpolation really isn't enough even for big wavetables.
With 2048 point wavetable and cubic interpolation with 3x oversampling, the
results were similar to when linear-interpolation was used, but it was even
>> When it comes to oversampling, then I cannot really afford too much. Say
>> oversampling is reasonable, 512x absolutely not.
>you missed the point. the oversampling is accomplished by having a
>wavetable of N points with very little or *no* energy in the harmonics
>with indices anywhere close to N/2.
Anyway the band limiting with 8192 samples (even if there are just say 20
harmonics!) seems working very well. But still, if I decrease the wavetable
>> And it must be zero-latency, because it is realtime.
>so a 32-sample delay (from using 16-sample double buffering) is gonna
>make it not realtime?
>"realtime" does not mean the same as "live". but even "live" can handle
>a little delay. you get 44 samples of delay for every foot you stand
>away from your amp or monitor speakers.
I cannot fully agree. 44 samples is 1 millisecond and every millisecond is
relevant. Of course, we can live with it, but if we can avoid it... The
minimum phase filter should be fine with it.
Btw. where did you get the "32-sample" delay get from? You mean
linear-phase filtering with 32 point FIR? I don't know, but I'd say it can
hardly be that steep with such a few points, or could it? I'm generally
using 512 points or even 2048 points if I need linear-phase.
>> The "arithmetics" - I think I understand it now. So the idea is that
>> we limit our hearing to 20k and have Nyquist at say 24k, then there is
>> space, which we can fill with any mess, including alias and we are ok.
>it's a 4 kHz space.
Hmmm, then I'm missing something - let's say I create a wavetable for
generating pitches from 100Hz and the limit 20k, sampling rate 48k, so
Nyquist 24k. Then if I generate 100 * (28000/20000) = 140 Hz pitch, then
the highest harmonic will be at 28k, which will alias from 24k to 20k,
right? So where am I wrong?
>> Personally I'm not sure about the theory, that we can totally ignore
>> everything above 20k, after all there are headphones capable of
>better do some blind testing. with false negatives to keep the test
That's a really hard thing to do, because many people are "trained". There
are even apps to train the ears, online. And it also depends on the
situation - e.g. if you are in a noise environment, the high frequency
resolution gets lower. If you don't sleep well, same thing. So the
listening tests are good as a "guide", but saying "we can easily create
anything above 20k" just because me and nobody around me listens it isn't
such a good idea.
>bump it down to 18 kHz, then you're back to 2.
Not really a good idea, some people just have better ears, and they can
measure it... some really do.
Simply put, I cannot judge ears for other people. It's even possible our
hearing will get better in the future with meds and stuff. And imagine
someone makes some music, that will be "ugly" in the future, because
suddenly people will hear above 20k.
I know it's a little extreme attitude, but still... Though your idea with
having more band limited wavetables is probably the only good solution.
Though even with 1 table / oct it looks good now.
Posted through www.DSPRelated.com