i tried to simulate it with a variable that was increasing itself every frame and once it reached certain point the music positon was changed, but that doesn't work right if the framerate isn't perfect 60fps all the time, and all it'd need would be a slight hickup or pause and the faked synchronization would be over.
Use timedelta for this. Working with timedelta
. However, I doubt this is a very accurate method.
To make a perfect loop, I always manually cut the file. But first things first, what format are you using? OGG is the best format if you want things to loop (it's also the best format overal). Also, when you want to loop, you want to make sure that the waveform is at the 0dB line at the beginning and the end of the file. This is usually a pretty good guideline to make good loops.
I do that with Audacity. Be sure to remove all the silence at the beginning and the ending by zooming in an incredible amount. Also, like I said, make sure that the waveform is at the 0dB line at the beginning and the ending. Then save the file as an OGG file. For me OGG has always looped perfectly, unlike MP3 for some reason.
I hope that helps you a bit