https://github.com/hackergrrl/mic-stream
[UNMAINTAINED] :microphone: Get a stream of audio data from the microphone on the browser or with Node!
https://github.com/hackergrrl/mic-stream
Last synced: 6 months ago
JSON representation
[UNMAINTAINED] :microphone: Get a stream of audio data from the microphone on the browser or with Node!
- Host: GitHub
- URL: https://github.com/hackergrrl/mic-stream
- Owner: hackergrrl
- License: isc
- Created: 2016-04-05T02:37:47.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2022-10-03T18:20:14.000Z (almost 3 years ago)
- Last Synced: 2024-12-28T21:45:00.631Z (7 months ago)
- Language: JavaScript
- Homepage:
- Size: 21.5 KB
- Stars: 22
- Watchers: 4
- Forks: 5
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: license.md
Awesome Lists containing this project
README
# mic-stream
> Get a stream of audio data from the microphone.
---
## Unmaintained
This module is old and doesn't seem to work any longer, and I don't have capacity / interest in maintaining it. Please consider using [node-record-lpcm16](https://github.com/gillesdemey/node-record-lpcm16/) instead.
---[](https://www.npmjs.com/package/mic-stream)
## wip disclaimer
**Still TODO**: browser support (see #9)!
[microphone-stream](https://github.com/saebekassebil/microphone-stream) ought to
do the trick.## support
| | Node | Browser |
|---------|------|---------|
| Windows | NO | NO |
| Linux | *YES*¹ | NO |
| macOS | *YES*² | NO |
| *BSD | NO | NO |¹ requires `alsa-utils` to be installed.
² requires [`rec` from *sox*](http://sox.sourceforge.net/) to be installed.Like to see your platform supported? Take a look at the source and consider
submitting a PR!## example
Let's pipe our microphone input back to our speakers: feedback loop!
```js
var mic = require('mic-stream')
var speaker = require('audio-speaker')mic().pipe(speaker())
```## api
```js
var mic = require('mic-stream')
```### var stream = mic(format={})
Creates a new [audio-through](https;//github.com/audio-lib/audio-through) stream
from the local microphone. If on the browser, the user may be first asked for
permission.`format` is an object that decides the format of the audio data received. It
takes a wide variety of parameters. These are defaults:```
{
signed: true,
float: false,
bitDepth: 16,
byteOrder: 'LE', // or BE, if you're on a big-endian system
channels: 2,
sampleRate: 44100,
interleaved: false,
samplesPerFrame: 44100,
sampleSize: 2,
id: 'S_16_LE_2_44100_I',
max: 32678,
min: -32768
}
```The returned `stream` can be treated like a regular Node stream and piped
where ever you'd like.### stream.stop(cb)
Stops the microphone stream. `cb` is called when the process is fully stopped.
## install
With [`npm`](http://npmjs.org/), run
```
npm install mic-stream
```For browser use you'll need a tool like [browserify](https://browserify.com).
Node users will need a working install of [sox](http://sox.sourceforge.net).
## license
ISC
## works well with..
> [audio-speaker](https://github.com/audio-lab/audio-speaker) - Pipe audio data
> straight to your speaker. Works in Node and the browser!> [goertzel-stream](https://github.com/noffle/goertzel-stream/) - Detect
> specific frequencies from a stream of audio data.