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?
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);
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
It wasn't reset properly. This is the code im currently using for the voice recording using the SPW2430(microphone)
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
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.