[Csnd] expanding arbitrary number of pfields into an array?

Hello list, I’m trying to figure out how best to get arbitrary (potentially large) lists of numbers coming from stdin into csound instruments. I’ve been looking through the 2016 book, but not finding an example so far in my hunting. I would like to be able to have my Scheme program send a large list in and then have a csound instrument work with this.

Some questions:

  • is there a way to loop through pfields numerically?
  • or a way to group all received pfields into an itime array? (without knowing how many there will be?
  • if the answers to the above are no, would it be reasonable instead to send an f statement and have the function expanded into an array in the orchestra?
  • are there other approaches to this that I haven’t thought of?

thanks!
iain

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

hi iain -
have a look at pcount and passign. this might do some of what you need.
best -
  joachim

Hello,

I suppose that looping pfields can be done with:

ifields pcount

ifield = 1

while ifield < ifields do

ival pindex ifield

iarray[ifield] = ival

ifield += 1

od

didn’t try but maybe works, the array must be longer or equal to the maximum pfields you plan to send

Ciao

Stefano

Thanks Stefano and Joachim, that should at least get me going!

iain

Iain,

Excited to see where you are going with this.

  • thanks for the suggestions and for the feedback from the Csound Community.
    Keep us in the loop!

And… good luck.