Guys I love your examples. They all show the creativity we all have.
@xtinct
It is awesome to see with how little effort this behaviour at least can be achieved.
@all
Maybe I seem like a child that is stubborn just because. But I assure you I'm not. It is rather that I see how close we are. I see Martin's awesome algorithmic oscillators. They consist of just one ASM code module. You input frequency and phase and it spits out a stable waveform, whose cycle is constant in length for a given freq.
I so hoped that this irregular thing could also end like this, just an ASM module with a freq input and some kind of phase input, only that it not just moves the start point of the cycle around, but instead moves the mid-point.
And I know it can be done. I know it because I already have done it. Just not for audio. I can shape curves to look exactly like the audio signals should be. And I don't use magic - it is just plain cubic interpolation. Those of you who are reading here and are not quite sure what I mean, look at the images:
Here you see two points connected by a line. But that line doesn't exist. It is completely estimated by cubic interpolation. The only known values are the two points, and then math calculates how to connect them. Such a thing like the above can also be done with linear interpolation (aka lerp).
Here you see a third point. This one is used indirectly. It means that the calculation tries to connect the two outer points, but while doing so tends towards the third point. Something like this can also be achieved with quadratic interpolation (aka qarp)

Now there are two additional points. But you already know the game. The math tries to connect the outer points, but tends towards the two other points while doing so. This is cubic interpolation (aka cubic). The additional points are so called control points. They only influence the line, but they are not connected to it. Each end point has one control point.
For the irregular wave we use 3 instead of two points, the line has to connect. That makes a total of two cubic lines generated from 3 base points and 4 control points. For example:

Now you may think, this is all so complicated. But it isn't. I talked about lerp earlier. If you lerp two lerps, the result is a qarp.
The equation for a lerp is
Code: Select all
pos = a*(1-t) + b*t
# with a and b the start and end points and t the t-value (in case of audio either the time or sample pos)
# if t = 0 then pos = a and if t = 1 then pos = b and if 1 > t > 0 then somewhere between a and b
so lerping two lerps is
Code: Select all
pos1 = a*(1-t) + b*t
pos2 = b*(1-t) + c*t
q = pos1*(1-t) + pos2*t
# with a and c being the end points and b the control point
We made qarp.
And yes, it is just as easy to get to cubic. cubic is just lerping two qarps
Code: Select all
pos1 = a*(1-t) + b*t
pos2 = b*(1-t) + c*t
pos3 = b*(1-t) + c*t
pos4 = c*(1-t) + d*t
q1 = pos1*(1-t) + pos2*t
q2 = pos3*(1-t) + pos4*t
cubic = q1*(1-t) + q2*t
# with a and d being the end points and b and c the control points
If you do this for enough t-values you get a line a curve, etc. Since this math is so simple (no exponents, no roots, just multiplication and addition/subtraction), I am absolutely sure it can be done in DSP/ASM.
Maybe we should forget about the word "sine" and call it a spline oscillator instead. We would have created something completely new, that is sonically rich and useful, plus works in realtime, without any wavetables. That makes it very versatile and modulator-friendly.
Is it really just a dream?