How to set the shortest attack time in your compressor

There are two ways to approach setting the attack time of the compressor. One is to set a short attack time so that the compressor reacts quickly. The other is to intentionally set a long attack time so that the initial transients of notes or drum hits get through uncompressed. Either can be useful depending on what you want to hear.
Here I will concentrate on setting a short attack time.
The question is, how short is short?
How short is short?
Well this has to be considered with respect to the period of the audio waveform. The period is the time taken for one complete cycle and is the inverse of frequency. So a frequency of 1000 Hz has a period of 1 millisecond. A frequency of 20 Hz has the period 50 milliseconds; 20 kHz has the period 50 microseconds.
Now look at this compressor...
The longest available attack time is 300 milliseconds, the shortest is 10 microseconds.
So suppose you want to compress a sine wave of frequency 20 Hz. An odd thing to want to do perhaps, but useful as an illustration.
The period of this sine wave is 50 milliseconds. So if you set an attack time of 50 milliseconds or less, then the compressor will react within one cycle of the waveform. This will change the shape of the sine wave leading to distortion. Actually 50 milliseconds isn't a hard and fast barrier. There will be distortion above 50 milliseconds, and it will get worse the shorter the attack time gets. This will depend to an extent on the individual compressor and how fast the attack accelerates.
Reality
Let's link this to reality... The frequency of the lowest string of a conventional bass guitar is 42 Hz. This corresponds to a period of roughly 24 milliseconds. So if you're compressing bass guitar and you set an attack time of anything less than around 30 milliseconds you can expect distortion on the very lowest notes. Again, the shorter the attack, the more distortion you'll hear.
So if we take 40 Hz or so as the lowest frequency of interest in our music, even though a kick drum will probably go lower, then we can consider 30 milliseconds to be the shortest safe attack time for anything. You can judge the kick drum on its merits - a little distortion probably won't do it much harm. We'll round up that 30 milliseconds to 50 to be completely safe.
But often you will be compressing a vocal or an instrument that doesn't go anywhere near 40 Hz. In this case you can try for a shorter attack, if it works to the benefit of your sound.
Action
So start at 50 milliseconds and work down. At some point you will hear distortion and you can back off to a safe attack time. If you don't hear distortion, well it's still happening but it's masked by the signal. In this case the ancient rule of 'if it sounds good then it is good' should apply.
Main image credit: Pedronchi CC BY 2.0