audio-context

A WebAudio Context singleton

Depends on Web-Audio-API implementation. Use either web-audio-api, web-audio-js or web-audio-engine package.
Last updated 8 years ago by dfcreative .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install audio-context 
SYNC missed versions from official npm registry.

audio-context Build Status unstable Greenkeeper badge npm license

Creates a WebAudio context singleton with the given options. Returns null if not supported.

Example

var audioCtx = require('audio-context')()

You can also create an OfflineAudioContext in case you would like to process (faster) without any rendering.

var offlineContext = require('audio-context')({offline: true})

Usage

npm install audio-context

ctx = createContext(options|sampleRate)

Returns a singleton audio context for the given sampleRate.

The options:

  • sampleRate - if specified, will set the context sampleRate.
  • latencyHint - if specified, will control latency. One of 'balanced', 'playback', 'interaction' (default) or number.
  • offline - if specified, will create OfflineAudioContext.
  • length - if specified, will set number of frames for offline context.
  • channels - if specified, will set number of channels for offline context.
  • {...contextAttributes} any other options for the context.

Handles vendor prefixing for audio contexts. Returns null if we are not in a browser, or if the context is not available, or if there was an error creating the context.

Running tests

# Run tests in tape-run's default browser
npm test

# Run in a specified browser.
# See https://github.com/juliangruber/tape-run#runopts for options
npm test -- --browser firefox

License

MIT

Current Tags

  • 1.0.3                                ...           latest (8 years ago)

6 Versions

  • 1.0.3 [deprecated]           ...           8 years ago
  • 1.0.2 [deprecated]           ...           8 years ago
  • 1.0.1 [deprecated]           ...           9 years ago
  • 1.0.0 [deprecated]           ...           9 years ago
  • 0.1.0 [deprecated]           ...           12 years ago
  • 0.0.0 [deprecated]           ...           12 years ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (0)
None
Dev Dependencies (4)

Copyright 2013 - present © cnpmjs.org | Home |