[Csnd] OSC-control of instrument instances
Date | 2019-02-21 22:12 |
From | Sigurd Saue |
Subject | [Csnd] OSC-control of instrument instances |
I hope someone could give me some good advice. I’m working on a sound installation project where I control a number of Csound instruments from an external application using OSC, including start/stop of instruments, fade in/outs, parameter changes, etc. I do not want to use the API this time. I plan to handle the OSC messages similar to what Dave Seidel showed earlier, and then use channel opcodes to communicate with the various instruments. My question is: What is the smartest way to access a particular instance of a Csound instrument? I may have several instances of the same instrument running simultaneously, but I want to change, say, the amplitude of only one of them. Does this sound familiar to anyone? Sigurd |
Date | 2019-02-21 22:26 |
From | Victor Lazzarini |
Subject | Re: [Csnd] OSC-control of instrument instances |
I would suggest registering a named channel using the fractional p1 of the instance, e.g
schedule(1.01, 0, -1)
You can sprintf the channel name and instance together using the value of p1
Sname sprintf "amp::%f", p1
then that name (amp::1.01000) can be used for a channel linked to a particular instance.
Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland
|
Date | 2019-02-21 22:30 |
From | Dave Seidel |
Subject | Re: [Csnd] OSC-control of instrument instances |
Yes, I use a somewhat similar scheme. On Thu, Feb 21, 2019 at 5:26 PM Victor Lazzarini <Victor.Lazzarini@mu.ie> wrote:
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
|
Date | 2019-02-21 22:39 |
From | Sigurd Saue |
Subject | Re: [Csnd] OSC-control of instrument instances |
Thanks, both of you! How would the external application know what named channel to call? I plan to generate a numeric ID for each instance in the calling application. Maybe I could use this ID as the fractional part in schedule (e.g. ID 43 maps to instrument number 1.043). Does that make sense? Sigurd From: A discussion list for users of Csound <CSOUND@LISTSERV.HEANET.IE>
On Behalf Of Dave Seidel
Yes, I use a somewhat similar scheme.
On Thu, Feb 21, 2019 at 5:26 PM Victor Lazzarini <Victor.Lazzarini@mu.ie> wrote:
-- 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 |
Date | 2019-02-21 22:45 |
From | Dave Seidel |
Subject | Re: [Csnd] OSC-control of instrument instances |
I think so, yes. On Thu, Feb 21, 2019 at 5:39 PM Sigurd Saue <sigurd.saue@ntnu.no> wrote:
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
|
Date | 2019-02-21 22:52 |
From | Victor Lazzarini |
Subject | Re: [Csnd] OSC-control of instrument instances |
you can either use p1 or a separate p-field in
that case in which you put an ID that you
created. Fractional p1s will be needed for
held notes, if you have them, otherwise you
could use a separate pfield just as well.
Once you launch the instance, the channel
becomes available, you just have to
keep track of it in your app.
Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland
|
Date | 2019-02-21 22:55 |
From | Sigurd Saue |
Subject | Re: [Csnd] OSC-control of instrument instances |
Makes a lot of sense. Thanks again! Sigurd From: A discussion list for users of Csound <CSOUND@LISTSERV.HEANET.IE>
On Behalf Of Victor Lazzarini
you can either use p1 or a separate p-field in that case in which you put an ID that you created. Fractional p1s will be needed for held notes, if you have them, otherwise you could use a separate pfield just as well.
Once you launch the instance, the channel becomes available, you just have to keep track of it in your app.
Victor Lazzarini Dean of Arts, Celtic Studies, and Philosophy Maynooth University Ireland
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 |
Date | 2019-02-22 11:01 |
From | Rory Walsh |
Subject | Re: [Csnd] OSC-control of instrument instances |
I had to do this recently too Sigurd, albeit in a different context. I found the easiest thing to do was name each instance when it started, and then construct unique channels based on that string id. On Thu, 21 Feb 2019 at 22:55, Sigurd Saue <sigurd.saue@ntnu.no> wrote:
|
Date | 2019-02-22 15:18 |
From | Sigurd Saue |
Subject | Re: [Csnd] OSC-control of instrument instances |
Thanks, Rory. Uniquely named channels is obviously the way to go. Is there any performance hit in creating a new channel for every instance? The installation will be running for a couple of months. Sigurd From: A discussion list for users of Csound <CSOUND@LISTSERV.HEANET.IE>
On Behalf Of Rory Walsh
I had to do this recently too Sigurd, albeit in a different context. I found the easiest thing to do was name each instance when it started, and then construct unique channels based on that string id.
On Thu, 21 Feb 2019 at 22:55, Sigurd Saue <sigurd.saue@ntnu.no> wrote:
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 |
Date | 2019-02-22 15:42 |
From | Rory Walsh |
Subject | Re: [Csnd] OSC-control of instrument instances |
The devs will need to answer that, but I don't foresee any issues. I am doing this for games, where each instance is a sound source in a 3d scene. I've been able to launch a dozen or so instances without any problems. And that's all using the WASM version of Csound, so I expect you won't see any issues using the full version of Csound. On Fri, 22 Feb 2019 at 15:18, Sigurd Saue <sigurd.saue@ntnu.no> wrote:
|
Date | 2019-02-22 16:02 |
From | Eduardo Moguillansky |
Subject | Re: [Csnd] OSC-control of instrument instances |
I run into issues with exactly this same setup, but I was
creating a new channel for each instance at quite a high rate.
After a couple of minutes memory and cpu get very high, even if
the number of running instances (polyphony) is low. This has
apparently to do with the underlying hash-table implementation. So
the problem has to do with the number of created channels in
general, which make the creating of a new channel more expensive.
If these are long-running instances, but the number of instances
in total stay under a certain limit (say below 10000), then it
should not be a problem. If on the other hand you are launching
several notes per minute, each with one or several channels, then
it will become problematic.
eduardo
On 22.02.19 16:42, Rory Walsh wrote:
|
Date | 2019-02-22 16:10 |
From | Sigurd Saue |
Subject | Re: [Csnd] OSC-control of instrument instances |
Thanks for that info. The instances represent sound objects more than notes and will run for several minutes. On average I will launch an instance every half minute, so I will supersede your suggested limit after a week or so. However, I guess I could reuse IDs (and channels) as long as I’m sure the instances do not overlap. Sigurd From: A discussion list for users of Csound <CSOUND@LISTSERV.HEANET.IE>
On Behalf Of Eduardo Moguillansky
I run into issues with exactly this same setup, but I was creating a new channel for each instance at quite a high rate. After a couple of minutes memory and cpu get very high, even if the number of running instances (polyphony) is low. This has apparently to do with the underlying hash-table implementation. So the problem has to do with the number of created channels in general, which make the creating of a new channel more expensive. If these are long-running instances, but the number of instances in total stay under a certain limit (say below 10000), then it should not be a problem. If on the other hand you are launching several notes per minute, each with one or several channels, then it will become problematic. eduardo
On 22.02.19 16:42, Rory Walsh wrote:
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 |
Date | 2019-02-22 16:57 |
From | Victor Lazzarini |
Subject | Re: [Csnd] OSC-control of instrument instances |
You could also use gk arrays as well to hold the values, instead of channels.
Since you are not using the API, and
everything is in Csound, I think channels
are probably overkill.
Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland
|