node-webrtc started supporting programmatic audio since version 0.3.6. But it doesn't cover how to get audio stream from microphone.
This library gives you a RTCAudioSource object which streams audio data from microphone.
yarn add node-webrtc-audio-source wrtc
import { nonstandard } from 'wrtc'
import RTCAudioSource from 'node-webrtc-audio-source'
const { RTCAudioSink } = nonstandard
const rtcAudioSource = new RTCAudioSource()
const track = rtcAudioSource.createTrack()
const rtcAudioSink = new RTCAudioSink(track)
rtcAudioSink.ondata = data => {
// Do something with the received audio samples.
}
rtcAudioSource.start()
setTimeout(() => rtcAudioSource.stop(), 10000) // stop after 10 seconds
rec -q -b 16 -r 48000 -e signed -c 1 -t raw --buffer 1920 -
ffmpeg -f dshow -audio_buffer_size 50 -i audio="My Microphone Device" -ac 1 -ar 48000 -f s16le -acodec pcm_s16le -
ffmpeg -list_devices true -f dshow -i dummy