Unplug the generator. If the noise stops, it most likely has a defective diode.
To reduce the number of repeat failures, replace the battery at the same time unless it is less than about two years old. Due to their design, these generators produce huge voltage spikes that can destroy the internal diodes and voltage regulator, and interfere with the many computers on the car. As the battery ages it loses its ability to dampen and absorb those spikes.