| I don't have time to look into the specific issue you are having, but
I would use the k-rate version of event if I was doing this:
instr 1
k1 metro 1
if k1 ==1 then
event "i", 10, 0, 1
endif
endin
instr 10
asig poscil 0.5,220,gisine
kenv linseg 0,0.01,1,p3-0.02,1,0.01,0
asig = asig*kenv
out asig
endin
This will keep triggering instr 10 for as long as instr 1 is set to run for.
On 11 September 2014 18:37, orebronerd wrote:
> I work a lot with loops, a simple example would be (instr 1 calls on instr 10
> via event_i):
>
>
>
>
> sr = 44100
> ksmps = 10
> nchnls = 1
> 0dbfs = 1
>
> gisine ftgen 0,0,2^12,10,1
>
> instr 1
> index=0
> until index=30 do
> itime = index/4
> idur = 0.1
> event_i "i",10,itime,idur
> index =index+1
> od
> endin
>
> instr 10
>
> asig poscil 0.5,220,gisine
> kenv linseg 0,0.01,1,p3-0.02,1,0.01,0
> asig = asig*kenv
> out asig
> endin
>
>
>
> i 1 0 6
>
>
>
>
> But now I want to try a more timebased loop. I want a loop to run for a
> certain amount of seconds. I thought I could just set a condition based on
> timesints but CsoundQT just stops and then crashes, both on Windows and Mac.
>
>
>
>
> sr = 44100
> ksmps = 10
> nchnls = 1
> 0dbfs = 1
>
> gisine ftgen 0,0,2^12,10,1
>
> instr 1
> index=0
> ksec timeinsts
> until ksec >4 do
> itime = index/4
> idur = 0.1
> event_i "i",10,itime,idur
> index =index+1
> od
> endin
>
> instr 10
>
> asig poscil 0.5,220,gisine
> kenv linseg 0,0.01,1,p3-0.02,1,0.01,0
> asig = asig*kenv
> out asig
> endin
>
>
>
> i 1 0 4
>
>
>
>
> Any ideas why it doesn´t work? Any suggestions on how make it work? I know
> that I can use index like in the first example, and raise index to a
> suitable number, but it seems somewhat easier to base it on seconds.
>
>
>
>
>
> --
> View this message in context: http://csound.1045644.n5.nabble.com/Time-based-loops-tp5737458.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"
>
>
>
|