Music Loop skips at end?

Started by tinytim42, Tue 19/09/2023 14:25:16

Previous topic - Next topic

tinytim42

I am trying to loop cleanly the end of a music file with its own beginning, but when I use music.Play(eAudioPriorityVeryHigh, eRepeat), there is a gap of about a tenth of a second between the end of the audio file and the beginning of its loop.

I also tried to put it into an AudioChannel and then use channel.SeekMs() to bring it back to the beginning when it reaches the end of the file, and that just stops it playing altogether. I've experimented with using SeekMs just before the end of the loop, and that improves things, but there's still a noticeable "click" when it loops.

I'd just like it to smoothly interpolate the end of the looping audio file with its beginning. Is there something I can do (or some other audio capability) that would remedy this?

Perhaps this belongs in the beginner's forum, but I haven't found a workaround and I've tried several things.

eri0o

This is better at the beginner forums

Please tell specifically exactly which ags version you are using and please share the audio file you are using.

tinytim42

Sure thing. I am running 3.6.0 - Patch 5, and I don't see the capability to attach files in the forums? Here's a link.

eri0o

Please try using ogg instead, mp3 can't loop perfectly due to how it's compression works.

tinytim42

Thanks, eri0o! I'm afraid the issue happens with .wav files as well (which aren't compressed). Something funky under the hood, I assume.

morganw

I don't think it is an issue of compression, it is more an issue of alignment of the data. Wave files have their own issues so a .wav file isn't a good test.

I converted your file to .ogg and it loops with no problems when I've tested it:
au000003.ogg

Quote from: tinytim42 on Tue 19/09/2023 14:25:16I also tried to put it into an AudioChannel and then use channel.SeekMs() to bring it back to the beginning when it reaches the end of the file
This approach will not work because the scripting commands won't run often enough to stay in sync with the end of the audio playback. You need to do it the first way that you tried (usinge eRepeat).

SMF spam blocked by CleanTalk