0.3.4 • Published 5 years ago

node-webrtc-audio-source v0.3.4

Weekly downloads
16
License
MIT
Repository
-
Last release
5 years ago

node-webrtc-audio-source

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.

Install

yarn add node-webrtc-audio-source wrtc

Usage

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

How does it work?

macOS

rec -q -b 16 -r 48000 -e signed -c 1 -t raw --buffer 1920 -

Windows

ffmpeg -f dshow -audio_buffer_size 50 -i audio="My Microphone Device" -ac 1 -ar 48000 -f s16le -acodec pcm_s16le -

How to get list of devices

ffmpeg -list_devices true -f dshow -i dummy
0.3.4

5 years ago

0.3.3

5 years ago

0.3.2

5 years ago

0.3.1

5 years ago

0.3.0

5 years ago

0.2.11

5 years ago

0.2.10

5 years ago

0.2.9

5 years ago

0.2.8

5 years ago

0.2.7

5 years ago

0.2.6

5 years ago

0.2.5

5 years ago

0.2.4

5 years ago

0.2.3

5 years ago

0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago