This has to do with the sound not running on a separate thread. As noted above there’s a fix for it but I have not been able to locate it and every time I recompile Cave Story on the RPi my audio gets messed up.
Sorry it doesn’t help, I just wanted to add extra detail.