Here’s my tweaked version. Most of the calculations are replaced with lookup tables. The pulsewidth can go as narrow as 1% now (was previously 10%)
After a little evaluation, I found that a fixed highshelf filter gave a better result, so that’s in there in place of the moving shelf. (highpass + original)
Also, the FM is much cleaner in this version since I’ve got it connected to the PWM, so there’s less stepping as you sweep the modulation index. One thing to note, because the FM is interacting with the scaling factor, the sound is not as bright, because the spectral tilt becomes that of a modulated sine rather than a modulated square. I think this is a more useful sound.
It’s more expensive as an oscillator than rect~ and slightly brighter, but you do get FM. The tradeoff, for the time being at least, is the lack of hard sync. Need to brush up on maths before that one gets dealt with…