Csound Csound-dev Csound-tekno Search About

passing arrays to opcodes?

Date2016-02-04 10:27
FromKarin Daum
Subjectpassing arrays to opcodes?
I have a couple of arrays containing the same type of information, e.g probabilities. They will be processed in the same way by some opcode. Is there a possibility to avoid writing an opcode for each array separately by passing the array(pointer) as input to the opcode? 

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

Date2016-02-04 10:40
FromRory Walsh
SubjectRe: passing arrays to opcodes?
Are you taling about passing entire arrays as input arguments to opcodes? Only some opcodes take array inputs. I usually create an input and output array and then do something like this: 

while iCnt<10 do
    aOuts[iCnt] oscil 1, iFreqs[iCnt]
    iCnt=iCnt+1
od

On 4 February 2016 at 10:27, Karin Daum <karin.daum@desy.de> wrote:
I have a couple of arrays containing the same type of information, e.g probabilities. They will be processed in the same way by some opcode. Is there a possibility to avoid writing an opcode for each array separately by passing the array(pointer) as input to the opcode?

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

Date2016-02-04 11:26
FromKarin Daum
SubjectRe: passing arrays to opcodes?
sorry, I just realised that I had already a similar problem two days ago, where Steven posted a solution using function tables instead and then use an array of these tables, e.g.

iWord1 ftgen 0,0,2,-2, 1,0.04,.55,3.15,4.7,2.15,0.34,0.01
iWord2 ftgen 0,0,9,-2, 2,0.02,0.49,6.1,7.3,7.9,6.4,2.1,0.45,.12
iWord3 ftgen 0,0,11,-2, 3,0.03,1.25,5.4,9.,9.3,5.5,2.75,0.77,.14,.02,.005
iWord4 ftgen 0,0,11,-2, 6,0.11,1,3.15,4.3,4.4,2.8,1.3,.48,.22,.03,.02
giword[] array iWord1,iWord2,iWord3,iWord4
then I can access in MY OWN opcode the different tables via pointing to specific array elements

What I initially asked for: is there a possibility to  pass to a used defined opcode arrays as arguments. As far as I understood the manual this is not foreseen

cheers,

Karin

On 4 Feb 2016, at 11:40, Rory Walsh <rorywalsh@EAR.IE> wrote:

Are you taling about passing entire arrays as input arguments to opcodes? Only some opcodes take array inputs. I usually create an input and output array and then do something like this: 

while iCnt<10 do
    aOuts[iCnt] oscil 1, iFreqs[iCnt]
    iCnt=iCnt+1
od

On 4 February 2016 at 10:27, Karin Daum <karin.daum@desy.de> wrote:
I have a couple of arrays containing the same type of information, e.g probabilities. They will be processed in the same way by some opcode. Is there a possibility to avoid writing an opcode for each array separately by passing the array(pointer) as input to the opcode?

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


Date2016-02-04 12:23
FromRory Walsh
SubjectRe: passing arrays to opcodes?
I think it is possible to pass arrays to UDOs. I've not done it, but here is an example Joachim posted to the list two 3 ago:

   opcode hu, k, k[] 
kArr[] xin 
xout kArr[0] 
   endop 

instr 1 
kArr[] fillarray 1, 2, 3 
kVal hu kArr 
printk2 kVal 
turnoff 
endin 


On 4 February 2016 at 11:26, Karin Daum <karin.daum@desy.de> wrote:
sorry, I just realised that I had already a similar problem two days ago, where Steven posted a solution using function tables instead and then use an array of these tables, e.g.

iWord1 ftgen 0,0,2,-2, 1,0.04,.55,3.15,4.7,2.15,0.34,0.01
iWord2 ftgen 0,0,9,-2, 2,0.02,0.49,6.1,7.3,7.9,6.4,2.1,0.45,.12
iWord3 ftgen 0,0,11,-2, 3,0.03,1.25,5.4,9.,9.3,5.5,2.75,0.77,.14,.02,.005
iWord4 ftgen 0,0,11,-2, 6,0.11,1,3.15,4.3,4.4,2.8,1.3,.48,.22,.03,.02
giword[] array iWord1,iWord2,iWord3,iWord4
then I can access in MY OWN opcode the different tables via pointing to specific array elements

What I initially asked for: is there a possibility to  pass to a used defined opcode arrays as arguments. As far as I understood the manual this is not foreseen

cheers,

Karin

On 4 Feb 2016, at 11:40, Rory Walsh <rorywalsh@EAR.IE> wrote:

Are you taling about passing entire arrays as input arguments to opcodes? Only some opcodes take array inputs. I usually create an input and output array and then do something like this: 

while iCnt<10 do
    aOuts[iCnt] oscil 1, iFreqs[iCnt]
    iCnt=iCnt+1
od

On 4 February 2016 at 10:27, Karin Daum <karin.daum@desy.de> wrote:
I have a couple of arrays containing the same type of information, e.g probabilities. They will be processed in the same way by some opcode. Is there a possibility to avoid writing an opcode for each array separately by passing the array(pointer) as input to the opcode?

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

Date2016-02-04 12:23
FromRory Walsh
SubjectRe: passing arrays to opcodes?
2, 3 years ago....

On 4 February 2016 at 12:23, Rory Walsh <rorywalsh@ear.ie> wrote:
I think it is possible to pass arrays to UDOs. I've not done it, but here is an example Joachim posted to the list two 3 ago:

   opcode hu, k, k[] 
kArr[] xin 
xout kArr[0] 
   endop 

instr 1 
kArr[] fillarray 1, 2, 3 
kVal hu kArr 
printk2 kVal 
turnoff 
endin 


On 4 February 2016 at 11:26, Karin Daum <karin.daum@desy.de> wrote:
sorry, I just realised that I had already a similar problem two days ago, where Steven posted a solution using function tables instead and then use an array of these tables, e.g.

iWord1 ftgen 0,0,2,-2, 1,0.04,.55,3.15,4.7,2.15,0.34,0.01
iWord2 ftgen 0,0,9,-2, 2,0.02,0.49,6.1,7.3,7.9,6.4,2.1,0.45,.12
iWord3 ftgen 0,0,11,-2, 3,0.03,1.25,5.4,9.,9.3,5.5,2.75,0.77,.14,.02,.005
iWord4 ftgen 0,0,11,-2, 6,0.11,1,3.15,4.3,4.4,2.8,1.3,.48,.22,.03,.02
giword[] array iWord1,iWord2,iWord3,iWord4
then I can access in MY OWN opcode the different tables via pointing to specific array elements

What I initially asked for: is there a possibility to  pass to a used defined opcode arrays as arguments. As far as I understood the manual this is not foreseen

cheers,

Karin

On 4 Feb 2016, at 11:40, Rory Walsh <rorywalsh@EAR.IE> wrote:

Are you taling about passing entire arrays as input arguments to opcodes? Only some opcodes take array inputs. I usually create an input and output array and then do something like this: 

while iCnt<10 do
    aOuts[iCnt] oscil 1, iFreqs[iCnt]
    iCnt=iCnt+1
od

On 4 February 2016 at 10:27, Karin Daum <karin.daum@desy.de> wrote:
I have a couple of arrays containing the same type of information, e.g probabilities. They will be processed in the same way by some opcode. Is there a possibility to avoid writing an opcode for each array separately by passing the array(pointer) as input to the opcode?

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

Date2016-02-04 12:53
FromVictor Lazzarini
SubjectRe: passing arrays to opcodes?
yes, it’s possible to pass any type of array.

Regards
========================
Dr Victor Lazzarini
Dean of Arts, Celtic Studies and Philosophy,
Maynooth University,
Maynooth, Co Kildare, Ireland
Tel: 00 353 7086936
Fax: 00 353 1 7086952 

> On 4 Feb 2016, at 12:23, Rory Walsh  wrote:
> 
> I think it is possible to pass arrays to UDOs. I've not done it, but here is an example Joachim posted to the list two 3 ago:
> 
>    opcode hu, k, k[] 
> kArr[] xin 
> xout kArr[0] 
>    endop 
> 
> instr 1 
> kArr[] fillarray 1, 2, 3 
> kVal hu kArr 
> printk2 kVal 
> turnoff 
> endin 
> 
> 
> On 4 February 2016 at 11:26, Karin Daum  wrote:
> sorry, I just realised that I had already a similar problem two days ago, where Steven posted a solution using function tables instead and then use an array of these tables, e.g.
> 
> iWord1	ftgen 0,0,2,-2,	1,0.04,.55,3.15,4.7,2.15,0.34,0.01
> iWord2	ftgen 0,0,9,-2,	2,0.02,0.49,6.1,7.3,7.9,6.4,2.1,0.45,.12
> iWord3	ftgen 0,0,11,-2,	3,0.03,1.25,5.4,9.,9.3,5.5,2.75,0.77,.14,.02,.005
> iWord4	ftgen 0,0,11,-2,	6,0.11,1,3.15,4.3,4.4,2.8,1.3,.48,.22,.03,.02
> giword[]	array iWord1,iWord2,iWord3,iWord4
> then I can access in MY OWN opcode the different tables via pointing to specific array elements
> 
> What I initially asked for: is there a possibility to  pass to a used defined opcode arrays as arguments. As far as I understood the manual this is not foreseen
> 
> cheers,
> 
> Karin
> 
>> On 4 Feb 2016, at 11:40, Rory Walsh  wrote:
>> 
>> Are you taling about passing entire arrays as input arguments to opcodes? Only some opcodes take array inputs. I usually create an input and output array and then do something like this: 
>> 
>> while iCnt<10 do
>>     aOuts[iCnt] oscil 1, iFreqs[iCnt]
>>     iCnt=iCnt+1
>> od
>> 
>> On 4 February 2016 at 10:27, Karin Daum  wrote:
>> I have a couple of arrays containing the same type of information, e.g probabilities. They will be processed in the same way by some opcode. Is there a possibility to avoid writing an opcode for each array separately by passing the array(pointer) as input to the opcode?
>> 
>> 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

Date2016-02-04 21:41
Fromjoachim heintz
SubjectRe: passing arrays to opcodes?
some descriptions and examples are at the end of this chapter in the 
floss manual:
http://floss.booktype.pro/csound/e-arrays/

	joachim


On 04/02/16 13:53, Victor Lazzarini wrote:
> yes, it’s possible to pass any type of array.
>
> Regards
> ========================
> Dr Victor Lazzarini
> Dean of Arts, Celtic Studies and Philosophy,
> Maynooth University,
> Maynooth, Co Kildare, Ireland
> Tel: 00 353 7086936
> Fax: 00 353 1 7086952
>
>> On 4 Feb 2016, at 12:23, Rory Walsh  wrote:
>>
>> I think it is possible to pass arrays to UDOs. I've not done it, but here is an example Joachim posted to the list two 3 ago:
>>
>>     opcode hu, k, k[]
>> kArr[] xin
>> xout kArr[0]
>>     endop
>>
>> instr 1
>> kArr[] fillarray 1, 2, 3
>> kVal hu kArr
>> printk2 kVal
>> turnoff
>> endin
>>
>>
>> On 4 February 2016 at 11:26, Karin Daum  wrote:
>> sorry, I just realised that I had already a similar problem two days ago, where Steven posted a solution using function tables instead and then use an array of these tables, e.g.
>>
>> iWord1	ftgen 0,0,2,-2,	1,0.04,.55,3.15,4.7,2.15,0.34,0.01
>> iWord2	ftgen 0,0,9,-2,	2,0.02,0.49,6.1,7.3,7.9,6.4,2.1,0.45,.12
>> iWord3	ftgen 0,0,11,-2,	3,0.03,1.25,5.4,9.,9.3,5.5,2.75,0.77,.14,.02,.005
>> iWord4	ftgen 0,0,11,-2,	6,0.11,1,3.15,4.3,4.4,2.8,1.3,.48,.22,.03,.02
>> giword[]	array iWord1,iWord2,iWord3,iWord4
>> then I can access in MY OWN opcode the different tables via pointing to specific array elements
>>
>> What I initially asked for: is there a possibility to  pass to a used defined opcode arrays as arguments. As far as I understood the manual this is not foreseen
>>
>> cheers,
>>
>> Karin
>>
>>> On 4 Feb 2016, at 11:40, Rory Walsh  wrote:
>>>
>>> Are you taling about passing entire arrays as input arguments to opcodes? Only some opcodes take array inputs. I usually create an input and output array and then do something like this:
>>>
>>> while iCnt<10 do
>>>      aOuts[iCnt] oscil 1, iFreqs[iCnt]
>>>      iCnt=iCnt+1
>>> od
>>>
>>> On 4 February 2016 at 10:27, Karin Daum  wrote:
>>> I have a couple of arrays containing the same type of information, e.g probabilities. They will be processed in the same way by some opcode. Is there a possibility to avoid writing an opcode for each array separately by passing the array(pointer) as input to the opcode?
>>>
>>> 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
>

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

Date2016-02-05 07:32
FromKarin Daum
SubjectRe: passing arrays to opcodes?
Thanks, foe the answers. I overlooked the section “Arrays in UDOs” in the floss manual

karin

> On 4 Feb 2016, at 22:41, joachim heintz  wrote:
> 
> some descriptions and examples are at the end of this chapter in the floss manual:
> http://floss.booktype.pro/csound/e-arrays/
> 
> 	joachim
> 
> 
> On 04/02/16 13:53, Victor Lazzarini wrote:
>> yes, it’s possible to pass any type of array.
>> 
>> Regards
>> ========================
>> Dr Victor Lazzarini
>> Dean of Arts, Celtic Studies and Philosophy,
>> Maynooth University,
>> Maynooth, Co Kildare, Ireland
>> Tel: 00 353 7086936
>> Fax: 00 353 1 7086952
>> 
>>> On 4 Feb 2016, at 12:23, Rory Walsh  wrote:
>>> 
>>> I think it is possible to pass arrays to UDOs. I've not done it, but here is an example Joachim posted to the list two 3 ago:
>>> 
>>>    opcode hu, k, k[]
>>> kArr[] xin
>>> xout kArr[0]
>>>    endop
>>> 
>>> instr 1
>>> kArr[] fillarray 1, 2, 3
>>> kVal hu kArr
>>> printk2 kVal
>>> turnoff
>>> endin
>>> 
>>> 
>>> On 4 February 2016 at 11:26, Karin Daum  wrote:
>>> sorry, I just realised that I had already a similar problem two days ago, where Steven posted a solution using function tables instead and then use an array of these tables, e.g.
>>> 
>>> iWord1	ftgen 0,0,2,-2,	1,0.04,.55,3.15,4.7,2.15,0.34,0.01
>>> iWord2	ftgen 0,0,9,-2,	2,0.02,0.49,6.1,7.3,7.9,6.4,2.1,0.45,.12
>>> iWord3	ftgen 0,0,11,-2,	3,0.03,1.25,5.4,9.,9.3,5.5,2.75,0.77,.14,.02,.005
>>> iWord4	ftgen 0,0,11,-2,	6,0.11,1,3.15,4.3,4.4,2.8,1.3,.48,.22,.03,.02
>>> giword[]	array iWord1,iWord2,iWord3,iWord4
>>> then I can access in MY OWN opcode the different tables via pointing to specific array elements
>>> 
>>> What I initially asked for: is there a possibility to  pass to a used defined opcode arrays as arguments. As far as I understood the manual this is not foreseen
>>> 
>>> cheers,
>>> 
>>> Karin
>>> 
>>>> On 4 Feb 2016, at 11:40, Rory Walsh  wrote:
>>>> 
>>>> Are you taling about passing entire arrays as input arguments to opcodes? Only some opcodes take array inputs. I usually create an input and output array and then do something like this:
>>>> 
>>>> while iCnt<10 do
>>>>     aOuts[iCnt] oscil 1, iFreqs[iCnt]
>>>>     iCnt=iCnt+1
>>>> od
>>>> 
>>>> On 4 February 2016 at 10:27, Karin Daum  wrote:
>>>> I have a couple of arrays containing the same type of information, e.g probabilities. They will be processed in the same way by some opcode. Is there a possibility to avoid writing an opcode for each array separately by passing the array(pointer) as input to the opcode?
>>>> 
>>>> 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
>> 
> 
> 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