Allows getting an input or output audio stream to a specific device.
npm install audio-cmd-stream
npm i audio-cmd-stream -S
`
API
$3
`js
// @device - The device id for PyAudio or the device string for arecord
// @args - Additional arguments passed to the spawn command
let inputStream = new AudioStream.Input(device, args);
`
$3
`js
// @device - The device id for PyAudio or the device string for aplay
// @args - Additional arguments passed to the spawn command
let outputStream = new AudioStream.Output(device, args);
`
Code Example
`js
var AudioStream = require('audio-cmd-stream');
// Create a new input stream for the specified device using the specified additional arguments that are passed to arecord
let inputStream = new AudioStream.Input(device, ['-f', 'cd', '-t', 'raw']);
// Create a new output stream for the specified device
let outputStream = new AudioStream.Output(device);
// Pipe the input stream straight to the output stream
inputStream.pipe(outputStream);
``