Avatar for user73560

user73560

Member since Feb 2017 • Last active Feb 2019
  • 10 conversations
  • 96 comments

Most recent activity

  • in Puck.js, Pixl.js and MDBT42
    Avatar for user73560

    Hi @Gordon,

    Does the Nordic SDK is a moving target in general or it becomes a moving target as you are trying to support multiple devices with single firmware ? As there is no backward compatibility in technologies as is bluetooth, added with the complexity of supporting multiple devices, are is your case, don't you think that forking the firmware for each, or required, device is the only solution to adopt most up-to-date technologies for the concrete device ?

    I haven't tested your last proposal but hopefully will get back with some results soon.

  • in Puck.js, Pixl.js and MDBT42
    Avatar for user73560

    Hi @Gordon,

    Do you think of using https://www.seeedstudio.com/MDBT50Q-1M-n­RF52840-Based-BLE-Module-p-3147.html in the Puck ? Is it too hard to implement it on the hardware and software level ? Should this add support for Bluetooth 5 finally ?

    • 43 comments
    • 11,260 views
  • in Puck.js, Pixl.js and MDBT42
    Avatar for user73560

    Hi @Gordon,

    Adding the two results for one seconds works better for me with 200Hz test.

    var p=0, sBuff=new Uint8Array(2), sN=new Uint8Array(2);
    function soundTest() {
      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=50;i<250;i++)if(a[i]>n)n=a[m=i];
        sBuff[p]=m;
        sN[p]=n;
        if(p==1){
          var avgF=E.sum(sBuff);
          var nAvg=E.sum(sN);
          console.log(avgF+"Hz @ "+nAvg);
          p=0;
        } else {
          p=1;
        }
      });
      w.startInput(D2,1024,{repeat:true});
    }
    

    Do you know what is the accuracy loss on doubling the input sound compared to the buffer we have for processing ?

  • in Puck.js, Pixl.js and MDBT42
    Avatar for user73560

    Hi @Gordon,

    In order to calculate 400Hz when such frequency is produced, should I gather(concat) the two buffers for once second and then run FTT over them ?

  • in Puck.js, Pixl.js and MDBT42
    Avatar for user73560

    Hi @Gordon,

    I did some tests on point one above, it appeared that when you have:

    1) Input at 512Hz with 512 buffer size restricting frequencies between 100Hz and 250Hz.

    * Produce 200Hz sine wave audio frequency, then every thing is correctly determined - 200Hz @ XXX
    

    2) Input at 1024Hz with 512 buffer size restricting frequencies between 100Hz and 500Hz.

     * Produce 200Hz sine wave audio frequency, then you have - 100Hz @ XXX as buffer is received twice per second
     * Produce 400Hz sine wave audio frequency, then you have - 200Hz @ XXX as buffer is received twice per second
    

    How can the correct frequency be determined from point 2 above ?

  • in Puck.js, Pixl.js and MDBT42
    Avatar for user73560

    Hi @Gordon,
    1) You mean this code can still measure 500Hz with lower accuracy ?

    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=100;i<500;i++)if(a[i]>n)n=a[m=i];
      console.log(m.toFixed(0)+"Hz @ "+n);
    });
    w.startInput(D2,512,{repeat:true});
    

    2) Is it possible to use 1024 buffer size on behalf of other functionalities ?

  • in Puck.js, Pixl.js and MDBT42
    Avatar for user73560

    Hi @Gordon,

    I am running with firmware 1v99.50 and trying run your example at https://www.espruino.com/Waveform

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

    but have :
    ***Uncaught Error: Insufficient stack for computing FFT
    at line 8 col 12

    E.FFT(a);***
    

    Is it possible to measure 500Hz frequency or we are restricted by the Puck's memory ?

  • in Puck.js, Pixl.js and MDBT42
    Avatar for user73560

    Hi @Gordon,

    How should I interpret the returned Uint16Array buf in order to play it with javascript in the web browser for example ?

  • in Puck.js, Pixl.js and MDBT42
    Avatar for user73560

    Hi @Gordon,

    On Pi I gather the data via the built-in bluetooth and once per hour switch on the 3G modem to send data into the cloud and then switch it off.

    Do you think that 3G modem could impact the bluetooth range ?
    Do you think an additional BLE dongle could improve gathering the data ?

Actions