Detect a transient without setting a threshold

DSP, Plug-in and Host development discussion.
User avatar
Richard_Synapse
KVRian
1097 posts since 20 Dec, 2010

Post Thu Nov 18, 2021 2:30 am

quikquak wrote:
Tue Nov 16, 2021 5:40 am
Aren’t transients based on rate of change, rather than have a gain threshold?
I think it is even more complex than that, if we are talking about transients in the psycho-acoustic sense, like what is perceived as transients. For more practical purposes, I'd use something like Urs suggested :)

Richard
Synapse Audio Software - www.synapse-audio.com

User avatar
quikquak
KVRian
792 posts since 6 Aug, 2005 from England

Post Thu Nov 18, 2021 8:15 am

Richard_Synapse wrote:
Thu Nov 18, 2021 2:30 am
quikquak wrote:
Tue Nov 16, 2021 5:40 am
Aren’t transients based on rate of change, rather than have a gain threshold?
I think it is even more complex than that, if we are talking about transients in the psycho-acoustic sense, like what is perceived as transients. For more practical purposes, I'd use something like Urs suggested :)

Richard
Yeah, detecting imperceptible spectral micro-transients probably won't really help here.
User expectations, and standard practices are also important. :hihi:

camsr
KVRAF
7125 posts since 17 Feb, 2005

Post Thu Nov 18, 2021 5:28 pm

quikquak wrote:
Thu Nov 18, 2021 8:15 am
Richard_Synapse wrote:
Thu Nov 18, 2021 2:30 am
quikquak wrote:
Tue Nov 16, 2021 5:40 am
Aren’t transients based on rate of change, rather than have a gain threshold?
I think it is even more complex than that, if we are talking about transients in the psycho-acoustic sense, like what is perceived as transients. For more practical purposes, I'd use something like Urs suggested :)

Richard
Yeah, detecting imperceptible spectral micro-transients probably won't really help here.
User expectations, and standard practices are also important. :hihi:
It will matter when it's a large portion of the signal's gain. Just trying to throw out an example, a sine wave with a discontinuity could be considered a transient, even if the gain of the sine wave signal is steady. Also it's place in a mix, could make it more or less pronounced, if it's relatively stronger than other signals.

This thread may help to understand what I mean by discontinuity: viewtopic.php?f=33&t=400381

User avatar
quikquak
KVRian
792 posts since 6 Aug, 2005 from England

Post Fri Nov 19, 2021 7:57 am

The frequency analysis of a single sine wave with an instant phase change will probably register it as a broad spectrum impulse in an FFT just to create the shape? In a mix it will probably be involved with quite a lot of temporal and frequency masking, which makes the whole thing a tad complex to analyse musically.

User avatar
SNFK
KVRist
42 posts since 8 Nov, 2020

Post Tue Nov 23, 2021 2:00 pm

I went back to this topic today and came up with this algorithm:

Code: Select all

class TransientDetector {
public:
  TransientDetector() {
    fast.SetAttackInSamples(0);
    fast.SetReleaseInSamples(200);
    slow.SetAttackInSamples(1200);
    slow.SetReleaseInSamples(500);
    master.SetAttackInSamples(100);
    master.SetReleaseInSamples(5000);
  }

  float Tick(float input) {
    float masterVal = master.Tick(input);
    float slowVal = slow.Tick(input);
    float fastVal = fast.Tick(input);
    float mix = Clip((fastVal - slowVal) / masterVal, 0.f, 1.f);
    return input - input * mix;
  }

private:
  //GainFollowerMoving can be any envelope follower
  GainFollowerMoving fast;
  GainFollowerMoving slow;
  GainFollowerMoving master;
};
The code is pretty much what Urs said, but I added a master envelope follower to determine the overall level of the audio in relation to the transients. This example removes the transients from the input, but you can solo them by doing input * mix only.

User avatar
kingozrecords
KVRian
1030 posts since 7 Apr, 2019 from Canada

Post Wed Dec 01, 2021 5:09 pm

You can merely have a set db change that goes nowhere but to a comparison, like division from that to the original after an absolute value is established. Pretty simple.
DSPplug Products https://www.kvraudio.com/marketplace/dspplug
DSPplug Linktree https://linktr.ee/dspplug
Voiceover, Design, Ghost Production, Ghost Writing services.

Return to “DSP and Plug-in Development”