[Cs-dev] conditional loop and event question
Date | 2015-10-03 10:28 |
From | Peiman Khosravi |
Subject | [Cs-dev] conditional loop and event question |
Attachments | None None |
Dear all, I've never done this before and can't figure it out in my head. I'd like to put event (or event_i) inside a loop block in order to generate N instances of an instrument. I've tried a normal krate loop but I think I'm getting a note on each k-cycle instead of a predefined number of notes, which in the instrument below should correspond to the channel count in the file. instr 1 ilength filelen "$FILE" ; Length of file in seconds ichanNumb filenchnls "$FILE" kchanOffset init 0 generate: kchanOffset = kchanOffset+1 event "i", 2, 0, ilength*0.02, kchanOffset if (kchanOffset < ichanNumb) kgoto generate endin Any suggestions much appreciated. All the best, Peiman |
Date | 2015-10-03 10:33 |
From | Victor Lazzarini |
Subject | Re: [Cs-dev] conditional loop and event question |
Attachments | None None |
You need to make your counter 0 after you generate the desired number of events: kcnt init 0 while kcnt < iend do event ... kcnt += 1 od kcnt = 0 Victor Lazzarini Dean of Arts, Celtic Studies, and Philosophy Maynooth University Ireland
|
Date | 2015-10-03 10:35 |
From | Victor Lazzarini |
Subject | Re: [Cs-dev] conditional loop and event question |
Attachments | None None |
actually that was wrong. In my previous code, you should not reset kcnt if you only want one set of events in one kcycle. Sorry for the confusion Victor Lazzarini Dean of Arts, Celtic Studies, and Philosophy Maynooth University Ireland
|
Date | 2015-10-03 10:38 |
From | Victor Lazzarini |
Subject | Re: [Cs-dev] conditional loop and event question |
Attachments | None None |
Also note that you can do this at i-time: icnt = 0 while icnt < iend do event_i ... icnt += 1 od Victor Lazzarini Dean of Arts, Celtic Studies, and Philosophy Maynooth University Ireland
|
Date | 2015-10-03 10:51 |
From | Peiman Khosravi |
Subject | Re: [Cs-dev] conditional loop and event question |
Attachments | None None |
Thanks Victor, That works perfectly! Best, Peiman On 03/10/2015 10:38, Victor Lazzarini
wrote:
|