oh wait - you're using the random battle encounter, are you? Battles every X steps?
If you had monster events on screen, moving around, and when you touch one it launches a battle, you could simply add a Memorize BGM command before the Battle Processing command, and a Restore BGM command after it.
If you're using random battles, have a search around on the forum, because I KNOW this question has been asked many times before. I just tried to make a few script mods to do this, and it didn't work as I expected. I don't have enough time to explore further right now, but maybe someone else has already provided the answer in another thread