You are reading a single comment by @user73560 and its replies. Click here to read the full conversation.
  • Hi @Gordon,

    I updated my puck to 1v95.153 and uploaded this code:

    function fq(sec){
      var cSec=0, sBuff=new Uint8Array(sec);
      var w=new Waveform(512,{doubleBuffer:true,bits:8})­;
      var a=new Uint16Array(512);
      w.on("buffer", function(buf) {
        a.set(buf);
        E.FFT(a);
        var m=0,n=-1;
        for (var i=150;i<250;i++)if(a[i]>n)n=a[m=i];
        sBuff[cSec]=m.toFixed(0);
        console.log(sBuff[cSec]+"Hz @ "+n);
        cSec++;
        if (cSec >= sec) {
          w.stop();
          var v=E.sum(sBuff)/sec;
          var rKey=new Date(Date.now()).toString();
          console.log(rKey,v);
        }
      });
      w.startInput(D2,512,{repeat:true});
    }
    

    which worked before.
    When you call fq(3) for example, the puck got reset. The problem comes from E.FFT(a);

    Thank you.

About

Avatar for user73560 @user73560 started