Login / Register  0 items | $0.00 NewWhat is KVR? Submit News Advertise
mystran
KVRAF
 
4579 posts since 11 Feb, 2006, from Helsinki, Finland

Postby mystran; Tue Sep 26, 2017 10:58 pm Re: What is wrong with this code?

JCJR wrote:Along the same lines, your plugin during dev/debug doesn't have to output audio. You could process the dual-mono file as above, with no change to the left channel, but print the envelope output to the right channel rather than audio, and look at the results in an audio editor.


I generally prefer to just make the plugin either ignore the other input channel or simply sum to mono internally. This makes it easier to just feed "anything random" to the plugin, since often times it's quite convenient to debug "live" in a host (with a spectrum analyser and/or scope behind it.. plus Edison if I need to record something to inspect the waveform on sample-to-sample level), feeding it audio from a synth or something, trying to find a "worst case" signal to make problems more obvious etc.

Other tip is to add another parameter that lets you switch the second channel (or even two parameters, one for each channel) between various debug signals... and in general add various debug parameters to change things around internally, since it's much faster to turn around a knob (or slider, whatever) then change source-code constants and recompile. :)
Image <- plugins | forum
tunca
KVRist
 
376 posts since 26 Mar, 2015

Postby tunca; Wed Sep 27, 2017 12:50 pm Re: What is wrong with this code?

I tried everything but no luck...

Compressor working when i use seekgain.But can't control attack and release.Cause no envelope processing on seekgain.It's working like 0 ms attack and 0 ms release.As peak limiter...

How to impelement envelope?
http://analogobsession.com/ VST,AU for WIN & MAC
stratum
KVRian
 
1285 posts since 29 May, 2012

Postby stratum; Wed Sep 27, 2017 11:02 pm Re: What is wrong with this code?

Implementation of envelope detection is a separate issue, controlling the gain is another issue, and seems like you aren't thinking about them in isolation from each other.

Use a lowpass filter with the desired gain variable as input and when the estimated signal level is below the desired level use LP filter coefficient for attack and otherwise use coefficient for release. Have a look at a textbook (dspguide.com?) for a 1-pole lowpass filter for that. Set the cutoff frequencies (for attack and release) of the filter to match whatever typically used as convention to specify attack & release time constants.

p.s. that filter should probably be operating on dB values instead of linear gain.
~stratum~
camsr
KVRAF
 
6687 posts since 16 Feb, 2005

Postby camsr; Thu Sep 28, 2017 12:33 am Re: What is wrong with this code?

stratum wrote:p.s. that filter should probably be operating on dB values instead of linear gain.


Why?
Image
stratum
KVRian
 
1285 posts since 29 May, 2012

Postby stratum; Thu Sep 28, 2017 12:49 am Re: What is wrong with this code?

p.s. that filter should probably be operating on dB values instead of linear gain.


Volume controls work on log-scale because that's the way the human ear perceives volume. Just a guess by analogy, I don't really know, and would try both.
~stratum~
mystran
KVRAF
 
4579 posts since 11 Feb, 2006, from Helsinki, Finland

Postby mystran; Thu Sep 28, 2017 1:02 am Re: What is wrong with this code?

camsr wrote:
stratum wrote:p.s. that filter should probably be operating on dB values instead of linear gain.


Why?


It tends to make the perceived gain changes more consistent, especially when gain riding, which in turn tends to make the compression somewhat less obvious and more natural sounding.

Basically, if you draw a straight line between two linear gain values, then in terms of decibels the slope is much steeper for low gain values. While you usually don't use straight lines as such, this still means that the perceptible attack/release slopes become faster and faster as the compressor pushes deeper into compression and since natural (input) audio rarely has very consistent "peak" levels, doing the envelopes in linear domain tends to give you a compressor that can react quite differently to audibly similar peaks, which tends to draw attention to the compressor and sound quite erratic and unnatural.

It's a little hard to describe really, but if you try it both ways on something fairly dynamic (eg. acoustic drum loops are often nice for testing) it's pretty obvious how linear-domain envelopes really sound like garbage (and yeah, that's an opinion, but really they do).
Image <- plugins | forum
camsr
KVRAF
 
6687 posts since 16 Feb, 2005

Postby camsr; Thu Sep 28, 2017 1:39 am Re: What is wrong with this code?

I think I disagree, reason being a linear envelope will react more strongly while the gain is also decreased. In some ways this accents the peaks, while the total perceived effect of the compression can be quite low when it follows the attack stage. But that's just opinion, there shouldn't be a religious war over it. :D I quite like the logarithm way also. I suggest comparing them at low time constants.
Image
stratum
KVRian
 
1285 posts since 29 May, 2012

Postby stratum; Thu Sep 28, 2017 1:43 am Re: What is wrong with this code?

Human ear has a log-scale sensitivity but a one-pole lp filter decays exponentially. What would the net result be? I did not try or thought much about it:)
~stratum~
camsr
KVRAF
 
6687 posts since 16 Feb, 2005

Postby camsr; Thu Sep 28, 2017 1:44 am Re: What is wrong with this code?

tunca wrote:How to impelement envelope?


Have a look at the AudioTK audio toolkit written by miles1981, there's a few envelope examples in there.
Image
camsr
KVRAF
 
6687 posts since 16 Feb, 2005

Postby camsr; Thu Sep 28, 2017 1:48 am Re: What is wrong with this code?

stratum wrote:Human ear has a log-scale sensitivity but a one-pole lp filter decays exponentially. What would the net result be? I did not try or thought much about it:)


But the audio itself can have limited dynamic range already, so what's the use in compressing by, say, 18dB, and having it sound "natural" when it can be more like 6dB and sound "linear"? :D
Image
stratum
KVRian
 
1285 posts since 29 May, 2012

Postby stratum; Thu Sep 28, 2017 1:58 am Re: What is wrong with this code?

But the audio itself can have limited dynamic range already, so what's the use in compressing by, say, 18dB, and having it sound "natural" when it can be more like 6dB and sound "linear"? :D


Who knows, but I bet any analog unit that one can model by following the current marketing trend would probably have linear gain control, but admittedly I haven't looked at the details of any. What would an optical compressor do for example, perhaps Tunca would tell, as he apparently repaired (or built clones of) many such units for his friends:)
~stratum~
tunca
KVRist
 
376 posts since 26 Mar, 2015

Postby tunca; Thu Sep 28, 2017 7:59 am Re: What is wrong with this code?

camsr wrote:
tunca wrote:How to impelement envelope?


Have a look at the AudioTK audio toolkit written by miles1981, there's a few envelope examples in there.


Thanks.

I will check.

As i understand,compressor working good.Justi need to implement envelope to seekgain to make it works as compressor.Now seekgain working as really fast limiter or clipper.

But in this design,i have envelope.I saw other examples(musicdsp) and they use same type envelope.Why mine is not working?
http://analogobsession.com/ VST,AU for WIN & MAC
mystran
KVRAF
 
4579 posts since 11 Feb, 2006, from Helsinki, Finland

Postby mystran; Thu Sep 28, 2017 8:54 am Re: What is wrong with this code?

stratum wrote:
But the audio itself can have limited dynamic range already, so what's the use in compressing by, say, 18dB, and having it sound "natural" when it can be more like 6dB and sound "linear"? :D


Who knows, but I bet any analog unit that one can model by following the current marketing trend would probably have linear gain control, but admittedly I haven't looked at the details of any. What would an optical compressor do for example, perhaps Tunca would tell, as he apparently repaired (or built clones of) many such units for his friends:)


Good sounding "simple" analog compressors tend to be feedback designs though, which have quite different dynamics in general.
Image <- plugins | forum
stratum
KVRian
 
1285 posts since 29 May, 2012

Postby stratum; Thu Sep 28, 2017 9:00 am Re: What is wrong with this code?

Good sounding "simple" analog compressors tend to be feedback designs though, which have quite different dynamics in general.


The wiki article on dynamic range compression mentions something like that (i.e. derive the envelope from the output instead of the input), but obviously without any hint about whether or why it would sound better or not.
~stratum~
stratum
KVRian
 
1285 posts since 29 May, 2012

Postby stratum; Thu Sep 28, 2017 9:01 am Re: What is wrong with this code?

As i understand,compressor working good.Justi need to implement envelope to seekgain to make it works as compressor.Now seekgain working as really fast limiter or clipper.

But in this design,i have envelope.I saw other examples(musicdsp) and they use same type envelope.Why mine is not working?


It's quite difficult to understand what you mean by a compressor that works well without working as a compressor at all. I haven't looked at musicdsp examples.
~stratum~
PreviousNext

Moderator: Moderators (Main)

Return to DSP and Plug-in Development