Replies: 4 comments 15 replies
This comment was marked as off-topic.
This comment was marked as off-topic.
-
MP3 files are not generally gapless, they contain some padding samples (there are some workarounds). The AAC files might work better and if possible try Opus, which is truly gapless. |
Beta Was this translation helpful? Give feedback.
-
Those are browser bugs, please report the bugs to the browser vendors. mp3 files can be gapless, aac files can also be gapless, what matters is how the browser uses the codec implementation, and more importantly, if it skips the encoder delay and the padding appropriately. |
Beta Was this translation helpful? Give feedback.
-
Thanks for all replies. In the end my solution was to use very long samples, and do a fade at the beginning and at the end. Obviously the fade is perceived, but not often, and the final experience was acceptable for the user. Please note this: webaudio does not seem to play ogg files on iOS (or, at least, I had no success). |
Beta Was this translation helpful? Give feedback.
-
I need to control the volumes of various audio loops being played, and am trying to do this with webaudio. The web application must work on both Android and IOS:
<script>The files have been edited on a DAW in order to be perfect loops. However, during webaudio playback there is always a gap between the end and the beginning. The gap appears variable and device dependent. If multiple files are played, the gaps often interrupt the whole mix (so even the files that are far from their ends).
At the moment I got the best behavior using AudioBuffer (see minimal code below). Using ogg instead of mp3 the situation improves (although not entirely). However webaudio does not seem to play ogg files on iOS. :-(
I can't find a solution. Is there a webaudio code example that plays loops without any glitches on both Android and iOS?
var source;
var audioBuffer;
var audioCtx
createAudio = async() =>{
audioCtx = new AudioContext();
source = audioCtx.createBufferSource();
const arrayBuffer = await fetch(
"test.mp3",
).then((res) => res.arrayBuffer());
audioBuffer = await audioCtx.decodeAudioData(arrayBuffer);
}
function startAudio(){
</script> TESTsource.buffer = audioBuffer;
source.loop = true;
source.connect(audioCtx.destination);
source.start();
}
Beta Was this translation helpful? Give feedback.
All reactions