| typo, i meant schedulek
thanks again
E
> On 28 Nov 2021, at 19:04, Enrico Fiocco wrote:
>
> I see, thanks!
> scheduled fixed it!!!
> kind regards
> E
>
>
>
>> On 28 Nov 2021, at 19:03, mskala@ansuz.sooke.bc.ca wrote:
>>
>> On Sun, 28 Nov 2021, Enrico F wrote:
>>> if (ktrig != 0) then
>>> schedule 2, 0, 1
>>> endif
>>
>>> instr 2
>>> prints "s***t" ; why is instr 2 scheduled? ... the condition of the if statement is not fulfilled
>>> endin
>>
>> The "schedule" opcode is an i-time opcode and your k-time if statement
>> does not affect it.
>>
>> In more detail: Csound code is not actually just a single program, it is
>> three different programs whose statements can be mixed together in the
>> file. Some statements run at i-time (once when the note starts); some at
>> k-time (once per control cycle); and some at a-time (which functionally
>> means once per audio sample, though the actual implementation may fake
>> this by processing multiple samples at once). These three programs are
>> separated out and run separately at the appropriate times. You can
>> confuse yourself by writing k-time statements in the middle of i-time
>> code, but that won't change their relative order of execution.
>>
>> So your code is really saying:
>>
>> ; AT I-TIME
>>
>> ktrig init 0
>> schedule 2, 0, 1
>>
>> ; AT K-TIME
>>
>> if (ktrig != 0) then
>> ; nothing here!
>> endif
>>
>> I think if you put a k-time opcode like "event" inside the k-time if
>> statement instead of "schedule", you'll find that it does get affected by
>> the conditional. But you'll need to add a bit of further logic (resetting
>> a k-time variable as in the manual's example for "event") to prevent it
>> from triggering a new event on every single k-cycle.
>>
>> --
>> Matthew Skala
>> mskala@ansuz.sooke.bc.ca People before tribes.
>> https://ansuz.sooke.bc.ca/
>>
>> 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
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 |