Drum Machine Project Feedback

Drum Machine Project Feedback


I’ve made this pen for the drum machine project:

It passed all the tests, however, there are a couple of things that bother me:

  1. I copied the audio source link from the FCC example project. Is it okay? Will I breach the academic honesty policy? Should I link back to the FCC example project?
  2. I noticed that, unlike the FCC example, when my drum pad is pressed repeatedly there’s a bit of lag between the sounds. Does anyone know what caused it?

That being said, I also welcome any feedback that you have :grin:


I have a fresh experience of making drum machine and this is why I know the answer on your second question :slight_smile:

When you start playing audio with play() method it changes the current position of the track. So when you press same key again it will play audio from this current position, not from the beginning. If you want to hear the sound from the beginning you need to set current position to 0 by using currentTime property


Looks pretty good, I don’t think there would be a problem copying those sounds - if there comes a day where someone tries to take your certificate because of that, you can go find some new audio files - but you clearly put in the time and built the project. The code looks good - the design looks… good enough - I had a problem with audio like that on a drum machine I made a while back, the solution for me was to create a new audio when the button was clicked - I think it’s trying to play the same sound the way you have it, so it needs to wait for the first one to finish. So for instance, on my project I had something like…

sound = new Audio('soundfile');
onclick => sound.play()

and that gave me the lag problem, my solution was to make it more like this…

onclick => new Audio('soundfile').play();

i think this way it will create a new sound every time and give the ability for the sounds to overlap - not sure if that will help, looks like @nadktk has a possible alternative


Thank you @nadktk and @moT01 for responding, I will try your suggestions

edit: Your suggestions both worked, however, @moT01 's didn’t pass the test. I think it’s because it uses a new audio object rather than playing what’s already in the HTML. So I go with @nadktk’s solution. Thanks again to both of you!