Csound Csound-dev Csound-tekno Search About

[Csnd] conditional question

Date2012-08-22 01:22
Frompeiman khosravi
Subject[Csnd] conditional question
Hello,

Is it not possible to combine k and i variables together in a conditional? Like this:

if (kplay==idur) then

turnoff

endif


The conditional seems to work at i-rate only. But if I change "idur" to a straight number it works as expected. Is this normal?


Thanks

Peiman



Date2012-08-22 02:02
FromJim Aikin
Subject[Csnd] Re: conditional question
I imagine it's normal ... but there's an easy workaround:

kdur init idur
if (kplay == kdur) then



--
View this message in context: http://csound.1045644.n5.nabble.com/conditional-question-tp5715059p5715060.html
Sent from the Csound - General mailing list archive at Nabble.com.

Date2012-08-22 02:05
Frompeiman khosravi
Subject[Csnd] Re: conditional question
Attachmentstest2.csd  
I'm sure I'm missing something but in the csd attached I'm the "test" button (in CsoundQT) to turn on after 5 secs but it comes on straight away.

Thanks
Peiman

On 22 August 2012 01:22, peiman khosravi <peimankhosravi@gmail.com> wrote:
Hello,

Is it not possible to combine k and i variables together in a conditional? Like this:

if (kplay==idur) then

turnoff

endif


The conditional seems to work at i-rate only. But if I change "idur" to a straight number it works as expected. Is this normal?


Thanks

Peiman




Date2012-08-22 02:29
Frompeiman khosravi
Subject[Csnd] Re: conditional question
Thanks Jim,

I'll give this a go tomorrow.

Best,
Peiman

On 22 August 2012 02:05, peiman khosravi <peimankhosravi@gmail.com> wrote:
I'm sure I'm missing something but in the csd attached I'm the "test" button (in CsoundQT) to turn on after 5 secs but it comes on straight away.

Thanks
Peiman

On 22 August 2012 01:22, peiman khosravi <peimankhosravi@gmail.com> wrote:
Hello,

Is it not possible to combine k and i variables together in a conditional? Like this:

if (kplay==idur) then

turnoff

endif


The conditional seems to work at i-rate only. But if I change "idur" to a straight number it works as expected. Is this normal?


Thanks

Peiman





Date2012-08-22 05:06
FromAndres Cabrera
SubjectRe: [Csnd] Re: conditional question
Attachmentstest.csd  
Hi Peiman,

Here's one way it works. The main issue is that outvalue is a bit of
an odd opcode as it sends a value both at init and every control
block, so when the opcode is initialized it will send the value, which
will happen always for k-rate conditionals!
The other issue is that the value will never be exactly 1, so I've
made a quick fix. Not ideal, but works here...

Cheers,
Andres

On 8/21/12, peiman khosravi  wrote:
> Thanks Jim,
>
> I'll give this a go tomorrow.
>
> Best,
> Peiman
>
> On 22 August 2012 02:05, peiman khosravi  wrote:
>
>> I'm sure I'm missing something but in the csd attached I'm the "test"
>> button (in CsoundQT) to turn on after 5 secs but it comes on straight
>> away.
>>
>> Thanks
>> Peiman
>>
>> On 22 August 2012 01:22, peiman khosravi 
>> wrote:
>>
>>> Hello,
>>>
>>> Is it not possible to combine k and i variables together in a
>>> conditional? Like this:
>>>
>>> if (kplay==idur) then
>>>
>>> turnoff
>>>
>>> endif
>>>
>>>
>>> The conditional seems to work at i-rate only. But if I change "idur" to
>>> a
>>> straight number it works as expected. Is this normal?
>>>
>>>
>>> Thanks
>>>
>>> Peiman
>>>
>>>
>>
>
> 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"
>
>


-- 


Andrés

Date2012-08-22 09:45
Frompeiman khosravi
SubjectRe: [Csnd] Re: conditional question
Thanks Andres,

That's great. Just as you think you know all the basic stuff you find out how much you don't know!

Cheers,
Peiman

On 22 August 2012 05:06, Andres Cabrera <mantaraya36@gmail.com> wrote:
Hi Peiman,

Here's one way it works. The main issue is that outvalue is a bit of
an odd opcode as it sends a value both at init and every control
block, so when the opcode is initialized it will send the value, which
will happen always for k-rate conditionals!
The other issue is that the value will never be exactly 1, so I've
made a quick fix. Not ideal, but works here...

Cheers,
Andres

On 8/21/12, peiman khosravi <peimankhosravi@gmail.com> wrote:
> Thanks Jim,
>
> I'll give this a go tomorrow.
>
> Best,
> Peiman
>
> On 22 August 2012 02:05, peiman khosravi <peimankhosravi@gmail.com> wrote:
>
>> I'm sure I'm missing something but in the csd attached I'm the "test"
>> button (in CsoundQT) to turn on after 5 secs but it comes on straight
>> away.
>>
>> Thanks
>> Peiman
>>
>> On 22 August 2012 01:22, peiman khosravi <peimankhosravi@gmail.com>
>> wrote:
>>
>>> Hello,
>>>
>>> Is it not possible to combine k and i variables together in a
>>> conditional? Like this:
>>>
>>> if (kplay==idur) then
>>>
>>> turnoff
>>>
>>> endif
>>>
>>>
>>> The conditional seems to work at i-rate only. But if I change "idur" to
>>> a
>>> straight number it works as expected. Is this normal?
>>>
>>>
>>> Thanks
>>>
>>> Peiman
>>>
>>>
>>
>
> 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"
>
>


--


Andrés

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"



Date2012-08-22 10:46
Frompeiman khosravi
SubjectRe: [Csnd] Re: conditional question
AttachmentsreadStereoAudioFile_3.csd  
This seems to be working nicely. I would like to simply it if possible but it works!

Best,
Peiman

On 22 August 2012 09:45, peiman khosravi <peimankhosravi@gmail.com> wrote:
Thanks Andres,

That's great. Just as you think you know all the basic stuff you find out how much you don't know!

Cheers,
Peiman


On 22 August 2012 05:06, Andres Cabrera <mantaraya36@gmail.com> wrote:
Hi Peiman,

Here's one way it works. The main issue is that outvalue is a bit of
an odd opcode as it sends a value both at init and every control
block, so when the opcode is initialized it will send the value, which
will happen always for k-rate conditionals!
The other issue is that the value will never be exactly 1, so I've
made a quick fix. Not ideal, but works here...

Cheers,
Andres

On 8/21/12, peiman khosravi <peimankhosravi@gmail.com> wrote:
> Thanks Jim,
>
> I'll give this a go tomorrow.
>
> Best,
> Peiman
>
> On 22 August 2012 02:05, peiman khosravi <peimankhosravi@gmail.com> wrote:
>
>> I'm sure I'm missing something but in the csd attached I'm the "test"
>> button (in CsoundQT) to turn on after 5 secs but it comes on straight
>> away.
>>
>> Thanks
>> Peiman
>>
>> On 22 August 2012 01:22, peiman khosravi <peimankhosravi@gmail.com>
>> wrote:
>>
>>> Hello,
>>>
>>> Is it not possible to combine k and i variables together in a
>>> conditional? Like this:
>>>
>>> if (kplay==idur) then
>>>
>>> turnoff
>>>
>>> endif
>>>
>>>
>>> The conditional seems to work at i-rate only. But if I change "idur" to
>>> a
>>> straight number it works as expected. Is this normal?
>>>
>>>
>>> Thanks
>>>
>>> Peiman
>>>
>>>
>>
>
> 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"
>
>


--


Andrés

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"