Csound Csound-dev Csound-tekno Search About

[Csnd] define twodimensional i-array

Date2022-10-24 10:46
FromTarmo Johannes
Subject[Csnd] define twodimensional i-array
Hi!

Is there a good way to define a 2-mentional array like in python/:

myArray = [ [1,2,3], [4,5,6]  ]

I tried:

giInputChannels[][] init 4, 3 ; define left, right and inputs
giArr[] fillarray 1, 2,3
giInputChannels setrow 0, giArr;


also

giInputChannels[0] = giArr


and

giInputChannels[0] fillarray 1,2,3


But none of them work, giving and error error like

unable to find opcode entry for .... with matching argument types

anks!

tarmo


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

Date2022-10-24 10:56
FromOeyvind Brandtsegg
SubjectRe: [Csnd] define twodimensional i-array
Hi Tarmo,

You have just switched the order of arguments for setrow

This works
  giInputChannels setrow giArr, 0

try this:
  giInputChannels[][] init 4, 3
  printarray(giInputChannels)
  giArr[] fillarray 1, 2,3
  giInputChannels setrow giArr, 0
  printarray(giInputChannels)

all best
Øyvind

man. 24. okt. 2022 kl. 11:48 skrev Tarmo Johannes <trmjhnns@gmail.com>:
Hi!

Is there a good way to define a 2-mentional array like in python/:

myArray = [ [1,2,3], [4,5,6]  ]

I tried:

giInputChannels[][] init 4, 3 ; define left, right and inputs
giArr[] fillarray 1, 2,3
giInputChannels setrow 0, giArr;


also

giInputChannels[0] = giArr


and

giInputChannels[0] fillarray 1,2,3


But none of them work, giving and error error like

unable to find opcode entry for .... with matching argument types

anks!

tarmo


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

Date2022-10-24 11:19
FromTarmo Johannes
SubjectRe: [Csnd] define twodimensional i-array
Thanks, Øyvind!

True, I was reading manual too quickly and go confused, which is which:

i/kout[] setrow i/kin[],i/krow

Best!
Tarmo


Kontakt Oeyvind Brandtsegg (<obrandts@gmail.com>) kirjutas kuupäeval E, 24. oktoober 2022 kell 12:57:
Hi Tarmo,

You have just switched the order of arguments for setrow

This works
  giInputChannels setrow giArr, 0

try this:
  giInputChannels[][] init 4, 3
  printarray(giInputChannels)
  giArr[] fillarray 1, 2,3
  giInputChannels setrow giArr, 0
  printarray(giInputChannels)

all best
Øyvind

man. 24. okt. 2022 kl. 11:48 skrev Tarmo Johannes <trmjhnns@gmail.com>:
Hi!

Is there a good way to define a 2-mentional array like in python/:

myArray = [ [1,2,3], [4,5,6]  ]

I tried:

giInputChannels[][] init 4, 3 ; define left, right and inputs
giArr[] fillarray 1, 2,3
giInputChannels setrow 0, giArr;


also

giInputChannels[0] = giArr


and

giInputChannels[0] fillarray 1,2,3


But none of them work, giving and error error like

unable to find opcode entry for .... with matching argument types

anks!

tarmo


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

Date2022-10-24 11:40
FromEduardo Moguillansky
SubjectRe: [Csnd] define twodimensional i-array

Fillarray is oblivious to the shape of the array so the way to define a 2D array is:


ixs[][] init 4, 3
ixs fillarray 0, 1, 2, \
              3, 4, 5, \
              6, 7, 8, \
              9, 10, 11

On 24.10.22 12:19, Tarmo Johannes wrote:
Thanks, Øyvind!

True, I was reading manual too quickly and go confused, which is which:

i/kout[] setrow i/kin[],i/krow

Best!
Tarmo


Kontakt Oeyvind Brandtsegg (<obrandts@gmail.com>) kirjutas kuupäeval E, 24. oktoober 2022 kell 12:57:
Hi Tarmo,

You have just switched the order of arguments for setrow

This works
  giInputChannels setrow giArr, 0

try this:
  giInputChannels[][] init 4, 3
  printarray(giInputChannels)
  giArr[] fillarray 1, 2,3
  giInputChannels setrow giArr, 0
  printarray(giInputChannels)

all best
Øyvind

man. 24. okt. 2022 kl. 11:48 skrev Tarmo Johannes <trmjhnns@gmail.com>:
Hi!

Is there a good way to define a 2-mentional array like in python/:

myArray = [ [1,2,3], [4,5,6]  ]

I tried:

giInputChannels[][] init 4, 3 ; define left, right and inputs giArr[] fillarray 1, 2,3 giInputChannels setrow 0, giArr;

also

giInputChannels[0] = giArr

and

giInputChannels[0] fillarray 1,2,3

But none of them work, giving and error error like

unable to find opcode entry for .... with matching argument types

anks!

tarmo

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

Date2022-10-24 16:38
Fromjoachim heintz
SubjectRe: [Csnd] define twodimensional i-array
yes; this is also mentioned in
https://flossmanual.csound.com/csound-language/arrays#fillarray


On 24/10/2022 12:40, Eduardo Moguillansky wrote:
> Fillarray is oblivious to the shape of the array so the way to define a 
> 2D array is:
> 
> ixs[][] init 4, 3
> 
> ixs fillarray 0, 1, 2, \
> 
>                3, 4, 5, \
> 
>                6, 7, 8, \
> 
>                9, 10, 11
> 
> 
> On 24.10.22 12:19, Tarmo Johannes wrote:
>> Thanks, Øyvind!
>>
>> True, I was reading manual too quickly and go confused, which is which:
>>
>> i/kout[] setrow i/kin[],i/krow
>>
>> Best!
>> Tarmo
>>
>>
>> Kontakt Oeyvind Brandtsegg () kirjutas kuupäeval 
>> E, 24. oktoober 2022 kell 12:57:
>>
>>     Hi Tarmo,
>>
>>     You have just switched the order of arguments for setrow
>>
>>     This works
>>       giInputChannels setrow giArr, 0
>>
>>     try this:
>>       giInputChannels[][] init 4, 3
>>       printarray(giInputChannels)
>>       giArr[] fillarray 1, 2,3
>>       giInputChannels setrow giArr, 0
>>       printarray(giInputChannels)
>>
>>     all best
>>     Øyvind
>>
>>     man. 24. okt. 2022 kl. 11:48 skrev Tarmo Johannes
>>     :
>>
>>         Hi!
>>
>>         Is there a good way to define a 2-mentional array like in python/:
>>
>>         myArray = [ [1,2,3], [4,5,6]  ]
>>
>>         I tried:
>>
>>         giInputChannels[][] init 4, 3 ; define left, right and inputs
>>         giArr[] fillarray 1, 2,3 giInputChannels setrow 0, giArr;
>>
>>         also
>>
>>         giInputChannels[0] = giArr
>>
>>         and
>>
>>         giInputChannels[0] fillarray 1,2,3
>>
>>         But none of them work, giving and error error like
>>
>>         unable to find opcode entry for .... with matching argument types
>>
>>         anks!
>>
>>         tarmo
>>
>>         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 
> 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

Date2022-10-24 20:36
FromSteven Yi
SubjectRe: [Csnd] define twodimensional i-array
I think there's array literal syntax in cs7 branch, but I'm unsure if
it works for multidimensional arrays.

On Mon, Oct 24, 2022 at 5:48 AM Tarmo Johannes  wrote:
>
> Hi!
>
> Is there a good way to define a 2-mentional array like in python/:
>
> myArray = [ [1,2,3], [4,5,6]  ]
>
> I tried:
>
> giInputChannels[][] init 4, 3 ; define left, right and inputs
> giArr[] fillarray 1, 2,3
> giInputChannels setrow 0, giArr;
>
>
> also
>
> giInputChannels[0] = giArr
>
>
> and
>
> giInputChannels[0] fillarray 1,2,3
>
>
> But none of them work, giving and error error like
>
> unable to find opcode entry for .... with matching argument types
>
> anks!
>
> tarmo
>
>
> 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

Date2022-10-24 20:47
FromVictor Lazzarini
SubjectRe: [Csnd] [EXTERNAL] Re: [Csnd] define twodimensional i-array
btw, 7.0 is in the develop branch, just to be clear. There's a cs7 branch but that's stale.

Prof. Victor Lazzarini
Maynooth University
Ireland

> On 24 Oct 2022, at 20:39, Steven Yi  wrote:
> 
> *Warning*
> 
> This email originated from outside of Maynooth University's Mail System. Do not reply, click links or open attachments unless you recognise the sender and know the content is safe.
> 
> I think there's array literal syntax in cs7 branch, but I'm unsure if
> it works for multidimensional arrays.
> 
>> On Mon, Oct 24, 2022 at 5:48 AM Tarmo Johannes  wrote:
>> 
>> Hi!
>> 
>> Is there a good way to define a 2-mentional array like in python/:
>> 
>> myArray = [ [1,2,3], [4,5,6]  ]
>> 
>> I tried:
>> 
>> giInputChannels[][] init 4, 3 ; define left, right and inputs
>> giArr[] fillarray 1, 2,3
>> giInputChannels setrow 0, giArr;
>> 
>> 
>> also
>> 
>> giInputChannels[0] = giArr
>> 
>> 
>> and
>> 
>> giInputChannels[0] fillarray 1,2,3
>> 
>> 
>> But none of them work, giving and error error like
>> 
>> unable to find opcode entry for .... with matching argument types
>> 
>> anks!
>> 
>> tarmo
>> 
>> 
>> Csound mailing list Csound@listserv.heanet.ie https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flistserv.heanet.ie%2Fcgi-bin%2Fwa%3FA0%3DCSOUND&data=05%7C01%7CVictor.Lazzarini%40mu.ie%7Cad405faa24c14a66e24708dab5f742d7%7C1454f5ccbb354685bbd98621fd8055c9%7C0%7C0%7C638022371390347337%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=VgrexQ56VTl7hFfk6QDYJUkC%2FLR4dXQw38U5gw8EdhQ%3D&reserved=0 Send bugs reports to https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fcsound%2Fcsound%2Fissues&data=05%7C01%7CVictor.Lazzarini%40mu.ie%7Cad405faa24c14a66e24708dab5f742d7%7C1454f5ccbb354685bbd98621fd8055c9%7C0%7C0%7C638022371390347337%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=Z4N4KpdhNpdmiMTcyBMpXWt5US22zrzRz2rez2fCVXM%3D&reserved=0 Discussions of bugs and features can be posted here
> 
> Csound mailing list
> Csound@listserv.heanet.ie
> https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flistserv.heanet.ie%2Fcgi-bin%2Fwa%3FA0%3DCSOUND&data=05%7C01%7CVictor.Lazzarini%40mu.ie%7Cad405faa24c14a66e24708dab5f742d7%7C1454f5ccbb354685bbd98621fd8055c9%7C0%7C0%7C638022371390347337%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=VgrexQ56VTl7hFfk6QDYJUkC%2FLR4dXQw38U5gw8EdhQ%3D&reserved=0
> Send bugs reports to
>        https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fcsound%2Fcsound%2Fissues&data=05%7C01%7CVictor.Lazzarini%40mu.ie%7Cad405faa24c14a66e24708dab5f742d7%7C1454f5ccbb354685bbd98621fd8055c9%7C0%7C0%7C638022371390347337%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=Z4N4KpdhNpdmiMTcyBMpXWt5US22zrzRz2rez2fCVXM%3D&reserved=0
> 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