Sounds like a dying power supply. If you didn't have the issues with the audio ports, it could also be a dying voltage regulator for your cpu, but the case is quite clear.
Do you really need to run OS 9? What are the specs of your G4? (I'm asking because we can gauge by the specs what your requirements are and whether it's worth getting the G4 fixed or getting a different OS 9-capable Mac is the better option.)