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