• It wasn't reset properly. This is the code im currently using for the voice recording using the SPW2430(microphone)

    var spi = new SPI(); 
    spi.setup({mosi:B15, miso:B14, sck:B10});
    E.connectSDCard(spi, B1);
    console.log(require("fs").readdirSync())­;
    
    require("fs").writeFileSync("X.raw");
    
    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);
      require("fs").appendFileSync("X.raw", a);
      var m=0,n=-1;
      for (var i=100;i<1000;i++)if(a[i]>n)n=a[m=i];
      console.log(m.toFixed(0)+"Hz @ "+n);
    });
    
    analogWrite(B0, 0.5, {freq:20000});
    w.startInput(B0,2000,{repeat:true});
    //w.stop();
    setInterval(function() {
      w.stop();
    },10000);
    
    

    would the Hardware drive the values for var i? meaning if my mic can record from 100Hz to 10kHz do i put i=100,i<10000?

    with the code above the IDE writes

    >[
      "System Volume Information",
    "X.raw"
     ]
    =undefined
    105Hz @ 4
    127Hz @ 6
    194Hz @ 5
    128Hz @ 5
    444Hz @ 6
    423Hz @ 5
    181Hz @ 4
    107Hz @ 6
    101Hz @ 4
    506Hz @ 22
    470Hz @ 7
    469Hz @ 8
    425Hz @ 6
    233Hz @ 7
    152Hz @ 6
    130Hz @ 5
    121Hz @ 6
    438Hz @ 7
    481Hz @ 10
    168Hz @ 6
    >
    

    I still cannot get proper voice playback so I thought maybe my sample rate needed to go up but, when I change the sample rate to 1024 in waveform and and Uint16array the IDE gives me an error code.

    in function called from system
    Uncaught Error: Insufficient stack for computing FFT
     at line 2 col 10
      E.FFT(a);
    
About

Avatar for jruroede @jruroede started