[Csnd] k-rate woes
| Date | 2020-07-22 21:35 |
| From | Alex Weiss |
| Subject | [Csnd] k-rate woes |
The following is an excerpt from an instrument:
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
aRecIndex line 0, gitablelen/sr, gitablelen gkRecDur = k(aRecIndex) ; alternatively, can also try gkRecDur downsamp aRecIndex What surprises me here is that after the first k-cycle gkRecDur is 0. At that point, didn't line already compute ksmps worth of a-rate values, so gkRecDur should be whatever the last-computed value of aRecIndex is? |
| Date | 2020-07-22 21:58 |
| From | Pete Goodeve |
| Subject | Re: [Csnd] k-rate woes |
| Attachments | None |
| Date | 2020-07-22 22:59 |
| From | joachim heintz |
| Subject | Re: [Csnd] k-rate woes |
i would have expected it to calculate the mean of the audio vector, but
i think you are right:
instr down
aSig linseg 10, p3, -10
printk 0, k(aSig)
endin
schedule("down",0,4/kr)
new alloc for instr down:
i 1 time 0.00000: 10.00000
i 1 time 0.00018: 5.00000
i 1 time 0.00036: 0.00000
i 1 time 0.00054: -5.00000
joachim
On 22/07/2020 22:58, Pete Goodeve wrote:
> On Wed, Jul 22, 2020 at 01:35:41PM -0700, Alex Weiss wrote:
>> The following is an excerpt from an instrument:
>>
>> aRecIndex line 0, gitablelen/sr, gitablelen
>> gkRecDur = k(aRecIndex)
>> ; alternatively, can also try gkRecDur downsamp aRecIndex
>>
>> What surprises me here is that after the first k-cycle gkRecDur is 0. At
>> that point, didn't line already compute ksmps worth of a-rate values, so
>> gkRecDur should be whatever the last-computed value of aRecIndex is?
>>
> As the a-rate variable is actually an array of ksmps values,
> doesn't a k-conversion simply take the fir4st value of the array?
>
> -- Pete --
>
> 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 |
| Date | 2020-07-23 00:26 |
| From | Alex Weiss |
| Subject | Re: [Csnd] k-rate woes |
I guess that makes sense. For some reason I just thought it would be the last element. On Wed, Jul 22, 2020 at 1:58 PM Pete Goodeve <pete.goodeve@computer.org> wrote:
|
| Date | 2020-07-23 09:37 |
| From | Victor Lazzarini |
| Subject | Re: [Csnd] [EXTERNAL] [Csnd] k-rate woes |
k() is equivalent to downsample
{ "k.a", S(DOWNSAMP),0, 3, "k", "ao", (SUBR)downset,(SUBR)downsamp },
========================
Prof. Victor Lazzarini
Maynooth University
Ireland
> On 22 Jul 2020, at 22:59, joachim heintz |
| Date | 2020-07-23 10:42 |
| From | joachim heintz |
| Subject | Re: [Csnd] [EXTERNAL] [Csnd] k-rate woes |
thanks for the hint. this means, we *can* get what i thought is the
default, in adding the window length as second argument for averaging
the a-signal:
instr down
aSig linseg 10, p3, -10
printk 0, k(aSig,ksmps)
endin
schedule("down",0,4/kr)
i 1 time 0.00000: 7.81250
i 1 time 0.00018: 2.81250
i 1 time 0.00036: -2.18750
i 1 time 0.00054: -7.18750
joachim
On 23/07/2020 10:37, Victor Lazzarini wrote:
> k() is equivalent to downsample
>
> { "k.a", S(DOWNSAMP),0, 3, "k", "ao", (SUBR)downset,(SUBR)downsamp },
>
>
> ========================
> Prof. Victor Lazzarini
> Maynooth University
> Ireland
>
>> On 22 Jul 2020, at 22:59, joachim heintz |
| Date | 2020-07-23 17:25 |
| From | Alex Weiss |
| Subject | Re: [Csnd] [EXTERNAL] [Csnd] k-rate woes |
So is there no way then to get the last element (or, more generally, any other element) of a ksmps array of a-values and assign it to a k-rate variable during the k-cycle it was computed? On Thu, Jul 23, 2020, 01:37 Victor Lazzarini <Victor.Lazzarini@mu.ie> wrote: k() is equivalent to downsample |
| Date | 2020-07-23 17:36 |
| From | Victor Lazzarini |
| Subject | Re: [Csnd] [EXTERNAL] [Csnd] k-rate woes |
yes, of course there is. The simplest is just to use indexing asig init 0 k1 = asig[ksmps-1] ======================== Prof. Victor Lazzarini Maynooth University Ireland > On 23 Jul 2020, at 17:25, Alex Weiss |
| Date | 2020-07-23 18:02 |
| From | Alex Weiss |
| Subject | Re: [Csnd] [EXTERNAL] [Csnd] k-rate woes |
Wow. I had no idea that was a thing. I really gotta read up about all these "new" array features. I feel like a fossil. On Thu, Jul 23, 2020, 09:36 Victor Lazzarini <Victor.Lazzarini@mu.ie> wrote: yes, of course there is. The simplest is just to use indexing |