# sound-fx

> An easy way to manage and play sound effects

Latest version **2.1.0** (published 2017-05-16) · 0 weekly downloads

## Install

```sh
npm install sound-fx
pnpm add sound-fx
yarn add sound-fx
bun add sound-fx
```

## 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 | 2.1.0 |
| Published | 2017-05-16 |
| First published | 2017-01-30 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Simon Wears |
| Maintainers | munkyjunky |

## Links

- npm: https://www.npmjs.com/package/sound-fx
- Repository: https://github.com/munkyjunky/sound-fx
- Homepage: https://github.com/munkyjunky/sound-fx#readme
- Issues: https://github.com/munkyjunky/sound-fx/issues
- npm.io page: https://npm.io/package/sound-fx

## Recent versions

- 2.1.0 (latest) — 2017-05-16
- 2.0.2 — 2017-04-05
- 2.0.1 — 2017-02-03
- 2.0.0 — 2017-01-30

## README

# SoundFX
[![NPM version][npm-image]][npm-url]

SoundFX is a sound effect manager with support for Chrome, Firefox, Safari, Edge & IE9+, using the HTML5 Web Audio API where available, and falls back to `<audio>` elements.

## Using it

```js
// Create an instance of SoundFX
var SoundFX = require('sound-fx');
var sfx = new SoundFX();

// load some files by passing it a url and a name
sfx.load('taps.mp3', 'taps');
sfx.load('rocket.wav', 'rocket');

// then play the sounds like so:
sfx.play('rocket');

// or play a sound in looping mode:
sfx.play('taps', true);

// and to stop a loop:
sfx.stop('taps');

// that's it!
```

## API

#### `load (url, name, delay, callback)`
- `<String> url` - URI or data-encoded string of audio file to load
- `<String> name` - Name to save sound against
- `<Number> delay` - Delay before loading the file (ms)
- `<Function (err, data)> callback` - Callback once the file has been loaded

#### `play (name, loop, callback)`
- `<String> name` - Name of sound to play
- `<Boolean> loop` - Play the sound on a loop
- `<Function (err, data)> callback` - Callback once the sound has been played

#### `stop (name)`
- `<String> name` - Name of sound to stop playing

#### `has (name)`
- `<String> name` - Check if a sound has been loaded

#### `remove (name)`
- `<String> name` - Name of sound to remove

## License

MIT

## Credits
Originally built by [@HenrikJoreteg](http://twitter.com/henrikjoreteg) as [SoundEffectManager][SoundEffectManager]. Extended by [@munkyjunky](https://github.com/munkyjunky)

[SoundEffectManager]: https://github.com/henrikjoreteg/soundeffectmanager
[npm-image]: https://badge.fury.io/js/sound-fx.svg
[npm-url]: https://npmjs.org/package/sound-fx

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