Refactor logic to play sound effect.