# node-webrtc-audio-source

> [node-webrtc](https://github.com/node-webrtc/node-webrtc) started supporting programmatic audio since version [0.3.6](https://github.com/node-webrtc/node-webrtc/releases/tag/v0.3.6). But it doesn't cover how to get audio stream from microphone.

Latest version **0.3.4** (published 2019-11-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install node-webrtc-audio-source
pnpm add node-webrtc-audio-source
yarn add node-webrtc-audio-source
bun add node-webrtc-audio-source
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.4 |
| Published | 2019-11-04 |
| First published | 2019-09-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 15.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | tylerlong |

## Links

- npm: https://www.npmjs.com/package/node-webrtc-audio-source
- npm.io page: https://npm.io/package/node-webrtc-audio-source

## Dependencies (1)

- [command-exists](https://npm.io/package/command-exists.md) ^1.2.8

## Recent versions

- 0.3.4 (latest) — 2019-11-04
- 0.3.3 — 2019-11-03
- 0.3.2 — 2019-09-22
- 0.3.1 — 2019-09-22
- 0.3.0 — 2019-09-21
- 0.2.11 — 2019-09-21
- 0.2.10 — 2019-09-21
- 0.2.9 — 2019-09-21
- 0.2.8 — 2019-09-21
- 0.2.7 — 2019-09-21
- 0.2.6 — 2019-09-21
- 0.2.5 — 2019-09-21
- 0.2.4 — 2019-09-21
- 0.2.3 — 2019-09-21
- 0.2.2 — 2019-09-21
- … 4 more at https://npm.io/package/node-webrtc-audio-source/versions

## README

# node-webrtc-audio-source

[node-webrtc](https://github.com/node-webrtc/node-webrtc) started supporting programmatic audio since version [0.3.6](https://github.com/node-webrtc/node-webrtc/releases/tag/v0.3.6). But it doesn't cover how to get audio stream from microphone.

This library gives you a [RTCAudioSource](https://github.com/node-webrtc/node-webrtc/blob/864bc136e8376c2e47ad5b206aa8c8568256a6b3/docs/nonstandard-apis.md#rtcaudiosource) object which streams audio data from microphone.

## Install

```
yarn add node-webrtc-audio-source wrtc
```

## Usage

```js
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
```

---
_Source: https://npm.io/package/node-webrtc-audio-source · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
