A simple stream wrapper for arecord (Linux (including Raspbian)) and sox (Mac, Windows). Returns a Passthrough stream object so that stream control like pause(), resume(), pipe(), etc. are all available.
Added the fileType option (already defaults to raw) as a parameter that gets passed to the spawned arecord process. This resolves the issues noted in https://github.com/ashishbajaj99/mic/issues/22.
Without this parameter, arecord defaults to WAV format, which has a 2GB file size limit. In situations where a fileType has not been specified and the user wants to run arecord continuously, arecord eventually exits when it has processed 2GB worth of audio. Now, by default, the audio type will be raw (which has no file size limit), meaning that arecord will run indefinitely. For any given fileType the user supplies, the expected behavior is that arecord will run until it has processed the maximum file size amount of data for that given type.
Thank you for figuring this out! This solves a problem I was having with another project that used arecord to stream microphone input, but would die after an hour or so.
Added the fileType option (already defaults to raw) as a parameter that gets passed to the spawned
arecord
process. This resolves the issues noted in https://github.com/ashishbajaj99/mic/issues/22.Without this parameter,
arecord
defaults to WAV format, which has a 2GB file size limit. In situations where a fileType has not been specified and the user wants to runarecord
continuously,arecord
eventually exits when it has processed 2GB worth of audio. Now, by default, the audio type will beraw
(which has no file size limit), meaning thatarecord
will run indefinitely. For any given fileType the user supplies, the expected behavior is thatarecord
will run until it has processed the maximum file size amount of data for that given type.More info on arecord is available here: https://linux.die.net/man/1/arecord