gillesdemey / node-record-lpcm16

:microphone: Records a 16-bit signed-integer linear pulse modulation code encoded audio file.
ISC License
212 stars 59 forks source link

Recording byte rate falls drastically on long term usage - down to 12bytes #25

Open shekit opened 7 years ago

shekit commented 7 years ago

Hey,

I'm using node-record to listen for a hotword and then stream the rest of the command to a speech to text api. I have been facing some issues with my program failing to work after 15-16 hours and began tracking node-record. I realized that the recording byte rate is falling really low down to 12bytes before stopping completely. It also becomes very jumpy, jumping from between 12 and 44 bytes. At these rates it obviously is unable to stream anything useful. On restarting the application it begins recording again at 4000bytes.

I'm running it on a raspberry pi 3 using 'arecord' in an electron app.

Any idea why this would be happening?

gillesdemey commented 7 years ago

Can you try to isolate this and see if it's perhaps related to arecord on a RasPi? Am I understanding correctly that this occurs after 15-16 hours of continuous listening?

There isn't much complexity going on in this module, besides building the CLI command and returning stdout as a stream. My speculation is that this is either related to arec or a bug in Node Streams.

shekit commented 7 years ago

Yes that is correct, this usually occurs after several hours of continuous listening. I tried to isolate and see whether this is related to arecord only but it doesn't seem to be the case. There don't seem to be any memory issues either. Perhaps it's related to node streams?