Detect a transient without setting a threshold
-
- KVRist
- Topic Starter
- 65 posts since 1 Apr, 2016
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.
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.
-
- KVRist
- 81 posts since 24 Oct, 2000 from Bremen, Germany
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)
- KVRist
- 77 posts since 8 Nov, 2020
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.
- KVRian
- 872 posts since 6 Aug, 2005 from England
Aren’t transients based on rate of change, rather than have a gain threshold?
Dave Hoskins. http://www.quikquak.com
- u-he
- 28065 posts since 8 Aug, 2002 from Berlin
+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.
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.
- KVRist
- 77 posts since 8 Nov, 2020
This is a good point, thanks.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.
- KVRAF
- 7891 posts since 12 Feb, 2006 from Helsinki, Finland
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.
- KVRAF
- 2239 posts since 25 Sep, 2014 from Specific Northwest
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?
- u-he
- 28065 posts since 8 Aug, 2002 from Berlin
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.
- KVRAF
- 7891 posts since 12 Feb, 2006 from Helsinki, Finland
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.
- u-he
- 28065 posts since 8 Aug, 2002 from Berlin
- KVRAF
- 7891 posts since 12 Feb, 2006 from Helsinki, Finland
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.
- KVRAF
- 2239 posts since 25 Sep, 2014 from Specific Northwest
Quite a strange semantic distinction. Aren't envelope followers still just signal level vs time?Urs wrote: ↑Wed Nov 17, 2021 9:13 amThe "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.
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?
- KVRAF
- 7891 posts since 12 Feb, 2006 from Helsinki, Finland
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.syntonica wrote: ↑Wed Nov 17, 2021 11:21 pmQuite a strange semantic distinction. Aren't envelope followers still just signal level vs time?Urs wrote: ↑Wed Nov 17, 2021 9:13 amThe "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.