| rand doesn't run at i-rate so it will return 0 on the init-pass.
Perhaps you could try using an i-rate number generator?
On 18 May 2014 11:24, Gleb wrote:
> Dear Csounders,
>
> This time I would like to create several instances of instruments with
> independently working random generators. In the fragment of code included I
> am trying to delay the envelope of each instance by some random time and for
> each instance it must be a different one.
>
> Please correct me: I pass the random seed values to each instance as a
> p-field.
> In the instance I feed the corresponding seed value to the random generator.
> I do transform of k-rate random value to i-time and feed it to linseg.
> In each instance for some reason idel is equal to zero.
>
> I was experimenting with timeout/reinit opcodes and it works well, but in
> any case the very first number produced is zero for all the instances.
>
> Thank you!
>
> instr 10
> iNumVoices = 10
> kIter init 0
> kIter += 1
>
> if kIter == iNumVoices then
> turnoff
> endif
>
> kseed rand .5, .5
> event "i", 11, 0, p3, kseed+.5
> endin
>
> instr 11
> print p4
> krand rand .5, p4
> idel = i(krand)
> print idel
> kEnv linseg 0, idel*10, 0, .1, 1, 3, 0
> endin
>
>
>
> -----
> Gleb Rogozinsky, PhD
> Associated Professor
> Interactive Arts Department
> Saint-Petersburg University of Film and Television
>
> Deputy Director of Medialab
> Saint-Petersburg University of Telecommunications
> --
> View this message in context: http://csound.1045644.n5.nabble.com/Several-instrument-instances-with-independent-random-generators-tp5735339.html
> Sent from the Csound - General mailing list archive at Nabble.com.
>
>
> Send bugs reports to
> https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>
>
>
|