[Csnd] API and csound~ (max) question

Hi folks, while I wait for my copy of the big new csound book to make its way across the Atlantic, I’m hoping someone could give me a broad-strokes overview of the practicality of doing something, and how one would go about it.

I want to have the csound~ object in Max (and later Pd) triggering Max event messages based on kr activity in csound instruments. I’d like to be able to, for example, specify an instrument to be an lfo and at some k-rate trigger a C function in the host code that is hosting CSound through the API. Though sending a generic Max message would probably do too. I’m not sure whether this will necessitate some kind of opcode development or is already in the API? (Or perhaps is even in the csound~ object already and I haven’t found it)…

Any thoughts would be most appreciated!
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

I don’t think it needs anything extra. These opcodes

https://csound.com/docs/manual/outvalue.html

and invalue

should take care of control in and out. I think it sends a message with two items, the channel name followed by the control rate value.

The named channel bus (e.g. chnget/chnset) should also work in the same way.

I’m guessing here based on how it works in Pd.

Rick Boulanger would know better since he used csound~ extensively.

Prof. Victor Lazzarini
Maynooth University
Ireland

Thanks Victor, I’ll muck around with that and see how I do. I was thinking of taking advantage of csound’s polyphony model, so that a scheme process (in the algorithmic composition sense) could trigger an instrument instance for some period of time, having it callback with ramp values. In which case I think I want more than just a chan identifier. Perhaps I’ll need to cook up an opcode that can send back a pair somehow of value, plus pfield it received.

At any rate, I’m looking forward to the book and figuring out how to do this, and to doing it in Pd too. So far the experiments combining Max, Scheme for Max, Csound, and modular have been really promising, and the Pd port is coming along pretty smoothly.

iain

You don’t need an opcode (unless you are thinking of an UDO), you can concatenate strings and numbers with sprintf
to make individual channel names on the fly. That’s the most common way of doing it. You can use fractional p1
and use that in the channel names.

Ah great to know, thanks!

iain