What is wrong with this code?

DSP, Plugin and Host development discussion.
RELATED
PRODUCTS

Post

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. :)

Post

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, AAX for WIN & MAC

Post

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~

Post

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

Post

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~

Post

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).

Post

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.

Post

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~

Post

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.

Post

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

Post

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~

Post

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, AAX for WIN & MAC

Post

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.

Post

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~

Post

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~

Post Reply

Return to “DSP and Plugin Development”