Csound Csound-dev Csound-tekno Search About

[Csnd] Re: triggering instruments from OSC

Date2009-06-17 07:48
From"vallste@libero.it"
Subject[Csnd] Re: triggering instruments from OSC
Hello,
Question 1: I don't understand why you would use two different instruments to 
do basically the same thing on the same instrument... could you please explain, 
I'm curious...
Question 2: I suppose it depends of what values are received with kp3 and 
kp4, maybe working with negative p3 (for indefinite duration - noteon) and 
negative p1 (to turn off the instrument - noteoff) can work.

Bye
Stefano

>----Messaggio originale----
>Da: atte.jensen@gmail.com
>Data: 17/06/2009 0.37
>A: "Csound mailing list address"
>Ogg: [Csnd] triggering instruments from OSC
>
>Hi
>
>I'm just getting started with OSC, so forgive me if I ask something 
obvious.
>
>I'm trying to trigger csound instruments from another application via 
>OSC. I'd like to have the osc -> instrument triggering only going on at 
>one place to make things cleaner. At the moment I have something like 
>(which seems to work just great):
>
>--- begin csound code ---
>     instr osc_listen_0
>kp3      init 0
>Sinstr       =     ""
>     nxtmsg:
>kk  OSClisten gihandle, "/csound/instr", "sf", Sinstr, kp3
>if (kk == 0) goto ex
>     event "i", Sinstr, 0, kp3
>     kgoto nxtmsg
>ex:
>     endin
>
>     instr osc_listen_1
>kp3       init 0
>kp4       init 0
>Sinstr       =     ""
>     nxtmsg:
>kk  OSClisten gihandle, "/csound/instr", "sff", Sinstr, kp3, kp4
>if (kk == 0) goto ex
>     event "i", Sinstr, 0, kp3, kp4
>     kgoto nxtmsg
>ex:
>     endin
>--- end csound code ---
>
>So basically I have one instrument that listens for OSC events that 
>contains only p3, one that has p3 and p4, and would also have others to 
>handle any number of p-fields. I don't expect to be needing much more 
>than a handful of these instruments (up to, say, p6), but still:
>
>Question #1:
>Is there a better way, for instance with everything done in one instrument?
>
>Question #2:
>Actually I would rather not have to worry about the p3, but instead have 
>things working more in a MIDI fashion, with matching noteon/noteoff. Or 
>even better; be able to use both p3 for duration and noteon/noteoff with 
>the same instruments (and even be able to trigger them via MIDI from a 
>keyboard). Is this possible and if so where do I have to look for 
>examples and/or opcodes that does this?
>
>Also any general thoughts or experiences with this kind of approach are 
>most welcome!
>
>-- 
>Atte
>
>http://atte.dk   http://modlys.dk   http://virb.com/atte
>
>
>Send bugs reports to this list.
>To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe 
csound"
>



Date2009-06-17 10:46
FromAtte Andre Jensen
Subject[Csnd] Re: Re: triggering instruments from OSC
vallste@libero.it wrote:

> Question 1: I don't understand why you would use two different instruments to 
> do basically the same thing on the same instrument... could you please explain, 
> I'm curious...

I might be totally wrong, but it seems that I can only listen for OSC 
messages with a certain format. So if I listen for "sf" (the string 
being the instrument name, the float being p3), I won't catch "sff" 
(where the last float is p4). Hence I simply setup a number of OSC 
listeners for each format I want to catch.

> Question 2: I suppose it depends of what values are received with kp3 and 
> kp4, maybe working with negative p3 (for indefinite duration - noteon) and 
> negative p1 (to turn off the instrument - noteoff) can work.

I'll try that, thanks. I like to work with names instruments, is it 
still possible to have negative p1 in such cases? If so should it be 
-"instr_name" or?

How are the noteons and noteoffs matched? Supposed the same instrument 
is triggered with two or more notes (with negative p3) how can I turnoff 
a specific instance?

My ignorance to the more subtle workings of p3 and p1 might stem from my 
main experience with csound is midi driven instruments, sorry for the 
newbie-ish nature of my question...

-- 
Atte

http://atte.dk   http://modlys.dk   http://virb.com/atte

Date2009-06-17 11:18
FromOeyvind Brandtsegg
Subject[Csnd] Re: Re: Re: triggering instruments from OSC
To keep track of different instances of instrument with negative p3,
you can use fractional instr numbers.
i 1.1  0  -1 ; turn on instance 1
i 1.2  1  -1 ; turn on instance 2
i -1.2  3  1 ; turn off instance 2
i -1.1  5  1 ; turn off instance 1

I'm not sure how this applies to named instruments.

best
Oeyvind

2009/6/17 Atte Andre Jensen :
> vallste@libero.it wrote:
>
>> Question 1: I don't understand why you would use two different instruments
>> to do basically the same thing on the same instrument... could you please
>> explain, I'm curious...
>
> I might be totally wrong, but it seems that I can only listen for OSC
> messages with a certain format. So if I listen for "sf" (the string being
> the instrument name, the float being p3), I won't catch "sff" (where the
> last float is p4). Hence I simply setup a number of OSC listeners for each
> format I want to catch.
>
>> Question 2: I suppose it depends of what values are received with kp3 and
>> kp4, maybe working with negative p3 (for indefinite duration - noteon) and
>> negative p1 (to turn off the instrument - noteoff) can work.
>
> I'll try that, thanks. I like to work with names instruments, is it still
> possible to have negative p1 in such cases? If so should it be -"instr_name"
> or?
>
> How are the noteons and noteoffs matched? Supposed the same instrument is
> triggered with two or more notes (with negative p3) how can I turnoff a
> specific instance?
>
> My ignorance to the more subtle workings of p3 and p1 might stem from my
> main experience with csound is midi driven instruments, sorry for the
> newbie-ish nature of my question...
>
> --
> Atte
>
> http://atte.dk   http://modlys.dk   http://virb.com/atte
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
> csound"
>