Combining fluid.ampslice~ / fluid.ampgate~

Maybe. I’m reticent about adding too much more stuff to repos without much sense of how shared maintenance is going to pan out in the future, especially given the current focus on trying to ensure that we have as much parity between hosts as possible.

That said, feel free to shine them up and put in a PR.

Something useful on the learn platform – if we can be bothered to collate and flag that its not maintained code but community code – would be to have a “snippets” area where people can peruse community sourced stuff. Keeps it out of the repos but makes it more exposed.

1 Like

That’s a good idea.

Unless I’m gonna get into the core guts of the stuff, it doesn’t make too much sense to try to edit help files or add snippets if it’s not in the correct style, or going to be implemented at all, etc…

Nor should you feel the need to – having workable but dirty patches on this forum is fine. We can tackle discoverability as a separate issue later :slight_smile:

I guess it’s more the latter.

I only half-remember that there is information on here, and can sometimes find the threads/patches, but I’ve been quite close to the project in that regard. Someone coming across it for the first time isn’t going to have that “luxury”.

I imagine this isn’t the code directly out of the native fluid.ampgate~ as it seems like adjusting the lockout time can break the logic of the ifelse loop.


----------begin_max5_patcher----------
2217.3ocuZszbaiiD9r8uBV7vTNaEqB.78lIoxdatrUsm1KimREDInDlvWKI
jr8jJyu8sA.AeHSJSaSGWwxhMdz8W+BcClue8U16Jef0Xa8Os9cqqt56We0U
JRRBW097U14zGhynMpoYGWlmyJD1eTOlf8fPQ+d998YLqblknzZWMi9MKwAl
UV4ddrYxY7BVb4wB0JHsDSKKDozXljFtkFOQsmk69yawdlUWbLmWjwDMCmIP
r7nvPEMXOa3+kZOInMCIWPyUjs+MV1IlfGSM6eEUDefWreaMKVnUIAtDXwVD
r7Sbfbmrb82fr9C4R9w0WK+3iKTykyZZn6YOQy45hQarm.4nIQNYRjazGZRh
GqXZDXaa8GW.e9Zj0BPTfBsjWI.KX2Cx8SvWUMqhUjXAXnIiGyxXE6EGl.v9
u.K8qDuN9Jf5o+iC48.u4MhxFZdUyeOAFeIdyj4vXCeeAMy9iV1oYkTwEgre
PnDjse91Lv.2.IzffSz5tfIf7NV8D308h3E1cdNriRRHTefZEsF1YAqdKqft
Ki875nzx5bpBx9y5Y.5qczh8KQc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
e4H7MwGukXCQilzJ48rDN+t373t.Uq2JnZCVhux6Qb4RhNBeOX7hP73IkySp
J4Eh1je3Hr5EH3peS59ntmV8THKRXCeWxdsXVu5Acx2Z+ymWAqY8amSK5bIx
ZvIxR3jyZvImkvI20fStKgSdqAm7VBm7WCN4uDNErFbJXIbJbM3T3R3TzZvo
nEE49VO3hfWZdb7pWe0hprC87GdoKq9rW5fjqm8xFN6EM7zWxv7ufgye4BpW
rvTuTAYSTW+iq++fyt12.
-----------end_max5_patcher-----------

Judge for yourself. The difference isn’t leaping out at me, but I can see the gen~ version getting stuck

Hmm, looks similar enough to me.

Maybe something to do with the fact that this is taking in a differential vs having an absolute threshold as the input in fluid.ampgate~ so maybe there’s a signal that can jump out of the logic somewhere?

Ok, I don’t see how this is the case from looking at the code, but I think if the minslicetime is adjusted while state = 1, then it breaks the logic.

I tested this by setting the values to extremes when playback is paused (or specifically timing it between hits).

The native fluid.ampgate~ version never seems to break in the same way (from my tests) so I guess there’s code above what you posted that takes care of that?

Lol, found it. It’s because you’re passing a float into as minslicelength and the code assumes it’s an integer. When it’s a float, debounce will go below zero in the decrement loop, and the condition to change state (debounce == 0) will never be true.

So you could either change that condition to debounce <= 0, or make sure that debounce is an integer by debounce = int(minslicelength);

I love that you thought I was holding out on you though :kissing_cat:

1 Like

Hah, that makes sense.

I know you guys are super busy over there so didn’t want to presume anything.

Here’s an updated version of the example patch from above for posterity (I’ll also edit the meme-post version of it too).


----------begin_max5_patcher----------
1894.3ocuYszbaaCD9r7uBN7PGmN1Z..e2zjI8VuzY5odotiGJRHIzPAxRB4
GMS5u8t.ffDTlTg1lNdhkL2E.6qu8AX9xEqb2T9.sw04mb9SmUq9xEqVoHII
rp84UtGReHqHsQsL2B1cz0MYkUz+y8JMeVthS4l+9ZBxPje7.iWPEpcQ5IVd
TXnhaopIIdrhpUD2Mo7ctN+UK6pTQ1dFe2s0zLgdE9jn0nqbBQpu7P9xuvXu
0ntcUCmQ64gTbk7jr95EWH+3pmi8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ukPRdyQR9Kg
j7mijBVBIELGIEtDRJbNRJZIjTzbjT7RHo34HojkPRIyJy8014hfmacb7h26
ZVcMQuUCFLq5UeCIqmI6jWasTnm75pO4UU+zWS8zuh5Se8zpWM8XuVZ4D3W7
0K9e.3LCj1C
-----------end_max5_patcher-----------

In my second (of likely more than a few of) reasking the same or similar questions about pd implementations, is it possible to do this kind of per-sample logic/debouncing in pd without gen~?

History state(0); 
History debounce(0); 
History prevValue(0); 

Param onthreshold(10); 
Param offthreshold(5); 
Param minslicelength(4410); 

if(state == 0 && in > onthreshold && prevValue < onthreshold && debounce == 0) 
{
  out1 = 1;   
  debounce = int(minslicelength); 	
  state = 1; 
} 
else 
{
	if(debounce > 0) debounce = debounce - 1; 
}
if(state == 1 && in1 < offthreshold) 
{
	state = 0; 
}
prevValue = in1; 
out2 = state; 

I can make sense of doing some of this logic with vanilla objects but setting/incrementing conditional counters is not something I’ve done with msp~-esque objects.

yes. I am (unsuccessfully) offline but I can help next week. for now, check the uber-powerful expr~ - I cannot remember which of my many helpfiles have something doing exactly that or even if that survived the latest edit, but hey, you can do a counter in expr~ and a comparison.

1 Like

The JIT-NMF example has the circular buffer recording with (very confusingly syntax’d!) fexpr~, so a sample counter makes sense, it just breaks down in how to fire/start/stop logic at audio rate (in pd). I’ll have a further poke today.

Also, turns out that threshold~ would be perfect on its own, as it has built-in time hysteresis, but it outputs message rate, which makes it useless for this purpose.

1 Like

For the time being I’m doing this, and it’s working pretty well:

Not ideal, but the ADSR~ I have further downstream is triggered via message rate anyways, so just driving it with a parallel fluid.ampfeature~.