Repository: godot
Issue: [Godot 4] Audio pop on looping with loop offset > 0
Labels: bug,confirmed,topic:audio

**Affects ogg vorbis & wav quite noticeable. As well as mp3, but to a lesser degree** (see [here](https://github.com/godotengine/godot/issues/64775#issuecomment-1421559403))

### Godot version

4.0 Alpha 1, 4.0 Alpha 14, 4.0 Beta 17, and https://github.com/godotengine/godot/pull/64488, https://github.com/godotengine/godot/pull/52626, https://github.com/godotengine/godot/pull/71780

### System information

* Distribution: Ubuntu 20.04.1 (OS: X11)
* Graphics Card: Nvidia GeForce GTX 970 (driver: nvidia 510.73.05)
* Audio Drivers: PulseAudio, ALSA
* CPU Name: Intel(R) Core(TM) i7-10700KF CPU @ 3.80GHz

### Issue description

**NOTE**: Looping only works without audio pop, if there is **no loop point** (i.e. offset == 0 seconds).

What doesn't work
* Godot 4
  * looping OGG Vorbis and WAV file without audio pop / tick / click (mp3 works, but has almost double the file size)
  * affects some of our files, not all
  * I also tested https://github.com/godotengine/godot/pull/64488, but same issue there. I mentioned the pop/tick there last week: https://github.com/godotengine/godot/pull/64488#issuecomment-1216875625
  * tested for PulseAudio (default) and ALSA, made no difference
* looping works fine in Godot 3.5 and Audacity

in MRP, you'll find 2 projects: one for 3.5, the other for 4 Alpha 14. And example audio file is in both projects, trimmed down to the necessary parts: end of file and loop point at 2 seconds

waveform looks good in Audacity (defaults to ALSA): left part shows end of file and the loop point, right side shows the same, but "merged"
![waveform](https://user-images.githubusercontent.com/6639237/186124297-8bf6347e-d71e-493a-9543-821569b72b09.png)

For testing purpose, I also tried manually editing the sample at the loop point down a pixel or two so it's perfectly on the 0 line, but that made no difference

### Steps to reproduce

Open MRPs and play game/scene (has an audio player which seeks towards end of file, shortly before looping). Or use the Editor's preview functionality

For some audio files, the pop only appears on my good headphone (HyperX HX-HSCA-RD Cloud Alpha), but not on my ~10-year-old cheap 10 EUR / USD Logitech stereo speakers who cannot reproduce high quality audio.  
For the MRP, I used one file where it's audible on both, headphone and speakers.

Audio file is stereo 44100Hz 32-bit float.  
I also tried setting format to 16-bit PCM in Audacity, but after exporting I see no difference in the meta data using exiftool and mediafire, except that that the file size increased by 21 kB… And the pop did not disappear. Maybe the conversion does not work/export in Audacity…

### Minimal reproduction project

The godot 4 zip was created using using [this PR](https://github.com/godotengine/godot/pull/71780)

[godot_3.5.zip](https://github.com/godotengine/godot/files/10681634/godot_3.5.zip)
[godot_4.zip](https://github.com/godotengine/godot/files/10681651/godot_4.zip)

---

more testing files for PR: https://github.com/godotengine/godot/pull/80452
1. [cooking_S00](https://github.com/godotengine/godot/files/12385918/cooking_S00.tar.gz) loops at second 9.0
2. [sweep_S00](https://github.com/godotengine/godot/files/12386492/sweep_S00.tar.gz) loops at second 1.0
3. [sweep_S00 low](https://github.com/godotengine/godot/files/12386501/sweep_S00.quality-5.tar.gz) loops at second 1.0 (_no pop_, for comparison sake with 2.)
   * it's basically 2. re-exported with Audacity with Quality setting 5 

or all bundled: 
[all_bundled.tar.gz](https://github.com/godotengine/godot/files/12386514/all_bundled.tar.gz)