DIY Electronics
— Building circuits, programming microcontrollers, and making things blinkSTM32 ADC calibration for accurate voltage readings
DIY Audio Compressor with VCA IC
Built an audio dynamics compressor using the THAT2162 VCA IC and an Arduino as the gain control computer. This taught me a lot about control loop design for audio.
The compressor architecture: input audio goes into the VCA (variable gain amplifier), the output goes to a peak detector, the Arduino reads the peak detector via ADC, computes the required gain reduction, and writes to a DAC that controls the VCA gain pin. Attack and release time constants are implemented in firmware with adjustable RC-equivalent digital filters on the gain control signal.
The THAT2162's gain is in dB, linear with control voltage — 30mV per dB. This simplifies the gain calculation: just work in dB throughout. Ratio (2:1, 4:1, ∞:1) is implemented as a slope in the gain reduction curve. A soft knee is implemented by blending the uncompressed and compressed gain in the threshold region.