Csound Csound-dev Csound-tekno Search About

[Csnd] if/elseif or assignment problem

Date2011-02-11 21:10
FromJulien Claassen
Subject[Csnd] if/elseif or assignment problem
Hello everyone!
   whatever can be wrong with this instrument. It's short and to my eyes it 
looks to the book:
sr = 48000
ksmps = 16
nchnls = 2

massign 1, 1
instr 1
 	kt init 0 ; tried this in and out...
 	kf midictrl 105 ; get the pushbutton with discrete values
 	if (kf == 0) then
 		kt init 1
 	elseif kf == 26) then
 		kt init 2
 	elseif (kf == 51) then
 		kt init 3
 	endif
 	a1 oscil 20000, 440*kt, 1
 	outs a1, a1
endin

   It gives me a cryptic error about line 10. Is there a way to make the new 
csound parser give more helpful output? I mean, helpful to the unsuspecting 
user and not the parser interested person? :-)
   Kindly yours
         Julien

--------
Music was my first love and it will be my last (John Miles)

======== FIND MY WEB-PROJECT AT: ========
http://ltsb.sourceforge.net
the Linux TextBased Studio guide
======= AND MY PERSONAL PAGES AT: =======
http://www.juliencoder.de


Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"

Date2011-02-11 21:27
FromJulien Claassen
Subject[Csnd] Re: if/elseif or assignment problem
Sorry, I found the mistake in there, it was a typo. And somehow, I got my 
other big instrument to work, but don't ask me how. I can't tell. :-)
   Sorry, for bothering...
   bye bye
           Julien

--------
Music was my first love and it will be my last (John Miles)

======== FIND MY WEB-PROJECT AT: ========
http://ltsb.sourceforge.net
the Linux TextBased Studio guide
======= AND MY PERSONAL PAGES AT: =======
http://www.juliencoder.de


Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"

Date2011-02-11 22:50
Fromjoachim heintz
SubjectRe: [Csnd] Re: if/elseif or assignment problem
i think there is a problem in your if clause, because you use a k-rate
if (if kf == ...), but inside you use an init statement, which should
just have effect at init-time.
wouldn't it be better to say
  if kf == 0 then
        kt = 1
    elseif kf == 26 then
        kt = 2
    elseif kf == 51 then
        kt = 3
    endif
?

regards -

	joachim


Am 11.02.2011 22:27, schrieb Julien Claassen:
> Sorry, I found the mistake in there, it was a typo. And somehow, I got
> my other big instrument to work, but don't ask me how. I can't tell. :-)
>   Sorry, for bothering...
>   bye bye
>           Julien
> 
> --------
> Music was my first love and it will be my last (John Miles)
> 
> ======== FIND MY WEB-PROJECT AT: ========
> http://ltsb.sourceforge.net
> the Linux TextBased Studio guide
> ======= AND MY PERSONAL PAGES AT: =======
> http://www.juliencoder.de
> 
> 
> Send bugs reports to the Sourceforge bug tracker
>            https://sourceforge.net/tracker/?group_id=81968&atid=564599
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
> csound"
> 
> 


Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"

Date2011-02-11 23:13
FromJulien Claassen
SubjectRe: [Csnd] Re: if/elseif or assignment problem
Hello Peiman and Joachim!
   Thanks both of you. As I said, I have already solved my problem. I did see 
the small missing ( in my example and that fixsed that, but I didn't know, 
what fixed the big one, since there everything was allright.
   And yes, I'm much better off using just an equal sign.
   Still the parser output isn't making it any easier to debug for me, while at 
the same time, figuring out, what exactly I need.
   Kindly yours
           Julien

--------
Music was my first love and it will be my last (John Miles)

======== FIND MY WEB-PROJECT AT: ========
http://ltsb.sourceforge.net
the Linux TextBased Studio guide
======= AND MY PERSONAL PAGES AT: =======
http://www.juliencoder.de


Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"

Date2011-02-12 12:40
Frompeiman khosravi
SubjectRe: [Csnd] Re: if/elseif or assignment problem
Talking about the parser output. In supercollider the parser would
have outputed something like this which makes debugging much easier:

 elseif kf *== 26) then

Best,

Peiman


On 11 February 2011 22:50, joachim heintz  wrote:
> i think there is a problem in your if clause, because you use a k-rate
> if (if kf == ...), but inside you use an init statement, which should
> just have effect at init-time.
> wouldn't it be better to say
>  if kf == 0 then
>        kt = 1
>    elseif kf == 26 then
>        kt = 2
>    elseif kf == 51 then
>        kt = 3
>    endif
> ?
>
> regards -
>
>        joachim
>
>
> Am 11.02.2011 22:27, schrieb Julien Claassen:
>> Sorry, I found the mistake in there, it was a typo. And somehow, I got
>> my other big instrument to work, but don't ask me how. I can't tell. :-)
>>   Sorry, for bothering...
>>   bye bye
>>           Julien
>>
>> --------
>> Music was my first love and it will be my last (John Miles)
>>
>> ======== FIND MY WEB-PROJECT AT: ========
>> http://ltsb.sourceforge.net
>> the Linux TextBased Studio guide
>> ======= AND MY PERSONAL PAGES AT: =======
>> http://www.juliencoder.de
>>
>>
>> Send bugs reports to the Sourceforge bug tracker
>>            https://sourceforge.net/tracker/?group_id=81968&atid=564599
>> Discussions of bugs and features can be posted here
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>> csound"
>>
>>
>
>
> Send bugs reports to the Sourceforge bug tracker
>            https://sourceforge.net/tracker/?group_id=81968&atid=564599
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>
>


Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"


Date2011-02-12 12:50
FromJulien Claassen
SubjectRe: [Csnd] Re: if/elseif or assignment problem
Greetngs Peiman!
   Yes this output does make debugging easier. :-) In csound I mostly get 
something like: T_INDENT expected T_COM or T_something... And when I finaly 
found my bugs, they were lines off. Of course from a parsng point of view, the 
problem is only generated there, but I found the old output was more to the 
point. Well, seeng that it's still a relatively new parser, I expect, that 
over time such luxury will come back. I can see, that it could be some bit to 
code and think about.
   Best wishes
            Julien

--------
Music was my first love and it will be my last (John Miles)

======== FIND MY WEB-PROJECT AT: ========
http://ltsb.sourceforge.net
the Linux TextBased Studio guide
======= AND MY PERSONAL PAGES AT: =======
http://www.juliencoder.de


Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"