- #1
1plus1is10
- 51
- 0
Hello,
I hope you can help me.
I want to "alter" a sine wave.
I would say "modulate", except that I was unsatisfied with the FM formula.
Here's what I want, visualize this:
1) copy-n-paste an image of a sine wave into MS-Paint
2) select part of the image from wave top1-to-bottom1
3) grab the right edge of the selection and shrink it to the left compressing the wave
4) select the next part of the wave bottom1-to-top2
5) grab the left edge of the selection and expand it to the left to fill-in the gap
Here is the sine wave code I've been toying with:
I've messed with freq, cirdiv, and phase to no avail.
I would have thought it would be as easy as:
if(cirdiv>=.25 && cirdiv<.75){ z=?; }else{ z=?; }
sin(phase + z)
Nope.
So, I need a mathmetician.
One thing though, I do not want to touch x1,x2.
Thanks
I hope you can help me.
I want to "alter" a sine wave.
I would say "modulate", except that I was unsatisfied with the FM formula.
Here's what I want, visualize this:
1) copy-n-paste an image of a sine wave into MS-Paint
2) select part of the image from wave top1-to-bottom1
3) grab the right edge of the selection and shrink it to the left compressing the wave
4) select the next part of the wave bottom1-to-top2
5) grab the left edge of the selection and expand it to the left to fill-in the gap
Here is the sine wave code I've been toying with:
Code:
ttlH=400; ttlW=600;
ttlTime=1000;
xW=ttlW/ttlTime;// width between x1,x2
amp=ttlH/3;// amplitude
center=ttlH/2;// center of sine wave
freq=ttlTime/3;// frequency
for(time=0; time<ttlTime; time++){
x2 = round(time*xW);
cirdiv = ((time%freq) / freq);
phase = cirdiv * 2 * PI;// radians
y2 = round((sin(phase)*amp) + center);
if(time>0) DrawLine(x1,ttlH-y1, x2,ttlH-y2);
x1=x2; y1=y2;
}
I've messed with freq, cirdiv, and phase to no avail.
I would have thought it would be as easy as:
if(cirdiv>=.25 && cirdiv<.75){ z=?; }else{ z=?; }
sin(phase + z)
Nope.
So, I need a mathmetician.
One thing though, I do not want to touch x1,x2.
Thanks