Web Audio api: Wav loops perfectly, Ogg does not

I made this small test to see why I was getting gaps in my seamless audio project.
Both files seamlessly loop in all audio applications.

const audioContext = new (window.AudioContext || window.webkitAudioContext)();

async function loadAndLoopAudioFile(url) {
  const response = await fetch(url);
  const arrayBuffer = await response.arrayBuffer();
  const audioBuffer = await audioContext.decodeAudioData(arrayBuffer);

  const source = audioContext.createBufferSource();
  source.buffer = audioBuffer;
  source.loop = true;
  source.connect(audioContext.destination);
  source.start(0);
}

loadAndLoopAudioFile('path.to.audiofile/my_file.ogg'); 

I tested (both Chrome and Firefox) with ogg, flac, and wav. Flac and Wav looped seamlessly, ogg did not. Thee was always a small hiccup. I tried different bitrates with .ogg but it made no difference.

Is there not a compressed audio format that loops seamlessly in web audio api?

Read more here: Source link