If you have a problem or need to report a bug please email : support@dsprobotics.com
There are 3 sections to this support area:
DOWNLOADS: access to product manuals, support files and drivers
HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects
USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here
NEW REGISTRATIONS - please contact us if you wish to register on the forum
Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright
K1 - RMS compressor
14 posts
• Page 1 of 2 • 1, 2
K1 - RMS compressor
Hi all,
In the last few weeks I had been exploring compressor design. I'd like to share my findings with you, for feedback as a well as simple data sharing.
There are many approaches to audio compression, so let me start with a 'bread & butter' design - a feedforward, RMS based stereophonic compressor.
The first model for me to present here is named 'K1' (hopefully more will follow soon).
The K1 is a feed-forward compressor, designed for 'down-compression' i.e. lower the signal parts which are higher than the given threshold.
The 'side-chain' channel is the part which 'calcultaes' how much to compress (at this stage it is based on the original signal, not 'side-chain' of a different channel in the DAW).
The Side chain is marked in red in the following image.
http://imgur.com/RmrRBML
Open the compressor main module (named: compressor) and see its inside.
The 'side-chain' channel is based on:
(ED - Energy Detector) --> (TF - Transfer Function) --> (EF - Envelope Follower).
Being a none-linear device, the order of processors is important.
Note that the TF and EF are based on 'logarithmic' calculation.
The TF and EF are pretty much straight forward.
TF
TF will process the signal only if it has passed the threshold. It also decides 'how much to process' based on the ratio. (input controls: Threshold and Ratio).
EF
EF will 'smooth' the signal by 'Attack' and 'release' times. (input controls: Attack and Release).
Notice that 'Attack' and 'Release' are symmetric and carry the same 'time constant' function, which is:
T = 1-exponent^(-1/(Fs*T))
This is a 'by the book' calculation of time constants and might vary tremendously if compared to 'analog modelled' compressors or other proprietary solutions.
ED
Compressors vary much by the ED itself. After all this module will 'declare' the energy level of incoming signal for reference.
An RMS approach is used here, in which:
So, it is first order IIR filter like window with a 'weighting' function (a) which decides how much to rely on previous result Vs. incoming sample.
a is sometimes referred to as Alpha.
Alpha's time constant is similar to 'Attack' and 'Release'.
Using Alpha, attack and release, one can decide the full timing of the algorithm.
Stereo processing
Some thought has to be taken for stereo processing.
If one channel's input surpasses the threshold (and requires processing) - both channels (Left and Right) need to be processed simultaneously, to avoid the sound 'bouncing' from left to right.
So, the K5 first squares each of the inputs (L_sample and R_Sample) and then chooses the current maximal sample value.
Notice that one must first square the signal to avoid comparing a negative value (samples are originally bi-polar). This will reverse the meaning of 'maximum' of course.
Hope this contributes to the forum and friends... Any question/remarks please go ahead.
K1 is built using Flowstone 3.0.8.1 Skylark version.
Rocko
In the last few weeks I had been exploring compressor design. I'd like to share my findings with you, for feedback as a well as simple data sharing.
There are many approaches to audio compression, so let me start with a 'bread & butter' design - a feedforward, RMS based stereophonic compressor.
The first model for me to present here is named 'K1' (hopefully more will follow soon).
The K1 is a feed-forward compressor, designed for 'down-compression' i.e. lower the signal parts which are higher than the given threshold.
The 'side-chain' channel is the part which 'calcultaes' how much to compress (at this stage it is based on the original signal, not 'side-chain' of a different channel in the DAW).
The Side chain is marked in red in the following image.
http://imgur.com/RmrRBML
Open the compressor main module (named: compressor) and see its inside.
The 'side-chain' channel is based on:
(ED - Energy Detector) --> (TF - Transfer Function) --> (EF - Envelope Follower).
Being a none-linear device, the order of processors is important.
Note that the TF and EF are based on 'logarithmic' calculation.
The TF and EF are pretty much straight forward.
TF
TF will process the signal only if it has passed the threshold. It also decides 'how much to process' based on the ratio. (input controls: Threshold and Ratio).
EF
EF will 'smooth' the signal by 'Attack' and 'release' times. (input controls: Attack and Release).
Notice that 'Attack' and 'Release' are symmetric and carry the same 'time constant' function, which is:
T = 1-exponent^(-1/(Fs*T))
This is a 'by the book' calculation of time constants and might vary tremendously if compared to 'analog modelled' compressors or other proprietary solutions.
ED
Compressors vary much by the ED itself. After all this module will 'declare' the energy level of incoming signal for reference.
An RMS approach is used here, in which:
- Code: Select all
E = x^2*a+(1-a)*En1
En1 = E
So, it is first order IIR filter like window with a 'weighting' function (a) which decides how much to rely on previous result Vs. incoming sample.
a is sometimes referred to as Alpha.
Alpha's time constant is similar to 'Attack' and 'Release'.
Using Alpha, attack and release, one can decide the full timing of the algorithm.
Stereo processing
Some thought has to be taken for stereo processing.
If one channel's input surpasses the threshold (and requires processing) - both channels (Left and Right) need to be processed simultaneously, to avoid the sound 'bouncing' from left to right.
So, the K5 first squares each of the inputs (L_sample and R_Sample) and then chooses the current maximal sample value.
Notice that one must first square the signal to avoid comparing a negative value (samples are originally bi-polar). This will reverse the meaning of 'maximum' of course.
Hope this contributes to the forum and friends... Any question/remarks please go ahead.
K1 is built using Flowstone 3.0.8.1 Skylark version.
Rocko
- Attachments
-
- K1_RMS.fsm
- (10.21 KiB) Downloaded 1605 times
Last edited by Rocko on Mon Dec 26, 2016 10:15 am, edited 4 times in total.
- Rocko
- Posts: 186
- Joined: Tue May 15, 2012 12:42 pm
Re: K1 - Pro Grade compressor (?)
Thank you very much for making the effort! Very nice!
- Wassaka
- Posts: 85
- Joined: Wed Dec 30, 2015 3:41 am
Re: K1 - Pro Grade compressor (?)
Hi Rocko
Many thanks for making it compatible with 3.08 so I can try it out!
I'm impressed with the results on my microphone and it's nice and easy to use, so much so that I've added it to my toolbox.
Have you considered the following points:
- There is no output clipping. On my previous soundcard (X-Fi Platinum) if the output went above +/- 1 it would either hang up or turn off the stream for a short time. My new Focusrite USB interface doesn't do this but some folk may have issues.
- So-called Look-ahead is useful for initial transients. This, as I'm sure you know, involves putting a short delay in the live path to offset the lag of the side-chain due to the ED. The larger the rms window (Alpha) and the Attack time the more delay is needed so the side-chain aligns with the transient better.
- Mouse-operated controls are more convenient than data entry, but you could have both maybe.
- It's nice to be able to visualise the side-chain action in some way like a meter or bar graph, rather than rely on just listening.
These aren't criticisms, just suggestions and I really like this, so many thanks for sharing it here.
Cheers
Spogg
Many thanks for making it compatible with 3.08 so I can try it out!
I'm impressed with the results on my microphone and it's nice and easy to use, so much so that I've added it to my toolbox.
Have you considered the following points:
- There is no output clipping. On my previous soundcard (X-Fi Platinum) if the output went above +/- 1 it would either hang up or turn off the stream for a short time. My new Focusrite USB interface doesn't do this but some folk may have issues.
- So-called Look-ahead is useful for initial transients. This, as I'm sure you know, involves putting a short delay in the live path to offset the lag of the side-chain due to the ED. The larger the rms window (Alpha) and the Attack time the more delay is needed so the side-chain aligns with the transient better.
- Mouse-operated controls are more convenient than data entry, but you could have both maybe.
- It's nice to be able to visualise the side-chain action in some way like a meter or bar graph, rather than rely on just listening.
These aren't criticisms, just suggestions and I really like this, so many thanks for sharing it here.
Cheers
Spogg
-
Spogg - Posts: 3358
- Joined: Thu Nov 20, 2014 4:24 pm
- Location: Birmingham, England
Re: K1 - Pro Grade compressor (?)
Hey Spogg,
Thank you for your comments, most appreciate and Good points, if I may say.
Notice that I'm saving the GUI for last.
Regarding the clip-protection, agreed. Will do.
For the look-ahead, well this is more challenging. Adding a look ahead to the system is easy of course.
But what should the look ahead be set to?
Please remember that the 'Energy Detector' in this design can change its 'window time'. So, if I'll change the look-ahead according to that (on the fly, while running), I guess I could not report the correct PDC to DAW ??
Maybe I could just provide two versions, one with a constant look-ahead, another without ?
What do you think?
Thank you for your comments, most appreciate and Good points, if I may say.
Notice that I'm saving the GUI for last.
Regarding the clip-protection, agreed. Will do.
For the look-ahead, well this is more challenging. Adding a look ahead to the system is easy of course.
But what should the look ahead be set to?
Please remember that the 'Energy Detector' in this design can change its 'window time'. So, if I'll change the look-ahead according to that (on the fly, while running), I guess I could not report the correct PDC to DAW ??
Maybe I could just provide two versions, one with a constant look-ahead, another without ?
What do you think?
- Rocko
- Posts: 186
- Joined: Tue May 15, 2012 12:42 pm
Re: K1 - Pro Grade compressor (?)
Rocko wrote:For the look-ahead, well this is more challenging. Adding a look ahead to the system is easy of course.
But what should the look ahead be set to?
Please remember that the 'Energy Detector' in this design can change its 'window time'. So, if I'll change the look-ahead according to that (on the fly, while running), I guess I could not report the correct PDC to DAW ??
Maybe I could just provide two versions, one with a constant look-ahead, another without ?
What do you think?
When I made my Quilcom Mistress I gave it a manual look-ahead knob but it could be automatic and relative to the Attack and Window settings. In my case the user chooses rms OR peak detection so it would have been tricky.
If you change the Attack or rms window the look-ahead will not align correctly. However, I found in practice that look-ahead is only useful if transient suppression is appropriate to the source, say for percussion. Also, in practice, the look-ahead time need only be typically a few mS when it's needed.
So I would personally avoid a fixed time for look-ahead because it would only be accurate for one setting of the ED.
Cheers
Spogg
-
Spogg - Posts: 3358
- Joined: Thu Nov 20, 2014 4:24 pm
- Location: Birmingham, England
Re: K1 - Pro Grade compressor (?)
Hi,
Appreciated. I look into it and come back with new stuff.
BTW -
Do you happen to have a good anti-clipping solution to share, or should I just add:
Appreciated. I look into it and come back with new stuff.
BTW -
Do you happen to have a good anti-clipping solution to share, or should I just add:
- Code: Select all
If [(x)>0.99 then x=0.99]
if (x)<-0.99 then x=-0.99
- Rocko
- Posts: 186
- Joined: Tue May 15, 2012 12:42 pm
Re: K1 - Pro Grade compressor (?)
Woha !!
The 'clipper' and explanation are tremendous, thanks.
Your "cycle meter" is a great tool. Thanks for sharing...
What if the schematic uses 'pack' 'unpack' as part of its design ? Even then it seems that MV's clipper is better (or same) CPU wise.
Thanks for sharing
The 'clipper' and explanation are tremendous, thanks.
Your "cycle meter" is a great tool. Thanks for sharing...
What if the schematic uses 'pack' 'unpack' as part of its design ? Even then it seems that MV's clipper is better (or same) CPU wise.
Thanks for sharing
- Rocko
- Posts: 186
- Joined: Tue May 15, 2012 12:42 pm
Re: K1 - Pro Grade compressor (?)
Another thought about look-ahead.
If you have a preset manager with presets you could manually tune the compressor for each source type, say vocal, percussion, mix etc. This way you could set a look-ahead delay time and all the other parameters to be ideal for the type of application.
Cheers
Spogg
If you have a preset manager with presets you could manually tune the compressor for each source type, say vocal, percussion, mix etc. This way you could set a look-ahead delay time and all the other parameters to be ideal for the type of application.
Cheers
Spogg
-
Spogg - Posts: 3358
- Joined: Thu Nov 20, 2014 4:24 pm
- Location: Birmingham, England
Re: K1 - Pro Grade compressor (?)
Hi,
Correct, but still the PDC reporting to DAW will be wrong...
That is the (only) advantage of having two different versions, one with fixed look-ahead and one without.
I tend to believe that your sugeestion (programmable Look-ahead) is better... Just highlighting the good/bad
Thanks,
Rocko
Correct, but still the PDC reporting to DAW will be wrong...
That is the (only) advantage of having two different versions, one with fixed look-ahead and one without.
I tend to believe that your sugeestion (programmable Look-ahead) is better... Just highlighting the good/bad
Thanks,
Rocko
- Rocko
- Posts: 186
- Joined: Tue May 15, 2012 12:42 pm
14 posts
• Page 1 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 27 guests