Morphing between sine & triangle without interpolation

I’m designing an oscillator & for one of my outputs I have a sine that I want to morph to a triangle, a lot of the other websites suggest that I use interpolation w a second oscillator & write a crossfader but I would prefer to be able to morph using an algorithm rather than use add another oscillator, is there a way I can go about implementing this, if anyone wants the code I’ve written so far I can post it.

Your module is computing f(t) = (1-p) \sin(t) * p \operatorname{triangle}(t), so there’s not really a way to get away with not computing both sin() and triangle(), directly or indirectly, unless p is 0 or 1.

1 Like

I guess you could pre-compute a wavetable and use that. It “technically” gets rid of the interpolation at runtime. It also likely is not worth it.

1 Like

Hmm, not really since you’d still have two wavetable oscillators. f(t) = (1-p) \textrm{wavetable}_1(t) + p \textrm{wavetable}_2(t).

You’d make a wavetable of the wavetables. Which would involve having to compute them for certain values of p. Then changes of increments of p use a different table-of-tables.

It would not be worth the rather heavy memory tradeoffs.

I forgot I made an account here, thanks for the input, kinda wanted to avoid having to make another oscillator but if that’s all I can do then so be it.

The question is equivalent to “interpolate without interpolation”. The answer is a falsology: “you can’t”.

1 Like

Alright now that I have that question answered, my next one is if it’s possible to morph between a saw & a square without interpolation

I mean… no? Morphing between waveforms is pretty much going to be interpolation to some degree.

Dino Dini’s beautiful “normalized tunable sigmoid function” has a single parameter (k or curvature) and can be used as a transfer function to morph a sine, triangle, or saw into a square.

I created my Swave module to use that sigmoid function as a waveshaper. If you send in a sine, triangle, or saw wave, the CURVE knob will morph between the incoming signal and a very-nearly-square wave. Here it is transforming an incoming saw wave into something squarer:

To see the magic of this function, wire up this patch and connect SIN, TRI, or SAW into Swave’s IN port and turn the CURVE knob.

I played around a bit on desmos (see my first link, above), and couldn’t quickly find a way to morph between a triangle wave and a sine wave.

I wonder if one of the “fast sine approximation” formulas can be given a parameter that can linearize the curvy parts. I don’t have the math chops to figure it out.