flutter_soloud
flutter_soloud copied to clipboard
fix: audio speed discrepancy
Description The audio files for some reason play faster than their actual speed. This speed discrepancy causes a very small noticeable drift between audio and visual elements in my app. The issue persists across multiple audio files, all of which play correctly in other media players. For example, when starting the audio in my app at the same time as the same file in my editor, it slowly but surely outpaces it.
I use the songs position to track the tempo of the song that I am currently playing so that I can track every beat of the song. This beat works completely fine, lining up with song audio that does not have any speed discrepancy. For example, when I play the song audio in the app side by side with the original audio file in the editor, the beat tracker matches the original song file and not the song when playing in my app. Don't really understand what is going on behind this, why the song position remains the same but the actual song audio plays faster.
Steps To Reproduce Set up a page that plays a given song and allows you to pause and unpause(ideally a song with noticeable beats and that is over 2 minutes so that you can start to hear the difference in speed). After playing the song, use the pause buttons on both the app page as well as the editor to sync up the music with each other.(tap the pause button twice quickly in succession for whichever audio is further ahead to delay it by just a little until it is matched up). After two or so minutes since the audios have been synced up, you will be able to hear the audio playing in the app be noticeably ahead than the one playing in the editor.
Expected Behavior I expect the audio to play at the exact same speed as the original audio especially when considering the fact that getting the current position of the audio will reflect the position of the original audio and not the one playing.