# Emulate Analog curcuit

Hey. I am interested in making a compressor with analog circuit emulation. Please, tell me what materials or videos can I watch about this?

I think they can help you better in KVRaudio, as it’s more about circuitry and dsp math. Once you get that implementing it in JUCE is easy

2 Likes
2 Likes

Yes, I read this text, but I need a more detailed description or a tutorial on how to convert circuits into code to get this nonlinearity, because I’m new to this business.

Analogue modelling is usually done with careful analysis of the hardware - there is no need to replicate a circuit into code. This would be horrendous for most people to do as you would need to be both very good at electrical engineering and very good at dsp/efficient C++. This method would also be hugely CPU intensive.

The way I would suggest is find a circuit you like and analyse it carefully. In the case of compressors (as in the UA blog post) I imagine you would need to at least look out for these things:

• Analyse the attack and release times of the compressor and set your envelope follower to respond in a similar way.
• Analyse the curve and frequency response of the signal detector so you can apply the correct amount of gain reduction.
• Analyse the frequency response of the audio path so that you can filter to suit.
• Analyse the harmonic distortion to come up with some non-linear algorithms to suit.
• Look at noise.
1 Like

Thank you, David, I`ll try. Still, anyone information about how it making in practice, wont be superfluous

What you are trying to do requires a lot of different skills. Can you maybe tell us what you tried so far and where you got stuck? And also what your background is? That might make it easier to give some helpful advice.

If you’re right at the beginning (it sounds a bit like it), you should probably start with something smaller. For example, implement a straightforward compressor without any analog modeling fancyness first.

1 Like

This JUCE post might be helpful

Agreed. This code would then also be able to be modified with nice analogue juiciness afterwards as you learn!

Ok, I musician and sound engineer, and I am going to write a compressor for parallel buses, because I am interested in this topic and I want to develop in it. Now that the plugin is almost ready, I want to give it a special color. At the same time, I need a very fast attack and release, faster than 1178, because it is supposed to work with very short sounds.

I have implemented a simple digital compressor with attack time, release time, threshold, ratio and knee parameters, which appended to sliders. I read book "Designing Audio Effect Plug-Ins in C++ ", that uses constants to supposedly emulate the operation of analog and digital compressors. I took this constants for my exponential equation:
ANALOG_TC = -0.43533393574791066201247090699309;
DIGITAL_TC = -2.0;
Hence:
Attack = exp(ANALOG_TC / (0.001 * mSampleRate * mAttackTime));
Release = exp(ANALOG_TC/ (0.001 * mSampleRate * mReleaseTime));

The same for DIGITAL_TC
However, this only gives me different attack and release times. Now I want to go further and give a special character to my plugin, some unpredictability.