analogRead is limited more by the speed of execution than anything else. You might be looking at 2000 samples/sec?
There is however the Waveform class which will do what you want (it even contains an example of making a sound meter) - but I wouldn't push that much beyond 20kHz.
Having said that, if you try doing a spectrum analyser in Espruino you may find that you hit issues with Espruino's processing speed pretty quickly. It's not going to be great at doing realtime FFTs in JavaScript :)
I've implemented things like E.variance(...) to work around this a little, and I guess I could look at implementing E.convolve(a,b,offset) which would allow you to quickly work out how much of a certain frequency was in a sound sample.
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.
analogRead is limited more by the speed of execution than anything else. You might be looking at 2000 samples/sec?
There is however the Waveform class which will do what you want (it even contains an example of making a sound meter) - but I wouldn't push that much beyond 20kHz.
Having said that, if you try doing a spectrum analyser in Espruino you may find that you hit issues with Espruino's processing speed pretty quickly. It's not going to be great at doing realtime FFTs in JavaScript :)
I've implemented things like
E.variance(...)
to work around this a little, and I guess I could look at implementingE.convolve(a,b,offset)
which would allow you to quickly work out how much of a certain frequency was in a sound sample.