My attempt to build a LDR compressor. Prototype done, some samples.

GroupDIY Audio Forum

Help Support GroupDIY Audio Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.

little_paco

Member
Joined
Dec 17, 2022
Messages
9
Location
france
I've been wandering how a compressor work since a long time. After reading and looking at schematics i tried to make my own.

Here is the result:
https://sites.google.com/site/nanotweed/home/ldr_compressor_xp
Is this the best compressor on earth certainly not, but it was fun to build and it use simple parts execpt for a LDR. It might interest some people....

In terms of performance here are some measurement:
Reponse_compresseur.jpg


A little description of the parts used:
part 1 a buffer with a tlo72 (to have high input impedance)

Part 2 a attenuator using the LDR

Part 3 a rectifier and a diode

Part 4 an enveloppe filter to drive the next stage next stage, and also an offset correction

Part 5 the heart of the system: a log converter
Vout is proportional to log (VThreshold/Venv)
The output is -2,9V every decade.

This feed part 6:
an amplifier to set the slope:
A diode (thresholdless)
An enveloppe dectector to set release and attack time

This control voltage feed the part 2 theres also a bias level to set the diode on the edge of blinking.

Here is a picture of the board just to for fun:
IMG_20221228_113031.jpg

I'll come back later to complete the post.
 

Attachments

  • mesures.pdf
    210.1 KB · Views: 3
  • Bucket_of_opamp.pdf
    125 KB · Views: 5
Last edited:
OK. I hope you won't blame me if I take the liberty to comment/criticize your work.
Part 2 a attenuator using the LDR
I don't see the LDR. But I see you have about 10dB gain overall. Is it something you wanted?
Part 5 the heart of the system: a log converter
Vout is proportional to log (VThreshold/Venv)
The output is -2,9V every decade.
Is it necessary? If the LDR-based gain cell reacted logarithmically, that would be a point, but here, I'm not sure it brings a definite advantage.
I know you're doing it for fun and learning, so knock yourself out!
This feed part 6:
an amplifier to set the slope:
A diode (thresholdless)
An enveloppe dectector to set release and attack time
I don't see how the release time is controlled by pot U15. Seems to me like it controls ratio, so, of course release time is modified, but so is attack time., and GR (Gain reduction). Too interactive to my taste.

I notice that you've chosen a feed-forward detection scheme, which supposes a perfectly continuous and bi-univocal behaviour of the gain cell, which is clearly not the case here, according to graphs. Most LDR-based compressors I know are feedback, meaning teh detector input is taken from teh output of teh compressor, which results in self-regulation..
I would suggest you study some of the existing commercial designs.
 
Well, i have to explain something about my schematics.

D4 is a red led and R6 is the LDR sorry i don't have symbol for LDR. They forms a kind of vactrol perfectly set in heat shrtink and electrical tape.

U15 set the slope, U15 doesn't affect attack and release. In order to change attack and release it would be better to change C3 C4 or R20 R27.

Is it necessary? If the LDR-based gain cell reacted logarithmically, that would be a point, but here, I'm not sure it brings a definite advantage.
I know you're doing it for fun and learning, so knock yourself out!

I 'll try to explain briefly.
Here is a graph showing R(LDR)=f(Uled):

rfu.jpg

as you can see that's not really linear.


Then if a build a tension divider with a 100kR on top and the LDR I can build an atténuator wich behave like that:
s100fdu.jpg

But if i plot the output in decibel i have that:
sdb100fdu.jpg
Well it's not perfectly linear but i gave it a try.
What i understand from this last graph is every 1volt rise i have around a 3db attenuation.

If my control voltage reflects the difference between input level ( indB ) in regard with the threshold i can have something not as bad.
 
Last edited:
D4 is a red led and R6 is the LDR sorry i don't have symbol for LDR.
You must google for LTspice vactrol; there are two Vactrol models, the 5C2 and the 5C10.
U15 set the slope, U15 doesn't affect attack and release.
OK. That confirms my reading.
Here is a graph showing R(LDR)=f(Uled):
LED's are current driven, not voltage-driven. You must evaluate R(LDR)=f(Iled). It's a 1/ax+b function in first approximation.
 
Last edited:
I am not sure you really want a linear relationship. If you replot your original opto resistance versus LED current with log/log axes you should find it is nearly a straight line. Here's what I got when testing a VTL5C3.

Cheers

Ian
 

Attachments

  • VTL5_C3loglog.png
    VTL5_C3loglog.png
    12.4 KB · Views: 0
Hello, i recently had time to make some more experiments.
LED's are current driven, not voltage-driven. You must evaluate R(LDR)=f(Iled). It's a 1/ax+b function in first approximation.

I though that with a 22k series resistor tension and current through the Led would be affine. But your right i tried with a voltage to current converter and this is way better: i don't have to bother with the led threshold.
And that's right R(LDR) is invert linear to current 1/(axi)

how could i miss that....

I am not sure you really want a linear relationship. If you replot your original opto resistance versus LED current with log/log axes you should find it is nearly a straight line. Here's what I got when testing a VTL5C3.

Cheers

Ian

Yes i get the same thing with my own assembly (didn't want to buy a vactrol, i just wanted to play with what i had lying around)



About the Log amplifier you were right this is not a good idear, must have mistaken myself somewhere between log and non log variables.
 

Attachments

  • invder_eg_fdr.jpg
    invder_eg_fdr.jpg
    434.1 KB · Views: 0
Last edited:
Think its starting to work!

Just had to add one more thing to my design.

The results are here:mesures_marche1.jpg

As you can see:
- It as some kind of soft knee (well don't really know if it's really one, but it seems to me)
- when it has to work hard the non linearity of the LDR, starts to get a little bit annoying.
All in all, just using opamp and simple parts. I think that's not bad for a feedforward LDR compressor


If someone is interested, keep in mind that's it might not be a perfect tool. Maybe more of an educative project.

I took time this afternoon, but sorry i put my calculation and explanation on paper, i'm to slow with a computer.

You'll find
the schematic,
some explanation and calculation
some coments about the design little things, and flaws not explored question...

Here is a link to the LT spice simulation of the circuit:


It use a b prefix model as shown in one of the picture, wich have been really usefull (i know that possibility since three days...)
 

Attachments

  • Manual_opto_paco.pdf
    13.9 MB · Views: 3
  • opto paco comments.pdf
    259.3 KB · Views: 2
  • optopaco schematic.pdf
    136.2 KB · Views: 3
  • simu_resistance_chelou.jpg
    simu_resistance_chelou.jpg
    294 KB · Views: 3
Last edited:
I made a prototype few month ago, but i have benne to lazy to post about it.

So i put evedy thing in a broken hifi tuner that was lying around.

façade.JPG

Labeling is poorly done...
façade2.JPG

I build everything on strip board, the wire connecting the different board are not the best but that was one of the most convenient solution.

The box contain the opto compressor, and also a mic preamp (a simple one but i wanted to try building one)

dessus2.JPG
here's the mic preamp board:mic_pre.JPG

and the compressor board
compressor_board.JPG

I tried to make some sound sample: I don't really know how to use a compressor so i might have done some poor setup.... Sorry.

I used an At2020 microphone.


First with voice:

Original take:
View attachment voix_original.mp3

Compressor Threshold :-32 dB Ratio 2 Attack: short Release:mid
View attachment voix_compressor_-32_2_shortattack_midrelease.mp3

Compressor Threshold :-24 dB Ratio 8 Attack: short Release:mid
View attachment voix_compressor_-24_8_shortattack_shortrelease.mp3

Compressor Threshold :-32 dB Ratio 8 Attack: long Release:mid
View attachment voix_compressor_-32_8_longattack_midrelease.mp3




with an acoustic guitar

Raw file:
View attachment Guitare_originale.mp3

Compressor Threshold :-32 dB Ratio 3 Attack: long Release:short

View attachment Guitare_T-32_R3_longattack_shortrelease.mp3

Compressor Threshold :-32 dB Ratio 3 Attack: short Release:mid
View attachment Guitare_T-32_R3_shortattack_midrelease.mp3

Compressor Threshold :-20 dB Ratio 8 Attack: long Release:mid

View attachment Guitare_T-20_R8_longattack_shortrelease.mp3


What are the flaws: maybe multiple i'm not very expert.

The main one: It can't be very fast.
Second one, when drived hard with big attack it can start to pump (don't know if it's really the word)

One advantage:
To my ears it doesn't eat to much treble.
It's mine, and quite original.

So what's your opinion, is it a compressor or not?

At the end you can find the schematic and layout of the mic pre and the compressor.
 

Attachments

  • dessus1.JPG
    dessus1.JPG
    2.4 MB · Views: 0
  • compressor_board.pdf
    125 KB · Views: 2
  • mic_pre.pdf
    99.5 KB · Views: 4
  • mic_pre_schematic.pdf
    118.3 KB · Views: 4
  • schema_comp.pdf
    144.8 KB · Views: 5
Last edited:
It sounds good on my cell phone...congrats
Myorigina designed single ended 6l7 comp was much smoother than my am984 clone for vocals so we mixed with it last weekend...point is YOUR DESIGN VS CLONE IS COMMENDABLE ...if you are using it proudly....even better

Thx for sharing
 
Listening to the tracks it seems clear to me that the obvious pumping is due to the feed-forward nature of the compressor. These only work well with a very well characterised gain cell. I suggst you modify the compressor to a feedback type and test it again. I expect the results will be much better.

If you look at the schematic of the LA2A for example, you will see that in the compress position the side chain signal is taken directly from the gain cell output. If the gain cell law is close to 1dB/V then you will get a ratio of 2:1

In the limit position, the side chain signal is a combination of the the cell output AND the input signal so it is part feedback and part feed-forward. The overall effect of this change is to increase the ratio and you can set different ratios by altering the resistor values. Notice that the limit resistor in the LA2A is a select on test par which indicates that gain cell variations are significant.

Cheers

IAn
 
Here are samples of a simple fixed ratio feedback opto compressor I made some years ago. Each sample has two uncompressed drum phrases followed by two compressed versions. The first file has 5dB of compression, the second 10dB and the third a whopping 20dB.

Cheers

Ian
 

Attachments

  • compdrum5dB.wav
    6.8 MB
  • compdrum10dB.wav
    6.5 MB
  • compdrum20dB.wav
    6.8 MB
Thanks for your reaction and suggestion.

It might have been optimistic to make a feedforward design. The truth is that a feedforward design was simpler to imagine.

The fact is that i don't really manage to figure out how a feedback design work without becoming a limiter. I might have to read and think about it.
 
Thanks for your reaction and suggestion.

It might have been optimistic to make a feedforward design. The truth is that a feedforward design was simpler to imagine.

The fact is that i don't really manage to figure out how a feedback design work without becoming a limiter. I might have to read and think about it.
It is not too hard if you start from the output. Assume your gain cell law is 1dB/dB. If you want to increase the output by 1dB then, because it is feedback, the control voltage increases by 1dB so the gain cell loss is 1dB more. This extra 1dB loss reduces the input signal by an extra 1dB. So to get 1dB more at the output we obviously need to increase the input by this extra 1dB plus the extra 1dB loss in the gain cell. So a 2dB increase in input is needed to increase the output by 1dB. So the ratio is 2:1.

In general, if the gain cell law is ndB/dB then the ratio is n+1.

Cheers

Ian
 
paco, I have finished the simulation of the side-chain.
I don't understand what you want to achieve with the log.exp circuits.
As I surmised, the output at out_exp is an almost one-to-one of the env input signal, with small time-constants, not long enough for the purpose. According to your schemo, most of the timing is done in the subsequent stage (U18 & U13).
My understanding is that the log/exp part does the rms trick but only at mid and high frequencies, where it's not the most efficient. At LF, you could probably replace it with a straight wire.
 
It is not too hard if you start from the output. Assume your gain cell law is 1dB/dB. If you want to increase the output by 1dB then, because it is feedback, the control voltage increases by 1dB so the gain cell loss is 1dB more. This extra 1dB loss reduces the input signal by an extra 1dB. So to get 1dB more at the output we obviously need to increase the input by this extra 1dB plus the extra 1dB loss in the gain cell. So a 2dB increase in input is needed to increase the output by 1dB. So the ratio is 2:1.

In general, if the gain cell law is ndB/dB then the ratio is n+1.

Cheers

Ian
Thank you, i have to think about it. I think i make a mistake when i think about it.
Something wrong like outpu take a value, system react and tell output to decrease, output decrease so system react and tell output to decrease etc, etc. Wich would lead to a limiter. This is an certainly obvious mistake, well i have to figure out where i'm mistaking.

https://groupdiy.com/threads/what-compressor.47105/post-591999This Is a simple design... I ll try It as i get time... It should be a feedforward topology as your design... No log amp at sidechain and It s also easy to evaluate how much signal Is going to sidechain part...
Hope It helps

Best

Thank you, i allready looked at it few month ago. And if i remerber well, i found that it was not really a compressor more a limiter with a adjustable threshold but you can't set the slope. I'll try to proove my point.

paco, I have finished the simulation of the side-chain.
I don't understand what you want to achieve with the log.exp circuits.
As I surmised, the output at out_exp is an almost one-to-one of the env input signal, with small time-constants, not long enough for the purpose. According to your schemo, most of the timing is done in the subsequent stage (U18 & U13).

My understanding is that the log/exp part does the rms trick but only at mid and high frequencies, where it's not the most efficient. At LF, you could probably replace it with a straight wire
Thank you that's so kind, sorry i should have put my simulation files in the thread instead of letting you do all this work.
It's there in a zip file.

You're right, the timing is done in the subsequent stage.


The log.exp circuit is there to set the slope of the compressor, and set the threshold.
If you directly send the output of the log circuit to the exp circuit. As you've seen tou'll get the voltage taht fed the log circuit. And the compressor should behave as a limiter (sort of).
If you put a voltage divider lts say 1kohm and 1kohm between the two, then the out put of the exp circuit should be the squareroot of the input.

the output should be something like v(out)= Vref2 * (Vin/Vthreshold)^(1-Ratio)
(wich i thin is the right law to drive the LDR)

It's explained in a file in a previous post:
Manual_opto_paco

But i must admit this is not very well explained (even for I, After 6 months it's not really easy to understand)

Well you'll find a file named:
Fonctionnement cellule in the zip file, this one can be interesting to play with. Particularly if you choose a logarithmic graph.


Your final point was one of my question. Does all the frequency have to feed the sidechain or is it better to pu a little of Hi Pass filter?
 

Attachments

  • compresseur.zip
    9.5 KB · Views: 2
Last edited:
Back
Top