I am having issues using a microphone in a Node script.
The microphone (a SEEED Array mic) works when running the command line:
arecord -D plughw:1 --duration=10 -f cd -vv ~/rectest.wav
It does not work, however, when called from a node script:
var record = require('node-record-lpcm16');
var fs = require('fs');
var file = fs.createWriteStream('test.wav', { encoding: 'binary' });
record.start({
sampleRate : 48000,
verbose : true,
source: 'plughw:1',
recordProgram: 'arecord'
}).pipe(file);
This sample script runs fine on my mac, but not on my Rpi Zero.
On Rpi Zero have no error message, the file created is empty.
I have tried a number of things (including combinations of source - 1/1,1/1,0/0,1/0,0) but I am having a hard time finding a way to debug.
I have a Speaker Bonnet from Adafruit connected to the RPI (but get the same error when disconnecting it).
I am running node 8.9.3 and have built 'node-record-lpcm16' with no errors.
Any ideas what of what I could be doing wrong or ideas on how to further debug?