Sine Sliders

Discuss Lemur and share techniques.
Post Reply
MrCorba
Regular
Posts: 142
Joined: 02 Sep 2013 20:17
Location: Netherlands

Sine Sliders

Post by MrCorba »

Hey guys got a scripting question.

I've got a StepSlider object and I would like a button, that will set the Sliders in a Sine form. Probably if someone gives the answer I'll be like Dôh! but for now I'm just not seem to get it working.
"Having no silence in music is like having no black or white in a painting" - Brian Eno
https://soundcloud.com/mrcorba
Softcore
Regular
Posts: 1613
Joined: 04 Nov 2012 08:34

Re: Sine Sliders

Post by Softcore »

Assuming the StepSlider object in your template is named "StepSlider" add a script on expression x, rising from zero, inside the button (preferably of Pad nature and not switch).

Type in the script

Code: Select all

decl i,length=sizeof(StepSlider.x);

for (i=0;i<length;i++){
StepSlider.x[i]=(1 + sin(i*2*pi/(length)-(pi*.5)))*.5;
}
if you want it to start with the max value of the sine

Code: Select all

decl i,length=sizeof(StepSlider.x);

for (i=0;i<length;i++){
StepSlider.x[i]=(1+sin(i*2*pi/(length)+(pi*.5))*.5;
}
if you want it to start with the half value of the sine

Code: Select all

decl i,length=sizeof(StepSlider.x);

for (i=0;i<length;i++){
StepSlider.x[i]=(1+sin(i*2*pi/(length)))*.5;
}
Last edited by Softcore on 28 Mar 2014 12:32, edited 3 times in total.
MrCorba
Regular
Posts: 142
Joined: 02 Sep 2013 20:17
Location: Netherlands

Re: Sine Sliders

Post by MrCorba »

Awesome! Thanks!
"Having no silence in music is like having no black or white in a painting" - Brian Eno
https://soundcloud.com/mrcorba
Softcore
Regular
Posts: 1613
Joined: 04 Nov 2012 08:34

Re: Sine Sliders

Post by Softcore »

Dont thank me - thank Mark Strauss (LFO Studio template) and Antonio Blanca (AB faderlab template)....You can find more maths in those (tri, sawtooth, etc). ;)
Post Reply