So you have a stock radio and you have now added an amp or replaced the one which was there originally. Now you hear buzzing or alternator whine. To try and compensate you've adjusted the gain extremely high and most of the noise is gone. While you have mostly gotten rid of the issue this could be doing more damage than good.

Pioneer GM-D9705 (5 Channel AMP with Speaker/High Level Input)

This is because the stock radio has a thing called high-level inputs and the voltage level is significantly higher than with that of a standard preamp output connection found on most aftermarket radios with RCA's or RCA ports.

To resolve this you can either purchase amp which accepts high level (also known as speaker level) inputs or get a L.O.C (Line Output Converter) to reduce the voltage down to an acceptable level.



Ds18 Line Out Converter High-Level Speaker Signal to Low-Level RCA Adapter

To quote Crutchfield:



You'll want an amplifier with speaker-level (often called high-level) inpu…