@george I'm not sure on what version of RetroPie you're on or which hardware you're using, but I've experienced no such thing on the RPi4. TiMidity never hangs and my Pi hasn't been restarted for over three months. TiMidity is pre-installed on RetroPie v4.7.1 but isn't configured as a service/daemon. You can execute "sudo apt-get -y install timidity-daemon" to accomplish that. By default it's configured to be started/stopped through script whenever you start an application (like DOSBox) that needs it. I've opted for installing the daemon instead and removed the start/stop commands from the scripts, but that's a personal choice.
Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first