You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using "ReSpeaker Mic Array - Far-field w/ 7 PDM Microphones" with a Raspberry Pi. I can get it to work properly for audio capture / hotword detection. I also want to display volume from my Node app, but I can't get my VU meter under a ~1s latency.
I'm capturing audio via arecord called from Node. I measure audio levels directly through the data being sent by the card (see code below). Any suggestion on how I can bring the latency down? I'd like my VU meter to react approximately as fast as the leds on the Mic Array. I'm open to any solution.
arProcess.stdout.on('data', _update);
function _update(buffer){
var bufLength = buffer.length;
var min = 0;
var max = 0;
var sample;
for (var i = 0; i < bufLength; i += 2) {
//Reads an unsigned 16-bit integer from buf at the specified offset with specified endian format (readUInt16BE() returns big endian, readUInt16LE() returns little endian).
sample = buffer.readInt16LE(i + 0, true);
min = (sample < min ? sample : min);
max = (sample > max ? sample : max);
}
console.log(_log10(Math.max(max, -min) / 32768) * 20);
}
`
The text was updated successfully, but these errors were encountered:
I'm using "ReSpeaker Mic Array - Far-field w/ 7 PDM Microphones" with a Raspberry Pi. I can get it to work properly for audio capture / hotword detection. I also want to display volume from my Node app, but I can't get my VU meter under a ~1s latency.
I'm capturing audio via arecord called from Node. I measure audio levels directly through the data being sent by the card (see code below). Any suggestion on how I can bring the latency down? I'd like my VU meter to react approximately as fast as the leds on the Mic Array. I'm open to any solution.
Thanks to anyone who can help out!
`
const arProcess = spawn('arecord', [
'-q',
'-r', 16000,
'-c', 1,
'-t', 'wav',
'-f', 'S16_LE',
'-D', 'plughw:AR',
'-V', 'mono',
], { encoding: 'binary'});
arProcess.stdout.on('data', _update);
function _update(buffer){
var bufLength = buffer.length;
var min = 0;
var max = 0;
var sample;
`
The text was updated successfully, but these errors were encountered: