Csound Csound-dev Csound-tekno Search About

[Csnd] arrays---through tables?

Date2011-01-16 22:50
FromAaron Krister Johnson
Subject[Csnd] arrays---through tables?
Hi...

I'm wondering--is the only way to have an array in csound through a table? I want for instance to have a function that scans which MIDI notes are currently being played, and implementing this in a standard programming language would mean a storage array. It appears the only similar structure in csound is a table.

Am I right in assuming I'd have to create UDOs for things like creating a more standard programming-like array with a table, in order to do things like search the array (table) for a value, confirming it's there?

For instance, if I have an array of integers, I want kbool to return a '1' if the hypotetical opcode 'is_in_array' detects a value (kval) is inside the array (iarray):

         kbool    is_in_array  kval, iarray

has anyone ever done such work....it seems to me that what Csound needs are easy to use array structures, for precisely such applications.

AKJ 

--
Aaron Krister Johnson
http://www.akjmusic.com
http://www.untwelve.org


Date2011-01-16 23:13
Fromjoachim heintz
Subject[Csnd] Re: arrays---through tables?
hi aaron -

these thoughts sound very familiar to me ...

yes, i've written something like this. see below. and it's also possible
to use strings as arrays, in certain situations:
http://www.csounds.com/journal/issue13/StringsAsArrays.html

all best -

	joachim

  opcode TabValIn_k, k, ki
;looks whether any value in itable equals ksearch. returns -1 if not,
otherwise the first index where ksearch has been found in itable
ksearch, itable 	xin
ilen		=	ftlen(itable)
kndx		=	0
loop:
kval		tab	kndx, itable
kresult	=	(kval == ksearch ? kndx : -1)
kndx		=	kndx + 1
if kresult == -1 && kndx < ilen kgoto loop
		xout	kresult
  endop

Am 16.01.2011 23:50, schrieb Aaron Krister Johnson:
> Hi...
> 
> I'm wondering--is the only way to have an array in csound through a
> table? I want for instance to have a function that scans which MIDI
> notes are currently being played, and implementing this in a standard
> programming language would mean a storage array. It appears the only
> similar structure in csound is a table.
> 
> Am I right in assuming I'd have to create UDOs for things like creating
> a more standard programming-like array with a table, in order to do
> things like search the array (table) for a value, confirming it's there?
> 
> For instance, if I have an array of integers, I want kbool to return a
> '1' if the hypotetical opcode 'is_in_array' detects a value (kval) is
> inside the array (iarray):
> 
>          kbool    is_in_array  kval, iarray
> 
> has anyone ever done such work....it seems to me that what Csound needs
> are easy to use array structures, for precisely such applications.
> 
> AKJ 
> 
> -- 
> Aaron Krister Johnson
> http://www.akjmusic.com
> http://www.untwelve.org
> 


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"

Date2011-01-17 17:59
FromMichael Gogins
Subject[Csnd] Re: Re: arrays---through tables?
There is a complete set of linear algebra opcodes in Csound, including
real and complex scalars, vectors, and matrices, norms, sums and
products including dot products, and solvers and decompositions from
matrix inversion up through eigenvalue decompositions. The opcodes
work with Csound variables including i-rate, k-rate, a-rate, f-sigs,
and tables. The power available is equivalent to a good chunk of
Matlab. The opcodes are very efficient.

Using a-rate signals as vectors is easy if ksmps equals the vector
size, but is still possible even if that is not the case.

Regards,
Mike



On Sun, Jan 16, 2011 at 6:13 PM, joachim heintz  wrote:
> hi aaron -
>
> these thoughts sound very familiar to me ...
>
> yes, i've written something like this. see below. and it's also possible
> to use strings as arrays, in certain situations:
> http://www.csounds.com/journal/issue13/StringsAsArrays.html
>
> all best -
>
>        joachim
>
>  opcode TabValIn_k, k, ki
> ;looks whether any value in itable equals ksearch. returns -1 if not,
> otherwise the first index where ksearch has been found in itable
> ksearch, itable         xin
> ilen            =       ftlen(itable)
> kndx            =       0
> loop:
> kval            tab     kndx, itable
> kresult =       (kval == ksearch ? kndx : -1)
> kndx            =       kndx + 1
> if kresult == -1 && kndx < ilen kgoto loop
>                xout    kresult
>  endop
>
> Am 16.01.2011 23:50, schrieb Aaron Krister Johnson:
>> Hi...
>>
>> I'm wondering--is the only way to have an array in csound through a
>> table? I want for instance to have a function that scans which MIDI
>> notes are currently being played, and implementing this in a standard
>> programming language would mean a storage array. It appears the only
>> similar structure in csound is a table.
>>
>> Am I right in assuming I'd have to create UDOs for things like creating
>> a more standard programming-like array with a table, in order to do
>> things like search the array (table) for a value, confirming it's there?
>>
>> For instance, if I have an array of integers, I want kbool to return a
>> '1' if the hypotetical opcode 'is_in_array' detects a value (kval) is
>> inside the array (iarray):
>>
>>          kbool    is_in_array  kval, iarray
>>
>> has anyone ever done such work....it seems to me that what Csound needs
>> are easy to use array structures, for precisely such applications.
>>
>> AKJ
>>
>> --
>> Aaron Krister Johnson
>> http://www.akjmusic.com
>> http://www.untwelve.org
>>
>
>
> 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"
>
>



-- 
Michael Gogins
Irreducible Productions
http://www.michael-gogins.com
Michael dot Gogins at gmail dot com


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"


Date2011-01-17 19:12
FromAaron Krister Johnson
Subject[Csnd] Re: Re: Re: arrays---through tables?
Forgive my ignorance, but how can vectors, matrices, et al function as arrays?

AKJ

On Mon, Jan 17, 2011 at 11:59 AM, Michael Gogins <michael.gogins@gmail.com> wrote:
There is a complete set of linear algebra opcodes in Csound, including
real and complex scalars, vectors, and matrices, norms, sums and
products including dot products, and solvers and decompositions from
matrix inversion up through eigenvalue decompositions. The opcodes
work with Csound variables including i-rate, k-rate, a-rate, f-sigs,
and tables. The power available is equivalent to a good chunk of
Matlab. The opcodes are very efficient.

Using a-rate signals as vectors is easy if ksmps equals the vector
size, but is still possible even if that is not the case.

Regards,
Mike



On Sun, Jan 16, 2011 at 6:13 PM, joachim heintz <jh@joachimheintz.de> wrote:
> hi aaron -
>
> these thoughts sound very familiar to me ...
>
> yes, i've written something like this. see below. and it's also possible
> to use strings as arrays, in certain situations:
> http://www.csounds.com/journal/issue13/StringsAsArrays.html
>
> all best -
>
>        joachim
>
>  opcode TabValIn_k, k, ki
> ;looks whether any value in itable equals ksearch. returns -1 if not,
> otherwise the first index where ksearch has been found in itable
> ksearch, itable         xin
> ilen            =       ftlen(itable)
> kndx            =       0
> loop:
> kval            tab     kndx, itable
> kresult =       (kval == ksearch ? kndx : -1)
> kndx            =       kndx + 1
> if kresult == -1 && kndx < ilen kgoto loop
>                xout    kresult
>  endop
>
> Am 16.01.2011 23:50, schrieb Aaron Krister Johnson:
>> Hi...
>>
>> I'm wondering--is the only way to have an array in csound through a
>> table? I want for instance to have a function that scans which MIDI
>> notes are currently being played, and implementing this in a standard
>> programming language would mean a storage array. It appears the only
>> similar structure in csound is a table.
>>
>> Am I right in assuming I'd have to create UDOs for things like creating
>> a more standard programming-like array with a table, in order to do
>> things like search the array (table) for a value, confirming it's there?
>>
>> For instance, if I have an array of integers, I want kbool to return a
>> '1' if the hypotetical opcode 'is_in_array' detects a value (kval) is
>> inside the array (iarray):
>>
>>          kbool    is_in_array  kval, iarray
>>
>> has anyone ever done such work....it seems to me that what Csound needs
>> are easy to use array structures, for precisely such applications.
>>
>> AKJ
>>
>> --
>> Aaron Krister Johnson
>> http://www.akjmusic.com
>> http://www.untwelve.org
>>
>
>
> 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"
>
>



--
Michael Gogins
Irreducible Productions
http://www.michael-gogins.com
Michael dot Gogins at gmail dot com


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"




--
Aaron Krister Johnson
http://www.akjmusic.com
http://www.untwelve.org


Date2011-01-18 01:46
FromMichael Gogins
Subject[Csnd] Re: Re: Re: Re: arrays---through tables?
A vector is indeed a 1-dimensional array (like a table), a matrix is
indeed a 2-dimensional array. There is no difference in storage,
layout, or indexing. The only difference is that vectors and matrices
have arithmetic defined on them.

Regards,
Mike

On Mon, Jan 17, 2011 at 2:12 PM, Aaron Krister Johnson
 wrote:
> Forgive my ignorance, but how can vectors, matrices, et al function as
> arrays?
>
> AKJ
>
> On Mon, Jan 17, 2011 at 11:59 AM, Michael Gogins 
> wrote:
>>
>> There is a complete set of linear algebra opcodes in Csound, including
>> real and complex scalars, vectors, and matrices, norms, sums and
>> products including dot products, and solvers and decompositions from
>> matrix inversion up through eigenvalue decompositions. The opcodes
>> work with Csound variables including i-rate, k-rate, a-rate, f-sigs,
>> and tables. The power available is equivalent to a good chunk of
>> Matlab. The opcodes are very efficient.
>>
>> Using a-rate signals as vectors is easy if ksmps equals the vector
>> size, but is still possible even if that is not the case.
>>
>> Regards,
>> Mike
>>
>>
>>
>> On Sun, Jan 16, 2011 at 6:13 PM, joachim heintz 
>> wrote:
>> > hi aaron -
>> >
>> > these thoughts sound very familiar to me ...
>> >
>> > yes, i've written something like this. see below. and it's also possible
>> > to use strings as arrays, in certain situations:
>> > http://www.csounds.com/journal/issue13/StringsAsArrays.html
>> >
>> > all best -
>> >
>> >        joachim
>> >
>> >  opcode TabValIn_k, k, ki
>> > ;looks whether any value in itable equals ksearch. returns -1 if not,
>> > otherwise the first index where ksearch has been found in itable
>> > ksearch, itable         xin
>> > ilen            =       ftlen(itable)
>> > kndx            =       0
>> > loop:
>> > kval            tab     kndx, itable
>> > kresult =       (kval == ksearch ? kndx : -1)
>> > kndx            =       kndx + 1
>> > if kresult == -1 && kndx < ilen kgoto loop
>> >                xout    kresult
>> >  endop
>> >
>> > Am 16.01.2011 23:50, schrieb Aaron Krister Johnson:
>> >> Hi...
>> >>
>> >> I'm wondering--is the only way to have an array in csound through a
>> >> table? I want for instance to have a function that scans which MIDI
>> >> notes are currently being played, and implementing this in a standard
>> >> programming language would mean a storage array. It appears the only
>> >> similar structure in csound is a table.
>> >>
>> >> Am I right in assuming I'd have to create UDOs for things like creating
>> >> a more standard programming-like array with a table, in order to do
>> >> things like search the array (table) for a value, confirming it's
>> >> there?
>> >>
>> >> For instance, if I have an array of integers, I want kbool to return a
>> >> '1' if the hypotetical opcode 'is_in_array' detects a value (kval) is
>> >> inside the array (iarray):
>> >>
>> >>          kbool    is_in_array  kval, iarray
>> >>
>> >> has anyone ever done such work....it seems to me that what Csound needs
>> >> are easy to use array structures, for precisely such applications.
>> >>
>> >> AKJ
>> >>
>> >> --
>> >> Aaron Krister Johnson
>> >> http://www.akjmusic.com
>> >> http://www.untwelve.org
>> >>
>> >
>> >
>> > 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"
>> >
>> >
>>
>>
>>
>> --
>> Michael Gogins
>> Irreducible Productions
>> http://www.michael-gogins.com
>> Michael dot Gogins at gmail dot com
>>
>>
>> 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"
>>
>
>
>
> --
> Aaron Krister Johnson
> http://www.akjmusic.com
> http://www.untwelve.org
>
>



-- 
Michael Gogins
Irreducible Productions
http://www.michael-gogins.com
Michael dot Gogins at gmail dot com


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"


Date2011-01-18 04:50
FromAaron Krister Johnson
Subject[Csnd] Re: Re: Re: Re: Re: arrays---through tables?
I was thinking a vector in a mathematical (really geometric) sense-- a line with a direction and length, like the vectors in physics class....but in the sesne you are using it, it's an abstractions---a string of values.

Correct?

AKJ

On Mon, Jan 17, 2011 at 7:46 PM, Michael Gogins <michael.gogins@gmail.com> wrote:
A vector is indeed a 1-dimensional array (like a table), a matrix is
indeed a 2-dimensional array. There is no difference in storage,
layout, or indexing. The only difference is that vectors and matrices
have arithmetic defined on them.

Regards,
Mike

On Mon, Jan 17, 2011 at 2:12 PM, Aaron Krister Johnson
<aaron@akjmusic.com> wrote:
> Forgive my ignorance, but how can vectors, matrices, et al function as
> arrays?
>
> AKJ
>
> On Mon, Jan 17, 2011 at 11:59 AM, Michael Gogins <michael.gogins@gmail.com>
> wrote:
>>
>> There is a complete set of linear algebra opcodes in Csound, including
>> real and complex scalars, vectors, and matrices, norms, sums and
>> products including dot products, and solvers and decompositions from
>> matrix inversion up through eigenvalue decompositions. The opcodes
>> work with Csound variables including i-rate, k-rate, a-rate, f-sigs,
>> and tables. The power available is equivalent to a good chunk of
>> Matlab. The opcodes are very efficient.
>>
>> Using a-rate signals as vectors is easy if ksmps equals the vector
>> size, but is still possible even if that is not the case.
>>
>> Regards,
>> Mike
>>
>>
>>
>> On Sun, Jan 16, 2011 at 6:13 PM, joachim heintz <jh@joachimheintz.de>
>> wrote:
>> > hi aaron -
>> >
>> > these thoughts sound very familiar to me ...
>> >
>> > yes, i've written something like this. see below. and it's also possible
>> > to use strings as arrays, in certain situations:
>> > http://www.csounds.com/journal/issue13/StringsAsArrays.html
>> >
>> > all best -
>> >
>> >        joachim
>> >
>> >  opcode TabValIn_k, k, ki
>> > ;looks whether any value in itable equals ksearch. returns -1 if not,
>> > otherwise the first index where ksearch has been found in itable
>> > ksearch, itable         xin
>> > ilen            =       ftlen(itable)
>> > kndx            =       0
>> > loop:
>> > kval            tab     kndx, itable
>> > kresult =       (kval == ksearch ? kndx : -1)
>> > kndx            =       kndx + 1
>> > if kresult == -1 && kndx < ilen kgoto loop
>> >                xout    kresult
>> >  endop
>> >
>> > Am 16.01.2011 23:50, schrieb Aaron Krister Johnson:
>> >> Hi...
>> >>
>> >> I'm wondering--is the only way to have an array in csound through a
>> >> table? I want for instance to have a function that scans which MIDI
>> >> notes are currently being played, and implementing this in a standard
>> >> programming language would mean a storage array. It appears the only
>> >> similar structure in csound is a table.
>> >>
>> >> Am I right in assuming I'd have to create UDOs for things like creating
>> >> a more standard programming-like array with a table, in order to do
>> >> things like search the array (table) for a value, confirming it's
>> >> there?
>> >>
>> >> For instance, if I have an array of integers, I want kbool to return a
>> >> '1' if the hypotetical opcode 'is_in_array' detects a value (kval) is
>> >> inside the array (iarray):
>> >>
>> >>          kbool    is_in_array  kval, iarray
>> >>
>> >> has anyone ever done such work....it seems to me that what Csound needs
>> >> are easy to use array structures, for precisely such applications.
>> >>
>> >> AKJ
>> >>
>> >> --
>> >> Aaron Krister Johnson
>> >> http://www.akjmusic.com
>> >> http://www.untwelve.org
>> >>
>> >
>> >
>> > 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"
>> >
>> >
>>
>>
>>
>> --
>> Michael Gogins
>> Irreducible Productions
>> http://www.michael-gogins.com
>> Michael dot Gogins at gmail dot com
>>
>>
>> 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"
>>
>
>
>
> --
> Aaron Krister Johnson
> http://www.akjmusic.com
> http://www.untwelve.org
>
>



--
Michael Gogins
Irreducible Productions
http://www.michael-gogins.com
Michael dot Gogins at gmail dot com


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"




--
Aaron Krister Johnson
http://www.akjmusic.com
http://www.untwelve.org