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

notator

v1.0.1

Published

Reactive/adaptive soundtracks for the web

Downloads

13

Readme

notator

npm bundle size npm dependencies

Reactive/Adaptive soundtracks for the web.

Browser support

notator is built on top of the Web Audio API, which is still in the working draft stage. All modern browsers are supported.

Chrome | Firefox | Opera | Safari | Edge | IE :---: | :---: | :---: | :---: | :---: | :---: | 33+ ✅ | 29+ ✅ | 20+ ✅ | 7.1+ ✅ | 12+ ✅ | ❌ |

Web Audio API browser support

Installation

yarn add notator
npm i notator --save

Usage

Basic example

import {
	defaultContext,
	Timeline,
	Track,
	Part,
	Sound,
} from 'notator';

import drums from './path/to/drums.mp3';
import arp from './path/to/arp.mp3';
import click from './path/to/click.mp3';


const timeline = new Timeline({
	bpm: 65,
});

const part = new Part({
	duration: 1, // duration in bars
	tracks: [
		new Track({
			duration: 1,
			src: drums,
		}),
		new Track({
			duration: 1,
			src: arp,
		}),
	],
});

const sound = new Sound({
	src: click,
	quantize: 1 / 16,
	gain: 2, // boost volume
});

someElement.addEventListener( 'click', () => {
	defaultContext.start()
		.then( () => timeline.cue( part ) );
});

document.addEventListener( 'click', () => {
	timeline.play( sound );
});

Effects

Audio effects can be added to Timelines, Parts, Tracks and Sounds.

import {
	defaultContext,
	Timeline,
	Track,
	Part,
	Sound,

	Gain,
	BiquadFilter,
	DynamicsCompressor,
	Delay,
	Convolver,
	EffectController,
} from 'notator';

import drums from './path/to/drums.mp3';
import arp from './path/to/arp.mp3';
import click from './path/to/click.mp3';


const timeline = new Timeline({
	bpm: 65,
	effects: [
		new DynamicsCompressor({
			threshold: -24,
			knee: 30,
			ratio: 12,
			attack: .003,
			release: .25,
		}),
	],
});

const part = new Part({
	duration: 1, // duration in bars
	effects: [
		new Gain({
			gain: .75,
		}),
	],
	tracks: [
		new Track({
			duration: 1,
			src: drums,
		}),
		new Track({
			duration: 1,
			src: arp,
			effects: [
				new Delay({
					delayTime: .1,
				}),
			],
		}),
	],
});

An EffectController is used to dynamically control parameters or to sync multiple effects:

import {
	Gain,
	EffectController,
} from 'notator';

const gainA = new Gain();
const gainB = new Gain();
const ctrl = new EffectController({
	effects: [
		gainA,
		gainB,
	],
});

// parameters can now be dynamically changed
ctrl.set( 'gain', .5 );

Troubleshooting

Audio cuts out entirely for a second once a new sound is played

This happens because the browsers' audio system is overloaded. Try reducing the amount of sounds being played simultaneously or the number of effects used. Complex effects like Convolvers are especially taxing. Firefox seems to have a problem with Convolvers in general, so use them with caution for now.


Sounds are doubled, with varying delay! Some react to interactions, others don't? WTF?

Do you, by any chance, have multiple tabs/windows of the same project open? Yeah, no worries. It happened to me as well.


Naming

notator is named after Notator SL, a MIDI sequencer for the Atari ST.

Todo

  • docs
  • support for audio sprites
  • hooks to randomise/vary playback
  • additional Effects, like pan, crossfade, etc.
  • customised signal routing for more complex mixes
  • testing

Licence

© 2020 DOWNPOUR DIGITAL, licensed under BSD-4-Clause