Post
by **antto** » Sat Dec 13, 2014 4:50 am

well, it doesn't mean waves is using SE code, more like that they use algo based on the same thing.. a coincidence

if my calculations are correct, let's say F3 is 43.653529Hz (i could be off by a few octaves but it doesn't matter for this example)

at a sampling rate of 44100, the phase length of a single sawtooth cycle is 1010.227 samples (Fs/freq)

now, if you use mipmap tables, you typically use table size of powers of two

so you have tables with sizes 4096, 2048, 1024, 512, 256, 128, ....

so, given that for the desired frequency you need ideally a table of size 1010.227 - if you pick the table of size 1024 - it will be a bit too long - you'll have to play it faster than 1x speed, and that's gonna need decent resampling, otherwise the high freq content will alias

so instead, in such situation you could just pick the lower table - the 512 one, and play it slower, then even linear interpolation wouldn't sound too bad

if your sound of interest is at 0dB, then at -90dB you have a 90dB difference

however, if the sound of interest was at -50dB - at -90dB you would have only 40dB diff, which is not much, in that case you would want to look down to -140dB on the graph... or just amplify your signal so it goes to 0dB

now, a bit more about the mipmap tables

that's what the built-in SE oscillator module uses (at least in v1.0x, no idea about the new SE)

and Waves probably uses mipmaps as well

now, there are various ways to implement mipmaps

i personally hate mipmaps for VST synths, because you have a problem with low frequency notes

you typically start from the smallest table size (2 samples? that would be for frequencies just below nyquist) and go down to the bigger table sizes.. 4 samples (for freqs below nyquist/2).. 8 samples... etc

when do you stop? at what size? - that's the question

in my early implementations of mipmaps, i'd stop at 1024

that's quite big, right?

actually, a table of size 1024, at 44.1kHz sampling rate, maps to a frequency of 43.066Hz

and if that's your biggest table, then you don't have a table to play notes with lower pitches than that, which means that when you play 20Hz using the 1024 table - your sawtooth will lack one of the top harmonics... this gets worse when you play a 10Hz note

to put it another way, a 1024 size table can hold a specific amount of harmonics

if i hardcode this, and then if the user runs my plugin at 88.2kHz - then things get worse

the same 1024 table will map to 86.132Hz which is high

now, this problem can be dealt with, by deciding the max table size at run time, when the sampling rate is known, if you say you don't care about freqs below 30Hz - then you can calculate how big of a table you need to be able to play 30Hz with the full number of harmonics all the way to nyquist, i've done that, it works

there's still one thing left tho... if you switch between 44.1k and 48kHz sampling rates - the frequencies to which the tables map will slightly change, thus you'll have slightly different "lack" of harmonics depending on which note you play when you compare them

this is valid if the implementation is similar to the one in SE, where the lower table is used and a gap of missing top harmonics is left

and, i should also mention that mipmaps don't have to be 1 octave apart, you could make 2 tables per octave, or even 12 tables (one for each semitone)

It doesn't matter how it sounds..

..as long as it has BASS and it's LOUD!

**irc.freenode.net** >>> **#kvr**