# neat-audio

> A simple, neat promise wrapper for the web Audio Context API. Get and play sounds from urls with ease.

Latest version **0.2.1** (published 2015-05-31) · MIT license · 0 weekly downloads

## Install

```sh
npm install neat-audio
pnpm add neat-audio
yarn add neat-audio
bun add neat-audio
```

## 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.2.1 |
| Published | 2015-05-31 |
| First published | 2014-10-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | iqrow |
| Maintainers | iqrow |
| Keywords | neat, audio, context, web, js |

## Links

- npm: https://www.npmjs.com/package/neat-audio
- Repository: https://github.com/iqrow/neatAudio
- Issues: https://github.com/iqrow/neatAudio/issues
- npm.io page: https://npm.io/package/neat-audio

## Dependencies (1)

- [es6-promise](https://npm.io/package/es6-promise.md) ~1.0.0

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 0.2.1 (latest) — 2015-05-31
- 0.2.0 — 2014-11-03
- 0.1.5 — 2014-10-04
- 0.1.4 — 2014-10-04
- 0.1.3 — 2014-10-04
- 0.1.2 — 2014-10-03
- 0.1.1 — 2014-10-03
- 0.1.0 — 2014-10-03
- 0.0.0 — 2014-10-03

## README

neatAudio
===========

A simple, neat promise wrapper for the web Audio Context API, designed for use with browserify. Get and play sounds from urls with ease.

## Usage

You'll need to use a Promise pattern with neatAudio, since it returns promises.


### Fetch a Sound

```javascript
var neatAudio = require('neat-audio');

// Init neatAudio
neatAudio.init(window);

// Load the sound buffers into variable
neatAudio.fetchSound('willhelm_scream.wav').then(function(soundBuffer) {
  var scream = soundBuffer;

  // Play the sound
  neatAudio.playSound(scream);
}).catch(function(err) {
  console.error('Could not fetch sound!', err);
});
```

### Fetch Multiple Sounds

```javascript
var neatAudio = require('neat-audio');
var Promise = require('es6-promise'); // or some other promise lib/polyfill

// Init neatAudio
neatAudio.init(window);

// Declare some variables to look after your sound buffers
var sounds = {
  click: null,
  shick: null,
  boom: null
};

// Load the sound buffers into local variables
Promise.all([
  neatAudio.fetchSound('click.wav'),
  neatAudio.fetchSound('shick.wav'),
  neatAudio.fetchSound('boom.wav')
]).then(function(values) {
  sounds.click = values[0];
  sounds.shick = values[1];
  sounds.boom = values[2];

  // Playing any of them
  neatAudio.playSound(sounds.boom);
});
```

## Todo

- [ ] Modify project to show browserify bundling
- [ ] Test with browser `window`
- [ ] Add tests for getting and playing sounds

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