Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

85
Views
Keydown has a delay

I'm using

    document.addEventListener('keydown', function(e) {
  if (e.keyCode == 65) {
    notedo.play()
  }
});

which essentially just plays a sound on keypress, however I'm trying to create sampler and there's a delay pressing a key. Anyway I can get around this? as well as being able to play multiple keys at once?

I am also using this in my HTML side:

<div class="black key" data-note="G#3" onclick="notedo.play()"></div>

So when clicking on my div element above it plays the notedo variable in javascript. I'm trying to find a way to implement key pressing to play the sound as well.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Found my issue which I think was getting confused with delay.

I was actually trying to play the same audio immediately after I press the same button.

I ended up using this!

document.addEventListener('keydown', function(e) {
  if (e.keyCode == 65) {
    notedo.play()
  }
  if (e.keyCode == 65) {
    notedo.play();
    notedo.currentTime = 0
  }
});
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!