Page 1 of 1

Minor bug with SeekMusic

Posted: Wed Mar 04, 2026 11:03 am
by Bugala
I am currently making an entro, and trying to time things right.

To avoid needing to watch the whole thing from beginning, I am using SeekMusic to jump to a certain location in the Music, and then timing is based upon using: GetAttribute(#MUSIC, 5, #ATTRPOSITION)

I have only one SeekMusic in the whole program, and it is like this:

Code: Select all

SeekMusic(5, 225000)
For some reason, it sometimes randomly keeps jumping to wrong location, seems to be at bit earlier location than it should.

Sometimes (very rare) it also seems to affect the GetAttribute command, since somehow while the music goes at normal speed, animation seems to slow down to half or something, which I suspect is that when using GetAttribute #MUSIC #ATTRPOSITION, it somehow moves the position index slower than it should.

And this behavior is not affected by changes in code, since sometimes, even without changing anything in the code, it one time works right, next time not.

I would say this problem occurs about once every 5-10 times.

Program is large, so it could be that something is colliding somewhere somehow, as in, something else causes this command to bug.

Just letting you know about this in case you take a look at the command. The problem is minor, so just reporting about it.

Windows 11, Hollywood 11.

Re: Minor bug with SeekMusic

Posted: Wed Mar 04, 2026 11:10 am
by Bugala
Just took a try with this:

Code: Select all

OpenMusic(5, "sfx/musicfile.mp3")
PlayMusic(5)
SeekMusic(5, 225000)
WaitLeftMouse()
And bug doesnt happen.

Re: Minor bug with SeekMusic

Posted: Wed Mar 04, 2026 11:25 am
by Bugala
Actually, I just took that SeekMusic line off from my program, and noticed that timings I have done are all off.

It appears it is actually the other way around. It is systematically jumping to wrong location, and only randomly jumps to, I assume, right location, since my animations are happening too late, and randomly it jumped to earlier spot, so it might be the right spot actually.

Re: Minor bug with SeekMusic

Posted: Wed Mar 04, 2026 11:43 am
by Bugala
Actually, This isnt such a minor after all. Here is what I tried:

First I did:

Code: Select all

OpenMusic(5, "musicfile.mp3")
PlayMusic(5)
SeekMusic(5, 124800)
I kept changing the Seekmusic location number to find easily recognisable spot, which in this case was 124800.

Then I did following:

Code: Select all

OpenMusic(5, "sfx/musicfile.mp3")
PlayMusic(5)
Local time
Repeat
time = GetAttribute(#MUSIC, 5, #ATTRPOSITION)
If time > 124800 Then DebugPrint("location reached")
Forever
And this Debugprint happened several seconds after the easily recognisable location actually played.

It seems SeekMusic and GetAttribute #MUSIC #ATTRPOSITION, are offsync towards each other.

I assume this is not supposed to be so.

Re: Minor bug with SeekMusic

Posted: Wed Mar 04, 2026 7:40 pm
by Bugala
And more info. I tried with a different file, and it works fine. So has to do with the specific MP3, going to email you the file.

Re: Minor bug with SeekMusic

Posted: Wed Mar 04, 2026 8:24 pm
by Flinx
Do you use the avcodec plugin? This has such problems mainly with MP3s with variable bit rate, but for me it's more of an issue on Linux.

Re: Minor bug with SeekMusic

Posted: Wed Mar 04, 2026 10:14 pm
by Bugala
No, not using avcodec plugin for this test.

Re: Minor bug with SeekMusic

Posted: Wed Mar 04, 2026 11:08 pm
by Flinx
Then you could try it. If something changes, it will probably help to narrow down the problem.

Re: Minor bug with SeekMusic

Posted: Fri Mar 06, 2026 1:05 pm
by Bugala
AvCodec seems to fix the issue. Compariosn between using SeekMusic with AvCodec on and without it, result in SeekMusic jumping to completely different locations, several seconds apart when jumping to location at about 2 minutes.

Thanks from the suggestion Flinx, can use this to solve my problem.