Android Question

A few weeks ago, my android started doing this thing where the sound was really distorted. At first, I thought it was the headphones, but every other pair I used did the same thing, as did the phone's speaker. This was the case with every program I used.

Suddenly, 2 days ago, I turned my phone on for the first time in two weeks, and the problem was gone. I was able to listen to music.

Now it's suddenly started up again. What could be the problem, and how do I fix it?
To be clear, it sounds very staticy, as though the radio were at the wrong frequency, or almost like the sound you'd expect from water damage to the speakers.