Crackling sound can come from the connection or from the speaker itself.
1. Move the phone closer. Distance and walls cause crackles and dropouts.
2. Play music stored on the phone to rule out a slow internet stream.
3. Lower the phone's volume a little and raise the speaker's. Max volume on both can distort.
4. Turn off the phone's equaliser and bass boost.
5. Try a cable (AUX) if the speaker has one. If the cable also crackles, the speaker driver is damaged.
6. Check the grille for sand or metal bits stuck to the magnet.
A torn speaker cone usually needs a replacement driver.