Delay when triggering note onclick
See original GitHub issueI’m building a React synth using Tone.js, I am experiencing a delay when running an onClick event. I explored the issues and found this: https://github.com/Tonejs/Tone.js/issues/306. Neither of the fixes mentioned here work for me
here is my function:
function playNote (noteToTrigger) {
Tone.context.lookAhead = 0
synth.current.triggerAttack(noteToTrigger, Tone.context.currentTime, 100)
}
const WhiteKey = ({ playNote, note }) => {
return (
<div
onClick={() => playNote(note)}
>
White key {note}
</div>
)
}
am I implementing this correctly?
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Shorten the delay from the onclick event on touchscreen devices
1 Answer 1 ... You could disable zoom for instant onClick. ... The delay occurs because the phone is waiting for the second...
Read more >How to delay a JavaScript function call using JavaScript?
To provide delay in JavaScript function we use a global window object named as setTimeout(). This function allows us to provide a specific...
Read more >Is there a delay for firing the "click" event for DevExtreme ...
I noticed that my buttons and even simple html elements that have click/onclick events attached to it takes a time to perform (about...
Read more >[SOLVED] Trigger button delay | Velo by Wix
Hi! I want to delay the time between clicking on the button and triggering its action (in this case, redirecting to a subpage)....
Read more >setTimeout() - Web APIs - MDN Web Docs
Note that in either case, the actual delay may be longer than ... Firefox will defer firing setTimeout() timers while the current tab...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
That’s alright! This exact problem is actually pretty common. Now it’s documented for other people who might come across the same thing
I feel really silly but I forgot about the Bluetooth latency, it works now! thanks for taking the time to help out