The pictures may look sort of skewed but I hope you get the idea..
Any thoughts?
-ef
EDIT : I'd post a sound sample but my desktop PC suffers from thermal shutdowns so I can't really record anything for the time being
EDIT 2 : there's a typo in the schematic, the output vol pot could be after the LDR.. this current plan changes the load the control circuit resistor sees, whereas with the pot after the LDR it limits the output signal.. I guess it's a matter of taste, since it doesn't have active buffering for the output signal.
The code doesn’t look complete. Let’s ignored the burnt LED do you have it working? Wonder how it sounds. Also there’s no gain stage. I have an LA2A. Same concept. Look it up. You should be able to find schematics. Think along the line. Currently all you have a threshold and gate but no make up gain.
I really don’t see the need for the Arduino for this. It’s all analog circuitry. It’s been done before with tubes. Just replace the tubes with transistors.
wolframore:
The code doesn’t look complete. Let’s ignored the burnt LED do you have it working?
Yes the last time I tested it.
Also there’s no gain stage. I have an LA2A. Same concept. Look it up. You should be able to find schematics. Think along the line. Currently all you have a threshold and gate but no make up gain.
That's something I was thinking but I didn't have opamps.
I really don’t see the need for the Arduino for this. It’s all analog circuitry. It’s been done before with tubes. Just replace the tubes with transistors.
I breadboarded a Schmitt trigger to light a LED but it didn't work for one reason or another. I think one option/mod would be to invert the optocoupler LED.
A Schmitt trigger is the wrong idea. The beautiful thing about a optocompressor is the smooth analog that comes with it. It’s almost transparent. The original filament light took time to turn on and fade out which adds a smoothness to the compression. It slows and smooths the attack and release.
I really have no idea what you have since I can only imagine how you have it functioning. It could work as a noise gate or a leveling device. All depends on how you program but I wouldn’t think that it’s a compressor without the make up gain.
This has been done many times (mostly with PICs or solid state control logic), but it is far from easy. The right vactrol (and a periphery tuned to it) is vital for the sound, and so is ultra low latency on the control signal.
Besides, you absolutely must have proper buffering on the in- and output - the Arduinos are 0 to +5V (or 0 to +3.3V) devices, while audio is AC. Just feeding audio into A0 will have you miss the bottom half of the wave and overshoot the available sample rate by a magnitude - you'd have to use an anti-aliasing filter and shift the entire wave to the positive range, or (better yet) rectify for the envelope before you make it to the Arduino input. And you have to brace the input element in your circuit for at least 12Vpp, or it may go up in smoke when used behind a fuzzbox or other hot devices - a self-limiting buffer op amp or at least clipping diodes will be necessary (at any rate unless you absolutely want to be swamped with repairs under warranty).
I fully understanding building something like this for fun. But, for less than $200 USD you can buy a stereo compressor that's got the traditional threshold, ratio, attack, release, and make-up gain controls. You couldn't build it for that. And, it's going to be fully debugged and tested for noise, distortion, and frequency response. Sometimes there are more controls/options and often a compressor can be set-up as a limiter (which is a kind of fast-compression).
As far as I know, these basic-compressors are analog. I don't know if they are optical or not (I assume not). But, it doesn't matter what's inside as long as it does what a compressor is supposed to do.
If you "go digital" you can do all kinds of things with DSP (digital signal processing) including simulating the operation of your favorite vintage optical (or other) compressor. And, you can do things in digital that aren't possible with analog.
If you don't need real-time processing you can do it in software. Audacity (free) comes with a compressor effect or there are other free & non-free plug-ins that work with Audacity or DAW software. Again, if you don't need real-time processing you can do things with an audio file that are impossible in real-time like "look-ahead" processing. Look-ahead is great for limiting because a real-time limiter has to kick-in (and distort the waveform) before you hit the limit. With look-ahead, you can leave the signal unmolested unless you go over the limit, and when you do go over the limit it can cut the level without changing the shape of the waveform.
==========================================
Way back in the analog days I built an expander (the opposite of a compressor) with an NE570 chip. It "worked" and it was "fun" but it was way too aggressive (2:1 linear expansion over the full dynamic range) and I was too inexperienced to improve it.
DVDdoug:
If you "go digital" you can do all kinds of things with DSP (digital signal processing) including simulating the operation of your favorite vintage optical (or other) compressor. And, you can do things in digital that aren't possible with analog.
There are many analog compressors with a digital control path, from the popular RNC1773 to the (very high end) Hoef DM or Cranesong Titan. And they do things you cannot do in digital (most notably, tame a signal BEFORE it is digitised). So the concept is feasible and has been explored.
But I agree that it is unlikely that a such minimal approach as above will result in something better sounding than the very affordable and pretty excellent RNC - if the original poster wants to discover the benefits of buffers, envelope followers and circuit protection iteratively, his experiment will be very much more expensive before it will even begin to work for more than a few hours...
It's cool in concept that an LED and LDR with arduino can outperform an actual opto-compressor but in reality it's not that simple.
I also like to compress a bit going to track for various reasons (good signal to noise being one). It's also a good tool in live performance so the levels are matched and easier to mix with a strong signal. You can also use it as a cool tool to duck based on other signals. Compressors are very important tools for engineering sound.
10 (1024 steps) bit ADC is little disconcerting if you're converting it to digital, compared to processing that works in 16 (65,536) - 24 (16,777,216) bit it's night and day. Many signal processors with 32 bit processing had hard time processing good reverbs back in the day. Not sure what the Arduino would add to the mix.
Might be cool might not... again I have no idea what the device does but it's not really a compressor.
wolframore:
10 (1024 steps) bit ADC is little disconcerting if you're converting it to digital,
For a control path that would do, analog limiters only have a one bit control path (over/under threshold), and even most analog compressors make do with three or four envelope switching points (which could be transported in two bits). A far more critical issue is that the maximum sample rate on the UNO is only 9.6kS/s - and that is the maximum, real time software will steal from that.
Both can be worked around if you extract the envelope prior to digitising, as the envelope needs much less resolution in either domain - even fast compressors can't have reaction times that reach into the audio domain, or they act as a filter or distortion, and ten times 20Hz, i.e. 5ms (200S/s), should be enough to pipe a envelope into the compressor.
But if you want to sample audio directly, and digitally extract its envelope in real time (perhaps even applying a filter), you need much more than a classic Arduino - a external audio grade ADC and a 32bit board (Zero or the like), perhaps even a MRK Vidor (with DSP code outside the Arduino domain doing the hard work) would be necessary.
Stuff that I'm possibly looking to add is an output buffer/opamp (ie. make-up gain) and a knob for the peak hold.
It's purely an experimental project and designed to be used with a computer but works equally well as stand-alone (the peak hold could be automated via serial and if I added a control for that it would require a bypass I think)