| Hi,
just add a fourth argument (imode) to randomh which steers the starting value
krnd randomh 100, 200, 5, 3
if you don’t set it, it always start with the lower bound. when setting it to 3 it does what you want it to do. (see manual)
cheers,
karin
> On 5 Jul 2016, at 11:12, Menno Knevel wrote:
>
> Hi,
>
> i'm using several seeds in an instrument and would like to know why the
> result of the the first value of seed A and seed B are always the same?
>
> the csd:
>
>
>
> ; Select audio/midi flags here according to platform
> -odac ;;;realtime audio out
> ;-iadc ;;;uncomment -iadc if RT audio input is needed too
> ; For Non-realtime ouput leave only the line below:
> ; -o seed.wav -W ;;; for file output any platform
>
>
>
> sr = 48000
> ksmps = 32
> nchnls = 2
> 0dbfs = 1
>
> instr 1 ;same values every time
>
> seed 10
> krnd randomh 100, 200, 5
> printk .5, krnd ; look
> aout oscili 0.8, 440+krnd, 1 ; & listen
> outs aout, aout
>
> endin
>
> instr 2 ;different values every time - value is derived from system clock
>
> seed 1100 ; seed from system clock
> krndL randomh 100, 200, 5
> printks2 "value A %f\n",krndL ; look
> seed 110
> krndR randomh 100, 200, 5
> printks2 "value B %f\n", krndR
> aoutL oscili 0.8, 440+krndL, 1
> aoutR oscili 0.8, 440+krndR, 1
> outs aoutL, aoutR
>
> endin
>
>
> f 1 0 16384 10 1 ;sine wave.
>
> i 1 0 1
> i 2 2 1
> e
>
>
>
>
> and the result:
> instr 1:
> i 1 time 0.00067: 100.00000
> i 1 time 0.25067: 100.10876
> i 1 time 0.75000: 154.99278
> B 0.000 .. 2.000 T 2.000 TT 2.000 M: 0.80000 0.80000
> new alloc for instr 2:
> value A 100.000000
> value B 100.000000
> value A 100.607046
> value B 115.863433
> value A 180.849026
> value B 142.666075
> value A 194.779182
> value B 177.089874
> value A 135.179442
> value B 157.930767
> B 2.000 .. 3.000 T 3.000 TT 3.000 M: 0.80000 0.80000
>
>
>
>
> --
> View this message in context: http://csound.1045644.n5.nabble.com/seed-question-tp5750464.html
> Sent from the Csound - General mailing list archive at Nabble.com.
>
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
> https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here
Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here |