sensorium / Mozzi

sound synthesis library for Arduino

Home Page:https://sensorium.github.io/Mozzi/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Optimization of `Oscil::phMod()`

tomcombriat opened this issue · comments

Currently, Oscil::phMod() uses a Q15n16 (or SFix<15,16>) as argument for the phase modulation of an oscillator:

where the fractional n16 part represents almost -1 to almost 1, modulating the phase by one whole table length in each direction.

So, in theory, one do not really need the integer part at all, as modulating by 1 brings you back to the original position, hence modulating by 0. The overflow of a 16bits should be able to reproduce this behavior.

The sign might be a problem, I have not though that completely through yet, but this could be a point of optimization.