Brought in code from GitHub for fixing sound playback.