how do you make a random curve using pixilang for the modules that load curves?
i have this pixi program CurveCreator.pixi and i can UN-comment the formulas and edit them to make weird things, but if i wanted to make a straight up individual random white noise plot in that app, what would the formula line look like?
for example this one is sine:
$y = sin( $x * M_PI * 4 ) / 3 + 0.5 //Sine
sorry that i am a pixi coder newb, but i am also a coder noob...
thanks.
Noise
- NightRadio
- Site Admin
- Posts: 3954
- Joined: Fri Jan 23, 2004 12:28 am
- Location: Ekaterinburg. Russia
- Contact:
Re: Noise
$y = rand() / 32768
Re: Noise
hmm, firstly i have to apologize for not seeing that a better version of the sunvox curve editor has been included in the latest distro, i was using the original one. secondly, when i output several noise curves, they are all the same. I tried looking at the manual for pixi lang and this thread: https://warmplace.ru/forum/viewtopic.php?f=8&t=1335 but again, not being a coder i just cant follow. if i change the number that the rand() function is divided by, it just moves it up or down like DC offset. if i try to set a seed "rand_seed( seed )" then it just makes a linear plot. how do you make a different random graph each time you output with the pixi script?
- NightRadio
- Site Admin
- Posts: 3954
- Joined: Fri Jan 23, 2004 12:28 am
- Location: Ekaterinburg. Russia
- Contact:
Re: Noise
Just move rand_seed() outside the curve_function(), because we need to call it once at the beginning.how do you make a different random graph each time you output with the pixi script?
get_ticks() - current system tick counter (returns different value every time you call it)
Code: Select all
rand_seed( get_ticks() )
fn curve_function( $x )
{
$y = rand() / 32768
ret( $y )
}