This library gives you a RTCAudioSource object which gets audio data from a readable stream.
yarn add node-webrtc-audio-stream-source wrtc
say -o test.wav --data-format=LEI16@48000 hello world
import fs from 'fs'
const readable = fs.createReadStream('test.wav')
The stream must be valid PCM audio meeting the following criteria:
- Bits per sample: 16
- Little endian
- encoding: signed integer
import RTCAudioSource from 'node-webrtc-audio-stream-source'
const rtcAudioSource = new RTCAudioSource()
rtcAudioSource.addStream(fs.createReadStream('test.wav', 16, 48000, 1))