# note-player-stream

> Plays different notes with the Web Audio API based on a stream of input

Latest version **1.0.2** (published 2015-04-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install note-player-stream
pnpm add note-player-stream
yarn add note-player-stream
bun add note-player-stream
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2015-04-04 |
| First published | 2015-04-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | rangermauve |
| Maintainers | rangermauve |
| Keywords | web, audio, midi, player, stream |

## Links

- npm: https://www.npmjs.com/package/note-player-stream
- Repository: https://github.com/RangerMauve/note-player-stream
- Issues: https://github.com/RangerMauve/note-player-stream/issues
- npm.io page: https://npm.io/package/note-player-stream

## Dependencies (3)

- [xtend](https://npm.io/package/xtend.md) ^4.0.0
- [through2](https://npm.io/package/through2.md) ^0.6.3
- [audio-context](https://npm.io/package/audio-context.md) ^0.1.0

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 1.0.2 (latest) — 2015-04-04
- 1.0.1 — 2015-04-04
- 1.0.0 — 2015-04-04

## README

# note-player-stream
Plays different notes with the Web Audio API based on a stream of input

This module expects to be used with [web-midi-note-stream](https://github.com/RangerMauve/web-midi-note-stream), but accepts any stream which outputs objects that look like the following:

``` javascript
{
	pressed: Boolean, // Whether the button has been pressed/released
	note: Number, // Integer between [0-127] which represents a midi note
	frequency: Number, // The frequency to play the oscillator at (note required for custom nodes)
}
```
## Usage

Install:

``` bash
npm install --save note-player-stream
```

Require:

```
var playerStream = require("note-player-stream");
var player = playerStream({type: "square"});
```

## Example

This example will listen for input from a Launchpad and play sound when a button is pressed

``` javascript
var playerStream = require("note-player-stream");
var noteStream = require("web-midi-note-stream");
var webMidi = require("web-midi");

webMidi("Launchpad")
	.pipe(noteStream())
	.pipe(playerStream());
```

## API

`playerStream([options])`

Returns an [object stream](nodejs.org/api/stream.html) which takes in objects representing device input, and plays sound using the [Web Audio API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API).

### Options

| Property | Default         | Explanation                                                                         |
|----------|-----------------|-------------------------------------------------------------------------------------|
| gain     | 0.2             | How loud the output should be                                                       |
| output   | ctx.destination | What node to output to                                                              |
| node     | make oscillator | Function that takes data and returns an AudioNode                                   |
| update   | no-op           | Function that takes data and a node that can be used to update the node on new data |
| type     | sine            | Type of oscillator to create                                                        |

---
_Source: https://npm.io/package/note-player-stream · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
