Csound Csound-dev Csound-tekno Search About

[Csnd] skipping condition

Date2019-04-19 10:15
FromMenno Knevel
Subject[Csnd] skipping condition
Can someone explain to me why "nothing\n" and "kFilterDepthenv\n" are printed
here?

this is the code:
if kbike == 0 then
   kFilterDepthenv  =   1
prints "kFilterDepthenv\n"
else
prints "nothing\n"
endif

and in the output window i read:
.....
kFilterDepthenv
nothing
.....

I am aware that i should use "printks "nothing\n", 0 because of the k-rate
condition etc. but still why are both printed? 
The if...then statement is executed whether the value of kbike is 1 or 0.
Why does this if...then just not skip the whole code section if kbike is not
0?



--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

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

Date2019-04-19 10:31
FromVictor Lazzarini
SubjectRe: [Csnd] skipping condition
because the if-else is only active at k-rate and prints is running at i-time.

Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland

> On 19 Apr 2019, at 10:15, Menno Knevel  wrote:
> 
> Can someone explain to me why "nothing\n" and "kFilterDepthenv\n" are printed
> here?
> 
> this is the code:
> if kbike == 0 then
>   kFilterDepthenv  =   1
> prints "kFilterDepthenv\n"
> else
> prints "nothing\n"
> endif
> 
> and in the output window i read:
> .....
> kFilterDepthenv
> nothing
> .....
> 
> I am aware that i should use "printks "nothing\n", 0 because of the k-rate
> condition etc. but still why are both printed? 
> The if...then statement is executed whether the value of kbike is 1 or 0.
> Why does this if...then just not skip the whole code section if kbike is not
> 0?
> 
> 
> 
> --
> Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html
> 
> 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

Date2019-04-19 11:14
FromMenno Knevel
SubjectRe: [Csnd] skipping condition
yes, very true.
k-rate is time, while i-rate exists is a statement and has nothing to do
with time. Somewhere along the line i was thinking that i-rate was the first
k-rate - and it is not! 

When Csound runs, it first sets the i-rate stuff and then k-rate (= time)
starts. This is why "prints", well, prints.

Thanks for helping me to reset my thoughts!



--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

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