Legacy Locomotive Question

I have a Lionel Legacy equipped D & H GP38-2 and it has a spot inside it for a 9v battery. I haven’t put a battery in yet.

Will that battery do the same thing as the battery inside an MTH ProtoSound 2.0 locomotive? Will it have sounds even when it isn’t receiving power from the track?

From my understanding the battery is for when you go over a dead spot on the track like a switch that you donot lose sound it stays the same.

Got a bunch of TMCC and several Legacy engines. No batteries to worry with. Why they are better than MTH.