npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

automation-events

v7.1.4

Published

A module which provides an implementation of an automation event list.

Downloads

496,013

Readme

automation-events

A module which provides an implementation of an automation event list.

version

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.

Usage

The automation-events module is available on npm and can be installed as usual.

npm install automation-events

AutomationEventList

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));

add(automationEvent)

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.

getValue(time)

This function returns the value at the given time.

flush(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.

utility functions

The automation-events package also exports utility functions to create all events that can be scheduled on an AudioParam.

createCancelAndHoldAutomationEvent()

import { createCancelAndHoldAutomationEvent } from 'automation-events';

createCancelAndHoldAutomationEvent(10);
// { cancelTime: 10, type: 'cancelAndHold' }

createCancelScheduledValuesAutomationEvent()

import { createCancelScheduledValuesAutomationEvent } from 'automation-events';

createCancelScheduledValuesAutomationEvent(5);
// { cancelTime: 5, type: 'cancelScheduledValues' }

createExponentialRampToValueAutomationEvent()

import { createExponentialRampToValueAutomationEvent } from 'automation-events';

createExponentialRampToValueAutomationEvent(2, 10);
// { endTime: 10, type: 'exponentialRampToValue', value: 2 }

createLinearRampToValueAutomationEvent()

import { createLinearRampToValueAutomationEvent } from 'automation-events';

createLinearRampToValueAutomationEvent(-1, 4);
// { endTime: 4, type: 'linearRampToValue', value: -1 };

createSetTargetAutomationEvent()

import { createSetTargetAutomationEvent } from 'automation-events';

createSetTargetAutomationEvent(0.5, 1, 0.1);
// { startTime: 1, target: 0.5, timeConstant: 0.1, type: 'setTarget' }

createSetValueAutomationEvent()

import { createSetValueAutomationEvent } from 'automation-events';

createSetValueAutomationEvent(1, 8);
// { startTime: 8, type: 'setValue', value: 1 }

createSetValueCurveAutomationEvent()

import { createSetValueCurveAutomationEvent } from 'automation-events';

const values = new Float32Array([1, 0, -1]);

createSetValueCurveAutomationEvent(values, 0, 5);
// { duration: 5, startTime: 0, type: 'setValueCurve', values }