You guys I am pissed-off about sound (Computer sound) so give me a break here

Youtube has recently added the absolute worst automatic gain control algorithm I have ever heard to the audio encoding process on all uploads. It seems to be a basic single-band compressor with an extremely long attack time (about 200ms) and a very high ratio. There WAS a problem with the audio level differing wildly between videos but that could have been solved easily and harmlessly using basic normalization.

Some have suggested that this was implemented to ruin the audio quality for people uploading songs and albums with a static image but I would rather assume incompetence.

I thought I would try mixing in a "spoiler signal" (a 20 KHz sine wave) to the audio, its amplitude inversely proportional to the instantaneous program level, to fool the level-detection in the compression algorithm into doing nothing. (In real-world [analog] signal processing this generally consists of a full-wave rectifier followed by a subsonic lowpass, to produce a DC voltage representing the instantaneous amplitude of the signal.) Since it is a single-band compressor all frequencies will cause it to react equally. The 20 KHz signal will also be inaudible (bar aliasing) in the final encoded audio due to MP3's rapid rolloff around 16KHz.

I used Audacity 1.3.0-beta, an inexcusably terrible multitrack audio editor, and the rather decent CMT and SWH LADSPA plugins on Linux. You should be able to adapt this technique to other (actual) software if you are a clever guy.
(I am thinking about building a box of op-amps to do this in hardware myself)

Some videos I made to demonstrate the AGC are here. "agc test 3" was done using this technique. That video had a small amount of aliasing due to being converted by youtube to 44.1 KHz. It would be best to originate your audio at that rate, as inconvenient as it may be.



01. Start with two copies of the same stereo track and use "Diode Processor" set on 2 (fullwave rectifier) on one of them.



02. Apply "Low Pass Filter (One Pole)" set at around 10Hz to the rectified copy. Do it at least twice to get rid of any audible frequencies.



03. Normalize both copies to -3 dBFS. It is very important that you uncheck "remove DC offset"



04. You now have one stereo track with the original program and another with a control voltage representing the level. Create a third stereo track (make sure it is at the same sampling frequency as the others!) and fill it with a 20KHz (or so) tone.



05. Split up the track with the tone (click on the track titles for options) and arrange it as seen here. You need a stereo pair with the left channel control voltage and the tone and another for the right.



06. Apply "Ringmod with two inputs" set on 2 to both of the CV/tone pairs. This acts like a VCA, producing a tone that follows the main program in amplitude. We need it the other way, so...



07. Use "Matrix: Stereo to MS" on both pairs. This plugin takes L and R and outputs L+R (stereo sum) in the left and L-R (stereo difference) in the right. Notice that the right-channel output now consists of a tone that is loud when the main signal is quiet and vice versa. This is what we need to fool the compressor.



08. Split the pairs and discard the former left channel on both (the sum from the MS matrix). Make sure you change the one for the left to output in the left channel. Decrease the volume of all tracks to -6dBFS to avoid clipping. It is worth noting that anything you put into youtube above -6dBFS will probably end up clipped due to the slow AGC, and clipping will cause audible intermodulation of our spoiler tone and the audio. Export the audio track as a stereo WAV.



09. For reference here is what it should look like. The inaudible spoiler tone takes up space when the audio is quiet. The bottom view is the detected level of the first. It now varies very little, only a couple dB, and this should sufficiently confuse any single-band compressor and cause it to stop working.

Meats P. Camera, The Campaign For Real Sound 2008-08-05

You can contact me on youtube (MeatsPCamera) with any questions. I do not think that the LADSPA plugins will work on Windows but this should work on any Linux distro as long as you can install everything.