Irregular Sine Waves

For general discussion related FlowStone
User avatar
Spogg
Posts: 3368
Joined: Thu Nov 20, 2014 4:24 pm
Location: Birmingham, England
Contact:

Re: Irregular Sine Waves

Post by Spogg »

If I understood a word of it I could maybe help!
At least we know what it sounds like now.
Over to the maths guys then...

Cheers

Spogg
User avatar
martinvicanek
Posts: 1334
Joined: Sat Jun 22, 2013 8:28 pm

Re: Irregular Sine Waves

Post by martinvicanek »

Here is a comparison of Spoggs sketches and phase modulation waveforms taken from my demo on page 1. Hmmm....
Attachments
comparison.png
comparison.png (46.95 KiB) Viewed 17169 times
tulamide
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Irregular Sine Waves

Post by tulamide »

martinvicanek wrote:Here is a comparison of Spoggs sketches and phase modulation waveforms taken from my demo on page 1. Hmmm....

You can clearly see the difference. There are spikes where a curve should be. I don't know how to express it correctly in english, but the left line is "konkav" instead of "konvex" and the right line "konvex" instead of "konkav"

EDIT: Martin, just before Spogg's last post I posted an answer I got on another forum. Does it help in terms of dsp/asm code conversion?
"There lies the dog buried" (German saying translated literally)
tulamide
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Irregular Sine Waves

Post by tulamide »

Here's visualized what the answer is talking about. Once again done with my spline class. Unfortunately I didn't build the cubic splines for the spline class with polynomials, but with cubic interpolation. The latter is easier to comprehend. That brings up another question: Is it possible that I already solved the math a year or longer ago? Because my spline class not only calculates each point of the spline but is also able to spit out any number of values for both, x- and y-axis, which make up the spline. So I could, for example spit out 512 or 44100 y-values, that describe one wave cycle.

If this is a good way to try it, I would provide the calculations I did and comments. But I can't translate it to DSP code.
Attachments
irregular_sine_animated.fsm
(14.78 KiB) Downloaded 881 times
"There lies the dog buried" (German saying translated literally)
KG_is_back
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: Irregular Sine Waves

Post by KG_is_back »

Tulamide, you seem to be quite good at math... I think I've come up with better approach. Instead of finding equation for a distorted sinewave, we may just find equation for distorted ramp and feed that to the sin1(x) function.

I've done two examples. First one uses the two straight lines and is dis not smooth at endpoints and midpoint (where it crosses zero). Does pretty much the same thing what spoggs example does.
Second example is continuous in the midpoint but still not in the ends.

From the screenshots martin provided, it seems that derivative at x=0 and x=1 and x=mod is 1 (or at least equal). So the function for ramp distortion needs to satisfy following (mod is the parameter):
y(x)'=y(x+1)'{=y(mod)'=1} and y(0)=0 and y(1)=1 and y(mod)=0.5 ( what written in {} is just a guess).

I'm incapable of comming up with such a function... Martin? Tulamide? anyone?
Attachments
irregular sine.fsm
(128.97 KiB) Downloaded 942 times
User avatar
Spogg
Posts: 3368
Joined: Thu Nov 20, 2014 4:24 pm
Location: Birmingham, England
Contact:

Re: Irregular Sine Waves

Post by Spogg »

Wow!!!
I think KG has done it!
Such talent :D

Cheers

Spogg
tulamide
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Irregular Sine Waves

Post by tulamide »

KG_is_back wrote:Tulamide, you seem to be quite good at math... I think I've come up with better approach. Instead of finding equation for a distorted sinewave, we may just find equation for distorted ramp and feed that to the sin1(x) function.

I've done two examples. First one uses the two straight lines and is dis not smooth at endpoints and midpoint (where it crosses zero). Does pretty much the same thing what spoggs example does.
Second example is continuous in the midpoint but still not in the ends.

From the screenshots martin provided, it seems that derivative at x=0 and x=1 and x=mod is 1 (or at least equal). So the function for ramp distortion needs to satisfy following (mod is the parameter):
y(x)'=y(x+1)'{=y(mod)'=1} and y(0)=0 and y(1)=1 and y(mod)=0.5 ( what written in {} is just a guess).

I'm incapable of comming up with such a function... Martin? Tulamide? anyone?

We're coming closer. The second example indeed is continuous at the midpoint. So this could be the base to work with. I'm just afraid that you will take the example images from Martin, since they are not correct in the sense that they don't provide continuous waves. The curvature is reversed on one side (the left point on the first screen, the right point on the third screen). The wave should behave like in the irregular_sine_animated.fsm in terms of curvature.

I will give my very best to help, but I avoided derivatives already in the spline class, so I don't think I will come to a conclusion.
"There lies the dog buried" (German saying translated literally)
KG_is_back
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: Irregular Sine Waves

Post by KG_is_back »

I've given it some thought. The concavity is inevitable. Let's look at the third wave. It starts as a rather slow sine wave, which means it has low curvature. the end of the wave is a fast sine wave, which has high curvature. In order for the wave to joint smoothly, the curvature in the end has to drop, which results in that concavous shape.

Your animated example is not a sine wave - it's two half-ellipses. Sine wave crosses x-axis at 45degrees. Kind of like this (see the modified FSM).
Attachments
irregular_sine_animated (1).fsm
(12.9 KiB) Downloaded 887 times
tulamide
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Irregular Sine Waves

Post by tulamide »

I see what you mean. My wave wasn't correct, but with the sine wave I discovered the issue. It is that the control points stay the same. But they shouldn't (since the upper and lower part of the wave change in dimension, the control points should as well). It's too late right now, but I'll post an example tomorrow.
"There lies the dog buried" (German saying translated literally)
User avatar
martinvicanek
Posts: 1334
Joined: Sat Jun 22, 2013 8:28 pm

Re: Irregular Sine Waves

Post by martinvicanek »

Tulamide, why do you insist that the wave be convex in the upper half and concave in the lower? KG is right, such a requirement leaves very little headroom for modulation if you want the wave to have continuous slope at the joints. It feels unnatural to me, I don't see the rationale behind it.
Post Reply