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

    I have following use-cases.

    • Client requests an average frequency for the last N seconds.

      var clipSeconds=5, currentSecond=0, sBuff=new Uint8Array(clipSeconds);
      var w = new Waveform(512,{doubleBuffer:true,bits:16}­);
      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[currentSecond]=m.toFixed(0);
      console.log(sBuff[currentSecond]+"Hz @ "+n);
      currentSecond++;
      if (currentSecond >= clipSeconds) {
      w.stop();
      var avg = E.sum(sBuff)/clipSeconds;
      console.log("Average " + avg.toFixed(0) + " Hz");
      }
      });
      w.startInput(D2,512,{repeat:true});
      

    This code is tested and working on firmware (1v92)

    • Client requests an audio for the last N seconds.

      var clipSeconds = 5;
      var w = new Waveform(512*clipSeconds,{bits:16});
      w.on("finish", function(buf) {
      console.log(buf.length);
      });
      w.startInput(D2,512);
      

    For ought I see the "buf" contains the audio which should be stored and send to the client ?

    I really appreciate your feedback!

    Thank you.

About

Avatar for user73560 @user73560 started