Broadcasting Your Voice with ESP32-S3 & INMP441

This commit is contained in:
Eric
2023-05-16 15:15:24 -07:00
parent ea26810ea0
commit de2b756bd6
7 changed files with 1227 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
// worker.js
self.addEventListener('message', function (e) {
var mean = 0;
var samples_read = e.data.byteLength / 8;
if (samples_read > 0) {
var byteArray = new Int16Array(e.data);
for (var i = 0; i < samples_read; ++i) {
mean += (byteArray[i]);
}
mean /= samples_read;
self.postMessage(mean);
}
});