Analyze CHOP - make Index of Highest Peak persistent

Hi. I have something fairly simple, but which I just can’t get my head around in TD (still fairly new to it, having come from Max/MSP).

I have built a video switcher which uses switch TOP to show the video with the loudest audio.

The logic for this is using audio->analyse CHOP->Merge CHOP->Shuffle CHOP, then index of highest peak.

This works fine, but it shows the values per time slice. What I’d now like to do is to show the video with a transient over the most recent threshold. I almost have this working, but I’d essentially want to make my last analyze chop hold onto the last peak index. What is currently happens is a get a transient in, it shows the correct index, but then reverts to its ‘no peak value’.

To put another way, I’d like it to output the index of highest peak until it receives a new peak. I was thinking one way of doing this is to set ‘no peak value’ to a negative number, and then ignore any negative number it outputs. Is there a way to do this? I’ve looked at limit chop and math chop, and they only seem able to turn a negative into a positive, as opposed to totally ignoring the negative.

If anyone has suggestions would be much appreciated. Apologies if my question is asked in a cumbersome way! Thanks!

Have a look at the Hold CHOP.
You can specify under what conditions it retains its incoming value.
Cheers,
Rob.

Hi. Thanks for your reply. I’ve had a look at HOLD, and there may be ways I can modify what I’m doing to work with that, but I’m not sure. It’s super useful to know about though, and really powerful!

To rephrase and make my question more legible:
If I have a sequence of numbers which goes 1 2 5 6 -1 7 9 -1, is there a way I can completely ignore the -1?

Thanks!

If I have a sequence of numbers which goes 1 2 5 6 -1 7 9 -1, is there a way I can completely ignore the -1?

several ways , depending on what you mean with “ignore”.
Here is an example showing the difference between using a Limit CHOP to clamp all values within a certain range, or using a Delete CHOP to remove samples which are lower than a certain value

ignore_lower_values.tox (7.7 KB)

And here’s another implementation using a Hold CHOP to hang onto the last positive values,
ignoring negative spans:

hold_positive_values.tox (830 Bytes)

Cheers

Thanks! Both of those completely sorted it.