Avatar for user73560

user73560

Member since Feb 2017 • Last active Apr 2017
  • 4 conversations
  • 24 comments

Most recent activity

  • in Puck.js
    Avatar for user73560

    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.

  • in Puck.js
    Avatar for user73560

    Hi @Gordon,

    Based on the code below:

    var clipSeconds = 3, currentSecond = 0;
    var w = new Waveform(512,{doubleBuffer:true,bits:16}­);
    var a = new Uint16Array(512 * clipSeconds);
    w.on("buffer", function(buf) {
    
      a.set(buf, currentSecond * 512);
      currentSecond++;
    
      if (currentSecond >= clipSeconds) {
        w.stop();
    
        E.FFT(a);
        var m=0,n=-1;
        for (var i=150;i<250;i++)if(a[i]>n)n=a[m=i];
        console.log(m.toFixed(0)+"Hz @ "+n);
      }
    });
    w.startInput(D2,512,{repeat:true});
    

    My understanding is that all the sound as buffer will be stored in "a" from where once all the data is aggregated we could define the frequency.

    When this code is deployed the flow hangs on "E.FFT(a);" and I cannot connect to the Puck anymore. Please advice.

    Thank you.

  • in Puck.js
    Avatar for user73560

    Hi @Gordon,

    Please advice how to update the firmware to a fairly huge number of pucks without manual interaction, may be puck password protection is enough for such mode ?

    Thank you.

  • in Puck.js
    Avatar for user73560

    Hi @Gordon,

    Along with self-propagating code is it possible to do a firmware update if needed, avoiding user interaction ?
    In my concrete case an Android phone interacts with multiple pucks, which will be really valuable to do both functionalities above.

    Thank you.

    • 2 comments
    • 105 views
  • in Puck.js
    Avatar for user73560

    Hi @Gordon,

    Is this (espruino.com/Reference) Javascript reference is the one which should be examined when writing code for Puck ? Where can I find the functions which are Puck specific ?

    Thank you.

  • in Puck.js
    Avatar for user73560

    Hi Gordon,

    Connecting the solar cell to 3V and GND with a voltage regulator chip should do the trick?
    My concern is that by having the battery constantly charged would drop its life. What is your opinion?

    Thank you.

  • in Puck.js
    Avatar for user73560

    Hi Guys,

    I would like to connect a solar cell to charge the Puck's battery. I think this could happen regularly checking the battery voltage using NRF.getBattery() and once it is below certain level to start charging from the solar cell. Is there a way to charge a battery through any of the pins ?

    Thank you.

Actions