Create a bang when signal reaches a threshold ?

Learn about building and using Max for Live devices.
Post Reply
chapelier fou
Posts: 6048
Joined: Mon May 15, 2006 12:15 pm

Create a bang when signal reaches a threshold ?

Post by chapelier fou » Mon Jul 01, 2013 9:18 pm

What's the best way to do it ? im confused with thres~, average~, etc. Using meter~ is probably not the best method.
My goal is to replace a shitty live kick drum by a sample. i want the original kick drum to send a midi note instead.
Thanks !
MacBook Pro 13" Retina i7 2.8 GHz OS 10.13, L10.0.1, M4L.
MacStudio M1Max 32Go OS 12.3.1

chapelier fou
Posts: 6048
Joined: Mon May 15, 2006 12:15 pm

Re: Create a bang when signal reaches a threshold ?

Post by chapelier fou » Mon Jul 01, 2013 9:24 pm

just found this topic, seems to be close to what im looking for
http://cycling74.com/forums/topic/how-t ... n-max-msp/
MacBook Pro 13" Retina i7 2.8 GHz OS 10.13, L10.0.1, M4L.
MacStudio M1Max 32Go OS 12.3.1

chapelier fou
Posts: 6048
Joined: Mon May 15, 2006 12:15 pm

Re: Create a bang when signal reaches a threshold ?

Post by chapelier fou » Mon Jul 01, 2013 9:30 pm

so, when using this, any idea on how to 'filter' bangs so it doesn't produce any bang if the last bang happened let's say less than 100 ms ago ?
(this is a pure max question, i know...)

<pre><code>
----------begin_max5_patcher----------
375.3ocyTFsaBBCEF95xSQSu1YnfUkc2dNVLKEnBcAZIzZlaF2y9ZKvFtnDl
5b6FZ5+4PO+mONkcd.TrbKSgf2CeDB.67..mjU.ztGfJoaSJnJWZHA6EY7yn
IMgzrsZmbUMWn6TWKEZE+MlMBNXpeqbEUmjyEYOUyRzM0L.uvDFFrLztDNys
wepObU66vScGuoj2Mu63EaJ4hBl1YHbuZJnktZhdnlSK5ktbitKeeq3dOO6i
IWVOyRyXu2o1TB8qUrlNCESEYnIsqe1O+bzPbPY1fngbUPSvYfl0ERygbRHX
BS0WBEB8I1FGShrKD+gn.N5OCCmXBgFqN8.hhmILd3bFMHK6AkvECBkqy0F7
0CJ57ZlJ+2jKQX2vBdPtb76LgW.WbkAUvEe+OpNqZ0ODVJ4l5jttt8ZL7Kyl
xTZtfp4RQublePN47zTlKbGVJ4oURy+has.b0Q+vMVGgGikH2VKMeDVBei8T
zX8D9enmBNSOY1r26Cvm3e9R
-----------end_max5_patcher-----------
</code></pre>
MacBook Pro 13" Retina i7 2.8 GHz OS 10.13, L10.0.1, M4L.
MacStudio M1Max 32Go OS 12.3.1

Machinate
Posts: 11648
Joined: Thu Jun 24, 2004 2:15 pm
Location: Denmark

Re: Create a bang when signal reaches a threshold ?

Post by Machinate » Tue Jul 02, 2013 12:02 am

you're looking for "hysteresis", a common audio gate concept. average~ -> thresh~ -> edge~ normally works just fine, to be honest.

Your problem in that patch is that you're setting both thresh~  thresholds to be the same value... don't do that ;)

You'll find that if you play with the difference there you'll get the hysteresis effect. The new Gate device in Live9 does this in a very effective way, you might be able to pick up some ideas there.
mbp 2.66, osx 10.6.8, 8GB ram.

chapelier fou
Posts: 6048
Joined: Mon May 15, 2006 12:15 pm

Re: Create a bang when signal reaches a threshold ?

Post by chapelier fou » Tue Jul 02, 2013 7:16 am

Thanks. But i can't avoid the fact that i got a whole flow of bangs...
MacBook Pro 13" Retina i7 2.8 GHz OS 10.13, L10.0.1, M4L.
MacStudio M1Max 32Go OS 12.3.1

broc
Posts: 1151
Joined: Mon Jul 26, 2004 8:37 am

Re: Create a bang when signal reaches a threshold ?

Post by broc » Tue Jul 02, 2013 8:36 am

Look at the 'onebang' object.

<pre><code>
----------begin_max5_patcher----------
395.3ocyTssSCCCC84zuhn7bYJtc8B7F7afPnz1vHn1jo0Twfo8uSSRKih15
pXWDujHebrywm33MdHRlZMulfuC+HFg13gPVHC.pyFQpXqyKY01iQj72UYuQ
7ctz70ZKbAuDCTJs2groRHK4ZaPAcfunjZIqhai39UBVI9AUYwOhQ0n6CB5P
Wxz4uJjKddEOW6XJDlLi5igzHyVD0YLihepKFQg8JZI5Mo8Y2kZ8GK4tjPxX
xEjuCwvsZwmVmPaFMna87LK9mlznwY3r8pKveQWBFQWBBsRQjUWBClEcXcIY
bcw+BnOYMZsRNpRL8V.WoFDDa2n8q6qTiOVKv+iZII83kR3EnTNPaqRxM4DC
muuzSn008dFCi8kFNest1yPJExeODzRQC9PgqV0rJu+15dPv6HYAuVKjLsns
0X2YfAm4UQQA25l1gTIJVpDRcGENvi3TYDLAFkbUYT5D0HX5LBlGaFtE.ttl
acSAFXAfaKYtcLnw5DqijAbb+0Q5UUYSlfxFeBLp0Xq2W3KEbeK
-----------end_max5_patcher-----------
</code></pre>

chapelier fou
Posts: 6048
Joined: Mon May 15, 2006 12:15 pm

Re: Create a bang when signal reaches a threshold ?

Post by chapelier fou » Tue Jul 02, 2013 9:03 am

Thanks broc ! Coincidentally this just appeared to me as i was walking in the street.
MacBook Pro 13" Retina i7 2.8 GHz OS 10.13, L10.0.1, M4L.
MacStudio M1Max 32Go OS 12.3.1

Machinate
Posts: 11648
Joined: Thu Jun 24, 2004 2:15 pm
Location: Denmark

Re: Create a bang when signal reaches a threshold ?

Post by Machinate » Tue Jul 02, 2013 11:22 pm

This is what I'd use:

<pre><code>
----------begin_max5_patcher----------
632.3ocyVsraiBCEcM7Uf7ZFD17LUpKluiQiFY.mfqH1HioSlV07sOXyyFkG
zTRZ2XiMW664b70G4WMM.I7cjJf0CV+xxv3USCC8TpIL5Fa.1h2kVfqzgApR
4kj8.61eUhko4T1l+HHox1sA5463Zag7iUcqVoZi7bBr9c2ZRwEoo7ZlN9P+
tYoY5smm7zOh628j50UzWHuKNV8VJqfH0nAMNIuV1OqqZx2LMUM1KLsfgtNn
fqiWgei4UDz4JYUvW.qXj+1j59DKI6znCHvrr8VAtmgtHeMEaKNCzsHWG2A5
1BL4+JIswCpnaX3BvP.SXtWedVyYRFdqdIfeJnMwO4O8hBD0jsiHKviJKvkS
Vj4BRU99KqJPOntK.9ozEzxnKdKltPdICmNxeAWxULY.Z4jhx0zBxPkLWjQD
5r4DEbZYyGENQ1786aOlnDMr4aR4EbQ2sO85m1Lr1BdpReGqOZQ0jE65D3BW
EBsO5WS2qaz0vjZojytr4hmWj95lWe6oKqRvrMGunZvm49d4gjsgLiqNdtwJ
CzVeED7hTz9bTM7CdAx6iXrfVNs4wG22TlcYwAorRlm3bNak3kQVP25Rlz7l
S14Tz.iBTcgteJcwy8VVtLUWzYGTPYG9jQMEUy+dwphWKR6YPOTsFYYFoRRY
XIswDYLH047jfxoYYD8+6Q8VZVImxjcf.Enu5gbC0cSFMlHZENofjcZit4xf
C.2IXP3EXvcFOw2O3LCzbPQvWMbtemUdyoz4aEZBtemTgyQbtV7zZbgKKelH
p51SMTZ7yep84Tg15gTV6PsYHPPdl1Gu94n.rnwKW1XjWKZsY2EGBLU44My+
CfmW7sO
-----------end_max5_patcher-----------
</code></pre>
mbp 2.66, osx 10.6.8, 8GB ram.

chapelier fou
Posts: 6048
Joined: Mon May 15, 2006 12:15 pm

Re: Create a bang when signal reaches a threshold ?

Post by chapelier fou » Tue Jul 02, 2013 11:52 pm

Thank you ! i am pretty happy with this :

<pre><code>
----------begin_max5_patcher----------
523.3ocwVssaiBCD8Y3qvxOmsBCw.YeqeGUUqb.2DWQri.G0zV07su1CWZ1c
SnN.K8ECy3w1myYlwv69d30pi7JL5mnGPddu664AtrN7Zr8v6XGyJXUPXXI+
E05mwKpmRyOpA247BDIHn0u5ftfq0utmWu230L4FL5wlo2yzYaExM+pjmoqi
HY4cAKPjjP6CZfcLzL1sjmTRsjsC1O78kBVQ6YIxAeFT8izVexC6DRCB.LGd
1VTIdC1Bh8b5hsFtPvDqyO78sCKFmlnjbKsQj9UkENnNqNSbhSFl3jLdwIb.
hySEJylbUIvLMS6jFPBn.8SGSER3EEAx+aQf+FKO6zUEgJwFoEtcu0qNPrTG
JBVRaG6VvYbkzKWGOotRY+9RgTi6KOBoNBzvGsbX4w3wmGClNJyy2vOMUc4Q
0I0AJLzumB7IqKmlL9lbxpuGQ3JUGr0UeYqe+W78ojDMvK+ISPCyD9oQ81Rd
01SHCOBMCIiWdVU27PFXaC4x8MQCUefSGWHj+8eWADv5+OEsJ0gxrVR27gJz
mbHmWoERlVnjmEiEznvtf1Jxy4v7s3amHeuxbabCFPOdwLnqPx1V4FlHyGlh
cESAyGlnNfoYFRtnRwyJjRc.RI2VsTZzcTyBnvUAzk+qQb8OPG2YLRNj3.GR
uMUkjBfaEbOeCgrFy.Rm27O0w7+PQjw3C+eCxneZuA
-----------end_max5_patcher-----------
</code></pre>
MacBook Pro 13" Retina i7 2.8 GHz OS 10.13, L10.0.1, M4L.
MacStudio M1Max 32Go OS 12.3.1

Machinate
Posts: 11648
Joined: Thu Jun 24, 2004 2:15 pm
Location: Denmark

Re: Create a bang when signal reaches a threshold ?

Post by Machinate » Wed Jul 03, 2013 12:24 am

yeah, but that effectively removes your hysteresis and replaces it with "no more than 10 a second", to some extent, hehe. YMMV, of course, and if it works in the application, then that's all that matters :)

Have a good patching wednesday, chapelier fou! :)

I really ought to do more work tomorrow. Keeping my fingers crossed for some motivation.
mbp 2.66, osx 10.6.8, 8GB ram.

Post Reply