Frequency range and magic numbers

Hi! Good questions!

Regarding the ranges, note that the docs for LFO1/2 here give the range as one osc per 4 minutes (~0.0042 Hz) up to ~1000Hz for the frequency knob. So that’s approximately the range of the -8 and +10 values; without investigating further, it looks like the docs might be slightly off. (EDIT: actually, I think the docs are right; you used 2 as the baseline frequency in your calculation, but I think it’s actually 1, so the -8 and 10 range is actually 0.00390625 to 1024 Hz, which is right in line with the docs).

The +30 and division are there so that the Taylor series approximation function, which is being called for efficiency, can handle negative exponents (which it would blow up on if fed directly). If you check the function definition in approx.hpp you’ll see a comment to this effect and an example which adds 20 to the argument and divides the result by 2^{20} to unscale. Here, there’s protection against negative values up to -30, and I’ll leave the pleasure of discovering how that relates to 1,073,741,824 to you (just because it’s satisfying to figure out :slight_smile: )

1 Like