Problem facing in Simon game

Problem facing in Simon game


I have to use a error sound in my project. But I am not getting any direct link of audio file. So please tell me about a site from where I can directly use the sound.


You could link to and use the sound clips provided in the problem statement.

var audio = new Audio('');


Why is there no “error” sound included with the simon game challenge. Where does the error sound in the example come from?


If you look at the source code of the example’s Codepen, you will see they are using an external library

then use the following code to create the error sound:

    var errOsc = audioCtx.createOscillator();
    errOsc.type = 'triangle';
    errOsc.frequency.value = 110;
    errOsc.start(0.0); //delay optional parameter is mandatory on Safari
    var errNode = audioCtx.createGain();
    errNode.gain.value = 0;

Ultimately, errNode is used in the following two functions:

    function playErrTone(){
      errNode.gain.linearRampToValueAtTime(vol, audioCtx.currentTime + ramp);

    function stopErrTone(){
      errNode.gain.linearRampToValueAtTime(0, audioCtx.currentTime + ramp);

which are used in the notifyError function which actually plays the error sound.