Csound Csound-dev Csound-tekno Search About

[Csnd] andif?

Date2010-11-08 11:45
FromStefan Thomas
Subject[Csnd] andif?
Dear community,
I'm searching for an opcode that does executes something if two conditions are true (something like "andif"),
Actually I would like to change the sound, if the modwheel is >1 and if the midinote is higher than 60.
I tried it, without sucess with:

<CsoundSynthesizer>
<CsOptions>
</CsOptions>
<CsInstruments>
sr     = 48000
kr     = 480
ksmps  = 100
nchnls = 2
0dbfs = 1
; tabels
giSine ftgen 0,0, 2^10, 10, 1

gkmodwheel init 0

massign 1, 101

instr 1
ichannelinstrumentone = 1
icontrollerinstrumentone = 1
gkmodwheel ctrl7 ichannelinstrumentone, icontrollerinstrumentone, 0, 1 ; controller 1 is the modwheel
endin

instr 101
; icps    cpstmid   ituningtable
inote notnum
isplitpoint init 60
 icps cpsmidi
  iamp    ampmidi     0.75
imodwheel = i(gkmodwheel)

amixSinus oscil iamp, icps, giSine
amixFM foscil iamp, icps, 8, 13, 1, giSine
if (imodwheel >0)  (inote >isplitpoint) then

amix = amixFM
else
amix = amixSinus
endif
outs amix, amix
      endin
 
</CsInstruments>
<CsScore>
f0 3600
i1   0    3600
</CsScore>
</CsoundSynthesizer>
 




Date2010-11-08 11:55
FromRory Walsh
Subject[Csnd] Re: andif?
Use the logical AND operator &&. For example

if(k1>0 && k2<10) then
bla bla bla
endif

This tests if k1>0 AND k2<10

Rory.



On 8 November 2010 11:45, Stefan Thomas
 wrote:
> Dear community,
> I'm searching for an opcode that does executes something if two conditions
> are true (something like "andif"),
> Actually I would like to change the sound, if the modwheel is >1 and if the
> midinote is higher than 60.
> I tried it, without sucess with:
>
>> 
>> 
>> 
>> 
>> sr     = 48000Use the &&
>> kr     = 480
>> ksmps  = 100
>> nchnls = 2
>> 0dbfs = 1
>> ; tabels
>> giSine ftgen 0,0, 2^10, 10, 1
>>
>> gkmodwheel init 0
>>
>> massign 1, 101
>>
>> instr 1
>> ichannelinstrumentone = 1
>> icontrollerinstrumentone = 1
>> gkmodwheel ctrl7 ichannelinstrumentone, icontrollerinstrumentone, 0, 1 ;
>> controller 1 is the modwheel
>> endin
>>
>> instr 101
>> ; icps    cpstmid   ituningtable
>> inote notnum
>> isplitpoint init 60
>>  icps cpsmidi
>>   iamp    ampmidi     0.75
>> imodwheel = i(gkmodwheel)
>>
>> amixSinus oscil iamp, icps, giSine
>> amixFM foscil iamp, icps, 8, 13, 1, giSine
>> if (imodwheel >0)  (inote >isplitpoint) then
>>
>> amix = amixFM
>> else
>> amix = amixSinus
>> endif
>> outs amix, amix
>>       endin
>>
>> 
>> 
>> f0 3600
>> i1   0    3600
>> 
>> 
>
>
>
>
>
>


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"


Date2010-11-08 11:57
FromStefan Thomas
Subject[Csnd] Re: Re: andif?
Oh Yes, thanks, it was simple!
But I couldn't find it in the manual (at least not quickly).

2010/11/8 Rory Walsh <rorywalsh@ear.ie>
Use the logical AND operator &&. For example

if(k1>0 && k2<10) then
bla bla bla
endif

This tests if k1>0 AND k2<10

Rory.



On 8 November 2010 11:45, Stefan Thomas
<kontrapunktstefan@googlemail.com> wrote:
> Dear community,
> I'm searching for an opcode that does executes something if two conditions
> are true (something like "andif"),
> Actually I would like to change the sound, if the modwheel is >1 and if the
> midinote is higher than 60.
> I tried it, without sucess with:
>
>> <CsoundSynthesizer>
>> <CsOptions>
>> </CsOptions>
>> <CsInstruments>
>> sr     = 48000Use the &&
>> kr     = 480
>> ksmps  = 100
>> nchnls = 2
>> 0dbfs = 1
>> ; tabels
>> giSine ftgen 0,0, 2^10, 10, 1
>>
>> gkmodwheel init 0
>>
>> massign 1, 101
>>
>> instr 1
>> ichannelinstrumentone = 1
>> icontrollerinstrumentone = 1
>> gkmodwheel ctrl7 ichannelinstrumentone, icontrollerinstrumentone, 0, 1 ;
>> controller 1 is the modwheel
>> endin
>>
>> instr 101
>> ; icps    cpstmid   ituningtable
>> inote notnum
>> isplitpoint init 60
>>  icps cpsmidi
>>   iamp    ampmidi     0.75
>> imodwheel = i(gkmodwheel)
>>
>> amixSinus oscil iamp, icps, giSine
>> amixFM foscil iamp, icps, 8, 13, 1, giSine
>> if (imodwheel >0)  (inote >isplitpoint) then
>>
>> amix = amixFM
>> else
>> amix = amixSinus
>> endif
>> outs amix, amix
>>       endin
>>
>> </CsInstruments>
>> <CsScore>
>> f0 3600
>> i1   0    3600
>> </CsScore>
>> </CsoundSynthesizer>
>
>
>
>
>
>


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"



Date2010-11-08 12:03
FromRichard Dobson
Subject[Csnd] Re: andif?
On 08/11/2010 11:45, Stefan Thomas wrote:
> Dear community,
> I'm searching for an opcode that does executes something if two
> conditions are true (something like "andif"),
> Actually I would like to change the sound, if the modwheel is >1 and if
> the midinote is higher than 60.
> I tried it, without sucess with:
..
>     if (imodwheel >0)  (inote >isplitpoint) then
>

You need the "Logical" AND operator &&


try:

if (imodwheel >0  &&  inote >isplitpoint) ...


Richard Dobson


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"

Date2010-11-08 12:08
Fromjoachim heintz
Subject[Csnd] Re: Re: Re: andif?
if you want to check the manual page, this is the overview:
http://www.csounds.com/manual/html/MathArtLogic.html

this may also be useful:
http://en.flossmanuals.net/bin/view/Csound/OpcodeGuideVI

	joachim

Am 08.11.2010 um 12:57 schrieb Stefan Thomas:

> Oh Yes, thanks, it was simple!
> But I couldn't find it in the manual (at least not quickly).
>
> 2010/11/8 Rory Walsh 
> Use the logical AND operator &&. For example
>
> if(k1>0 && k2<10) then
> bla bla bla
> endif
>
> This tests if k1>0 AND k2<10
>
> Rory.
>
>
>
> On 8 November 2010 11:45, Stefan Thomas
>  wrote:
> > Dear community,
> > I'm searching for an opcode that does executes something if two  
> conditions
> > are true (something like "andif"),
> > Actually I would like to change the sound, if the modwheel is >1  
> and if the
> > midinote is higher than 60.
> > I tried it, without sucess with:
> >
> >> 
> >> 
> >> 
> >> 
> >> sr     = 48000Use the &&
> >> kr     = 480
> >> ksmps  = 100
> >> nchnls = 2
> >> 0dbfs = 1
> >> ; tabels
> >> giSine ftgen 0,0, 2^10, 10, 1
> >>
> >> gkmodwheel init 0
> >>
> >> massign 1, 101
> >>
> >> instr 1
> >> ichannelinstrumentone = 1
> >> icontrollerinstrumentone = 1
> >> gkmodwheel ctrl7 ichannelinstrumentone, icontrollerinstrumentone,  
> 0, 1 ;
> >> controller 1 is the modwheel
> >> endin
> >>
> >> instr 101
> >> ; icps    cpstmid   ituningtable
> >> inote notnum
> >> isplitpoint init 60
> >>  icps cpsmidi
> >>   iamp    ampmidi     0.75
> >> imodwheel = i(gkmodwheel)
> >>
> >> amixSinus oscil iamp, icps, giSine
> >> amixFM foscil iamp, icps, 8, 13, 1, giSine
> >> if (imodwheel >0)  (inote >isplitpoint) then
> >>
> >> amix = amixFM
> >> else
> >> amix = amixSinus
> >> endif
> >> outs amix, amix
> >>       endin
> >>
> >> 
> >> 
> >> f0 3600
> >> i1   0    3600
> >> 
> >> 
> >
> >
> >
> >
> >
> >
>
>
> 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"

Date2010-11-08 17:38
FromStefan Thomas
Subject[Csnd] Re: Re: Re: Re: andif?
Thanks.
Especially the floss-manual seems to be a spring of wisdom!

2010/11/8 joachim heintz <jh@joachimheintz.de>
if you want to check the manual page, this is the overview:
http://www.csounds.com/manual/html/MathArtLogic.html

this may also be useful:
http://en.flossmanuals.net/bin/view/Csound/OpcodeGuideVI

       joachim

Am 08.11.2010 um 12:57 schrieb Stefan Thomas:


Oh Yes, thanks, it was simple!
But I couldn't find it in the manual (at least not quickly).

2010/11/8 Rory Walsh <rorywalsh@ear.ie>
Use the logical AND operator &&. For example

if(k1>0 && k2<10) then
bla bla bla
endif

This tests if k1>0 AND k2<10

Rory.



On 8 November 2010 11:45, Stefan Thomas
<kontrapunktstefan@googlemail.com> wrote:
> Dear community,
> I'm searching for an opcode that does executes something if two conditions
> are true (something like "andif"),
> Actually I would like to change the sound, if the modwheel is >1 and if the
> midinote is higher than 60.
> I tried it, without sucess with:
>
>> <CsoundSynthesizer>
>> <CsOptions>
>> </CsOptions>
>> <CsInstruments>
>> sr     = 48000Use the &&
>> kr     = 480
>> ksmps  = 100
>> nchnls = 2
>> 0dbfs = 1
>> ; tabels
>> giSine ftgen 0,0, 2^10, 10, 1
>>
>> gkmodwheel init 0
>>
>> massign 1, 101
>>
>> instr 1
>> ichannelinstrumentone = 1
>> icontrollerinstrumentone = 1
>> gkmodwheel ctrl7 ichannelinstrumentone, icontrollerinstrumentone, 0, 1 ;
>> controller 1 is the modwheel
>> endin
>>
>> instr 101
>> ; icps    cpstmid   ituningtable
>> inote notnum
>> isplitpoint init 60
>>  icps cpsmidi
>>   iamp    ampmidi     0.75
>> imodwheel = i(gkmodwheel)
>>
>> amixSinus oscil iamp, icps, giSine
>> amixFM foscil iamp, icps, 8, 13, 1, giSine
>> if (imodwheel >0)  (inote >isplitpoint) then
>>
>> amix = amixFM
>> else
>> amix = amixSinus
>> endif
>> outs amix, amix
>>       endin
>>
>> </CsInstruments>
>> <CsScore>
>> f0 3600
>> i1   0    3600
>> </CsScore>
>> </CsoundSynthesizer>
>
>
>
>
>
>


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"



Date2010-11-09 18:06
FromJana
Subject[Csnd] Re: Re: andif?
Am 08.11.2010 12:55, schrieb Rory Walsh:
> Use the logical AND operator&&. For example
>

By the way, there are some strange logical opcodes (and, or, xor) listed 
via csound -z1, even with different combinations of i/k/a-rates.

[...]
xor         a           aa
xor         a           ak
xor         a           ka
xor         i           ii
xor         k           kk
[...]

I haven't found anything about them in the manual and using them by 
trial ends up with a "no legal opcode" error. What's the matter with them?

Example:

instr 1
   k1 init 1
   k2 init 2
   kres xor k1, k2
endin

Best,
Jana





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"

Date2010-11-09 18:14
Fromjpff@cs.bath.ac.uk
Subject[Csnd] Re: Re: Re: andif?
They are expected to be used in expression (infix) form


> Am 08.11.2010 12:55, schrieb Rory Walsh:
>> Use the logical AND operator&&. For example
>>
>
> By the way, there are some strange logical opcodes (and, or, xor) listed
> via csound -z1, even with different combinations of i/k/a-rates.
>
> [...]
> xor         a           aa
> xor         a           ak
> xor         a           ka
> xor         i           ii
> xor         k           kk
> [...]
>
> I haven't found anything about them in the manual and using them by
> trial ends up with a "no legal opcode" error. What's the matter with them?
>
> Example:
>
> instr 1
>    k1 init 1
>    k2 init 2
>    kres xor k1, k2
> endin
>
> Best,
> Jana
>
>
>
>
>
> 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"