Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

audio-aggregate-param

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

audio-aggregate-param

Aggregate multiple AudioParam instances into a single object

  • 0.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5
Maintainers
1
Weekly downloads
 
Created
Source

audio-aggregate-param

Group multiple AudioParams into a single aggregate parameter for centralised manipulation.

Installation

Browserify

$ npm install audio-aggregate-param

UMD

// some code yadda yadda

Example

var osc1 = context.createOscillator();
var osc2 = context.createOscillator();
var osc3 = context.createOscillator();

var AudioAggregateParam = require('audio-aggregate-param');

var param = new AudioAggregateParam();
param.add(osc1.frequency);
param.add(osc2.frequency, 2);
param.add(osc3.frequency, 4);

// set frequency of osc1, osc2 and osc3
// osc1 = 220, osc2 = 440, osc3 = 880
param.cancelScheduledValues(context.currentTime);
param.setValueAtTime(220, context.currentTime);

// ramp oscillator frequencies over the next 2 seconds
// osc -> 440, osc2 -> 880, osc3 -> 1760
param.exponentialRampToValueAtTime(context.currentTime + 2, 440);

osc1.connect(context.destination);
osc2.connect(context.destination);
osc3.connect(context.destination);

osc1.start(0);
osc2.start(0);
osc3.start(0);

API

aggregate = new AudioAggregateParam()
aggregate.add(param, [scaleFactor])

Add a new AudioParam instance to this aggregate. If specified, all values assigned to this parameter - either directly or via one of the ramping/curve functions - will be multiplied by scaleFactor.

AudioParam methods

The following are proxied to the corresponding method of each aggregated AudioParam:

  • aggregate.value = newValue
  • aggregate.setValueAtTime(value, startTime)
  • aggregate.linearRampToValueAtTime(value, endTime)
  • aggregate.exponentialRampToValueAtTime(value, endTime)
  • aggregate.setTargetAtTime(timeConstant, target, startTime)
  • aggregate.setValueCurveAtTime(values, startTime, duration)
  • aggregate.cancelScheduledValues(time)

License

ISC

FAQs

Package last updated on 25 Apr 2014

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