[Csnd] Instrument self instance / note management
Date | 2022-07-19 22:57 |
From | "Jeanette C." |
Subject | [Csnd] Instrument self instance / note management |
Hey hey, I'm trying to implement a live MIDI orchestra. It has two vital instruments: one triggered by MIDI note and another one to be triggered multiple times from within the "master" instrument with slightly different parameters, called Play. Now, I'd like to turn off the Play instances, once the Master instrument is released, but I can't manage that properly. I tried calling Play with: iId1 = nstance("Play", 0, -1, iP4, ...) iId2 = nstance("Play", 0, -1, iP4, ...) And then later: if (release() == 1) then turnoff(iId1) turnoff(iId2) endif No joy. I worked with an i-time array of Ids first, when that failed, I switched to separate variables for each ID. Before that I had a global counter for use with fractional instrument numbers and turnoff2. The problem: if MIDI notes were depressed simultaneously, not every note would play. Due to some complexities the implementation with two instruments is the easiest and most maintainable solution. Is there a way to overcome this? Have I missed a pitfall? Best wishes and thanks, Jeanette -- * Website: http://juliencoder.de - for summer is a state of sound * Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g * Audiobombs: https://www.audiobombs.com/users/jeanette_c * GitHub: https://github.com/jeanette-c Just hang around and you'll see, There's nowhere I'd rather be <3 (Britney Spears) 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 | 2022-07-19 23:18 |
From | Tarmo Johannes |
Subject | Re: [Csnd] Instrument self instance / note management |
Hi, You need to use fractional instrument numbers like nstrnum("Play")+0.1nstrnum("Play")+0.2 otherwise you cannot have several instances with indefinite duration. Hope it helps... Tarmo K, 20. juuli 2022 00:59 Jeanette C. <julien@mail.upb.de> kirjutas: Hey hey, |
Date | 2022-07-19 23:33 |
From | "Jeanette C." |
Subject | Re: [Csnd] Instrument self instance / note management |
Jul 20 2022, Tarmo Johannes has written: > Hi, > > You need to use fractional instrument numbers like > nstrnum("Play")+0.1 ... This is what I tried with the global counter. that's when I ran into the simultaneous issues. The sound generation must be polyphonic. That's why I wonder if there is a way to determine the fractional ID or nstance handle of a playing instrument by itself, so the fractional numbers of sound generators can be unique. Best wishes and thanks, Jeanette -- * Website: http://juliencoder.de - for summer is a state of sound * Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g * Audiobombs: https://www.audiobombs.com/users/jeanette_c * GitHub: https://github.com/jeanette-c Just hang around and you'll see, There's nowhere I'd rather be <3 (Britney Spears) 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 | 2022-07-20 00:10 |
From | Victor Lazzarini |
Subject | Re: [Csnd] [EXTERNAL] Re: [Csnd] Instrument self instance / note management |
With -1 you will always replace the instance with a new one, unless a fractional p1 is used. You could use a large p3 though, and that should behave as expected, with separate instances. Prof. Victor Lazzarini Maynooth University Ireland > On 19 Jul 2022, at 23:35, Jeanette C. |
Date | 2022-07-20 02:02 |
From | thorin kerr |
Subject | Re: [Csnd] Instrument self instance / note management |
You also have to convert the irate handle to krate to get the k-rate turnoff. This example works: instr Master ild1 nstance nstrnum("Play") + 0.1, 0, -1, ip4, ip5 ... ild2 nstance nstrnum("Play") + 0.2, 0, -1, ip4, ip5 ... kld1 = k(ild1) kld2 = k(ild2) if release() == 1 then turnoff(kld1) turnoff(kld2) endif endin On Wed, Jul 20, 2022 at 7:59 AM Jeanette C. <julien@mail.upb.de> wrote: Hey hey, |
Date | 2022-07-20 10:10 |
From | "Jeanette C." |
Subject | Re: [Csnd] Instrument self instance / note management |
Hi Victor and Thorin, thanks both of you for the clarification. Just when I woke up this morning I thought of another viable solution, i Hope. I can create unique fractional p1 parts with each MIDI event based on the note number, since I won't play a note twice at the same time. It may cause some issues with release periods and note retriggered quickly. In this case it's a pad instrument and I know what I will play already. If that does cause more issues, I'll go with very long p3, as you suggested Victor. Thanks again and best wishes, Jeanette -- * Website: http://juliencoder.de - for summer is a state of sound * Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g * Audiobombs: https://www.audiobombs.com/users/jeanette_c * GitHub: https://github.com/jeanette-c 'Cause living in a dream of you and me Is not the way my life should be... <3 (Britney Spears) 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 |