Csound Csound-dev Csound-tekno Search About

[Csnd] trim array

Date2020-03-18 12:47
Fromjoachim heintz
Subject[Csnd] trim array
from https://csound.com/docs/manual/trim.html i understood that trim can 
be used to change k- and a-rate arrays at perf time.  but it seems that 
only k-arrays are working.

this is ok:
kArr[] fillarray  1, 3, 9, 5, 6, -1, 17
trim kArr, 5

but this does not change anything in the size of the audio array:
aArr[] init 8
printks "%d\n", 0, lenarray(aArr)
trim aArr, 2
printks "%d\n", 0, lenarray(aArr)
(reports always 8 as length)

it works with trim_i:
aArr[] init 8
prints "%d\n", lenarray(aArr)
trim_i aArr, 2
prints "%d\n", lenarray(aArr)

should the manual be corrected (trim audio arrays only at i-time), or is 
it supposed to work at performance time for audio arrays?

best -
	joachim

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

Date2020-03-18 16:42
Fromjohn
SubjectRe: [Csnd] trim array
trim on an a-array is working.  However I think your code calculates 
lenarray at i-time as it had a constant (i-time) argument.  If you use 
trim_i the 
action is only at i-time.



On Wed, 18 Mar 2020, joachim heintz wrote:

> from https://csound.com/docs/manual/trim.html i understood that trim can be 
> used to change k- and a-rate arrays at perf time.  but it seems that only 
> k-arrays are working.
>
> this is ok:
> kArr[] fillarray  1, 3, 9, 5, 6, -1, 17
> trim kArr, 5
>
> but this does not change anything in the size of the audio array:
> aArr[] init 8
> printks "%d\n", 0, lenarray(aArr)
> trim aArr, 2
> printks "%d\n", 0, lenarray(aArr)
> (reports always 8 as length)
>
> it works with trim_i:
> aArr[] init 8
> prints "%d\n", lenarray(aArr)
> trim_i aArr, 2
> prints "%d\n", lenarray(aArr)
>
> should the manual be corrected (trim audio arrays only at i-time), or is it 
> supposed to work at performance time for audio arrays?
>
> best -
> 	joachim
>
> 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

Date2020-03-18 16:45
Fromjohn
SubjectRe: [Csnd] trim array
PS for confirmation.  The code generate is

init.0 args:    aArr    8
lenarray.ix args:       #i0     aArr    1
printks args:   "%d\n"  0       #i0
trim.k args:    aArr    2
lenarray.ix args:       #i1     aArr    1
printks args:   "%d\n"  0       #i1

Note the lenarray calls ar givng i-toime valurs #10 and #i2

On Wed, 18 Mar 2020, joachim heintz wrote:

> from https://csound.com/docs/manual/trim.html i understood that trim can be 
> used to change k- and a-rate arrays at perf time.  but it seems that only 
> k-arrays are working.
>
> this is ok:
> kArr[] fillarray  1, 3, 9, 5, 6, -1, 17
> trim kArr, 5
>
> but this does not change anything in the size of the audio array:
> aArr[] init 8
> printks "%d\n", 0, lenarray(aArr)
> trim aArr, 2
> printks "%d\n", 0, lenarray(aArr)
> (reports always 8 as length)
>
> it works with trim_i:
> aArr[] init 8
> prints "%d\n", lenarray(aArr)
> trim_i aArr, 2
> prints "%d\n", lenarray(aArr)
>
> should the manual be corrected (trim audio arrays only at i-time), or is it 
> supposed to work at performance time for audio arrays?
>
> best -
> 	joachim
>
> 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

Date2020-03-18 16:59
Fromjohn
SubjectRe: [Csnd] trim array
...and this is a consequence of the functional style.  f I use the 
traditional style (as I usuakky do) it is as one expects

instr 1
aArr[] init 8
k1 lenarray aArr
printks "%d\n", 0, k1
k2 lenarray aArr
trim aArr, 2
printks "%d\n", 0, k2
endin

i suppose if we change lenarray to lenarray_i in the i-rate format it 
might be OK

==John

On Wed, 18 Mar 2020, joachim heintz wrote:

> from https://csound.com/docs/manual/trim.html i understood that trim can be 
> used to change k- and a-rate arrays at perf time.  but it seems that only 
> k-arrays are working.
>
> this is ok:
> kArr[] fillarray  1, 3, 9, 5, 6, -1, 17
> trim kArr, 5
>
> but this does not change anything in the size of the audio array:
> aArr[] init 8
> printks "%d\n", 0, lenarray(aArr)
> trim aArr, 2
> printks "%d\n", 0, lenarray(aArr)
> (reports always 8 as length)
>
> it works with trim_i:
> aArr[] init 8
> prints "%d\n", lenarray(aArr)
> trim_i aArr, 2
> prints "%d\n", lenarray(aArr)
>
> should the manual be corrected (trim audio arrays only at i-time), or is it 
> supposed to work at performance time for audio arrays?
>
> best -
> 	joachim
>
> 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

Date2020-03-18 17:06
Fromjoachim heintz
SubjectRe: [Csnd] trim array
yes i went into this trap ... this works as expected:

aArr[] init 8
printks "%d\n", 0, lenarray:k(aArr)
trim aArr, 2
printks "%d\n", 0, lenarray:k(aArr)
turnoff

thanks -
	joachim



On 18/03/2020 17:59, john wrote:
> ...and this is a consequence of the functional style.  f I use the 
> traditional style (as I usuakky do) it is as one expects
> 
> instr 1
> aArr[] init 8
> k1 lenarray aArr
> printks "%d\n", 0, k1
> k2 lenarray aArr
> trim aArr, 2
> printks "%d\n", 0, k2
> endin
> 
> i suppose if we change lenarray to lenarray_i in the i-rate format it 
> might be OK
> 
> ==John
> 
> On Wed, 18 Mar 2020, joachim heintz wrote:
> 
>> from https://csound.com/docs/manual/trim.html i understood that trim 
>> can be used to change k- and a-rate arrays at perf time.  but it seems 
>> that only k-arrays are working.
>>
>> this is ok:
>> kArr[] fillarray  1, 3, 9, 5, 6, -1, 17
>> trim kArr, 5
>>
>> but this does not change anything in the size of the audio array:
>> aArr[] init 8
>> printks "%d\n", 0, lenarray(aArr)
>> trim aArr, 2
>> printks "%d\n", 0, lenarray(aArr)
>> (reports always 8 as length)
>>
>> it works with trim_i:
>> aArr[] init 8
>> prints "%d\n", lenarray(aArr)
>> trim_i aArr, 2
>> prints "%d\n", lenarray(aArr)
>>
>> should the manual be corrected (trim audio arrays only at i-time), or 
>> is it supposed to work at performance time for audio arrays?
>>
>> best -
>>     joachim
>>
>> 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

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