turnoff2 scheduled instruments
Date | 2016-01-12 05:23 |
From | Guillermo Senna |
Subject | turnoff2 scheduled instruments |
Hi, Is there a way to turn off (like when you use turnoff2) instruments that: * Have been scheduled using event_i * Have a delayed (not 0) p2. * Have not started yet when you intend to do the turnoff2 from another instrument. If I use turnoff2 from another instrument, before the instrument I want to turn off starts, it doesn't kill it. If I do an event_i with negative p1 it says it could not find a running instance of that instrument. Thanks. 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 | 2016-01-12 09:09 |
From | Tarmo Johannes |
Subject | Re: turnoff2 scheduled instruments |
Hi!
so you want to turn off an insrument at some moment in future?
Obviously you cannot stop an instrument that is not currently playing with turnoff2.
You could try calling an event (either event(_i) or scoreline(_i) or schedule) with negative instrument number but p2 icontaining the time when it will be executed. To stop instr 1 after 2 seconds you coud do:
scoreline_i " i -1 2 0"
The problem is - it works only when instr 1 was started for indetermined time (ie negative p3), otherwise csound complains: 'couldn't find playing instr 1.000000'
Then I think you need to have another instrument that you start when you need:
instr _turnoff instrno = p4 turnoff2 instrno,0,1 turnoff ; turn itself off as well endin
and call it:
schedule "_turnoff",2,1
There are definitely also other ways to solve it - as always in Csound.
Best! tarmo
On Tuesday 12 January 2016 02:23:18 you wrote: > Hi, > > Is there a way to turn off (like when you use turnoff2) instruments that: > * Have been scheduled using event_i > * Have a delayed (not 0) p2. > * Have not started yet when you intend to do the turnoff2 from another > instrument. > > If I use turnoff2 from another instrument, before the instrument I want > to turn off starts, it doesn't kill it. If I do an event_i with negative > p1 it says it could not find a running instance of that instrument. > > Thanks. > > 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 | 2016-01-12 09:23 |
From | Kevin Welsh |
Subject | Re: turnoff2 scheduled instruments |
If I were working on this issue, I think my first approach would be instead of scheduling the notes in the future, I would try to have a basic "waiting" instrument that starts immediately, waits the amount of time you would have supplied to p2, and then calls the actual sounding instrument at the end of the wait with a new p2 of 0. This should allow you to cancel the waiting instrument pretty easily. Hope that made sense, good luck! On Tue, Jan 12, 2016 at 12:23 AM, Guillermo Senna |
Date | 2016-01-12 20:01 |
From | Guillermo Senna |
Subject | Re: turnoff2 scheduled instruments |
Hi Kevin, Hi Tarmo, Finally, I think I've solved it. I am using p2 = 0, so that turnoff2 will work. But the secret was realizing about perf-time and using k(0). Otherwise the conditional branch doesn't wait. Now my instrument looks like this: instr 100 ; This is the instr I'd like to turnoff2 if release() == 1 then chnset k(0), "btn1" endif endin This is for resetting a Start/Stop Button in Cabbage. So I'm going to keep testing it like it was real human interaction, but I think with your help it's now done. Thank you! On 12/01/16 06:23, Kevin Welsh wrote: > If I were working on this issue, I think my first approach would be > instead of scheduling the notes in the future, I would try to have a > basic "waiting" instrument that starts immediately, waits the amount > of time you would have supplied to p2, and then calls the actual > sounding instrument at the end of the wait with a new p2 of 0. This > should allow you to cancel the waiting instrument pretty easily. > > Hope that made sense, good luck! > > On Tue, Jan 12, 2016 at 12:23 AM, Guillermo Senna |
Date | 2016-01-12 20:25 |
From | Tarmo Johannes |
Subject | Re: turnoff2 scheduled instruments |
Another possible syntax: cnhset:k(0,"btn1") to force action on k-time tarmo On Tuesday 12 January 2016 17:01:47 you wrote: > chnset k(0), "btn1" 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 | 2016-01-12 21:04 |
From | Guillermo Senna |
Subject | Re: turnoff2 scheduled instruments |
Right. So now I have another problem. I've just realized that my oscillators will suffer from the same thing. I have a loop that schedules them. The problem is that now I can't use release() because p2 of those oscillators does not equal to the last k-cycle. I really need a way to unschedule events, because timing/triggering inside a loop doesn't make sense. Is there some door I could knock where all the scheduled events go and drink beer until they're called? On 12/01/16 17:25, Tarmo Johannes wrote: > Another possible syntax: > > cnhset:k(0,"btn1") > > to force action on k-time > > tarmo > > On Tuesday 12 January 2016 17:01:47 you wrote: >> chnset k(0), "btn1" > 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 |