New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

standardized-audio-context

Package Overview
Dependencies
Maintainers
1
Versions
482
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

standardized-audio-context

A patched AudioContext which imitates the current API in current browsers.

  • 8.2.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
130K
decreased by-1.13%
Maintainers
1
Weekly downloads
 
Created
Source

standardized-audio-context

A patched AudioContext which imitates the current API in current browsers.

tests dependencies version

This is a hopelessly naive attempt to patch the current implementation of the Web Audio API's AudioContext in current browsers. The goal is to make them all behave as promised by the Specification.

There are of course some things which cannot be faked in a reasonable way. The most obvious amongst those is the AudioWorkerNode which is currently not implemented by any browser. Therefore the corresponding createAudioWorker() method is missing here, too. All implemented methods are covered by unit tests.

That said, there are a lot of other functions which are currently not implemented for no specific reason besides a lack of time: createAudioWorker(), createConvolver(), createDelay(), createDynamicsCompressor(), createMediaElementSource(), createMediaStreamDestination(), createMediaStreamSource(), createPanner(), createPeriodicWave(), createScriptProcessor(), createStereoPanner(), createWaveShaper(), resume() and suspend(). The listener property is also missing for now.

This module also provides an OfflineAudioContext which does only expose the destination, length and sampleRate attributes as well as the createGain() and decodeAudioData() methods up to now.

Usage

The standardized-audio-context is available on npm and can be installed as usual.

npm install standardized-audio-context

You can then import the AudioContext and OfflineAudioContext into your module like this:

import { AudioContext, OfflineAudioContext } from 'standardized-audio-context';

In addition to that the standardized-audio-context also exports a promise named isSupported which resolves to a boolean which indicates support within the currently used browser.

import { isSupported } from 'standardized-audio-context';

isSupported
    .then((isSupported) => {
        if (isSupported) {
            // yeah everything should work
        } else {
            // oh no this browser seems to be outdated
        }
    });

Tests

Many thanks to BrowserStack and Sauce Labs for allowing this module to be tested with their services.

Keywords

FAQs

Package last updated on 06 Aug 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc