# start-web-audio

> chore function for starting web audio in mobile Safari

Latest version **1.4.0** (published 2016-06-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install start-web-audio
pnpm add start-web-audio
yarn add start-web-audio
bun add start-web-audio
```

## 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.4.0 |
| Published | 2016-06-02 |
| First published | 2016-05-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | Nao Yonamine |
| Maintainers | mohayonao |
| Keywords | webaudioapi |

## Links

- npm: https://www.npmjs.com/package/start-web-audio
- Repository: https://github.com/mohayonao/start-web-audio
- Homepage: https://github.com/mohayonao/start-web-audio/
- Issues: https://github.com/mohayonao/start-web-audio/issues
- npm.io page: https://npm.io/package/start-web-audio

## Recent versions

- 1.4.0 (latest) — 2016-06-02
- 1.3.1 — 2016-06-02
- 1.3.0 — 2016-06-01
- 1.2.0 — 2016-06-01
- 1.1.0 — 2016-05-31

## README

# startWebAudio
[![NPM Version](http://img.shields.io/npm/v/start-web-audio.svg?style=flat-square)](https://www.npmjs.org/package/start-web-audio)
[![License](http://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](http://mohayonao.mit-license.org/)

> chore function for starting web audio in mobile Safari

## Installation

```
npm install start-web-audio
```

downloads:

- [start-web-audio.js](https://raw.githubusercontent.com/mohayonao/start-web-audio/master/build/start-web-audio.js)
- [start-web-audio.min.js](https://raw.githubusercontent.com/mohayonao/start-web-audio/master/build/start-web-audio.min.js)

## API
- `startWebAudio(audioContext, [ elem, requireUserAction, callback ]): void`
  - attach event listeners to `elem` for starting Web Audio API
  - `audioContext: AudioContext`
  - `elem: EventTarget`
    - a target of event listener - _default: **window**_
  - `requireUserAction: boolean`
    - require user action  - _default: **false**_
    - this option is useful, when want to use the same workflow in all devices.
  - `callback: function`
    - called when Web Audio API has been started - _default: noop_

## Usage

```js
var audioContext = new AudioContext();

startWebAudio(audioContext, function() {
  console.log("web audio is now available");
});

setInterval(function() {
  var oscillator = audioContext.createOscillator();

  oscillator.start(audioContext.currentTime);
  oscillator.stop(audioContext.currentTime + 0.1);
  oscillator.connect(audioContext.destination);
}, 1000);
```

## License

MIT

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