Dirty Dan Compressor

Fast Compressor built with minimal components

Similar projects worth following
Compressors are devices designed to reduce the dynamic range of audio. Typically, this is achieved by creating an AC voltage divider between a fixed resistor and a voltage or current controllable element. The simplest way of doing this is with a pairing of an LED and photo-resistor pairing. However, this technique is too slow to process percussion.

I created a simple compressor using a LM324 and two bipolar transistors. The signal gets compressed, and then a second stage reduces distortion and furthers the compression. To minimize distortion, a portion of the unprocessed audio is added and sent to the output.
The envelope is driven by this signal, which in turn feeds both transistor bases. The second transistor cancels much of the distortion of the first.

Due to many simplifications, the sound output is not HiFi, but it is usable and seems to add a unique energy to cymbals and hi-hats.

When I set out to make this, I based my initial design on what was either a very poorly remembered schematic or a fever dream about a technique used to control the gain of a cassette recorder. I'm absolutely sure there is some reason why this isn't supposed to work, but I don't know what that might be. Something to do with transconductance maybe.

Either way, I set out to make a compressor that could be made out of just about any junk you have laying around. Despite the fact that it uses a lm324, it manages to avoid the disadvantages of doing so by not using a ton of gain and by biasing the output so that it's *mostly* class A. I let the stray transients break through into crossover distortion because it represented a significant power savings while having relatively little impact on cost.

I am working on another project that's a percussive instrument that has a very high dynamic range which introduces a lot of problems. Internally, it has a 3W power amplifier and a moderately powerful headphone amplifier. While 3W can play studio produced music quite nicely, an actual percussive instrument has a much higher dynamic range with a very sharp attack. I had considered just adding a soft clipping circuit, but this doesn't seem to produce a very pleasant sound at all with bright sounds like hi hats and cymbals.

The main control element being a transistor introduces some interesting distortions. When heavily driven it becomes less of a compressor and more of an overdrive. I think this is likely due to the base collector juction diode reaching it's conducting voltage and clipping the compressed signal. The interesting thing about this is that the envelope accounts for this as gain reduction, so in theory at least it must be bringing the gain up again after the signal drops off distortion.

To save on parts, the rectifier is just a single op amp, no "precision rectifier" circuit. This likely introduces a saturation signal hang, though it's possible this dissapears when the signal drops .7v across the diode into the passive section of the signal. It's also a half wave rectifier, because, again, lower component count and cost. This disadvantage of this is added distortion and the occasional missed cycle at the start of a transient. This also requires that the op amp in question is able to operate down to the 0v rail. This meant that my options were reduced to rather expensive op amps that I didn't have, and the LM324, which I did.

It was a complete accident that I found that two transistors driven by the same element cancelled most of the distortion of the previous stage and nearly eliminated low frequency bleedthrough. To futher reduce distortion I added some of the original signal back in at the last stage. It should be noted however, that this stage drives the envelope with this signal already mixed in. This seems to have altered the compression characteristic to instead of squasing the upper peaks and making up volume, it now seems that it's adding volume to the valleys of the sound.

It seems to handle percussive sounds well enough, adding it's own distortions to the mix . It sounds okay on guitar with a much better noise level than expected, but I think it's a little too fast for it's own good here. If I were to make it again or modify it with this as my intention, I would probably increase the size of envelope capacitor significantly - guitar sounds ok with a little bit of added attack.

toy compressor op amp 2.asc

Ltspice schematic

asc - 6.85 kB - 05/07/2023 at 02:56



diylc layout

diy - 50.12 kB - 05/07/2023 at 02:56


  • 2 × Resistor 470 Ohm
  • 7 × Resistor 10K Ohm
  • 1 × Resistor 47K Ohm
  • 4 × Resistor 100k Ohm
  • 2 × Resistor 220k Ohm

View all 23 components

  • It works

    John Wetzel05/07/2023 at 02:49 0 comments

    Having connected my power rails correctly this time, I was able to connect an oscilloscope and check to see if it was functioning. Well, signal went in, signal came out. The compression (threshold) knob did appear to influence the level. That was about as far as I was going to get with that.

    I assembled all the components and putting things together. Usually I adhere my boards to the back of the pots with a strip of automotive molding tape. It holds much much better than even the heavy duty double sided tape, I've found. Except this time there was a problem. Big gap on one side.

    I had previously met a guy, marcus, at the makerspace and he was there working on his violins. I asked if he had any scrap about the 1/4 inch and to my surprise he did. He gave me a piece, I cut an even smaller piece with a hacksaw and used the tape to use it as a riser for the other side of the board. I managed to assemble everything without breaking anything and set of to go home to test it.

    To my surprise, it worked mostly as expected. When pushed too far it more or less becomes an overdrive, but there are certainly some functional spots below that. I tested it with the percussion on a casio keyboard I had and it seemed to thicken it up nicely. I also tested it on guitar. It gave some usable tones although certainly more on the agressive side. Strangely enough, there was low enough noise it could be used going into an overdrive.

    Knowing that it worked, I ate dinner than started submitting the project, because when better to do an entire project than the very last day its due?

  • It doesn't work

    John Wetzel05/07/2023 at 02:39 0 comments

    After assembling the whole board, I connected it to the power supply to be astonished to see it reading 150ma at 9v. Hm. Seems a bit high. I took out the op amp and checked without it - there was no significant draw. So there was something wrong with the op amp I thought. Well, I have a bunch of them? I decided that the best path of action would be to lift up the pins from each quadrant of the op amp and only plug in the other three. I cycled through all four only to find that the draw remained the same. Most puzzling. I double checked my schematic, my layout and my components. Everything was where it was supposed to be. Hm. I had damaged one of the pins in the process and replaced the ic with another. Similar results. Then I noticed it, I had connected my 9V line to the 4.5v rail. Oh.

  • Assembling the board

    John Wetzel05/07/2023 at 02:34 0 comments

    This is very similar to assembling any pcb, it's just a matter of putting the parts in the correct places. With stripboards I find it's best to build bottom up. That is to say the lower a component is, the higher the priority that it needs to be placed. This is especially true if you're not using a helping-hands and have to balance the board on a desk to solder it. I was this time so I started with all the resistors.

    There was a section I had where I routed one resistor underneath another that was jumping a trace cut. Probably not the most elegant solution but it can save a couple rows, and make your life easier in the future when you have to figure out how to get it all to fit.

    I assembled all of the passives without trouble and then moved onto the actives. I started with the transistors. My transistors are of dubious quality so I tested both of them before adding them to the board. Both tested around 200hfe. Which is good, but I've always found it strange that 2n3904's seem to pretty reliably make those numbers when the datasheet only calls for 30. It's as though the datasheet is just the words "it's a transistor alright".

    I thought about soldering in the LM324 directly, but this time thought better of it which would save me in the next part.

  • Making the stripboard

    John Wetzel05/07/2023 at 02:28 0 comments

    Actually assembling a stripboard is a somewhat therapeutic process. I started with cutting the board to the size needed. To do this you score along a line of holes, as well as the bakelite on the exact other side. Then you can usually just snap it using your hands or against the edge of a table. I broke the board to the size needed and then sanded all the edges flat. Then I rounded off the edges and corners. It's absolutely not necessary for this part of the process, but something about it makes me happier with the end product.

    Next is the important part. Placing the cuts. Now if you're really clever you can probably flip the drawing of the layout in your mind and know where to place all of the cuts. I am not really clever. I just go back into diylc and make a copy of the board and all the components on it below the original. Then I delete all of the components and comments making sure not to delete the cuts. Then I select the now barren clone, right click and select Transform>mirror horizontally. I suppose you could do vertically as long as you can keep track, but I seem to like horizontal better.

    Then it's just a matter of marking out all of the locations of the cuts on the copper side of the board with a marker. Marking them out makes it much much harder to accidentally slip a position and put a cut somewhere you didn't intend. Originally, I would make these cuts with a hobby knife. It's not the most reliable method and it doesn't look the best. Instead, it's better to wrap a drill bit that's slightly larger than the copper row with tape to make a handle. You can then spin it on top of your markings and with light pressure it will drill just enough to take off a round little cone of the copper trace. Get all of these done and your board is ready for assembly.

  • Designing a Layout

    John Wetzel05/07/2023 at 02:19 0 comments

    Generally when I build a circuit myself there are two ways I design the boards. If a design has a relatively high complexity I use kicad to design a pcb and engrave the boards myself. This circuit was below the complexity where that seemed to matter.

    It was a matter of using a program called diylayout creator (it used to detect as a virus for some reason so, you know, heads up). Building a circuit with diylc is more of a challence of seeing just how small you can get the circuit. It's a lot like playing that old game where you have to move the blocks around to get another block out. You just have to start somewhere and keep moving things around until you get it all to fit.

    Generally speaking, quad op amps make for poor stripboard layouts. the power rails being right in the middle of the ic wastes a few lines just getting power there. With two dual ics you have the option to flip one upside down and have them both share the same ground or power bus. Either way, I managed to whittle down my width to about 22 rows, or just over 2.2 inches. Unfortunately this wouldn't fit in the 1590b size box that I had been planning on using.

    Luckily, I had a 125b box on hand that I'm much more fond of using - that extra bit of space makes it so much easier to fit jacks and such things on - the depth makes it so you can have several components overlap if you need to. I was also in luck, - forgotten to me the enclosure had already been drilled for knobs and such in exactly the amount I needed.

    Once I had settled on a board design I needed to start on actually making the board.

  • Creating the Circuit

    John Wetzel05/07/2023 at 02:11 0 comments

    I'm not really sure how I went about doing this, or even why. But I decided that I needed a functional compressor with a minimal parts count So I did. Bipolar transistors are not happy being used as compressive elements it seems, I basically formed this section by banging on ltspice until I had a functional circuit come out. There were a lot of different iterations of "what if I did this, or what if I did that" and I tried them all, one after another to get what's there.

    The design aesthetic I decided upon while designing this was minimum of parts to get it to function. All of the op amps are inverting topology because it meant that I could just direct connect a 4.5v or 0v line to each non inverting input, thus saving myself the extra resistor that would have come with a non inverting topology.

    When I got the circuit really close to what I thought it should be I made the decision to import and run some drum loops though the ltspice simulation. What I found was that the release of the envelope wasn't nearly fast enough and that it hadn't fully relaxed itself between beats. I had to cut the envelope capacitor from a 10uf to a 1uf.

    I was concerned about how much distortion would be on the output. My simulations with sine waves had shown that it should top out around 7 percent when running near the detection threshold, but real audio seemed to show that it needed more mellowing than I had thought, hence the decision to add more dry signal to the final blend.

View all 6 project logs

Enjoy this project?



Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates