Yes charge the battery or fit a new fully charged one.
What is very likely happening is that battery charge and/or capacity has reduced to such a low level that when the starter is operated, the current drain drops battery voltage to such a level the solenoid that piggy backs the starter itself drops out. Current draw is removed and battery volts rise just enough for the start sequence to repeat. This typically happens several times a second hence machine gun sound.