![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
automation-events
Advanced tools
A module which provides an implementation of an automation event list.
A module which provides an implementation of an automation event list.
This module provides an implementation of an automation event list to manage the internal state of an AudioParam as defined by the Web Audio API.
The automation-events
module is available on npm and can be
installed as usual.
npm install automation-events
It exports an AutomationEventList
class which can be imported and used like this:
import { AutomationEventList } from 'automation-events';
const automationEventList = new AutomationEventList(1);
automationEventList.add({ startTime: 10, type: 'setValue', value: 0 });
// It will return 1 for a time >= 0 and <10.
console.log(automationEventList.getValue(5));
// It will return 0 for a time >= 10.
console.log(automationEventList.getValue(10));
This function can be used to add an automation event to the list. All automation events can also be created with utility functions as described below.
This function returns the value at the given time.
This function will remove all events from the AutomationEventList which are unnecessary to compute values at a time which is greater or equal to the given time.
The automation-events
package also exports utility functions to create all events that can be scheduled on an AudioParam
.
import { createCancelAndHoldAutomationEvent } from 'automation-events';
createCancelAndHoldAutomationEvent(10);
// { cancelTime: 10, type: 'cancelAndHold' }
import { createCancelScheduledValuesAutomationEvent } from 'automation-events';
createCancelScheduledValuesAutomationEvent(5);
// { cancelTime: 5, type: 'cancelScheduledValues' }
import { createExponentialRampToValueAutomationEvent } from 'automation-events';
createExponentialRampToValueAutomationEvent(2, 10);
// { endTime: 10, type: 'exponentialRampToValue', value: 2 }
import { createLinearRampToValueAutomationEvent } from 'automation-events';
createLinearRampToValueAutomationEvent(-1, 4);
// { endTime: 4, type: 'linearRampToValue', value: -1 };
import { createSetTargetAutomationEvent } from 'automation-events';
createSetTargetAutomationEvent(0.5, 1, 0.1);
// { startTime: 1, target: 0.5, timeConstant: 0.1, type: 'setTarget' }
import { createSetValueAutomationEvent } from 'automation-events';
createSetValueAutomationEvent(1, 8);
// { startTime: 8, type: 'setValue', value: 1 }
import { createSetValueCurveAutomationEvent } from 'automation-events';
const values = new Float32Array([1, 0, -1]);
createSetValueCurveAutomationEvent(values, 0, 5);
// { duration: 5, startTime: 0, type: 'setValueCurve', values }
FAQs
A module which provides an implementation of an automation event list.
The npm package automation-events receives a total of 106,307 weekly downloads. As such, automation-events popularity was classified as popular.
We found that automation-events demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
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.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.