AudioBuffer Node VS MediaElement

238 views Asked by At

I am working with WebAudio in HTML5. I am working with a team of devs. We are having issues with looping MP3 files. The files are authored in MP3 and printed without gaps.
I still have a slight bump during playback of the loop.

Do MediaElements buffer into RAM? I am wondering if AudioBuffer source nodes behave differently than MediaElement nodes while looping.

Am I looking in the right place?

I appreciate any insight.

1

There are 1 answers

0
HankMoody On

AudioBuffer looping should be perfect to a single sample, whereas MediaElements might introduce gaps during looping.

Gapless looping of MP3 tracks is also difficult, but not impossible. MP3 files contain an additional padding that is decoded as audio data by decoders. I would recommend one of these two options to work around the paddings:

  1. Prepare seamless MP3 loops with a special software. You can read more about that here: https://www.compuphase.com/mp3/mp3loops.htm

  2. Switch to a different format: AAC (best support in all browsers, but there still might be some issues with paddings, can be overcame), OPUS, OGG. Read more here: https://en.wikipedia.org/wiki/Gapless_playback#Prerequisites