Csound Csound-dev Csound-tekno Search About

[Csnd] Question(s) on genarray

Date2013-07-24 14:42
Fromjohn ffitch
Subject[Csnd] Question(s) on genarray
There has been a discussion about what the genarray opcode should do.
This e-mail is to see if there is a consensus.

Reminder: genarray writes an array in an arithmetic sequence

genarray 1, 4  => [1, 2, 3, 4]
genarray 1, 2, 0.5 => [1, 1.5, 2]


The current implementation is that genarray is an i-time operation
like init.  The other suggestion is that it should be a k-rate
operation, writing values every perf cycle, and there should be a
genarray_i operation that is like the current genarray.

This needs to be settled before the next release so as not to break
backward compatability say inside a week.

Anyone have answers, reasons, etc?

==John ffitch

Date2013-07-24 15:18
FromLouis Cohen
SubjectRe: [Csnd] Question(s) on genarray
John,

It makes good sense to me to have genarray work in i-mode and k-mode. For small arrays, running at k-rate could be very useful. Obviously for large arrays running at k-rate could be unduly time consuming.

Maybe:
genarrayi
genarrayk
?

Another thought is to make genarray work ONLY at k-rate, since with appropriate coding it can be made to execute only in the first k-cycle (or, with trickier coding, to operate in some k-cycles but not others.)

best,
Lou Cohen


On Jul 24, 2013, at 9:42 AM, john ffitch  wrote:

> There has been a discussion about what the genarray opcode should do.
> This e-mail is to see if there is a consensus.
> 
> Reminder: genarray writes an array in an arithmetic sequence
> 
> genarray 1, 4  => [1, 2, 3, 4]
> genarray 1, 2, 0.5 => [1, 1.5, 2]
> 
> 
> The current implementation is that genarray is an i-time operation
> like init.  The other suggestion is that it should be a k-rate
> operation, writing values every perf cycle, and there should be a
> genarray_i operation that is like the current genarray.
> 
> This needs to be settled before the next release so as not to break
> backward compatability say inside a week.
> 
> Anyone have answers, reasons, etc?
> 
> ==John ffitch
> 
> 
> Send bugs reports to the Sourceforge bug trackers
> csound6:
>            https://sourceforge.net/p/csound/tickets/
> csound5:
>            https://sourceforge.net/p/csound/bugs/
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
> 
> 

Lou Cohen
www.jolc.net
www.opensound.org






Date2013-07-24 15:44
FromBen Hackbarth
SubjectRe: [Csnd] Question(s) on genarray
> genarray 1, 2, 0.5 => [1, 1.5, 2]

another option would be
genarray 1, 2, 2 -> [1, 2]
genarray 1, 2, 5 -> [1, 1.25, 1.5, 1.75, 2]

i slightly prefer option 2 as one would explicitly state the output array size rather than the step size.  but they are both ok imo.

--  ben


On Wed, Jul 24, 2013 at 4:18 PM, Louis Cohen <loucohen@jolc.net> wrote:
John,

It makes good sense to me to have genarray work in i-mode and k-mode. For small arrays, running at k-rate could be very useful. Obviously for large arrays running at k-rate could be unduly time consuming.

Maybe:
genarrayi
genarrayk
?

Another thought is to make genarray work ONLY at k-rate, since with appropriate coding it can be made to execute only in the first k-cycle (or, with trickier coding, to operate in some k-cycles but not others.)

best,
Lou Cohen


On Jul 24, 2013, at 9:42 AM, john ffitch <jpff@codemist.co.uk> wrote:

> There has been a discussion about what the genarray opcode should do.
> This e-mail is to see if there is a consensus.
>
> Reminder: genarray writes an array in an arithmetic sequence
>
> genarray 1, 4  => [1, 2, 3, 4]
> genarray 1, 2, 0.5 => [1, 1.5, 2]
>
>
> The current implementation is that genarray is an i-time operation
> like init.  The other suggestion is that it should be a k-rate
> operation, writing values every perf cycle, and there should be a
> genarray_i operation that is like the current genarray.
>
> This needs to be settled before the next release so as not to break
> backward compatability say inside a week.
>
> Anyone have answers, reasons, etc?
>
> ==John ffitch
>
>
> Send bugs reports to the Sourceforge bug trackers
> csound6:
>            https://sourceforge.net/p/csound/tickets/
> csound5:
>            https://sourceforge.net/p/csound/bugs/
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>
>

Lou Cohen
www.jolc.net
www.opensound.org






Send bugs reports to the Sourceforge bug trackers
csound6:
            https://sourceforge.net/p/csound/tickets/
csound5:
            https://sourceforge.net/p/csound/bugs/
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"




Date2013-07-24 16:00
From"\\js"
SubjectRe: [Csnd] Question(s) on genarray
hi

ok, i have not been a part of this discussion at all but i had a thought 
regarding this part:

On 7/24/13 9:42 , john ffitch wrote:
> The current implementation is that genarray is an i-time operation
> like init.  The other suggestion is that it should be a k-rate
> operation, writing values every perf cycle, and there should be a
> genarray_i operation that is like the current genarray.

could you call it have it both ways depending on the return variable?

iarr  genarray 1, 4
karr  genarray 1, 2, 0.5

although, if called to an anonymous return value [don't know if this can 
happen] you might need the genarray_k and genarray_i functions. if 
called in an anonymous context without specification, it should probably 
do what it did before [although k-rate would save cycles, right?].

my reasons are just based on knowing what i know about csound and trying 
to design the API to allow for maximum flexibility.

good luck!

-- 
\js [http://or8.net/~johns/] -

Date2013-07-24 18:00
FromAndres Cabrera
SubjectRe: [Csnd] Question(s) on genarray
I'm not sure if it makes sense here but arrays in numpy (and possibly other similar systems) are half open ranges like this:

In [4]: arange(0,3)
Out[4]: array([0, 1, 2])

In [5]: range(0,3)
Out[5]: [0, 1, 2]

In [6]: arange(0,3,0.2)
Out[6]:
array([ 0. ,  0.2,  0.4,  0.6,  0.8,  1. ,  1.2,  1.4,  1.6,  1.8,  2. ,
        2.2,  2.4,  2.6,  2.8])

Cheers,
Andrés



On Wed, Jul 24, 2013 at 8:00 AM, \js <johns@or8.net> wrote:
hi

ok, i have not been a part of this discussion at all but i had a thought regarding this part:


On 7/24/13 9:42 , john ffitch wrote:
The current implementation is that genarray is an i-time operation
like init.  The other suggestion is that it should be a k-rate
operation, writing values every perf cycle, and there should be a
genarray_i operation that is like the current genarray.

could you call it have it both ways depending on the return variable?

iarr  genarray 1, 4
karr  genarray 1, 2, 0.5

although, if called to an anonymous return value [don't know if this can happen] you might need the genarray_k and genarray_i functions. if called in an anonymous context without specification, it should probably do what it did before [although k-rate would save cycles, right?].

my reasons are just based on knowing what i know about csound and trying to design the API to allow for maximum flexibility.

good luck!

--
\js [http://or8.net/~johns/] -



Send bugs reports to the Sourceforge bug trackers
csound6:
           https://sourceforge.net/p/csound/tickets/
csound5:
           https://sourceforge.net/p/csound/bugs/
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"