Csound Csound-dev Csound-tekno Search About

OSC question: lists

Date2017-02-25 19:45
FromDave Seidel
SubjectOSC question: lists
Still an OSC newbie here -- I need to write some code to consume OSC from a collaborator. He will be sending a series a numeric values each of which corresponds to a cell in a grid. He can send individual messages (one per cell) or he can send a list of all the values each time the grid changes. Getting a list seems a lot more efficient, but I'm not clear on how to use OSClisten to consume a list of integers. Can someone help?

I may decide to consume the OSC in Python, in which case I would use channels to send the data to an embedded Csound instance. In this scenario, how would I send a list of values to a Csound channel, hopefully in an atomic operation?

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

Date2017-02-25 19:58
FromGuillermo Senna
SubjectRe: OSC question: lists
Hi,

Does your collaborator have access to the OSC implementation on his
side? Because if he can tweak his code he probably can send you a Blob
and you'd receive it as an array in Csound. What he'll need to do is
bitshift two ints into a double. I'm doing that currently and it seems
to work fine.


On 25/02/17 16:45, Dave Seidel wrote:
> Still an OSC newbie here -- I need to write some code to consume OSC from a
> collaborator. He will be sending a series a numeric values each of which
> corresponds to a cell in a grid. He can send individual messages (one per
> cell) or he can send a list of all the values each time the grid changes.
> Getting a list seems a lot more efficient, but I'm not clear on how to use
> OSClisten to consume a list of integers. Can someone help?
>
> I may decide to consume the OSC in Python, in which case I would use
> channels to send the data to an embedded Csound instance. In this scenario,
> how would I send a list of values to a Csound channel, hopefully in an
> atomic operation?
>
> - Dave
>

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

Date2017-02-25 20:07
FromDave Seidel
SubjectRe: OSC question: lists
Thanks, Guillermo, good question. Not sure how much flexibility he has. He's using Max (he uses it for visuals, with Jitter). I will ask.

On Sat, Feb 25, 2017 at 2:58 PM, Guillermo Senna <gsenna@gmail.com> wrote:
Hi,

Does your collaborator have access to the OSC implementation on his
side? Because if he can tweak his code he probably can send you a Blob
and you'd receive it as an array in Csound. What he'll need to do is
bitshift two ints into a double. I'm doing that currently and it seems
to work fine.


On 25/02/17 16:45, Dave Seidel wrote:
> Still an OSC newbie here -- I need to write some code to consume OSC from a
> collaborator. He will be sending a series a numeric values each of which
> corresponds to a cell in a grid. He can send individual messages (one per
> cell) or he can send a list of all the values each time the grid changes.
> Getting a list seems a lot more efficient, but I'm not clear on how to use
> OSClisten to consume a list of integers. Can someone help?
>
> I may decide to consume the OSC in Python, in which case I would use
> channels to send the data to an embedded Csound instance. In this scenario,
> how would I send a list of values to a Csound channel, hopefully in an
> atomic operation?
>
> - Dave
>

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

Date2017-02-26 10:30
FromRichard
SubjectRe: OSC question: lists

Expanding a bit on the Csound example. Say you have a 16 by 16 matrix, you would need to read 16 'rows' of 16 integers like shown below:
(This shows only one row, you'd have to implement this 16 times...)
It also depends on the destination addresses (in this case: 'row1') you get from the client. Maybe he also has an address for when one particular cell has changed - that would be more economic of course...

Richard

  sr = 44100
  ksmps = 100
  nchnls = 2

  gihandle OSCinit 7770

  instr   1
    kf1 init 0
    kf2 init 0
nxtmsg:
    kk  OSClisten gihandle, "row1", "iiiiiiiiiiiiiiii", kr11,kr12,kr13,kr14,kr15 ..., kr116
if (kk == 0) goto ex
    printk 0,kr11
    printk 0,kr12
    ...
    kgoto nxtmsg
ex:
  endin
 


On 25/02/17 20:45, Dave Seidel wrote:
Still an OSC newbie here -- I need to write some code to consume OSC from a collaborator. He will be sending a series a numeric values each of which corresponds to a cell in a grid. He can send individual messages (one per cell) or he can send a list of all the values each time the grid changes. Getting a list seems a lot more efficient, but I'm not clear on how to use OSClisten to consume a list of integers. Can someone help?

I may decide to consume the OSC in Python, in which case I would use channels to send the data to an embedded Csound instance. In this scenario, how would I send a list of values to a Csound channel, hopefully in an atomic operation?

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


Date2017-02-26 10:45
FromRichard
SubjectRe: OSC question: lists

typo correction for clarity..


On 26/02/17 11:30, Richard wrote:

Expanding a bit on the Csound example. Say you have a 16 by 16 matrix, you would need to read 16 'rows' of 16 integers like shown below:
(This shows only one row, you'd have to implement this 16 times...)
It also depends on the destination addresses (in this case: 'row1') you get from the client. Maybe he also has an address for when one particular cell has changed - that would be more economic of course...

Richard

  sr = 44100
  ksmps = 100
  nchnls = 2

  gihandle OSCinit 7770

  instr   1
    kr11 init 0
    kr12 init 0
    ..
nxtmsg:
    kk  OSClisten gihandle, "row1", "iiiiiiiiiiiiiiii", kr11,kr12,kr13,kr14,kr15 ..., kr116
if (kk == 0) goto ex
    printk 0,kr11
    printk 0,kr12
    ...
    kgoto nxtmsg
ex:
  endin
 


On 25/02/17 20:45, Dave Seidel wrote:
Still an OSC newbie here -- I need to write some code to consume OSC from a collaborator. He will be sending a series a numeric values each of which corresponds to a cell in a grid. He can send individual messages (one per cell) or he can send a list of all the values each time the grid changes. Getting a list seems a lot more efficient, but I'm not clear on how to use OSClisten to consume a list of integers. Can someone help?

I may decide to consume the OSC in Python, in which case I would use channels to send the data to an embedded Csound instance. In this scenario, how would I send a list of values to a Csound channel, hopefully in an atomic operation?

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



Date2017-02-26 17:11
FromDave Seidel
SubjectRe: OSC question: lists
Thanks, Richard.

As it turns out, he will be sending the entire set of values all at once, as a single list. I don't necessarily need to know row/col, but if I want to I can compute it easily enough by position in the list. The data will be changing frequently. The idea is that he will be scanning a large large roll of paper which will be slowly scrolling under a camera. The paper will be strewn with ashes and maybe other materials. His code takes the scrolling image, analyzes it as a grid, and sends greyscale values for each cell. The idea is to treat the scroll of ashes as a "score".

I would prefer to consume the OSC data in Python (using one of the Python OSC packages) so that I can more easily manipulate/transform it before sending it to Csound via the API (will probably use ctcsound). But I would still like to know what my options are, especially for efficient transmittal of potentially large datasets to Csound using the API. Can this be done using a channel? Would it be better to populate an array or table that Csound can use in orchestra code?

I may decide to send score events only from the Python layer, in which case everything is a lot easier. But I am investigating what is possible.

On Sun, Feb 26, 2017 at 5:45 AM, Richard <zappfinger@gmail.com> wrote:

typo correction for clarity..


On 26/02/17 11:30, Richard wrote:

Expanding a bit on the Csound example. Say you have a 16 by 16 matrix, you would need to read 16 'rows' of 16 integers like shown below:
(This shows only one row, you'd have to implement this 16 times...)
It also depends on the destination addresses (in this case: 'row1') you get from the client. Maybe he also has an address for when one particular cell has changed - that would be more economic of course...

Richard

  sr = 44100
  ksmps = 100
  nchnls = 2

  gihandle OSCinit 7770

  instr   1
    kr11 init 0
    kr12 init 0
    ..
nxtmsg:
    kk  OSClisten gihandle, "row1", "iiiiiiiiiiiiiiii", kr11,kr12,kr13,kr14,kr15 ..., kr116
if (kk == 0) goto ex
    printk 0,kr11
    printk 0,kr12
    ...
    kgoto nxtmsg
ex:
  endin
 


On 25/02/17 20:45, Dave Seidel wrote:
Still an OSC newbie here -- I need to write some code to consume OSC from a collaborator. He will be sending a series a numeric values each of which corresponds to a cell in a grid. He can send individual messages (one per cell) or he can send a list of all the values each time the grid changes. Getting a list seems a lot more efficient, but I'm not clear on how to use OSClisten to consume a list of integers. Can someone help?

I may decide to consume the OSC in Python, in which case I would use channels to send the data to an embedded Csound instance. In this scenario, how would I send a list of values to a Csound channel, hopefully in an atomic operation?

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

Date2017-02-26 18:09
FromRichard
SubjectRe: OSC question: lists

Is he sending it as an OSC blob (Binary large object) or as traditional OSC integers?
In case of a blob, Csound cannot handle that (maybe since 6.08), but PyOSC can.
Then from Python to Csound the API is your best option. I do not know about writing tables, but that would be preferred -
the more data you can send at once, the better. I think ctcsound can do that.

Richard


On 26/02/17 18:11, Dave Seidel wrote:
Thanks, Richard.

As it turns out, he will be sending the entire set of values all at once, as a single list. I don't necessarily need to know row/col, but if I want to I can compute it easily enough by position in the list. The data will be changing frequently. The idea is that he will be scanning a large large roll of paper which will be slowly scrolling under a camera. The paper will be strewn with ashes and maybe other materials. His code takes the scrolling image, analyzes it as a grid, and sends greyscale values for each cell. The idea is to treat the scroll of ashes as a "score".

I would prefer to consume the OSC data in Python (using one of the Python OSC packages) so that I can more easily manipulate/transform it before sending it to Csound via the API (will probably use ctcsound). But I would still like to know what my options are, especially for efficient transmittal of potentially large datasets to Csound using the API. Can this be done using a channel? Would it be better to populate an array or table that Csound can use in orchestra code?

I may decide to send score events only from the Python layer, in which case everything is a lot easier. But I am investigating what is possible.

On Sun, Feb 26, 2017 at 5:45 AM, Richard <zappfinger@gmail.com> wrote:

typo correction for clarity..


On 26/02/17 11:30, Richard wrote:

Expanding a bit on the Csound example. Say you have a 16 by 16 matrix, you would need to read 16 'rows' of 16 integers like shown below:
(This shows only one row, you'd have to implement this 16 times...)
It also depends on the destination addresses (in this case: 'row1') you get from the client. Maybe he also has an address for when one particular cell has changed - that would be more economic of course...

Richard

  sr = 44100
  ksmps = 100
  nchnls = 2

  gihandle OSCinit 7770

  instr   1
    kr11 init 0
    kr12 init 0
    ..
nxtmsg:
    kk  OSClisten gihandle, "row1", "iiiiiiiiiiiiiiii", kr11,kr12,kr13,kr14,kr15 ..., kr116
if (kk == 0) goto ex
    printk 0,kr11
    printk 0,kr12
    ...
    kgoto nxtmsg
ex:
  endin
 


On 25/02/17 20:45, Dave Seidel wrote:
Still an OSC newbie here -- I need to write some code to consume OSC from a collaborator. He will be sending a series a numeric values each of which corresponds to a cell in a grid. He can send individual messages (one per cell) or he can send a list of all the values each time the grid changes. Getting a list seems a lot more efficient, but I'm not clear on how to use OSClisten to consume a list of integers. Can someone help?

I may decide to consume the OSC in Python, in which case I would use channels to send the data to an embedded Csound instance. In this scenario, how would I send a list of values to a Csound channel, hopefully in an atomic operation?

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


Date2017-02-26 18:19
FromDave Seidel
SubjectRe: OSC question: lists
Looks like it will be a series of integers rather than a blob, so Csound could handle it, but it will be nice to have numpy available to manipulate the date. I am starting to lean toward the idea of having Python send only score events to Csound for simplicity, and to keep all the state in the Python layer.

(By the way, this is or a realtime piece with video and performance aspects as well as sound. Someone will be actually turning a crank of some sort to scroll the "score" of ashes that will govern the sound.)

On Sun, Feb 26, 2017 at 1:09 PM, Richard <zappfinger@gmail.com> wrote:

Is he sending it as an OSC blob (Binary large object) or as traditional OSC integers?
In case of a blob, Csound cannot handle that (maybe since 6.08), but PyOSC can.
Then from Python to Csound the API is your best option. I do not know about writing tables, but that would be preferred -
the more data you can send at once, the better. I think ctcsound can do that.

Richard


On 26/02/17 18:11, Dave Seidel wrote:
Thanks, Richard.

As it turns out, he will be sending the entire set of values all at once, as a single list. I don't necessarily need to know row/col, but if I want to I can compute it easily enough by position in the list. The data will be changing frequently. The idea is that he will be scanning a large large roll of paper which will be slowly scrolling under a camera. The paper will be strewn with ashes and maybe other materials. His code takes the scrolling image, analyzes it as a grid, and sends greyscale values for each cell. The idea is to treat the scroll of ashes as a "score".

I would prefer to consume the OSC data in Python (using one of the Python OSC packages) so that I can more easily manipulate/transform it before sending it to Csound via the API (will probably use ctcsound). But I would still like to know what my options are, especially for efficient transmittal of potentially large datasets to Csound using the API. Can this be done using a channel? Would it be better to populate an array or table that Csound can use in orchestra code?

I may decide to send score events only from the Python layer, in which case everything is a lot easier. But I am investigating what is possible.

On Sun, Feb 26, 2017 at 5:45 AM, Richard <zappfinger@gmail.com> wrote:

typo correction for clarity..


On 26/02/17 11:30, Richard wrote:

Expanding a bit on the Csound example. Say you have a 16 by 16 matrix, you would need to read 16 'rows' of 16 integers like shown below:
(This shows only one row, you'd have to implement this 16 times...)
It also depends on the destination addresses (in this case: 'row1') you get from the client. Maybe he also has an address for when one particular cell has changed - that would be more economic of course...

Richard

  sr = 44100
  ksmps = 100
  nchnls = 2

  gihandle OSCinit 7770

  instr   1
    kr11 init 0
    kr12 init 0
    ..
nxtmsg:
    kk  OSClisten gihandle, "row1", "iiiiiiiiiiiiiiii", kr11,kr12,kr13,kr14,kr15 ..., kr116
if (kk == 0) goto ex
    printk 0,kr11
    printk 0,kr12
    ...
    kgoto nxtmsg
ex:
  endin
 


On 25/02/17 20:45, Dave Seidel wrote:
Still an OSC newbie here -- I need to write some code to consume OSC from a collaborator. He will be sending a series a numeric values each of which corresponds to a cell in a grid. He can send individual messages (one per cell) or he can send a list of all the values each time the grid changes. Getting a list seems a lot more efficient, but I'm not clear on how to use OSClisten to consume a list of integers. Can someone help?

I may decide to consume the OSC in Python, in which case I would use channels to send the data to an embedded Csound instance. In this scenario, how would I send a list of values to a Csound channel, hopefully in an atomic operation?

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