Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed effect doesn't affect TrackPosition #81

Closed
SKProCH opened this issue Sep 18, 2021 · 5 comments
Closed

Speed effect doesn't affect TrackPosition #81

SKProCH opened this issue Sep 18, 2021 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@SKProCH
Copy link
Collaborator

SKProCH commented Sep 18, 2021

Describe the bug
When the effect that changes the playback speed is on, the TrackPosition changes at the normal speed.

To Reproduce
Steps to reproduce the behavior:

  1. Apply Timescale effect with changed speed

Expected behavior
TrackPosition must be actual track position.

@angelobreuer angelobreuer self-assigned this Sep 19, 2021
@angelobreuer angelobreuer added the bug Something isn't working label Sep 19, 2021
@angelobreuer
Copy link
Owner

angelobreuer commented Sep 19, 2021

Hello @SKProCH,

I've recently pushed a prerelease version of Lavalink4NET (2.0.1-preview.3). You may see there a new property on the LavalinkPlayer class called Position, which also offers more access to the underlying data for the track position and synchronization time. The old member TrackPosition will now include the speed of the track when using the timescale filter. Now it is marked obsolete because the same functionality can be used using the new property.

I was unsure how the speed and rate of the timescale effect are correlated to each other, but I think by looking at the source code of SoundTouch (the filter library that Lavaplayer uses for time stretching) includes speed and rate both. So I used a simple multiplication for calculating the actual time stretch (e.g., rate = 2, speed = 0.5, stretch = 1?) (Rate modifies pitch/tempo by modifying the sample rate, speed adjusts only the speed while preserving the same pitch level).

Could you try out the latest release, and tell me if this works for you?

Thank you!

@SKProCH
Copy link
Collaborator Author

SKProCH commented Sep 20, 2021

Hello, @angelobreuer

Seems like this is not working properly.
Here is video. As you can see at the end of video, track length is 2:35 and position is 0:55.
I looked at the code and I cannot say what the problem is, but the time is calculated incorrectly.
As for the player control panel, the time is displayed in it correctly, only, perhaps, with a delay of ~ 0.5 seconds, which is not critical in this case.

@angelobreuer
Copy link
Owner

I see. I think I have found the mistake in Lavalink4NET why the track position is not properly calculated.

The Lavalink server sends about every five seconds a player update (in the following sometimes called 'synchronization') which contains a timestamp where the payload was generated, and the relative offset of the track position. The track position sent by the Lavalink server simply represents the time when the track has been started; and not the actual position in the track. For example, when using 2x speed, the timestamp "flows" in natural time, and not the expected 2x speed (which is also the reason why this issue occurred at all). When using a constant time scaling, like 2x which is not modified while playing the track, it is relatively easy to calculate the position of the player by multiplying the natural position by 2. But if the speed of the track changes while playing, it becomes harder, as some parts are played faster, slower, or exactly the same as the natural time. This makes it a lot harder for Lavalink4NET to calculate the position of the track because Lavalink4NET needs to track every single change in the time scale filter options (rate & speed), which is not possible with multi-cluster environments or the already implemented Stay Online feature (as some nodes are not able to restore the exact player state). If Lavalink4NET would calculate each tile of the track with the position during its period, this would also lead to a high error rate as Lavalink4NET does not really know when the time scale filter is really applied on the server-side (e.g., delays due to filter initialization or network latencies).

Another option would be to implement a property in the player update, that indicates the current position in the track (calculated from the actual sample position of the track, not the starting position), which is sent every five seconds for each player (which is also part of the current behavior) and instantly when the time-scale filter is updated (to reduce error rates).

I've done some tests and fixed the calculation error in Lavalink4NET by simply applying the time scale also on the timestamp reported by the Lavalink server. As said above this will only work if a constant time scale is applied from the beginning of the track and is not changed while playing the track. Using this, I could achieve an error rate between 0.6 and 0.0005 (the theoretical error rate sinks every second passed, as it benefits from resyncing and calculation errors that are based on the starting of the whole process, the practical error rate should be much lower but is hard to measure). The first sample can be ignored as the resync did not occur at this time (thus the explosive error rate).

Actual Test Runtime (The time offset since the test is running) Stretched Player Position (The actual player position as it would be shown to the user) Unstretched Player Position (The current player position without respecting time stretch) Stretched relative player position (The stretched relative position which is relative to the last player time synchronization) Unstretched relative player position (The unstretched relative position which is relative to the last player time synchronization) Applied Timescale time stretch factor (stretched) (The actual time scale stretch applied to the track; 1 = normal; 2 = 2x speed; 0.5 = 0.5 speed) Unstretched unsynchronized time (The natural time that passed since the last update) Stretched unsynchronized time (The stretched time passed since the last player synchronization) Expected track offset (The currently calculate track offset that is expected) Difference between actual track offset (The actual difference between the actual track offset and the expected track offset which indicates the error rate between the calculations from Lavalink4NET and this test) Expected stretched track offset Difference between actual stretched track offset (The actual difference between the actual stretched track offset and the expected stretched track offset which indicates the error rate between the calculations from Lavalink4NET and this test) Actual computed time scale Actual error rate
00:00:00.0000002 00:00:00.0625071 00:00:00.0208366 00:00:00 00:00:00 3 (True) 00:00:00.0209729 00:00:00.0630930 00:00:00.0000002 00:00:00.0204191 00:00:00.0000006 00:00:00.0607806 306394.5x -102130.5
00:00:02.0179276 00:00:05.6520084 00:00:01.8840030 00:00:00 00:00:00 3 (True) 00:00:01.8840155 00:00:05.6520468 00:00:02.0179276 -00:00:00.1339386 00:00:06.0537828 -00:00:00.4018200 2.8008774943164463x 0.06637416856118461
00:00:04.0187354 00:00:11.6543976 00:00:03.8848048 00:00:00 00:00:00 3 (True) 00:00:03.8848127 00:00:11.6544384 00:00:04.0187354 -00:00:00.1339403 00:00:12.0562056 -00:00:00.4018232 2.900013173298247x 0.03332894223391769
00:00:06.0262268 00:00:17.5269008 00:00:05.8423009 00:00:14.4000000 00:00:04.8000000 3 (True) 00:00:01.0423091 00:00:03.1269282 00:00:06.0262268 -00:00:00.1839317 00:00:18.0786800 -00:00:00.5518000 2.908434578001611x 0.030521807332796302
00:00:08.0415780 00:00:23.5729280 00:00:07.8576424 00:00:14.4000000 00:00:04.8000000 3 (True) 00:00:03.0576499 00:00:09.1729504 00:00:08.0415780 -00:00:00.1839402 00:00:24.1247328 -00:00:00.5518224 2.931379288990295x 0.02287357033656834
00:00:10.0537230 00:00:29.5883680 00:00:09.8627895 00:00:29.4000000 00:00:09.8000000 3 (True) 00:00:00.0628004 00:00:00.1884018 00:00:10.0537230 -00:00:00.1909401 00:00:30.1611712 -00:00:00.5728256 2.943024390069231x 0.018991869976923037
00:00:12.0612325 00:00:35.6109024 00:00:11.8703012 00:00:29.4000000 00:00:09.8000000 3 (True) 00:00:02.0703136 00:00:06.2109420 00:00:12.0612325 -00:00:00.1909387 00:00:36.1836992 -00:00:00.5728224 2.9525078137744214x 0.015830728741859534
00:00:14.0806324 00:00:41.6691008 00:00:13.8897004 00:00:29.4000000 00:00:09.8000000 3 (True) 00:00:04.0897084 00:00:12.2691264 00:00:14.0806324 -00:00:00.1909413 00:00:42.2418944 -00:00:00.5728256 2.9593184465209106x 0.013560517826363139
00:00:16.0920658 00:00:47.7094080 00:00:15.9031361 00:00:44.4000000 00:00:14.8000000 3 (True) 00:00:01.1031489 00:00:03.3094470 00:00:16.0920658 -00:00:00.1889363 00:00:48.2761984 -00:00:00.5668160 2.964777138805883x 0.011740953731372294
00:00:18.0939247 00:00:53.7150848 00:00:17.9050295 00:00:44.4000000 00:00:14.8000000 3 (True) 00:00:03.1050390 00:00:09.3151176 00:00:18.0939247 -00:00:00.1889041 00:00:54.2817728 -00:00:00.5667136 2.968679271667357x 0.010440242777547737
00:00:20.1050112 00:00:59.7062272 00:00:19.9020772 00:00:59.3400000 00:00:19.7800000 3 (True) 00:00:00.1220844 00:00:00.3662538 00:00:20.1050112 -00:00:00.2029389 00:01:00.3150336 -00:00:00.6088192 2.9697180372622722x 0.010093987579242625
00:00:22.1166157 00:01:05.7410560 00:00:21.9136851 00:00:59.3400000 00:00:19.7800000 3 (True) 00:00:02.1336923 00:00:06.4010772 00:00:22.1166157 -00:00:00.2029392 00:01:06.3498496 -00:00:00.6088256 2.9724724294051916x 0.00917585686493616
00:00:24.1267867 00:01:11.7715648 00:00:23.9238553 00:00:59.3400000 00:00:19.7800000 3 (True) 00:00:04.1438632 00:00:12.4315896 00:00:24.1267867 -00:00:00.2029371 00:01:12.3803648 -00:00:00.6088192 2.9747660346331988x 0.008411321788933779
00:00:26.1350660 00:01:17.7874304 00:00:25.9291441 00:01:14.3400000 00:00:24.7800000 3 (True) 00:00:01.1491558 00:00:03.4474680 00:00:26.1350660 -00:00:00.2059397 00:01:18.4051968 -00:00:00.6178240 2.976360786691719x 0.007879737769426964
00:00:28.1428359 00:01:23.8107072 00:00:27.9369026 00:01:14.3400000 00:00:24.7800000 3 (True) 00:00:03.1569107 00:00:09.4707328 00:00:28.1428359 -00:00:00.2059393 00:01:24.4285056 -00:00:00.6178176 2.9780469991654255x 0.007317666944858137
00:00:30.1507925 00:01:29.9065984 00:00:29.9688671 00:01:29.4000000 00:00:29.8000000 3 (True) 00:00:00.1688765 00:00:00.5066301 00:00:30.1507925 -00:00:00.1819389 00:01:30.4523776 -00:00:00.5458240 2.981897925236957x 0.006034024921014347
00:00:32.1577392 00:01:35.9274048 00:00:31.9758026 00:01:29.4000000 00:00:29.8000000 3 (True) 00:00:02.1758096 00:00:06.5274288 00:00:32.1577392 -00:00:00.1819416 00:01:36.4732224 -00:00:00.5458240 2.9830268167608x 0.005657727746399943
00:00:34.1686865 00:01:41.9602688 00:00:33.9867542 00:01:29.4000000 00:00:29.8000000 3 (True) 00:00:04.1867626 00:00:12.5602880 00:00:34.1686865 -00:00:00.1819402 00:01:42.5060608 -00:00:00.5458240 2.9840256458204797x 0.0053247847265067705
00:00:36.1786905 00:01:47.9842688 00:00:35.9947542 00:01:44.4000000 00:00:34.8000000 3 (True) 00:00:01.1947611 00:00:03.5842840 00:00:36.1786905 -00:00:00.1839417 00:01:48.5360768 -00:00:00.5518336 2.984747145560727x 0.005084284813090978
00:00:38.1815882 00:01:53.9929728 00:00:37.9976588 00:01:44.4000000 00:00:34.8000000 3 (True) 00:00:03.1976700 00:00:09.5930112 00:00:38.1815882 -00:00:00.1839407 00:01:54.5447680 -00:00:00.5518208 2.9855475524719006x 0.004817482509366422
00:00:40.1884541 00:01:59.9895808 00:00:39.9965290 00:01:59.4000000 00:00:39.8000000 3 (True) 00:00:00.1965379 00:00:00.5896143 00:00:40.1884541 -00:00:00.1919319 00:02:00.5653632 -00:00:00.5757952 2.9856726437258008x 0.004775785424733114
00:00:42.1917521 00:02:05.9994496 00:00:41.9998168 00:01:59.4000000 00:00:39.8000000 3 (True) 00:00:02.1998253 00:00:06.5994760 00:00:42.1917521 -00:00:00.1919413 00:02:06.5752576 -00:00:00.5758208 2.986352320741854x 0.004549226419381935
00:00:44.2043256 00:02:12.0371712 00:00:44.0123912 00:01:59.4000000 00:00:39.8000000 3 (True) 00:00:04.2123975 00:00:12.6371928 00:00:44.2043256 -00:00:00.1919402 00:02:12.6129792 -00:00:00.5758336 2.986973419632942x 0.004342193455685983
00:00:46.2065161 00:02:18.0617472 00:00:46.0205839 00:02:14.4000000 00:00:44.8000000 3 (True) 00:00:01.2205936 00:00:03.6617820 00:00:46.2065161 -00:00:00.1859395 00:02:18.6195456 -00:00:00.5578240 2.9879275317188436x 0.004024156093718756
00:00:48.2214165 00:02:24.1064576 00:00:48.0354838 00:02:14.4000000 00:00:44.8000000 3 (True) 00:00:03.2354900 00:00:09.7064704 00:00:48.2214165 -00:00:00.1859424 00:02:24.6642560 -00:00:00.5578368 2.988431897267058x 0.0038560342443140216
00:00:50.2213872 00:02:30.0853504 00:00:50.0284529 00:02:29.4000000 00:00:49.8000000 3 (True) 00:00:00.2284604 00:00:00.6853818 00:00:50.2213872 -00:00:00.1929403 00:02:30.6641664 -00:00:00.5788160 2.9884748066058995x 0.0038417311313668767
00:00:52.2333834 00:02:36.1214080 00:00:52.0404717 00:02:29.4000000 00:00:49.8000000 3 (True) 00:00:02.2404810 00:00:06.7214440 00:00:52.2333834 -00:00:00.1929183 00:02:36.7001472 -00:00:00.5787520 2.988919825553556x 0.0036933914821480895
00:00:54.2400454 00:02:42.1417984 00:00:54.0472651 00:02:29.4000000 00:00:49.8000000 3 (True) 00:00:04.2472747 00:00:12.7418256 00:00:54.2400454 -00:00:00.1929405 00:02:42.7201280 -00:00:00.5788160 2.9893284713216706x 0.0035571762261098483
00:00:56.2516306 00:02:48.2090880 00:00:56.0696962 00:02:44.4000000 00:00:54.8000000 3 (True) 00:00:01.2697195 00:00:03.8091596 00:00:56.2516306 -00:00:00.1819396 00:02:48.7548928 -00:00:00.5458176 2.990296875056276x 0.0032343749812412392
00:00:58.2621968 00:02:54.2407936 00:00:58.0802617 00:02:44.4000000 00:00:54.8000000 3 (True) 00:00:03.2802701 00:00:09.8408112 00:00:58.2621968 -00:00:00.1819401 00:02:54.7865856 -00:00:00.5458176 2.9906316199872505x 0.0031227933375831407
00:01:00.2751636 00:03:00.2557056 00:01:00.0852377 00:02:59.4000000 00:00:59.8000000 3 (True) 00:00:00.2852845 00:00:00.8558544 00:01:00.2751636 -00:00:00.1899397 00:03:00.8254848 -00:00:00.5698176 2.990546295257173x 0.0031512349142756024
00:01:02.2900681 00:03:06.3004032 00:01:02.1001326 00:02:59.4000000 00:00:59.8000000 3 (True) 00:00:02.3001377 00:00:06.9004144 00:01:02.2900681 -00:00:00.1899395 00:03:06.8701952 -00:00:00.5698048 2.990852251131188x 0.003049249622937289
00:01:04.3008839 00:03:12.3328256 00:01:04.1109441 00:02:59.4000000 00:00:59.8000000 3 (True) 00:00:04.3109472 00:00:12.9328416 00:01:04.3008839 -00:00:00.1899425 00:03:12.9026560 -00:00:00.5698304 2.991138129595758x 0.0029539568014139705
00:01:06.3088872 00:03:18.3298560 00:01:06.1099491 00:03:14.3399936 00:01:04.7800000 3 (True) 00:00:01.3299519 00:00:03.9898564 00:01:06.3088872 -00:00:00.1989412 00:03:18.9266688 -00:00:00.5968384 2.9909992276269115x 0.003000257457696165
00:01:08.3169614 00:03:24.3540736 00:01:08.1180225 00:03:14.3399936 00:01:04.7800000 3 (True) 00:00:03.3380260 00:00:10.0140784 00:01:08.3169614 -00:00:00.1989420 00:03:24.9508864 -00:00:00.5968384 2.991264093311972x 0.0029119688960093093
00:01:10.3269583 00:03:30.4080640 00:01:10.1360191 00:03:29.4000000 00:01:09.8000000 3 (True) 00:00:00.3360227 00:00:01.0080687 00:01:10.3269583 -00:00:00.1909422 00:03:30.9808640 -00:00:00.5728256 2.9918550309320002x 0.002714989689333258
00:01:12.3420452 00:03:36.4533248 00:01:12.1511076 00:03:29.4000000 00:01:09.8000000 3 (True) 00:00:02.3511111 00:00:07.0533344 00:01:12.3420452 -00:00:00.1909412 00:03:37.0261504 -00:00:00.5728256 2.992081910341125x 0.0026393632196249905

When using a non-constant time, like emulating a user changing the speed of the track while playing, the following happens (note that the error rate is incorrect in the following as the speed jumps are not respected in the example):

Actual Test Runtime (The time offset since the test is running) Stretched Player Position (The actual player position as it would be shown to the user) Unstretched Player Position (The current player position without respecting time stretch) Stretched relative player position (The stretched relative position which is relative to the last player time synchronization) Unstretched relative player position (The unstretched relative position which is relative to the last player time synchronization) Applied Timescale time stretch factor (stretched) (The actual time scale stretch applied to the track; 1 = normal; 2 = 2x speed; 0.5 = 0.5 speed) Unstretched unsynchronized time (The natural time that passed since the last update) Stretched unsynchronized time (The stretched time passed since the last player synchronization) Expected track offset (The currently calculate track offset that is expected) Difference between actual track offset (The actual difference between the actual track offset and the expected track offset which indicates the error rate between the calculations from Lavalink4NET and this test) Expected stretched track offset Difference between actual stretched track offset (The actual difference between the actual stretched track offset and the expected stretched track offset which indicates the error rate between the calculations from Lavalink4NET and this test) Actual computed time scale Actual error rate
00:00:00.0000002 00:00:00.0449634 00:00:00.0149887 00:00:00 00:00:00 3 (True) 00:00:00.0151367 00:00:00.0455838 00:00:00.0000002 00:00:00.0144960 00:00:00.0000006 00:00:00.0430155 217543.5x -72513.5
00:00:02.0098542 00:00:06.0720192 00:00:02.0240069 00:00:00 00:00:00 3 (True) 00:00:02.0240254 00:00:06.0720780 00:00:02.0098542 00:00:00.0141437 00:00:06.0295624 00:00:00.0424264 3.0211128747547957x -0.007037624918265317
00:00:04.0258458 00:00:12.1200032 00:00:04.0400015 00:00:00 00:00:00 3 (True) 00:00:04.0400246 00:00:12.1200744 00:00:04.0258458 00:00:00.0141452 00:00:12.0775368 00:00:00.0424296 3.0105411389576817x -0.0035137129858939797
00:00:06.0394040 00:00:17.8577056 00:00:05.9525735 00:00:14.7000000 00:00:04.9000000 3 (True) 00:00:01.0525842 00:00:03.1577532 00:00:06.0394040 -00:00:00.0868451 00:00:18.1182112 -00:00:00.2605440 2.956861041255064x 0.014379652914978558
00:00:08.0461967 00:00:23.8780224 00:00:07.9593408 00:00:14.7000000 00:00:04.9000000 3 (True) 00:00:03.0593491 00:00:09.1780480 00:00:08.0461967 -00:00:00.0868611 00:00:24.1385904 -00:00:00.2605872 2.967614251836523x 0.010795249387825723
00:00:10.0625867 00:00:29.9272032 00:00:09.9757350 00:00:29.7000000 00:00:09.9000000 3 (True) 00:00:00.0757568 00:00:00.2272710 00:00:10.0625867 -00:00:00.0868605 00:00:30.1877600 -00:00:00.2605856 2.9741041436194533x 0.008631952126848863
00:00:12.0775625 00:00:35.9721216 00:00:11.9907078 00:00:29.7000000 00:00:09.9000000 3 (True) 00:00:02.0907164 00:00:06.2721496 00:00:12.0775625 -00:00:00.0868613 00:00:36.2326880 -00:00:00.2605888 2.978424562075336x 0.007191812641554662
00:00:14.0805934 00:00:41.9812512 00:00:13.9937517 00:00:29.7000000 00:00:09.9000000 3 (True) 00:00:04.0937634 00:00:12.2812912 00:00:14.0805934 -00:00:00.0868580 00:00:42.2417792 -00:00:00.2605824 2.9814943452596254x 0.006168551580124859
00:00:16.0874869 00:00:47.9688960 00:00:15.9896323 00:00:44.7000000 00:00:14.9000000 3 (True) 00:00:01.0896389 00:00:03.2689172 00:00:16.0874869 -00:00:00.0978599 00:00:48.2624576 -00:00:00.2935808 2.981751189491256x 0.006082936836247943
00:00:18.1014553 00:00:54.0107968 00:00:18.0035984 00:00:44.7000000 00:00:14.9000000 3 (True) 00:00:03.1036047 00:00:09.3108144 00:00:18.1014553 -00:00:00.0978615 00:00:54.3043712 -00:00:00.2935936 2.983780955998604x 0.005406348000465244
00:00:20.1043666 00:01:00.0165376 00:00:20.0055128 00:00:59.7000000 00:00:19.9000000 3 (True) 00:00:00.1055185 00:00:00.3165561 00:00:20.1043666 -00:00:00.0988604 00:01:00.3131008 -00:00:00.2965888 2.9852482296060003x 0.004917256797999925
00:00:22.1163499 00:01:06.0524992 00:00:22.0174993 00:00:59.7000000 00:00:19.9000000 3 (True) 00:00:02.1175078 00:00:06.3525240 00:00:22.1163499 -00:00:00.0988578 00:01:06.3490496 -00:00:00.2965760 2.9865904771202776x 0.004469840959907434
00:00:24.1263729 00:01:12.0825600 00:00:24.0275207 00:00:59.7000000 00:00:19.9000000 3 (True) 00:00:04.1275301 00:00:12.3825912 00:00:24.1263729 -00:00:00.0988600 00:01:12.3791168 -00:00:00.2965824 2.9877073150933517x 0.004097561635549418
00:00:26.1392947 00:01:18.1303296 00:00:26.0434441 00:01:14.7000000 00:00:24.9000000 3 (True) 00:00:01.1434538 00:00:03.4303640 00:00:26.1392947 -00:00:00.0958590 00:01:18.4178816 -00:00:00.2875776 2.988998413947259x 0.0036671953509136435
00:00:28.1521910 00:01:24.1690112 00:00:28.0563375 00:01:14.7000000 00:00:24.9000000 3 (True) 00:00:03.1563538 00:00:09.4690624 00:00:28.1521910 -00:00:00.0958592 00:01:24.4565760 -00:00:00.2875904 2.9897850011034666x 0.0034049996321777742
00:00:30.1682050 00:01:30.2470912 00:00:30.0823645 00:01:29.7000000 00:00:29.9000000 3 (True) 00:00:00.1823737 00:00:00.5471220 00:00:30.1682050 -00:00:00.0858597 00:01:30.5046144 -00:00:00.2575872 2.991463310462124x 0.0028455631792919656
00:00:32.1831112 00:01:36.2917760 00:00:32.0972588 00:01:29.7000000 00:00:29.9000000 3 (True) 00:00:02.1972671 00:00:06.5918016 00:00:32.1831112 -00:00:00.0858603 00:01:36.5493312 -00:00:00.2575808 2.9919963238358385x 0.002667892054720511
00:00:34.1871327 00:01:42.3038400 00:00:34.1012805 00:01:29.7000000 00:00:29.9000000 3 (True) 00:00:04.2012902 00:00:12.6038712 00:00:34.1871327 -00:00:00.0858600 00:01:42.5613952 -00:00:00.2575872 2.992465665305707x 0.0025114448980976256
00:00:36.2030078 00:01:48.3124608 00:00:36.1041524 00:01:44.7000000 00:00:34.9000000 3 (True) 00:00:01.2041586 00:00:03.6124764 00:00:36.2030078 -00:00:00.0988620 00:01:48.6090240 -00:00:00.2965888 2.991807990053246x 0.0027306699822512437
00:00:38.2169953 00:01:54.3544192 00:00:38.1181416 00:01:44.7000000 00:00:34.9000000 3 (True) 00:00:03.2181505 00:00:09.6544528 00:00:38.2169953 -00:00:00.0988618 00:01:54.6509824 -00:00:00.2965760 2.9922395913736315x 0.0025868028754562067
00:00:40.2319594 00:02:00.3633152 00:00:40.1211072 00:01:59.6400000 00:00:39.8800000 3 (True) 00:00:00.2411149 00:00:00.7233456 00:00:40.2319594 -00:00:00.1108604 00:02:00.6958720 -00:00:00.3325824 2.991733542065565x 0.0027554859781450114
00:00:42.2369195 00:02:06.3781888 00:00:42.1260650 00:01:59.6400000 00:00:39.8800000 3 (True) 00:00:02.2460812 00:00:06.7382440 00:00:42.2369195 -00:00:00.1108614 00:02:48.9476736 -00:00:42.5694976 2.992125787014368x 0.251968553246408
00:00:44.2398965 00:02:12.3871232 00:00:44.1290407 00:01:59.6400000 00:00:39.8800000 3 (True) 00:00:04.2490475 00:00:12.7471424 00:00:44.2398965 -00:00:00.1108623 00:02:56.9595904 -00:00:44.5724928 2.9924820823213274x 0.25187947941966815
00:00:46.2447915 00:03:04.6118656 00:00:46.1529654 00:02:59.6000000 00:00:44.9000000 4 (True) 00:00:01.2529730 00:00:05.0118932 00:00:46.2447915 -00:00:00.0918369 00:03:04.9791616 -00:00:00.3673472 3.9920563681209376x 0.00198590796976561
00:00:48.2556441 00:03:12.6552064 00:00:48.1638011 00:02:59.6000000 00:00:44.9000000 4 (True) 00:00:03.2638096 00:00:13.0552400 00:00:48.2556441 -00:00:00.0918608 00:03:13.0225792 -00:00:00.3674496 3.9923854130049836x 0.0019036467487540953
00:00:50.2667413 00:03:20.6835456 00:00:50.1708877 00:03:19.6000000 00:00:49.9000000 4 (True) 00:00:00.2709088 00:00:01.0836372 00:00:50.2667413 -00:00:00.0958604 00:03:21.0669696 -00:00:00.3834496 3.992371791166817x 0.0019070522082957897
00:00:52.2677015 00:03:28.6873856 00:00:52.1718453 00:03:19.6000000 00:00:49.9000000 4 (True) 00:00:02.2718510 00:00:09.0874048 00:00:52.2677015 -00:00:00.0958622 00:03:29.0708096 -00:00:00.3834496 3.9926638059643773x 0.0018340485089056724
00:00:54.2826326 00:03:36.7474688 00:00:54.1868660 00:03:19.6000000 00:00:49.9000000 4 (True) 00:00:04.2868743 00:00:17.1474976 00:00:54.2826326 -00:00:00.0958590 00:03:37.1305216 -00:00:00.3834368 3.9929361274198776x 0.0017659681450306053
00:00:56.2896995 00:01:52.4016896 00:00:56.2008430 00:01:49.8000000 00:00:54.9000000 2 (True) 00:00:01.3008509 00:00:02.6017024 00:00:56.2896995 -00:00:00.0888616 00:01:52.5794048 -00:00:00.1777280 1.996842722530434x 0.0015786387347830333
00:00:58.3014216 00:01:56.4251264 00:00:58.2125642 00:01:49.8000000 00:00:54.9000000 2 (True) 00:00:03.3125713 00:00:06.6251432 00:00:58.3014216 -00:00:00.0888619 00:01:56.6028416 -00:00:00.1777280 1.996951539171388x 0.0015242304143060492
00:01:00.3085671 00:02:00.3934464 00:01:00.1967224 00:01:59.7600000 00:00:59.8800000 2 (True) 00:00:00.3167464 00:00:00.6334936 00:01:00.3085671 -00:00:00.1118604 00:02:00.6171392 -00:00:00.2237312 1.996290308147613x 0.0018548459261934491
00:01:02.3105267 00:02:04.3973376 00:01:02.1986697 00:01:59.7600000 00:00:59.8800000 2 (True) 00:00:02.3186743 00:00:04.6373492 00:01:02.3105267 -00:00:00.1118613 00:02:04.6210560 -00:00:00.2237312 1.9964096628314971x 0.0017951685842514387
00:01:04.3220010 00:02:08.4202880 00:01:04.2101443 00:01:59.7600000 00:00:59.8800000 2 (True) 00:00:04.3301499 00:00:08.6603264 00:01:04.3220010 -00:00:00.1118607 00:02:08.6440064 -00:00:00.2237312 1.996521768655798x 0.0017391156721010548
00:01:06.3454286 00:02:12.4911488 00:01:06.2455724 00:02:09.8000000 00:01:04.9000000 2 (True) 00:00:01.3455759 00:00:02.6911522 00:01:06.3454286 -00:00:00.0998623 00:02:12.6908544 -00:00:00.1997184 1.996989676542688x 0.0015051617286560015
00:01:08.3478591 00:02:16.4960000 00:01:08.2480034 00:02:09.8000000 00:01:04.9000000 2 (True) 00:00:03.3480085 00:00:06.6960176 00:01:08.3478591 -00:00:00.0998605 00:02:16.6957184 -00:00:00.1997184 1.9970779157880016x 0.0014610421059991774
00:01:10.3509629 00:04:41.0004224 00:01:10.2501079 00:04:39.6000000 00:01:09.9000000 4 (True) 00:00:00.3501129 00:00:01.4004528 00:01:10.3509629 -00:00:00.1008604 00:04:41.4038528 -00:00:00.4034560 3.994265477210689x 0.0014336306973277146
00:01:12.3543154 00:04:49.0138368 00:01:12.2534594 00:04:39.6000000 00:01:09.9000000 4 (True) 00:00:02.3534637 00:00:09.4138560 00:01:12.3543154 -00:00:00.1008601 00:04:49.4172672 -00:00:00.4034560 3.994423962167708x 0.0013940094580729978

Here is also a test I made to see whether the Lavalink server reports the actual timestamp measured by actual audio samples played. You can see that it just sends the time the passed since the song started (with respecting pause/resume).

0, 1632169708790, 0, 0
4820, 1632169713638, 4820, 0.964
9820, 1632169718631, 5000, 1
14800, 1632169723627, 4980, 0.996
19800, 1632169728629, 5000, 1
change time scale to 4x
24800, 1632169733632, 5000, 1
29800, 1632169738629, 5000, 1
34820, 1632169743629, 5020, 1.004
39800, 1632169748635, 4980, 0.996
44800, 1632169753637, 5000, 1
change time scale to 2x
49820, 1632169758639, 5020, 1.004
54820, 1632169763636, 5000, 1

I have created an issue in the Lavalink repository that mentions this issue and a probably easier and more realistic fix for this (lavalink-devs/Lavalink#521). For a workaround, I pushed a prerelease(2.0.1-preview.3.1) that works with constant-time time scaling.

@angelobreuer
Copy link
Owner

Closing as stale until there is a response in the dependent issues

@angelobreuer
Copy link
Owner

Linking lavalink-devs/lavaplayer#94

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants