Detect a transient without setting a threshold

DSP, Plugin and Host development discussion.
RELATED
PRODUCTS

Post

Is it possible to detect a transient without depending on an amplitude threshold?
I want to extract all transients from an audio regardless of having set a threshold to experiment with saturations, I don't know if it's the right way to deal with this, but I'd like to try.

Thanks.

Post

The simple way to do this is with a fast-attack envelope follower and a slow-attack envelope follower, and set a threshold for "fast divided by slow" (or "fast minus slow" if they are in dB). But you might need to do more than that to avoid false triggers (e.g. emphasize high frequencies or measure multiple frequency bands)

Post

Why would you want to eliminate the threshold parameter? You can have a built in constant using the method mda described, but having a editable parameter for the threshold ensures the user will get the best results.

Post

Aren’t transients based on rate of change, rather than have a gain threshold?

Post

+1 for threshold not necessary. What Paul says.

If I'm not mistaken, it roughly works like this:

if( (fastEnv(x)->toDB() - slowEnv(x)->toDB() ) > 12 ) printf("Transient Detected!\n");

... where 12 dB is an arbitrary hysteresis that may or may not work for you and which may depend on the actual attack/release times used.

Post

Urs wrote: Tue Nov 16, 2021 1:51 pm +1 for threshold not necessary. What Paul says.

If I'm not mistaken, it roughly works like this:

if( (fastEnv(x)->toDB() - slowEnv(x)->toDB() ) > 12 ) printf("Transient Detected!\n");

... where 12 dB is an arbitrary hysteresis that may or may not work for you and which may depend on the actual attack/release times used.
This is a good point, thanks.

Post

mda, what you say makes sense. Thanks guys!

Post

Urs wrote: Tue Nov 16, 2021 1:51 pm If I'm not mistaken, it roughly works like this:

if( (fastEnv(x)->toDB() - slowEnv(x)->toDB() ) > 12 ) printf("Transient Detected!\n");
Yeah, that's the basic idea. If you want isolated events, then set a flag when you detect a transient and then clear it once fastEnv falls below slowEnv (or at least gets within some lower threshold) and don't redetect the same transient if the flag is already set.

Post

Urs wrote: Tue Nov 16, 2021 1:51 pm if( (fastEnv(x)->toDB() - slowEnv(x)->toDB() ) > 12 ) printf("Transient Detected!\n");

... where 12 dB is an arbitrary hysteresis that may or may not work for you and which may depend on the actual attack/release times used.
A threshold by any other name is still a limit to a comparison.

I don't think it's possible to determine a transient without some sort of comparison operation with some arbitrary threshold. Our brains even compare the relative silence to the sudden sound of a kick drum.
I started on Logic 5 with a PowerBook G4 550Mhz. I now have a MacBook Air M1 and it's ~165x faster! So, why is my music not proportionally better? :(

Post

syntonica wrote: Wed Nov 17, 2021 8:26 am A threshold by any other name is still a limit to a comparison.
The "threshold" in my example is independent of input level. It detects transients on very silent material just the same as it detects them on very loud events.

The meaning of "threshold" in context of dynamics processing commonly relates to the signal level of the side chain signal. Which isn't the case in my example of hysteresis.

Post

Urs wrote: Wed Nov 17, 2021 9:13 am The meaning of "threshold" in context of dynamics processing commonly relates to the signal level of the side chain signal. Which isn't the case in my example of hysteresis.
On threshold does NOT give you hysteresis. Hysteresis is the reluctance of a process to change it's state (whether continuous or discrete). With one threshold, if your input happens to be degenerate in such a way that the difference between two envelopes hovers near the threshold, you can get an erratic signal when some samples are over and other samples are under the threshold (with sensible envelope detectors and "normal" signals, this is unlikely to go on for long periods of time, but point is you can get some noise when you're crossing the threshold). You can theoretically try to "debounce" this (eg. what you would do with mechanical buttons that only have one detection threshold), but you can also solve it easier with actual hysteresis.

For actual hysteresis, in the binary detection case, you want to use two thresholds, such that the difference needs to go over the higher threshold for a transient to start and then fall below the lower threshold for a transient to end. The "hysteresis" then is the difference between the two thresholds. How you set the actual thresholds depends on the timing constants of the two envelopes and how sensitive you want to be, but you'll probably want two thresholds (=hysteresis) if you want a binary output.

Post

Yep, one would use slowEnv > fastEnv to mark “ready for next Transient”.

Post

Urs wrote: Wed Nov 17, 2021 7:35 pm Yep, one would use slowEnv > fastEnv to mark “ready for next Transient”.
Right, this effectively sets the lower threshold to zero, although you can also use a non-zero value as long as there is sufficient margin between the two thresholds to filter out noise.

Post

Urs wrote: Wed Nov 17, 2021 9:13 am
syntonica wrote: Wed Nov 17, 2021 8:26 am A threshold by any other name is still a limit to a comparison.
The "threshold" in my example is independent of input level. It detects transients on very silent material just the same as it detects them on very loud events.

The meaning of "threshold" in context of dynamics processing commonly relates to the signal level of the side chain signal. Which isn't the case in my example of hysteresis.
Quite a strange semantic distinction. Aren't envelope followers still just signal level vs time?

Regardless, this is a very interesting discussion.
I started on Logic 5 with a PowerBook G4 550Mhz. I now have a MacBook Air M1 and it's ~165x faster! So, why is my music not proportionally better? :(

Post

syntonica wrote: Wed Nov 17, 2021 11:21 pm
Urs wrote: Wed Nov 17, 2021 9:13 am
syntonica wrote: Wed Nov 17, 2021 8:26 am A threshold by any other name is still a limit to a comparison.
The "threshold" in my example is independent of input level. It detects transients on very silent material just the same as it detects them on very loud events.

The meaning of "threshold" in context of dynamics processing commonly relates to the signal level of the side chain signal. Which isn't the case in my example of hysteresis.
Quite a strange semantic distinction. Aren't envelope followers still just signal level vs time?
The key is that when you have two envelope followers with different time-constants, then in steady-state they will theoretically give you the same reading, but the fast one will react to changes in signal level faster than the slow one. So by taking the difference (in decibels) you can estimate how fast the signal level is increasing or decreasing. When you then set a threshold level on this difference (to detect a transient) you're not really setting a level-threshold, but a sensitivity-threshold that controls how fast the signal needs to increase (ie. how much the fast envelope needs to lead the slow one) for a transient to be detected. Sure, it's a threshold, but it's not about absolute signal levels at all, just the rate of change.

Post Reply

Return to “DSP and Plugin Development”