Csound Csound-dev Csound-tekno Search About

[Csnd] Choke groups in Csound

Date2025-04-24 18:23
FromGabriel Borin
Subject[Csnd] Choke groups in Csound
Hello, everyone

I am just curious about something. Is there a way of setting up choke groups for instruments in Csound -- meaning, out of a selected number of instruments, if this one plays stops the other? This behaviour would be similar to that of music tracker, or some samplers as well. I am thinking of implementing this in a future project, I just don't know how to start

Thank you,

Best,
Gabriel
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

Date2025-04-24 19:08
FromParham Izadyar
SubjectRe: [Csnd] Choke groups in Csound
hello gabriel, 

i guess there should be a better solution but i can only think of building this yourself with "active" and "turnoff2" opcodes. like:

if active(1) >= 1 then 
turnoff2 2,0,0
...
endif

i hope that's what you meant.
good luck - 

parham

On Thu, Apr 24, 2025, 8:53 PM Gabriel Borin <gabriel.s.borin@gmail.com> wrote:
Hello, everyone

I am just curious about something. Is there a way of setting up choke groups for instruments in Csound -- meaning, out of a selected number of instruments, if this one plays stops the other? This behaviour would be similar to that of music tracker, or some samplers as well. I am thinking of implementing this in a future project, I just don't know how to start

Thank you,

Best,
Gabriel
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

Date2025-04-24 20:03
FromTarmo Johannes
SubjectRe: [Csnd] Choke groups in Csound
Or you want to have probably a master instrument that calls the ones in the group. That could take care of stopping previous instrument with turnoff2 when it calls the new one with schdulek or event opcode.

Please let know if you need more hints!

Tarmo

N, 24. aprill 2025 21:08 Parham Izadyar <parhamizadyar93@gmail.com> kirjutas:
hello gabriel, 

i guess there should be a better solution but i can only think of building this yourself with "active" and "turnoff2" opcodes. like:

if active(1) >= 1 then 
turnoff2 2,0,0
...
endif

i hope that's what you meant.
good luck - 

parham

On Thu, Apr 24, 2025, 8:53 PM Gabriel Borin <gabriel.s.borin@gmail.com> wrote:
Hello, everyone

I am just curious about something. Is there a way of setting up choke groups for instruments in Csound -- meaning, out of a selected number of instruments, if this one plays stops the other? This behaviour would be similar to that of music tracker, or some samplers as well. I am thinking of implementing this in a future project, I just don't know how to start

Thank you,

Best,
Gabriel
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
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

Date2025-04-24 20:42
FromWerner Mendizabal
SubjectRe: [Csnd] Choke groups in Csound
If you are using Csound 7 you can use maxalloc with iturnoffmode.  Mode details can be found here: https://github.com/csound/csound/issues/1995

maxalloc insnum, icount, iturnoffmode
  • insnum: Instrument number.
  • icount: Maximum number of instances that can be allocated.
  • iturnoffmode (optional): Specifies the behavior when the icount limit is reached. This parameter can take the following values:
    • 0: Default behavior. When the number of instances equals icount, no new instances are allocated.
    • 1: When the number of instances equals icount, the oldest active instrument instance is automatically turned off, and a new instance is created.
    • 2: When the number of instances equals icount, the newest active instrument instance is automatically turned off, and a new instance is created.
iturnoffmoade allows automatically turning of previous instrument instances.

On Thu, Apr 24, 2025 at 2:14 PM Tarmo Johannes <trmjhnns@gmail.com> wrote:
Or you want to have probably a master instrument that calls the ones in the group. That could take care of stopping previous instrument with turnoff2 when it calls the new one with schdulek or event opcode.

Please let know if you need more hints!

Tarmo

N, 24. aprill 2025 21:08 Parham Izadyar <parhamizadyar93@gmail.com> kirjutas:
hello gabriel, 

i guess there should be a better solution but i can only think of building this yourself with "active" and "turnoff2" opcodes. like:

if active(1) >= 1 then 
turnoff2 2,0,0
...
endif

i hope that's what you meant.
good luck - 

parham

On Thu, Apr 24, 2025, 8:53 PM Gabriel Borin <gabriel.s.borin@gmail.com> wrote:
Hello, everyone

I am just curious about something. Is there a way of setting up choke groups for instruments in Csound -- meaning, out of a selected number of instruments, if this one plays stops the other? This behaviour would be similar to that of music tracker, or some samplers as well. I am thinking of implementing this in a future project, I just don't know how to start

Thank you,

Best,
Gabriel
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
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

Date2025-04-24 21:34
FromGabriel Borin
SubjectRe: [Csnd] Choke groups in Csound

Hello, everyone.

Thanks for all the hints. I have to test some of those things myself in the next couple of days, unfortunately I won't have time now. I will let you know in case I have any more questions.

Best regards,

Gabriel


On Thu, Apr 24, 2025, 15:42 Werner Mendizabal <nonameentername@gmail.com> wrote:
If you are using Csound 7 you can use maxalloc with iturnoffmode.  Mode details can be found here: https://github.com/csound/csound/issues/1995

maxalloc insnum, icount, iturnoffmode
  • insnum: Instrument number.
  • icount: Maximum number of instances that can be allocated.
  • iturnoffmode (optional): Specifies the behavior when the icount limit is reached. This parameter can take the following values:
    • 0: Default behavior. When the number of instances equals icount, no new instances are allocated.
    • 1: When the number of instances equals icount, the oldest active instrument instance is automatically turned off, and a new instance is created.
    • 2: When the number of instances equals icount, the newest active instrument instance is automatically turned off, and a new instance is created.
iturnoffmoade allows automatically turning of previous instrument instances.

On Thu, Apr 24, 2025 at 2:14 PM Tarmo Johannes <trmjhnns@gmail.com> wrote:
Or you want to have probably a master instrument that calls the ones in the group. That could take care of stopping previous instrument with turnoff2 when it calls the new one with schdulek or event opcode.

Please let know if you need more hints!

Tarmo

N, 24. aprill 2025 21:08 Parham Izadyar <parhamizadyar93@gmail.com> kirjutas:
hello gabriel, 

i guess there should be a better solution but i can only think of building this yourself with "active" and "turnoff2" opcodes. like:

if active(1) >= 1 then 
turnoff2 2,0,0
...
endif

i hope that's what you meant.
good luck - 

parham

On Thu, Apr 24, 2025, 8:53 PM Gabriel Borin <gabriel.s.borin@gmail.com> wrote:
Hello, everyone

I am just curious about something. Is there a way of setting up choke groups for instruments in Csound -- meaning, out of a selected number of instruments, if this one plays stops the other? This behaviour would be similar to that of music tracker, or some samplers as well. I am thinking of implementing this in a future project, I just don't know how to start

Thank you,

Best,
Gabriel
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
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
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