[Csnd] rnd(1) problem
| Date | 2010-08-30 12:13 |
| From | Louis Cohen |
| Subject | [Csnd] rnd(1) problem |
This is very unusual -- to come up with two problems in a row, but I think the rnd() function is not working. Try this: |
| Date | 2010-08-30 13:43 |
| From | jpff@cs.bath.ac.uk |
| Subject | [Csnd] Re: rnd(1) problem |
Actually it is not what you think at all. rnd(1) is being treated as an irate function and so is only evaluated once. #i0 rnd.i 1 krand =.k #i0 kone init 1 krand = rnd(kone) and you get teh krat eversion ==John ff > This is very unusual -- to come up with two problems in a row, but I > think the rnd() function is not working. Try this: > > |
| Date | 2010-08-30 14:08 |
| From | Louis Cohen |
| Subject | [Csnd] Re: rnd(1) problem |
John, Thanks for your answer. Apparently there is something about i-rate processing in general that I don't get. I have been confused by this in the past, I think. First, I regret that I do not know how to read: > #i0 rnd.i 1 > krand =.k #i0 Perhaps you can point me to some explanation of this notation. And to some general description of i-rate processing. Second, is it that the "1" inside of rnd(1) is considered to be an irate "variable"? If so, how does the following get processed? ktemp = 1 Is this executed only at i-time, NOT every k-cycle? Third, what is the difference between ktemp = 1 and ktemp init 1 ? thanks for your patience. -Lou On Aug 30, 2010, at 8:43 AM, jpff@cs.bath.ac.uk wrote: > Actually it is not what you think at all. rnd(1) is being treated > as an > irate function and so is only evaluated once. > > #i0 rnd.i 1 > krand =.k #i0 > > > kone init 1 > krand = rnd(kone) > > and you get teh krat eversion > > ==John ff > >> This is very unusual -- to come up with two problems in a row, but I >> think the rnd() function is not working. Try this: >> >> |
| Date | 2010-08-30 14:21 |
| From | Victor Lazzarini |
| Subject | [Csnd] Re: Re: rnd(1) problem |
On 30 Aug 2010, at 14:08, Louis Cohen wrote: > John, > > Thanks for your answer. > > Apparently there is something about i-rate processing in general > that I don't get. I have been confused by this in the past, I think. > > First, I regret that I do not know how to read: > >> #i0 rnd.i 1 >> krand =.k #i0 It is just how your code is parsed. First the opcode rnd.i is called, its answer is put into #i0 and that is assigned to krand. > Perhaps you can point me to some explanation of this notation. And > to some general description of i-rate processing. i-rate happens only once at the initialisation pass, before performance. > > Second, is it that the "1" inside of rnd(1) is considered to be an > irate "variable"? It is not a variable, but a constant. Since these do not change, the rnd function that is selected is the rnd.i and not rnd.k. > If so, how does the following get processed? > > ktemp = 1 > > Is this executed only at i-time, NOT every k-cycle? Not at i-time but at perf-time every k-cycle. To have it executed at i-time use ktemp init 1 > Third, what is the difference between > > ktemp = 1 > > and > > ktemp init 1 > > ? > > > thanks for your patience. > > -Lou > > > On Aug 30, 2010, at 8:43 AM, jpff@cs.bath.ac.uk wrote: > >> Actually it is not what you think at all. rnd(1) is being treated >> as an >> irate function and so is only evaluated once. >> >> #i0 rnd.i 1 >> krand =.k #i0 >> >> >> kone init 1 >> krand = rnd(kone) >> >> and you get teh krat eversion >> >> ==John ff >> >>> This is very unusual -- to come up with two problems in a row, but I >>> think the rnd() function is not working. Try this: >>> >>> |
| Date | 2010-08-30 14:38 |
| From | Louis Cohen |
| Subject | [Csnd] Re: Re: Re: rnd(1) problem |
I think your answer below helps me to pinpoint what's really
confusing. You wrote:
On Aug 30, 2010, at 9:21 AM, Victor Lazzarini wrote:
>> If so, how does the following get processed?
>>
>> ktemp = 1
>>
>> Is this executed only at i-time, NOT every k-cycle?
>
> Not at i-time but at perf-time every k-cycle.
If ktemp = 1 is executed at every k-cycle, then why isn't
ktemp = rnd(1) also executed at every k-cycle?
-Lou
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"
|
| Date | 2010-08-30 15:23 |
| From | Victor Lazzarini |
| Subject | [Csnd] Re: Re: Re: Re: rnd(1) problem |
Because the code turns out be equivalent to
i1 = rnd(1)
ktemp = i1
On 30 Aug 2010, at 14:38, Louis Cohen wrote:
> I think your answer below helps me to pinpoint what's really
> confusing. You wrote:
>
> On Aug 30, 2010, at 9:21 AM, Victor Lazzarini wrote:
>
>>> If so, how does the following get processed?
>>>
>>> ktemp = 1
>>>
>>> Is this executed only at i-time, NOT every k-cycle?
>>
>> Not at i-time but at perf-time every k-cycle.
>
>
> If ktemp = 1 is executed at every k-cycle, then why isn't
>
> ktemp = rnd(1) also executed at every k-cycle?
>
> -Lou
>
>
>
>
> 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"
|
| Date | 2010-08-30 15:34 |
| From | jpff@cs.bath.ac.uk |
| Subject | [Csnd] Re: Re: Re: Re: Re: rnd(1) problem |
> Because the code turns out be equivalent to
>
> i1 = rnd(1)
> ktemp = i1
>
Or another way of thinking about it, the expressions are considered bottom
up -- from the innermost part to the outermost. At each stage it seeks
the least work (i-rate prefered to k-rate). In the case of
ktemp = 1
there is only a simple expression, and we want a k-rate argument
in ktemp = (1+2)
the 1+2 will be unwrapped yo
#i0 add.ii 1,2
ktemp =.k #i0
> On 30 Aug 2010, at 14:38, Louis Cohen wrote:
>
>> I think your answer below helps me to pinpoint what's really
>> confusing. You wrote:
>>
>> On Aug 30, 2010, at 9:21 AM, Victor Lazzarini wrote:
>>
>>>> If so, how does the following get processed?
>>>>
>>>> ktemp = 1
>>>>
>>>> Is this executed only at i-time, NOT every k-cycle?
>>>
>>> Not at i-time but at perf-time every k-cycle.
>>
>>
>> If ktemp = 1 is executed at every k-cycle, then why isn't
>>
>> ktemp = rnd(1) also executed at every k-cycle?
>>
>> -Lou
>>
>>
>>
>>
>> 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"
|
| Date | 2010-08-30 15:38 |
| From | jpff@cs.bath.ac.uk |
| Subject | [Csnd] Re: rnd(1) problem |
ps
It i sof course perfectly possible that the semantic nalysis was top doen,
; ie =.k wants a k-argument so drive (1+2) as add.kk
Csound takes th ebottom up approach as it leads to faster code -- in my
exampe 1+2 is only evaluated at init time.
Th eprice is this confusion, which surfaces from time to time.
Perhaps the manul adoes not mak ethis semantics clear?
==John
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"
|
| Date | 2010-08-30 15:44 |
| From | jpff@cs.bath.ac.uk |
| Subject | [Csnd] Re: Re: rnd(1) problem |
oss:
Somehopw this seems like
http://xkcd.com/221/
which my colleage and ex-studnet has on his door -- creases us up every tome
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"
|
| Date | 2010-08-30 16:17 |
| From | Louis Cohen |
| Subject | [Csnd] Re: Re: rnd(1) problem |
John,
Your explanations are helpful, thanks.
Regarding help from the manual, I can find almost nothing in the
manual about i-rate processing. There's a fair amount of discussion
about the difference between a-rate, k-rate, there's a small amount
regarding f-rate and w-rate, but i-rate, which gets mentioned
frequently enough, is rarely explained.
The section of the manual entitled "Types, Constants and Variables:
Syntax of the Orchestra" is a good example. The various rates are
referred to, but not clarified (especially not i-rate.) The nature of
k-rate and a-rate variables is described, but exactly what happens to
these variables at execution time is not clear, at least not to me --
I have a working model in my head which usually is sufficient.
Obviously I fell into some sort of trap in the case of rnd(1)!
Note that in the manual section I mentioned there are not any links
that actually lead to explanations elsewhere.
I looked at the Csound book and found much the same: k-rate and a-rate
get some discussion, but not i-rate.
-Lou
On Aug 30, 2010, at 10:38 AM, jpff@cs.bath.ac.uk wrote:
> Th eprice is this confusion, which surfaces from time to time.
>
> Perhaps the manul adoes not mak ethis semantics clear?
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"
|
| Date | 2010-08-30 20:46 |
| From | Eric Luckerbau |
| Subject | [Csnd] Re: Re: rnd(1) problem |
I can only second this. It took me a long time to find out that you can actually let code getting executed at i-time. (For example a loop loading files to ftables.) Before that I thought i-rate is only for assigning variables that don't get changed later. Also I didn't know until today what z-rate is (which the compiler sometimes mentioned in an error message), found out just because of that remark by John. |
| Date | 2010-08-30 22:11 |
| From | Oeyvind Brandtsegg |
| Subject | [Csnd] Re: Re: Re: rnd(1) problem |
hum hum ;-) 2010/8/30 |