Tonejs / Tone.js

A Web Audio framework for making interactive music in the browser.
https://tonejs.github.io
MIT License
13.39k stars 976 forks source link

After 5 minutes it can't keep up with the rhythm #1093

Open liJie-wk opened 2 years ago

liJie-wk commented 2 years ago

Hello, I'm looping midi, I added 0.002s to loopEnd, but after 5 minutes it can't keep up with the rhythm, what to do? The increase of 0.002s is due to a problem 微信图片_20220628172140 in the picture

liJie-wk commented 2 years ago

Start the metronome while playing, and the rhythm doesn't match after about 5 minutes

Code-Lonely commented 2 years ago

@tambien I have also encountered this problem. If 0.1 is not added at the end, the playback of the last sound will not stop. If 0.1 is added, it will lead to a little out of time after many cycles. Can you solve this problem

abswiz commented 2 years ago

Hello. Sounds like a problem we encountered and worked around quite some time ago. We have players triggered at loop start using an event and this event fires at the designated time. We also had to introduce a separate event just before the loop end to stop players manually. We found that events scheduled at the same time as the loop end do not necessarily fire when looping. If it helps, purely by trial and error, we shave off 0.0005s from the loop end. It's the smallest figure we could get away with for bpms between (60 and 180). For interactive looping, we found this to be imperceptible, but does not apply in any case if the loop is not set, therefore sonically no impact on the end result. This may sort of be related to #1110?