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

Don't use triggerAttackRelease incorrectly #1075

Closed syfenx closed 2 years ago

syfenx commented 2 years ago

I made a mistake, at around 100+ bars my sequences would lag so I thought it was something about triggerAttackRelease so I tried triggerAttack with no issue and noticed my timing mistake. As the time keeps going up the release gets longer and longer

As I was posting this, I saw https://github.com/Tonejs/Tone.js/wiki/Accurate-Timing so it should be posted again.

// wrong
this.sampler.triggerAttackRelease(value.note, time, time, value.velocity);
// correct
let duration = 1;
this.sampler.triggerAttackRelease(value.note, duration, time, value.velocity);

This is not a bug but I'm trying to bring attention to it so no one else makes the same error, after making this change I've had no issue that I could notice yet.

syfenx commented 2 years ago

I didn't want to make another issue for this but something else I noticed. When I upgraded to v14.8.39, the version I was using before I believe it was v14.77, svelte would complain of circular imports, I'm not seeing it now.

tambien commented 2 years ago

Thanks for the issue! hopefully people who have a similar issue come across this issue