Csound Csound-dev Csound-tekno Search About

[Csnd] Toggle UDO?

Date2020-07-31 10:44
From"Dr. Richard Boulanger"
Subject[Csnd] Toggle UDO?
Does anyone have a toggle UDO that they might be able to share?
Are there examples that you might point me to in Floss or in CsoundQt?

Thanks.

What my students are trying to do is press a single button (on a Bela or Arduino) or play a single MIDI note on a controller keyboard and have it turn on an effect, and then press the same button again and have it turn off the effect.  Or, like in Ableton Live - start playing a sample and then press again to stop playing the sample.

a "toggle"

John and I have worked on a new "counter" opcode that will work in these situations, but it won't be released until 6.15.  

I will be working and searching and sharing later today, but if any of you have one already, or might point me to some solutions - that would be a huge help and head-start.  (In CsoundQt, the button widget has a "latch" mode, which is perfect, but I need this to work in Csound without a widget or front-end)

Thanks

-dB

Dr. Richard Boulanger

Professor of Electronic Production and Design

Berklee College of Music

Professional Writing and Technology Division


skype: radiobaton 

facebook: https://www.facebook.com/richard.boulanger.58

about: http://www.boulangerlabs.com/#about

about: http://www.csounds.com/community/developers/dr-richard-boulanger/

music: http://www.csounds.com/community/developers/dr-richard-boulanger/dr-richard-boulanger-music/

Boulanger Labs - http://boulangerlabs.com

The Csound Book http://mitpress.mit.edu/books/csound-book

The Audio Programming Book - http://mitpress.mit.edu/books/audio-programming-book

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

Date2020-07-31 11:07
FromVictor Lazzarini
SubjectRe: [Csnd] [EXTERNAL] [Csnd] Toggle UDO?
Do you mean this?

opcode Toggle,k,0
 kstate init 0
 kstate = kstate == 0? 0 : 1
 xout kstate
endop

========================
Prof. Victor Lazzarini
Maynooth University
Ireland

> On 31 Jul 2020, at 10:44, Dr. Richard Boulanger  wrote:
> 
> WARNINGThis email originated from outside of Maynooth University's Mail System. Do not reply, click links or open attachments unless you recognise the sender and know the content is safe.
> Does anyone have a toggle UDO that they might be able to share?
> Are there examples that you might point me to in Floss or in CsoundQt?
> 
> Thanks.
> 
> What my students are trying to do is press a single button (on a Bela or Arduino) or play a single MIDI note on a controller keyboard and have it turn on an effect, and then press the same button again and have it turn off the effect.  Or, like in Ableton Live - start playing a sample and then press again to stop playing the sample.
> 
> a "toggle"
> 
> John and I have worked on a new "counter" opcode that will work in these situations, but it won't be released until 6.15.  
> 
> I will be working and searching and sharing later today, but if any of you have one already, or might point me to some solutions - that would be a huge help and head-start.  (In CsoundQt, the button widget has a "latch" mode, which is perfect, but I need this to work in Csound without a widget or front-end)
> 
> Thanks
> 
> -dB
> Dr. Richard Boulanger
> Professor of Electronic Production and Design
> Berklee College of Music
> Professional Writing and Technology Division
> 
> skype: radiobaton 
> facebook: https://www.facebook.com/richard.boulanger.58
> about: http://www.boulangerlabs.com/#about
> about: http://www.csounds.com/community/developers/dr-richard-boulanger/
> music: http://www.csounds.com/community/developers/dr-richard-boulanger/dr-richard-boulanger-music/
> Boulanger Labs - http://boulangerlabs.com
> The Csound Book - http://mitpress.mit.edu/books/csound-book
> The Audio Programming Book - http://mitpress.mit.edu/books/audio-programming-book
> 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

Date2020-07-31 11:08
FromVictor Lazzarini
SubjectRe: [Csnd] [EXTERNAL] [Csnd] Toggle UDO?
actually the other way round


opcode Toggle,k,0
 kstate init 0
 kstate = kstate == 0? 1 : 0
 xout kstate
endop

========================
Prof. Victor Lazzarini
Maynooth University
Ireland

> On 31 Jul 2020, at 11:07, Victor Lazzarini  wrote:
> 
> Do you mean this?
> 
> opcode Toggle,k,0
> kstate init 0
> kstate = kstate == 0? 0 : 1
> xout kstate
> endop
> 
> ========================
> Prof. Victor Lazzarini
> Maynooth University
> Ireland
> 
>> On 31 Jul 2020, at 10:44, Dr. Richard Boulanger  wrote:
>> 
>> WARNINGThis email originated from outside of Maynooth University's Mail System. Do not reply, click links or open attachments unless you recognise the sender and know the content is safe.
>> Does anyone have a toggle UDO that they might be able to share?
>> Are there examples that you might point me to in Floss or in CsoundQt?
>> 
>> Thanks.
>> 
>> What my students are trying to do is press a single button (on a Bela or Arduino) or play a single MIDI note on a controller keyboard and have it turn on an effect, and then press the same button again and have it turn off the effect.  Or, like in Ableton Live - start playing a sample and then press again to stop playing the sample.
>> 
>> a "toggle"
>> 
>> John and I have worked on a new "counter" opcode that will work in these situations, but it won't be released until 6.15.  
>> 
>> I will be working and searching and sharing later today, but if any of you have one already, or might point me to some solutions - that would be a huge help and head-start.  (In CsoundQt, the button widget has a "latch" mode, which is perfect, but I need this to work in Csound without a widget or front-end)
>> 
>> Thanks
>> 
>> -dB
>> Dr. Richard Boulanger
>> Professor of Electronic Production and Design
>> Berklee College of Music
>> Professional Writing and Technology Division
>> 
>> skype: radiobaton 
>> facebook: https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.facebook.com%2Frichard.boulanger.58&data=02%7C01%7CVictor.Lazzarini%40mu.ie%7C7d2c0d8ac6714c2a308908d835397f0d%7C1454f5ccbb354685bbd98621fd8055c9%7C1%7C0%7C637317868341958289&sdata=nIi485JjFCS3aqruH987MpyfDISfKLx0UKENkPna9fQ%3D&reserved=0
>> about: https://eur02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.boulangerlabs.com%2F%23about&data=02%7C01%7CVictor.Lazzarini%40mu.ie%7C7d2c0d8ac6714c2a308908d835397f0d%7C1454f5ccbb354685bbd98621fd8055c9%7C1%7C0%7C637317868341968283&sdata=jxQk0TgDJivGuv85Zjys7dUG5Ik3KGPiwHAWZdfQ1sk%3D&reserved=0
>> about: https://eur02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.csounds.com%2Fcommunity%2Fdevelopers%2Fdr-richard-boulanger%2F&data=02%7C01%7CVictor.Lazzarini%40mu.ie%7C7d2c0d8ac6714c2a308908d835397f0d%7C1454f5ccbb354685bbd98621fd8055c9%7C1%7C0%7C637317868341968283&sdata=JWZj1jVaaB5%2B65ayBVutuH7mXqNIOCL7QrwXTHNnFv4%3D&reserved=0
>> music: https://eur02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.csounds.com%2Fcommunity%2Fdevelopers%2Fdr-richard-boulanger%2Fdr-richard-boulanger-music%2F&data=02%7C01%7CVictor.Lazzarini%40mu.ie%7C7d2c0d8ac6714c2a308908d835397f0d%7C1454f5ccbb354685bbd98621fd8055c9%7C1%7C0%7C637317868341968283&sdata=%2BjEi5joVSTlNNIxgOvWGYagb4VeP28XhYu0pjNfDJyk%3D&reserved=0
>> Boulanger Labs - https://eur02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fboulangerlabs.com%2F&data=02%7C01%7CVictor.Lazzarini%40mu.ie%7C7d2c0d8ac6714c2a308908d835397f0d%7C1454f5ccbb354685bbd98621fd8055c9%7C1%7C0%7C637317868341968283&sdata=dJd9UMNNMRPvvYp4%2BnD79CA60bnjfHse66upApnknks%3D&reserved=0
>> The Csound Book - https://eur02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmitpress.mit.edu%2Fbooks%2Fcsound-book&data=02%7C01%7CVictor.Lazzarini%40mu.ie%7C7d2c0d8ac6714c2a308908d835397f0d%7C1454f5ccbb354685bbd98621fd8055c9%7C1%7C0%7C637317868341968283&sdata=BPo3Fxxp7IKq%2FmXg%2Fcoqt6ojLJfu1RQXCfeYk9QMTGc%3D&reserved=0
>> The Audio Programming Book - https://eur02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmitpress.mit.edu%2Fbooks%2Faudio-programming-book&data=02%7C01%7CVictor.Lazzarini%40mu.ie%7C7d2c0d8ac6714c2a308908d835397f0d%7C1454f5ccbb354685bbd98621fd8055c9%7C1%7C0%7C637317868341968283&sdata=32xGVO7P0rjBPkwdgkTCKubeifH4FfhHJNIBR9V1Zwg%3D&reserved=0
>> Csound mailing list Csound@listserv.heanet.ie https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flistserv.heanet.ie%2Fcgi-bin%2Fwa%3FA0%3DCSOUND&data=02%7C01%7CVictor.Lazzarini%40mu.ie%7C7d2c0d8ac6714c2a308908d835397f0d%7C1454f5ccbb354685bbd98621fd8055c9%7C1%7C0%7C637317868341968283&sdata=lrchPT7AnTtbAvdN%2BifSOfhdBtHbu%2FAKqV3o2ETEdoc%3D&reserved=0 Send bugs reports to https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fcsound%2Fcsound%2Fissues&data=02%7C01%7CVictor.Lazzarini%40mu.ie%7C7d2c0d8ac6714c2a308908d835397f0d%7C1454f5ccbb354685bbd98621fd8055c9%7C1%7C0%7C637317868341968283&sdata=AFisC6ZgOKWBQkzvgvHyL00AKdmlHorSvL675o%2BdNP0%3D&reserved=0 Discussions of bugs and features can be posted here
> 
> Csound mailing list
> Csound@listserv.heanet.ie
> https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flistserv.heanet.ie%2Fcgi-bin%2Fwa%3FA0%3DCSOUND&data=02%7C01%7CVictor.Lazzarini%40mu.ie%7C7d2c0d8ac6714c2a308908d835397f0d%7C1454f5ccbb354685bbd98621fd8055c9%7C1%7C0%7C637317868341968283&sdata=lrchPT7AnTtbAvdN%2BifSOfhdBtHbu%2FAKqV3o2ETEdoc%3D&reserved=0
> Send bugs reports to
>        https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fcsound%2Fcsound%2Fissues&data=02%7C01%7CVictor.Lazzarini%40mu.ie%7C7d2c0d8ac6714c2a308908d835397f0d%7C1454f5ccbb354685bbd98621fd8055c9%7C1%7C0%7C637317868341968283&sdata=AFisC6ZgOKWBQkzvgvHyL00AKdmlHorSvL675o%2BdNP0%3D&reserved=0
> 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

Date2020-07-31 11:37
From"Jeanette C."
SubjectRe: [Csnd] Toggle UDO?
Hello Dr. B.
Jul 31 2020, Dr. Richard Boulanger has written:
...
> What my students are trying to do is press a single button (on a Bela or
> Arduino) or play a single MIDI note on a controller keyboard and have it
> turn on an effect, and then press the same button again and have it turn
> off the effect.
...
Could this be done with channels?
Have a UDO to create a channel with a predefined state:
opcode make_toggle, 0, Si
 	Sname, iStartValue xin
 	... ; possibly concat a name like toggle.Sname
 	chn_k SchannelName, 3
 	chnset iStartValue, SchannelName
endop

And then have a toggle opcode to check a control signal with changed2 or
compare to fixed values - in the case of MIDI notes, always setting the
channel to 0 or 1.
opcode toggle_run, k, Sk
 	Sname, kControl xin
 	...
 	kCurrentValue chnget SchannelName
 	if changed2(kControl) == 1 then
 		if kcurrentValue == 0 then
 			kCurrentValue = 1
 		else
 			kCurrentValue = 0
 		endif
 		chnset kCurrentValue, SchannelName
 	endif

 	xout kCurrentValue
endop

That way, I think, you could use this in several places in the orchestra
and still have a central state.

HTH.

Best wishes,

Jeanette

-- 
  * Website: http://juliencoder.de - for summer is a state of sound
  * Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g
  * SoundCloud: https://soundcloud.com/jeanette_c
  * Twitter: https://twitter.com/jeanette_c_s
  * Audiobombs: https://www.audiobombs.com/users/jeanette_c
  * GitHub: https://github.com/jeanette-c

Don't care about money
It doesn't give me half the thrill <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

Date2020-07-31 12:17
Fromthorin kerr
SubjectRe: [Csnd] Toggle UDO?
Would i-rate code do?
I have a counter which could be used as a toggle. This is similar to Jeanette's solution. You need to give it a string, which is used as a state-saving channel.

opcode counterChan, i, Spoo
;;; state saving counter.
;;; usage ival counterChan "id" [, iincrement, imodulo, ilower]
Schan, iincrement, imodulo, ilower  xin
icurrent chnget Schan
if (imodulo != 0) then
   icurrent = wrap(icurrent, ilower, imodulo)
   inewval = wrap((icurrent + iincrement), ilower, imodulo)
else
   inewval = icurrent + iincrement
endif
chnset inewval, Schan
xout icurrent
endop

;;;Example (toggle) usage
ibutton1 counterChan "button1", 1, 2, 0
ibutton2 counterChan "button2", 1, 2, 0
ibutton3 counterChan "button3", 1, 2, 0

Thorin


On Fri, Jul 31, 2020 at 7:44 PM Dr. Richard Boulanger <rboulanger@berklee.edu> wrote:
Does anyone have a toggle UDO that they might be able to share?
Are there examples that you might point me to in Floss or in CsoundQt?

Thanks.

What my students are trying to do is press a single button (on a Bela or Arduino) or play a single MIDI note on a controller keyboard and have it turn on an effect, and then press the same button again and have it turn off the effect.  Or, like in Ableton Live - start playing a sample and then press again to stop playing the sample.

a "toggle"

John and I have worked on a new "counter" opcode that will work in these situations, but it won't be released until 6.15.  

I will be working and searching and sharing later today, but if any of you have one already, or might point me to some solutions - that would be a huge help and head-start.  (In CsoundQt, the button widget has a "latch" mode, which is perfect, but I need this to work in Csound without a widget or front-end)

Thanks

-dB

Dr. Richard Boulanger

Professor of Electronic Production and Design

Berklee College of Music

Professional Writing and Technology Division


skype: radiobaton 

facebook: https://www.facebook.com/richard.boulanger.58

about: http://www.boulangerlabs.com/#about

about: http://www.csounds.com/community/developers/dr-richard-boulanger/

music: http://www.csounds.com/community/developers/dr-richard-boulanger/dr-richard-boulanger-music/

Boulanger Labs - http://boulangerlabs.com

The Csound Book http://mitpress.mit.edu/books/csound-book

The Audio Programming Book - http://mitpress.mit.edu/books/audio-programming-book

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

Date2020-07-31 12:26
From"Dr. Richard Boulanger"
SubjectRe: [Csnd] Toggle UDO?
Victor, Jeanette and Thorin,

These are all super inspiring and helpful!

Today is going to be toggle day at Boulanger Labs!

I will get my students to explore and apply these for sure, and any other suggestions and approaches that others might share too.

Super helpful and most appreciated.

-dB



Dr. Richard Boulanger
Professor
Electronic Production and Design
Berklee College of Music

On Jul 31, 2020, at 7:18 AM, thorin kerr <thorin.kerr@gmail.com> wrote:


Would i-rate code do?
I have a counter which could be used as a toggle. This is similar to Jeanette's solution. You need to give it a string, which is used as a state-saving channel.

opcode counterChan, i, Spoo
;;; state saving counter.
;;; usage ival counterChan "id" [, iincrement, imodulo, ilower]
Schan, iincrement, imodulo, ilower  xin
icurrent chnget Schan
if (imodulo != 0) then
   icurrent = wrap(icurrent, ilower, imodulo)
   inewval = wrap((icurrent + iincrement), ilower, imodulo)
else
   inewval = icurrent + iincrement
endif
chnset inewval, Schan
xout icurrent
endop

;;;Example (toggle) usage
ibutton1 counterChan "button1", 1, 2, 0
ibutton2 counterChan "button2", 1, 2, 0
ibutton3 counterChan "button3", 1, 2, 0

Thorin


On Fri, Jul 31, 2020 at 7:44 PM Dr. Richard Boulanger <rboulanger@berklee.edu> wrote:
Does anyone have a toggle UDO that they might be able to share?
Are there examples that you might point me to in Floss or in CsoundQt?

Thanks.

What my students are trying to do is press a single button (on a Bela or Arduino) or play a single MIDI note on a controller keyboard and have it turn on an effect, and then press the same button again and have it turn off the effect.  Or, like in Ableton Live - start playing a sample and then press again to stop playing the sample.

a "toggle"

John and I have worked on a new "counter" opcode that will work in these situations, but it won't be released until 6.15.  

I will be working and searching and sharing later today, but if any of you have one already, or might point me to some solutions - that would be a huge help and head-start.  (In CsoundQt, the button widget has a "latch" mode, which is perfect, but I need this to work in Csound without a widget or front-end)

Thanks

-dB

Dr. Richard Boulanger

Professor of Electronic Production and Design

Berklee College of Music

Professional Writing and Technology Division


skype: radiobaton 

facebook: https://www.facebook.com/richard.boulanger.58

about: http://www.boulangerlabs.com/#about

about: http://www.csounds.com/community/developers/dr-richard-boulanger/

music: http://www.csounds.com/community/developers/dr-richard-boulanger/dr-richard-boulanger-music/

Boulanger Labs - http://boulangerlabs.com

The Csound Book http://mitpress.mit.edu/books/csound-book

The Audio Programming Book - http://mitpress.mit.edu/books/audio-programming-book

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

Date2020-07-31 14:48
FromJoseph Hughes
SubjectRe: [Csnd] Toggle UDO?
Hi Richard, This matches the use case you're describing pretty closely. It's not an opcode, it's an instrument that turns a delay effect on and off: https://github.com/riffquantum/static_brothers_see_cound/blob/master/songs/sbDrumKit/instruments/midiRouter/noteInstruments/PadC4.orc

On Fri, Jul 31, 2020 at 7:26 AM Dr. Richard Boulanger <rboulanger@berklee.edu> wrote:
Victor, Jeanette and Thorin,

These are all super inspiring and helpful!

Today is going to be toggle day at Boulanger Labs!

I will get my students to explore and apply these for sure, and any other suggestions and approaches that others might share too.

Super helpful and most appreciated.

-dB



Dr. Richard Boulanger
Professor
Electronic Production and Design
Berklee College of Music

On Jul 31, 2020, at 7:18 AM, thorin kerr <thorin.kerr@gmail.com> wrote:


Would i-rate code do?
I have a counter which could be used as a toggle. This is similar to Jeanette's solution. You need to give it a string, which is used as a state-saving channel.

opcode counterChan, i, Spoo
;;; state saving counter.
;;; usage ival counterChan "id" [, iincrement, imodulo, ilower]
Schan, iincrement, imodulo, ilower  xin
icurrent chnget Schan
if (imodulo != 0) then
   icurrent = wrap(icurrent, ilower, imodulo)
   inewval = wrap((icurrent + iincrement), ilower, imodulo)
else
   inewval = icurrent + iincrement
endif
chnset inewval, Schan
xout icurrent
endop

;;;Example (toggle) usage
ibutton1 counterChan "button1", 1, 2, 0
ibutton2 counterChan "button2", 1, 2, 0
ibutton3 counterChan "button3", 1, 2, 0

Thorin


On Fri, Jul 31, 2020 at 7:44 PM Dr. Richard Boulanger <rboulanger@berklee.edu> wrote:
Does anyone have a toggle UDO that they might be able to share?
Are there examples that you might point me to in Floss or in CsoundQt?

Thanks.

What my students are trying to do is press a single button (on a Bela or Arduino) or play a single MIDI note on a controller keyboard and have it turn on an effect, and then press the same button again and have it turn off the effect.  Or, like in Ableton Live - start playing a sample and then press again to stop playing the sample.

a "toggle"

John and I have worked on a new "counter" opcode that will work in these situations, but it won't be released until 6.15.  

I will be working and searching and sharing later today, but if any of you have one already, or might point me to some solutions - that would be a huge help and head-start.  (In CsoundQt, the button widget has a "latch" mode, which is perfect, but I need this to work in Csound without a widget or front-end)

Thanks

-dB

Dr. Richard Boulanger

Professor of Electronic Production and Design

Berklee College of Music

Professional Writing and Technology Division


skype: radiobaton 

facebook: https://www.facebook.com/richard.boulanger.58

about: http://www.boulangerlabs.com/#about

about: http://www.csounds.com/community/developers/dr-richard-boulanger/

music: http://www.csounds.com/community/developers/dr-richard-boulanger/dr-richard-boulanger-music/

Boulanger Labs - http://boulangerlabs.com

The Csound Book http://mitpress.mit.edu/books/csound-book

The Audio Programming Book - http://mitpress.mit.edu/books/audio-programming-book

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

Date2020-07-31 15:46
From"Dr. Richard Boulanger"
SubjectRe: [Csnd] Toggle UDO?
Thanks, Joseph,

I will try it too and pass that along to the students as well.

Much appreciated

Dr. Richard Boulanger

Professor of Electronic Production and Design

Berklee College of Music




On Fri, Jul 31, 2020 at 9:48 AM Joseph Hughes <joehughesmail@gmail.com> wrote:
Hi Richard, This matches the use case you're describing pretty closely. It's not an opcode, it's an instrument that turns a delay effect on and off: https://github.com/riffquantum/static_brothers_see_cound/blob/master/songs/sbDrumKit/instruments/midiRouter/noteInstruments/PadC4.orc

On Fri, Jul 31, 2020 at 7:26 AM Dr. Richard Boulanger <rboulanger@berklee.edu> wrote:
Victor, Jeanette and Thorin,

These are all super inspiring and helpful!

Today is going to be toggle day at Boulanger Labs!

I will get my students to explore and apply these for sure, and any other suggestions and approaches that others might share too.

Super helpful and most appreciated.

-dB



Dr. Richard Boulanger
Professor
Electronic Production and Design
Berklee College of Music

On Jul 31, 2020, at 7:18 AM, thorin kerr <thorin.kerr@gmail.com> wrote:


Would i-rate code do?
I have a counter which could be used as a toggle. This is similar to Jeanette's solution. You need to give it a string, which is used as a state-saving channel.

opcode counterChan, i, Spoo
;;; state saving counter.
;;; usage ival counterChan "id" [, iincrement, imodulo, ilower]
Schan, iincrement, imodulo, ilower  xin
icurrent chnget Schan
if (imodulo != 0) then
   icurrent = wrap(icurrent, ilower, imodulo)
   inewval = wrap((icurrent + iincrement), ilower, imodulo)
else
   inewval = icurrent + iincrement
endif
chnset inewval, Schan
xout icurrent
endop

;;;Example (toggle) usage
ibutton1 counterChan "button1", 1, 2, 0
ibutton2 counterChan "button2", 1, 2, 0
ibutton3 counterChan "button3", 1, 2, 0

Thorin


On Fri, Jul 31, 2020 at 7:44 PM Dr. Richard Boulanger <rboulanger@berklee.edu> wrote:
Does anyone have a toggle UDO that they might be able to share?
Are there examples that you might point me to in Floss or in CsoundQt?

Thanks.

What my students are trying to do is press a single button (on a Bela or Arduino) or play a single MIDI note on a controller keyboard and have it turn on an effect, and then press the same button again and have it turn off the effect.  Or, like in Ableton Live - start playing a sample and then press again to stop playing the sample.

a "toggle"

John and I have worked on a new "counter" opcode that will work in these situations, but it won't be released until 6.15.  

I will be working and searching and sharing later today, but if any of you have one already, or might point me to some solutions - that would be a huge help and head-start.  (In CsoundQt, the button widget has a "latch" mode, which is perfect, but I need this to work in Csound without a widget or front-end)

Thanks

-dB

Dr. Richard Boulanger

Professor of Electronic Production and Design

Berklee College of Music

Professional Writing and Technology Division


skype: radiobaton 

facebook: https://www.facebook.com/richard.boulanger.58

about: http://www.boulangerlabs.com/#about

about: http://www.csounds.com/community/developers/dr-richard-boulanger/

music: http://www.csounds.com/community/developers/dr-richard-boulanger/dr-richard-boulanger-music/

Boulanger Labs - http://boulangerlabs.com

The Csound Book http://mitpress.mit.edu/books/csound-book

The Audio Programming Book - http://mitpress.mit.edu/books/audio-programming-book

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

Date2020-07-31 15:50
FromJoseph Hughes
SubjectRe: [Csnd] Toggle UDO?
As a UDO I guess the concept would look like this:

opcode instrumentToggle 0, iooooooo
iInstrumentNumber, iP4, iP5, iP6, iP7, iP8, iP9, iP10 xin

iInstrumentIsActive active iInstrumentNumber
if iInstrumentIsActive > 0 then
turnoff2 iInstrumentNumber, 8, 1
else
event_i "i", iInstrumentNumber, 0, -1, iP4, iP5, iP6, iP7, iP8, iP9, iP10
endif
endop

On Fri, Jul 31, 2020 at 10:46 AM Dr. Richard Boulanger <rboulanger@berklee.edu> wrote:
Thanks, Joseph,

I will try it too and pass that along to the students as well.

Much appreciated

Dr. Richard Boulanger

Professor of Electronic Production and Design

Berklee College of Music




On Fri, Jul 31, 2020 at 9:48 AM Joseph Hughes <joehughesmail@gmail.com> wrote:
Hi Richard, This matches the use case you're describing pretty closely. It's not an opcode, it's an instrument that turns a delay effect on and off: https://github.com/riffquantum/static_brothers_see_cound/blob/master/songs/sbDrumKit/instruments/midiRouter/noteInstruments/PadC4.orc

On Fri, Jul 31, 2020 at 7:26 AM Dr. Richard Boulanger <rboulanger@berklee.edu> wrote:
Victor, Jeanette and Thorin,

These are all super inspiring and helpful!

Today is going to be toggle day at Boulanger Labs!

I will get my students to explore and apply these for sure, and any other suggestions and approaches that others might share too.

Super helpful and most appreciated.

-dB



Dr. Richard Boulanger
Professor
Electronic Production and Design
Berklee College of Music

On Jul 31, 2020, at 7:18 AM, thorin kerr <thorin.kerr@gmail.com> wrote:


Would i-rate code do?
I have a counter which could be used as a toggle. This is similar to Jeanette's solution. You need to give it a string, which is used as a state-saving channel.

opcode counterChan, i, Spoo
;;; state saving counter.
;;; usage ival counterChan "id" [, iincrement, imodulo, ilower]
Schan, iincrement, imodulo, ilower  xin
icurrent chnget Schan
if (imodulo != 0) then
   icurrent = wrap(icurrent, ilower, imodulo)
   inewval = wrap((icurrent + iincrement), ilower, imodulo)
else
   inewval = icurrent + iincrement
endif
chnset inewval, Schan
xout icurrent
endop

;;;Example (toggle) usage
ibutton1 counterChan "button1", 1, 2, 0
ibutton2 counterChan "button2", 1, 2, 0
ibutton3 counterChan "button3", 1, 2, 0

Thorin


On Fri, Jul 31, 2020 at 7:44 PM Dr. Richard Boulanger <rboulanger@berklee.edu> wrote:
Does anyone have a toggle UDO that they might be able to share?
Are there examples that you might point me to in Floss or in CsoundQt?

Thanks.

What my students are trying to do is press a single button (on a Bela or Arduino) or play a single MIDI note on a controller keyboard and have it turn on an effect, and then press the same button again and have it turn off the effect.  Or, like in Ableton Live - start playing a sample and then press again to stop playing the sample.

a "toggle"

John and I have worked on a new "counter" opcode that will work in these situations, but it won't be released until 6.15.  

I will be working and searching and sharing later today, but if any of you have one already, or might point me to some solutions - that would be a huge help and head-start.  (In CsoundQt, the button widget has a "latch" mode, which is perfect, but I need this to work in Csound without a widget or front-end)

Thanks

-dB

Dr. Richard Boulanger

Professor of Electronic Production and Design

Berklee College of Music

Professional Writing and Technology Division


skype: radiobaton 

facebook: https://www.facebook.com/richard.boulanger.58

about: http://www.boulangerlabs.com/#about

about: http://www.csounds.com/community/developers/dr-richard-boulanger/

music: http://www.csounds.com/community/developers/dr-richard-boulanger/dr-richard-boulanger-music/

Boulanger Labs - http://boulangerlabs.com

The Csound Book http://mitpress.mit.edu/books/csound-book

The Audio Programming Book - http://mitpress.mit.edu/books/audio-programming-book

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
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

Date2020-07-31 15:55
From"Dr. Richard Boulanger"
SubjectRe: [Csnd] Toggle UDO?
Thanks!

I think that the students (and me too) are looking for both a UDO or a nice MIDI instrument model of this.
- it's all pretty easy in Pd or MaxMSP (and this is the experience that they all bring to Csound)

-dB



On Fri, Jul 31, 2020 at 10:50 AM Joseph Hughes <joehughesmail@gmail.com> wrote:
As a UDO I guess the concept would look like this:

opcode instrumentToggle 0, iooooooo
iInstrumentNumber, iP4, iP5, iP6, iP7, iP8, iP9, iP10 xin

iInstrumentIsActive active iInstrumentNumber
if iInstrumentIsActive > 0 then
turnoff2 iInstrumentNumber, 8, 1
else
event_i "i", iInstrumentNumber, 0, -1, iP4, iP5, iP6, iP7, iP8, iP9, iP10
endif
endop

On Fri, Jul 31, 2020 at 10:46 AM Dr. Richard Boulanger <rboulanger@berklee.edu> wrote:
Thanks, Joseph,

I will try it too and pass that along to the students as well.

Much appreciated

Dr. Richard Boulanger

Professor of Electronic Production and Design

Berklee College of Music




On Fri, Jul 31, 2020 at 9:48 AM Joseph Hughes <joehughesmail@gmail.com> wrote:
Hi Richard, This matches the use case you're describing pretty closely. It's not an opcode, it's an instrument that turns a delay effect on and off: https://github.com/riffquantum/static_brothers_see_cound/blob/master/songs/sbDrumKit/instruments/midiRouter/noteInstruments/PadC4.orc

On Fri, Jul 31, 2020 at 7:26 AM Dr. Richard Boulanger <rboulanger@berklee.edu> wrote:
Victor, Jeanette and Thorin,

These are all super inspiring and helpful!

Today is going to be toggle day at Boulanger Labs!

I will get my students to explore and apply these for sure, and any other suggestions and approaches that others might share too.

Super helpful and most appreciated.

-dB



Dr. Richard Boulanger
Professor
Electronic Production and Design
Berklee College of Music

On Jul 31, 2020, at 7:18 AM, thorin kerr <thorin.kerr@gmail.com> wrote:


Would i-rate code do?
I have a counter which could be used as a toggle. This is similar to Jeanette's solution. You need to give it a string, which is used as a state-saving channel.

opcode counterChan, i, Spoo
;;; state saving counter.
;;; usage ival counterChan "id" [, iincrement, imodulo, ilower]
Schan, iincrement, imodulo, ilower  xin
icurrent chnget Schan
if (imodulo != 0) then
   icurrent = wrap(icurrent, ilower, imodulo)
   inewval = wrap((icurrent + iincrement), ilower, imodulo)
else
   inewval = icurrent + iincrement
endif
chnset inewval, Schan
xout icurrent
endop

;;;Example (toggle) usage
ibutton1 counterChan "button1", 1, 2, 0
ibutton2 counterChan "button2", 1, 2, 0
ibutton3 counterChan "button3", 1, 2, 0

Thorin


On Fri, Jul 31, 2020 at 7:44 PM Dr. Richard Boulanger <rboulanger@berklee.edu> wrote:
Does anyone have a toggle UDO that they might be able to share?
Are there examples that you might point me to in Floss or in CsoundQt?

Thanks.

What my students are trying to do is press a single button (on a Bela or Arduino) or play a single MIDI note on a controller keyboard and have it turn on an effect, and then press the same button again and have it turn off the effect.  Or, like in Ableton Live - start playing a sample and then press again to stop playing the sample.

a "toggle"

John and I have worked on a new "counter" opcode that will work in these situations, but it won't be released until 6.15.  

I will be working and searching and sharing later today, but if any of you have one already, or might point me to some solutions - that would be a huge help and head-start.  (In CsoundQt, the button widget has a "latch" mode, which is perfect, but I need this to work in Csound without a widget or front-end)

Thanks

-dB

Dr. Richard Boulanger

Professor of Electronic Production and Design

Berklee College of Music

Professional Writing and Technology Division


skype: radiobaton 

facebook: https://www.facebook.com/richard.boulanger.58

about: http://www.boulangerlabs.com/#about

about: http://www.csounds.com/community/developers/dr-richard-boulanger/

music: http://www.csounds.com/community/developers/dr-richard-boulanger/dr-richard-boulanger-music/

Boulanger Labs - http://boulangerlabs.com

The Csound Book http://mitpress.mit.edu/books/csound-book

The Audio Programming Book - http://mitpress.mit.edu/books/audio-programming-book

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
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

Date2020-07-31 16:03
FromVictor Lazzarini
SubjectRe: [Csnd] [EXTERNAL] [Csnd] Toggle UDO?
Well it’s even easier in Csound

giSw[] init 127

instr 1
 ikey notnum
 giSw[ikey] = giSw[ikey] == 0 ? 1 : 0
endin


========================
Prof. Victor Lazzarini
Maynooth University
Ireland

> On 31 Jul 2020, at 15:55, Dr. Richard Boulanger  wrote:
> 
> WARNINGThis email originated from outside of Maynooth University's Mail System. Do not reply, click links or open attachments unless you recognise the sender and know the content is safe.
> Thanks!
> 
> I think that the students (and me too) are looking for both a UDO or a nice MIDI instrument model of this.
> - it's all pretty easy in Pd or MaxMSP (and this is the experience that they all bring to Csound)
> 
> -dB
> 
> 
> 
> On Fri, Jul 31, 2020 at 10:50 AM Joseph Hughes  wrote:
> As a UDO I guess the concept would look like this:
> 
> 
> opcode
> instrumentToggle
> 0
> ,
> 
> iooooooo
> 
> i
> InstrumentNumber, iP4, iP5, iP6, iP7, iP8, iP9, iP10
> 
> xin
> 
> 
> 
> i
> InstrumentIsActive
> 
> active
> iInstrumentNumber
> 
> 
> if
> i
> InstrumentIsActive >
> 
> 0
> then
> 
> turnoff2
> i
> InstrumentNumber,
> 
> 8
> ,
> 
> 1
> 
> else
> 
> event_i
> "i"
> ,
> 
> i
> InstrumentNumber,
> 
> 0, -1, iP4, iP5, iP6, iP7, iP8, iP9, iP10
> 
> endif
> 
> endop
> 
> 
> On Fri, Jul 31, 2020 at 10:46 AM Dr. Richard Boulanger  wrote:
> Thanks, Joseph,
> 
> I will try it too and pass that along to the students as well.
> 
> Much appreciated
> 
> Dr. Richard Boulanger
> Professor of Electronic Production and Design
> Berklee College of Music
> 
> 
> 
> On Fri, Jul 31, 2020 at 9:48 AM Joseph Hughes  wrote:
> Hi Richard, This matches the use case you're describing pretty closely. It's not an opcode, it's an instrument that turns a delay effect on and off: https://github.com/riffquantum/static_brothers_see_cound/blob/master/songs/sbDrumKit/instruments/midiRouter/noteInstruments/PadC4.orc
> 
> On Fri, Jul 31, 2020 at 7:26 AM Dr. Richard Boulanger  wrote:
> Victor, Jeanette and Thorin,
> 
> These are all super inspiring and helpful!
> 
> Today is going to be toggle day at Boulanger Labs!
> 
> I will get my students to explore and apply these for sure, and any other suggestions and approaches that others might share too.
> 
> Super helpful and most appreciated.
> 
> -dB
> 
> 
> 
> Dr. Richard Boulanger
> Professor
> Electronic Production and Design
> Berklee College of Music
> 
>> On Jul 31, 2020, at 7:18 AM, thorin kerr  wrote:
>> 
>> 
>> Would i-rate code do?
>> I have a counter which could be used as a toggle. This is similar to Jeanette's solution. You need to give it a string, which is used as a state-saving channel. 
>> 
>> opcode counterChan, i, Spoo
>> ;;; state saving counter.
>> ;;; usage ival counterChan "id" [, iincrement, imodulo, ilower]
>> Schan, iincrement, imodulo, ilower  xin
>> icurrent chnget Schan
>> if (imodulo != 0) then
>>    icurrent = wrap(icurrent, ilower, imodulo)
>>    inewval = wrap((icurrent + iincrement), ilower, imodulo)
>> else
>>    inewval = icurrent + iincrement
>> endif
>> chnset inewval, Schan
>> xout icurrent
>> endop
>> 
>> ;;;Example (toggle) usage
>> ibutton1 counterChan "button1", 1, 2, 0
>> ibutton2 counterChan "button2", 1, 2, 0
>> ibutton3 counterChan "button3", 1, 2, 0
>> 
>> Thorin
>> 
>> 
>> On Fri, Jul 31, 2020 at 7:44 PM Dr. Richard Boulanger  wrote:
>> Does anyone have a toggle UDO that they might be able to share?
>> Are there examples that you might point me to in Floss or in CsoundQt?
>> 
>> Thanks.
>> 
>> What my students are trying to do is press a single button (on a Bela or Arduino) or play a single MIDI note on a controller keyboard and have it turn on an effect, and then press the same button again and have it turn off the effect.  Or, like in Ableton Live - start playing a sample and then press again to stop playing the sample.
>> 
>> a "toggle"
>> 
>> John and I have worked on a new "counter" opcode that will work in these situations, but it won't be released until 6.15.  
>> 
>> I will be working and searching and sharing later today, but if any of you have one already, or might point me to some solutions - that would be a huge help and head-start.  (In CsoundQt, the button widget has a "latch" mode, which is perfect, but I need this to work in Csound without a widget or front-end)
>> 
>> Thanks
>> 
>> -dB
>> Dr. Richard Boulanger
>> Professor of Electronic Production and Design
>> Berklee College of Music
>> Professional Writing and Technology Division
>> 
>> skype: radiobaton 
>> facebook: https://www.facebook.com/richard.boulanger.58
>> about: http://www.boulangerlabs.com/#about
>> about: http://www.csounds.com/community/developers/dr-richard-boulanger/
>> music: http://www.csounds.com/community/developers/dr-richard-boulanger/dr-richard-boulanger-music/
>> Boulanger Labs - http://boulangerlabs.com
>> The Csound Book - http://mitpress.mit.edu/books/csound-book
>> The Audio Programming Book - http://mitpress.mit.edu/books/audio-programming-book
>> 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
> 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

Date2020-07-31 16:55
FromJustin Smith
SubjectRe: [Csnd] [EXTERNAL] [Csnd] Toggle UDO?
as a style concern (clearly the examples so far are correct) I'm fond of:

x = 1 - x

(this breaks if anybody sets x to a value other than 0 or 1, but
ruling that out it has a nice clarity)

On Fri, Jul 31, 2020 at 8:03 AM Victor Lazzarini  wrote:
>
> Well it’s even easier in Csound
>
> giSw[] init 127
>
> instr 1
>  ikey notnum
>  giSw[ikey] = giSw[ikey] == 0 ? 1 : 0
> endin
>
>
> ========================
> Prof. Victor Lazzarini
> Maynooth University
> Ireland
>
> > On 31 Jul 2020, at 15:55, Dr. Richard Boulanger  wrote:
> >
> > WARNINGThis email originated from outside of Maynooth University's Mail System. Do not reply, click links or open attachments unless you recognise the sender and know the content is safe.
> > Thanks!
> >
> > I think that the students (and me too) are looking for both a UDO or a nice MIDI instrument model of this.
> > - it's all pretty easy in Pd or MaxMSP (and this is the experience that they all bring to Csound)
> >
> > -dB
> >
> >
> >
> > On Fri, Jul 31, 2020 at 10:50 AM Joseph Hughes  wrote:
> > As a UDO I guess the concept would look like this:
> >
> >
> > opcode
> > instrumentToggle
> > 0
> > ,
> >
> > iooooooo
> >
> > i
> > InstrumentNumber, iP4, iP5, iP6, iP7, iP8, iP9, iP10
> >
> > xin
> >
> >
> >
> > i
> > InstrumentIsActive
> >
> > active
> > iInstrumentNumber
> >
> >
> > if
> > i
> > InstrumentIsActive >
> >
> > 0
> > then
> >
> > turnoff2
> > i
> > InstrumentNumber,
> >
> > 8
> > ,
> >
> > 1
> >
> > else
> >
> > event_i
> > "i"
> > ,
> >
> > i
> > InstrumentNumber,
> >
> > 0, -1, iP4, iP5, iP6, iP7, iP8, iP9, iP10
> >
> > endif
> >
> > endop
> >
> >
> > On Fri, Jul 31, 2020 at 10:46 AM Dr. Richard Boulanger  wrote:
> > Thanks, Joseph,
> >
> > I will try it too and pass that along to the students as well.
> >
> > Much appreciated
> >
> > Dr. Richard Boulanger
> > Professor of Electronic Production and Design
> > Berklee College of Music
> >
> >
> >
> > On Fri, Jul 31, 2020 at 9:48 AM Joseph Hughes  wrote:
> > Hi Richard, This matches the use case you're describing pretty closely. It's not an opcode, it's an instrument that turns a delay effect on and off: https://github.com/riffquantum/static_brothers_see_cound/blob/master/songs/sbDrumKit/instruments/midiRouter/noteInstruments/PadC4.orc
> >
> > On Fri, Jul 31, 2020 at 7:26 AM Dr. Richard Boulanger  wrote:
> > Victor, Jeanette and Thorin,
> >
> > These are all super inspiring and helpful!
> >
> > Today is going to be toggle day at Boulanger Labs!
> >
> > I will get my students to explore and apply these for sure, and any other suggestions and approaches that others might share too.
> >
> > Super helpful and most appreciated.
> >
> > -dB
> >
> >
> >
> > Dr. Richard Boulanger
> > Professor
> > Electronic Production and Design
> > Berklee College of Music
> >
> >> On Jul 31, 2020, at 7:18 AM, thorin kerr  wrote:
> >>
> >> 
> >> Would i-rate code do?
> >> I have a counter which could be used as a toggle. This is similar to Jeanette's solution. You need to give it a string, which is used as a state-saving channel.
> >>
> >> opcode counterChan, i, Spoo
> >> ;;; state saving counter.
> >> ;;; usage ival counterChan "id" [, iincrement, imodulo, ilower]
> >> Schan, iincrement, imodulo, ilower  xin
> >> icurrent chnget Schan
> >> if (imodulo != 0) then
> >>    icurrent = wrap(icurrent, ilower, imodulo)
> >>    inewval = wrap((icurrent + iincrement), ilower, imodulo)
> >> else
> >>    inewval = icurrent + iincrement
> >> endif
> >> chnset inewval, Schan
> >> xout icurrent
> >> endop
> >>
> >> ;;;Example (toggle) usage
> >> ibutton1 counterChan "button1", 1, 2, 0
> >> ibutton2 counterChan "button2", 1, 2, 0
> >> ibutton3 counterChan "button3", 1, 2, 0
> >>
> >> Thorin
> >>
> >>
> >> On Fri, Jul 31, 2020 at 7:44 PM Dr. Richard Boulanger  wrote:
> >> Does anyone have a toggle UDO that they might be able to share?
> >> Are there examples that you might point me to in Floss or in CsoundQt?
> >>
> >> Thanks.
> >>
> >> What my students are trying to do is press a single button (on a Bela or Arduino) or play a single MIDI note on a controller keyboard and have it turn on an effect, and then press the same button again and have it turn off the effect.  Or, like in Ableton Live - start playing a sample and then press again to stop playing the sample.
> >>
> >> a "toggle"
> >>
> >> John and I have worked on a new "counter" opcode that will work in these situations, but it won't be released until 6.15.
> >>
> >> I will be working and searching and sharing later today, but if any of you have one already, or might point me to some solutions - that would be a huge help and head-start.  (In CsoundQt, the button widget has a "latch" mode, which is perfect, but I need this to work in Csound without a widget or front-end)
> >>
> >> Thanks
> >>
> >> -dB
> >> Dr. Richard Boulanger
> >> Professor of Electronic Production and Design
> >> Berklee College of Music
> >> Professional Writing and Technology Division
> >>
> >> skype: radiobaton
> >> facebook: https://www.facebook.com/richard.boulanger.58
> >> about: http://www.boulangerlabs.com/#about
> >> about: http://www.csounds.com/community/developers/dr-richard-boulanger/
> >> music: http://www.csounds.com/community/developers/dr-richard-boulanger/dr-richard-boulanger-music/
> >> Boulanger Labs - http://boulangerlabs.com
> >> The Csound Book - http://mitpress.mit.edu/books/csound-book
> >> The Audio Programming Book - http://mitpress.mit.edu/books/audio-programming-book
> >> 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
> > 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

Date2020-10-06 00:08
FromKevin Welsh
SubjectRe: [Csnd] [EXTERNAL] [Csnd] Toggle UDO?
Hello everyone!  I needed a toggle in csound/cabbage to have one button or channel that can toggle any number of other channels.  Nothing I saw quite filled my needs, so I wrote these and figured I'd share in case it's useful to anyone else.

There are two versions, both take two arguments and have no outputs.  The first argument is a trigger, and be either a channel name or a k-rate variable.  The second argument is an array of all channels to toggle when triggered.

You can use it like this with a channel name:
  ToggleChans "toggle-mute", fillarray("left-mute","right-mute")

Or like this with a k-rate variable:
  kToggle chnget "toggle-mute"
  ToggleChans kToggle, fillarray("left-mute","right-mute")



; opcode to toggle a list of channels
; one version takes in a channel name to watch for triggers to toggle
; the other version takes in a krate signal to trigger toggle
; both versions take in an array of channel names to toggle when triggered

opcode ToggleChans,0,SS[]
  SToggleChan, SChanList[] xin

  kToggle chnget SToggleChan
  if (changed(kToggle)==1 && kToggle==1) then
    kCount=0
    LoopLbl:
    chnset 1-chnget:k(SChanList[kCount]), SChanList[kCount]
    loop_le kCount, 1, lenarray(SChanList)-1, LoopLbl
  endif
endop

opcode ToggleChans,0,kS[]
  kToggle, SChanList[] xin

  if (changed(kToggle)==1 && kToggle==1) then
    kCount=0
    LoopLbl:
    chnset 1-chnget:k(SChanList[kCount]), SChanList[kCount]
    loop_le kCount, 1, lenarray(SChanList)-1, LoopLbl
  endif
endop


On Fri, Jul 31, 2020 at 11:55 AM Justin Smith <noisesmith@gmail.com> wrote:
as a style concern (clearly the examples so far are correct) I'm fond of:

x = 1 - x

(this breaks if anybody sets x to a value other than 0 or 1, but
ruling that out it has a nice clarity)

On Fri, Jul 31, 2020 at 8:03 AM Victor Lazzarini <Victor.Lazzarini@mu.ie> wrote:
>
> Well it’s even easier in Csound
>
> giSw[] init 127
>
> instr 1
>  ikey notnum
>  giSw[ikey] = giSw[ikey] == 0 ? 1 : 0
> endin
>
>
> ========================
> Prof. Victor Lazzarini
> Maynooth University
> Ireland
>
> > On 31 Jul 2020, at 15:55, Dr. Richard Boulanger <rboulanger@berklee.edu> wrote:
> >
> > WARNINGThis email originated from outside of Maynooth University's Mail System. Do not reply, click links or open attachments unless you recognise the sender and know the content is safe.
> > Thanks!
> >
> > I think that the students (and me too) are looking for both a UDO or a nice MIDI instrument model of this.
> > - it's all pretty easy in Pd or MaxMSP (and this is the experience that they all bring to Csound)
> >
> > -dB
> >
> >
> >
> > On Fri, Jul 31, 2020 at 10:50 AM Joseph Hughes <joehughesmail@gmail.com> wrote:
> > As a UDO I guess the concept would look like this:
> >
> >
> > opcode
> > instrumentToggle
> > 0
> > ,
> >
> > iooooooo
> >
> > i
> > InstrumentNumber, iP4, iP5, iP6, iP7, iP8, iP9, iP10
> >
> > xin
> >
> >
> >
> > i
> > InstrumentIsActive
> >
> > active
> > iInstrumentNumber
> >
> >
> > if
> > i
> > InstrumentIsActive >
> >
> > 0
> > then
> >
> > turnoff2
> > i
> > InstrumentNumber,
> >
> > 8
> > ,
> >
> > 1
> >
> > else
> >
> > event_i
> > "i"
> > ,
> >
> > i
> > InstrumentNumber,
> >
> > 0, -1, iP4, iP5, iP6, iP7, iP8, iP9, iP10
> >
> > endif
> >
> > endop
> >
> >
> > On Fri, Jul 31, 2020 at 10:46 AM Dr. Richard Boulanger <rboulanger@berklee.edu> wrote:
> > Thanks, Joseph,
> >
> > I will try it too and pass that along to the students as well.
> >
> > Much appreciated
> >
> > Dr. Richard Boulanger
> > Professor of Electronic Production and Design
> > Berklee College of Music
> >
> >
> >
> > On Fri, Jul 31, 2020 at 9:48 AM Joseph Hughes <joehughesmail@gmail.com> wrote:
> > Hi Richard, This matches the use case you're describing pretty closely. It's not an opcode, it's an instrument that turns a delay effect on and off: https://github.com/riffquantum/static_brothers_see_cound/blob/master/songs/sbDrumKit/instruments/midiRouter/noteInstruments/PadC4.orc
> >
> > On Fri, Jul 31, 2020 at 7:26 AM Dr. Richard Boulanger <rboulanger@berklee.edu> wrote:
> > Victor, Jeanette and Thorin,
> >
> > These are all super inspiring and helpful!
> >
> > Today is going to be toggle day at Boulanger Labs!
> >
> > I will get my students to explore and apply these for sure, and any other suggestions and approaches that others might share too.
> >
> > Super helpful and most appreciated.
> >
> > -dB
> >
> >
> >
> > Dr. Richard Boulanger
> > Professor
> > Electronic Production and Design
> > Berklee College of Music
> >
> >> On Jul 31, 2020, at 7:18 AM, thorin kerr <thorin.kerr@gmail.com> wrote:
> >>
> >> 
> >> Would i-rate code do?
> >> I have a counter which could be used as a toggle. This is similar to Jeanette's solution. You need to give it a string, which is used as a state-saving channel.
> >>
> >> opcode counterChan, i, Spoo
> >> ;;; state saving counter.
> >> ;;; usage ival counterChan "id" [, iincrement, imodulo, ilower]
> >> Schan, iincrement, imodulo, ilower  xin
> >> icurrent chnget Schan
> >> if (imodulo != 0) then
> >>    icurrent = wrap(icurrent, ilower, imodulo)
> >>    inewval = wrap((icurrent + iincrement), ilower, imodulo)
> >> else
> >>    inewval = icurrent + iincrement
> >> endif
> >> chnset inewval, Schan
> >> xout icurrent
> >> endop
> >>
> >> ;;;Example (toggle) usage
> >> ibutton1 counterChan "button1", 1, 2, 0
> >> ibutton2 counterChan "button2", 1, 2, 0
> >> ibutton3 counterChan "button3", 1, 2, 0
> >>
> >> Thorin
> >>
> >>
> >> On Fri, Jul 31, 2020 at 7:44 PM Dr. Richard Boulanger <rboulanger@berklee.edu> wrote:
> >> Does anyone have a toggle UDO that they might be able to share?
> >> Are there examples that you might point me to in Floss or in CsoundQt?
> >>
> >> Thanks.
> >>
> >> What my students are trying to do is press a single button (on a Bela or Arduino) or play a single MIDI note on a controller keyboard and have it turn on an effect, and then press the same button again and have it turn off the effect.  Or, like in Ableton Live - start playing a sample and then press again to stop playing the sample.
> >>
> >> a "toggle"
> >>
> >> John and I have worked on a new "counter" opcode that will work in these situations, but it won't be released until 6.15.
> >>
> >> I will be working and searching and sharing later today, but if any of you have one already, or might point me to some solutions - that would be a huge help and head-start.  (In CsoundQt, the button widget has a "latch" mode, which is perfect, but I need this to work in Csound without a widget or front-end)
> >>
> >> Thanks
> >>
> >> -dB
> >> Dr. Richard Boulanger
> >> Professor of Electronic Production and Design
> >> Berklee College of Music
> >> Professional Writing and Technology Division
> >>
> >> skype: radiobaton
> >> facebook: https://www.facebook.com/richard.boulanger.58
> >> about: http://www.boulangerlabs.com/#about
> >> about: http://www.csounds.com/community/developers/dr-richard-boulanger/
> >> music: http://www.csounds.com/community/developers/dr-richard-boulanger/dr-richard-boulanger-music/
> >> Boulanger Labs - http://boulangerlabs.com
> >> The Csound Book - http://mitpress.mit.edu/books/csound-book
> >> The Audio Programming Book - http://mitpress.mit.edu/books/audio-programming-book
> >> 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
> > 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

Date2020-10-06 03:47
From"Dr. Richard Boulanger"
SubjectRe: [Csnd] [EXTERNAL] [Csnd] Toggle UDO?
Thanks Kevin - very helpful and very useful.

Dr. Richard Boulanger




On Mon, Oct 5, 2020 at 7:09 PM Kevin Welsh <tgrey1@gmail.com> wrote:
Hello everyone!  I needed a toggle in csound/cabbage to have one button or channel that can toggle any number of other channels.  Nothing I saw quite filled my needs, so I wrote these and figured I'd share in case it's useful to anyone else.

There are two versions, both take two arguments and have no outputs.  The first argument is a trigger, and be either a channel name or a k-rate variable.  The second argument is an array of all channels to toggle when triggered.

You can use it like this with a channel name:
  ToggleChans "toggle-mute", fillarray("left-mute","right-mute")

Or like this with a k-rate variable:
  kToggle chnget "toggle-mute"
  ToggleChans kToggle, fillarray("left-mute","right-mute")



; opcode to toggle a list of channels
; one version takes in a channel name to watch for triggers to toggle
; the other version takes in a krate signal to trigger toggle
; both versions take in an array of channel names to toggle when triggered

opcode ToggleChans,0,SS[]
  SToggleChan, SChanList[] xin

  kToggle chnget SToggleChan
  if (changed(kToggle)==1 && kToggle==1) then
    kCount=0
    LoopLbl:
    chnset 1-chnget:k(SChanList[kCount]), SChanList[kCount]
    loop_le kCount, 1, lenarray(SChanList)-1, LoopLbl
  endif
endop

opcode ToggleChans,0,kS[]
  kToggle, SChanList[] xin

  if (changed(kToggle)==1 && kToggle==1) then
    kCount=0
    LoopLbl:
    chnset 1-chnget:k(SChanList[kCount]), SChanList[kCount]
    loop_le kCount, 1, lenarray(SChanList)-1, LoopLbl
  endif
endop


On Fri, Jul 31, 2020 at 11:55 AM Justin Smith <noisesmith@gmail.com> wrote:
as a style concern (clearly the examples so far are correct) I'm fond of:

x = 1 - x

(this breaks if anybody sets x to a value other than 0 or 1, but
ruling that out it has a nice clarity)

On Fri, Jul 31, 2020 at 8:03 AM Victor Lazzarini <Victor.Lazzarini@mu.ie> wrote:
>
> Well it’s even easier in Csound
>
> giSw[] init 127
>
> instr 1
>  ikey notnum
>  giSw[ikey] = giSw[ikey] == 0 ? 1 : 0
> endin
>
>
> ========================
> Prof. Victor Lazzarini
> Maynooth University
> Ireland
>
> > On 31 Jul 2020, at 15:55, Dr. Richard Boulanger <rboulanger@berklee.edu> wrote:
> >
> > WARNINGThis email originated from outside of Maynooth University's Mail System. Do not reply, click links or open attachments unless you recognise the sender and know the content is safe.
> > Thanks!
> >
> > I think that the students (and me too) are looking for both a UDO or a nice MIDI instrument model of this.
> > - it's all pretty easy in Pd or MaxMSP (and this is the experience that they all bring to Csound)
> >
> > -dB
> >
> >
> >
> > On Fri, Jul 31, 2020 at 10:50 AM Joseph Hughes <joehughesmail@gmail.com> wrote:
> > As a UDO I guess the concept would look like this:
> >
> >
> > opcode
> > instrumentToggle
> > 0
> > ,
> >
> > iooooooo
> >
> > i
> > InstrumentNumber, iP4, iP5, iP6, iP7, iP8, iP9, iP10
> >
> > xin
> >
> >
> >
> > i
> > InstrumentIsActive
> >
> > active
> > iInstrumentNumber
> >
> >
> > if
> > i
> > InstrumentIsActive >
> >
> > 0
> > then
> >
> > turnoff2
> > i
> > InstrumentNumber,
> >
> > 8
> > ,
> >
> > 1
> >
> > else
> >
> > event_i
> > "i"
> > ,
> >
> > i
> > InstrumentNumber,
> >
> > 0, -1, iP4, iP5, iP6, iP7, iP8, iP9, iP10
> >
> > endif
> >
> > endop
> >
> >
> > On Fri, Jul 31, 2020 at 10:46 AM Dr. Richard Boulanger <rboulanger@berklee.edu> wrote:
> > Thanks, Joseph,
> >
> > I will try it too and pass that along to the students as well.
> >
> > Much appreciated
> >
> > Dr. Richard Boulanger
> > Professor of Electronic Production and Design
> > Berklee College of Music
> >
> >
> >
> > On Fri, Jul 31, 2020 at 9:48 AM Joseph Hughes <joehughesmail@gmail.com> wrote:
> > Hi Richard, This matches the use case you're describing pretty closely. It's not an opcode, it's an instrument that turns a delay effect on and off: https://github.com/riffquantum/static_brothers_see_cound/blob/master/songs/sbDrumKit/instruments/midiRouter/noteInstruments/PadC4.orc
> >
> > On Fri, Jul 31, 2020 at 7:26 AM Dr. Richard Boulanger <rboulanger@berklee.edu> wrote:
> > Victor, Jeanette and Thorin,
> >
> > These are all super inspiring and helpful!
> >
> > Today is going to be toggle day at Boulanger Labs!
> >
> > I will get my students to explore and apply these for sure, and any other suggestions and approaches that others might share too.
> >
> > Super helpful and most appreciated.
> >
> > -dB
> >
> >
> >
> > Dr. Richard Boulanger
> > Professor
> > Electronic Production and Design
> > Berklee College of Music
> >
> >> On Jul 31, 2020, at 7:18 AM, thorin kerr <thorin.kerr@gmail.com> wrote:
> >>
> >> 
> >> Would i-rate code do?
> >> I have a counter which could be used as a toggle. This is similar to Jeanette's solution. You need to give it a string, which is used as a state-saving channel.
> >>
> >> opcode counterChan, i, Spoo
> >> ;;; state saving counter.
> >> ;;; usage ival counterChan "id" [, iincrement, imodulo, ilower]
> >> Schan, iincrement, imodulo, ilower  xin
> >> icurrent chnget Schan
> >> if (imodulo != 0) then
> >>    icurrent = wrap(icurrent, ilower, imodulo)
> >>    inewval = wrap((icurrent + iincrement), ilower, imodulo)
> >> else
> >>    inewval = icurrent + iincrement
> >> endif
> >> chnset inewval, Schan
> >> xout icurrent
> >> endop
> >>
> >> ;;;Example (toggle) usage
> >> ibutton1 counterChan "button1", 1, 2, 0
> >> ibutton2 counterChan "button2", 1, 2, 0
> >> ibutton3 counterChan "button3", 1, 2, 0
> >>
> >> Thorin
> >>
> >>
> >> On Fri, Jul 31, 2020 at 7:44 PM Dr. Richard Boulanger <rboulanger@berklee.edu> wrote:
> >> Does anyone have a toggle UDO that they might be able to share?
> >> Are there examples that you might point me to in Floss or in CsoundQt?
> >>
> >> Thanks.
> >>
> >> What my students are trying to do is press a single button (on a Bela or Arduino) or play a single MIDI note on a controller keyboard and have it turn on an effect, and then press the same button again and have it turn off the effect.  Or, like in Ableton Live - start playing a sample and then press again to stop playing the sample.
> >>
> >> a "toggle"
> >>
> >> John and I have worked on a new "counter" opcode that will work in these situations, but it won't be released until 6.15.
> >>
> >> I will be working and searching and sharing later today, but if any of you have one already, or might point me to some solutions - that would be a huge help and head-start.  (In CsoundQt, the button widget has a "latch" mode, which is perfect, but I need this to work in Csound without a widget or front-end)
> >>
> >> Thanks
> >>
> >> -dB
> >> Dr. Richard Boulanger
> >> Professor of Electronic Production and Design
> >> Berklee College of Music
> >> Professional Writing and Technology Division
> >>
> >> skype: radiobaton
> >> facebook: https://www.facebook.com/richard.boulanger.58
> >> about: http://www.boulangerlabs.com/#about
> >> about: http://www.csounds.com/community/developers/dr-richard-boulanger/
> >> music: http://www.csounds.com/community/developers/dr-richard-boulanger/dr-richard-boulanger-music/
> >> Boulanger Labs - http://boulangerlabs.com
> >> The Csound Book - http://mitpress.mit.edu/books/csound-book
> >> The Audio Programming Book - http://mitpress.mit.edu/books/audio-programming-book
> >> 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
> > 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
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