move play_single_sound() definition to page end

This will block page load while the script evaluates. Probably not noticeable, but could be responsible for flashing (a.k.a. jank)