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 🙏

© 2026 – Pkg Stats / Ryan Hefner

elementary-audio-kit

v0.1.0

Published

Musical abstractions for Elementary Audio - timing, sequencing, and instruments

Readme

Elementary Audio Kit

Musical abstractions for Elementary Audio - timing, sequencing, and instruments.

Note: This library is in early development. APIs may change.

What is this?

Elementary Audio Kit provides higher-level building blocks for creating music applications with Elementary Audio. While Elementary gives you powerful DSP primitives, this library adds the musical concepts you need to build sequencers, drum machines, and synthesizers.

Think of it like this:

  • @elemaudio/core → Low-level DSP primitives (like Core Audio)
  • @elementary-audio-kit/core → Musical abstractions (like AudioKit)

Installation

npm install @elementary-audio-kit/core @elemaudio/core

Features

Timing

Beat clocks, transport control, quantization, and groove utilities.

import { createTransport, TimeSignatures } from '@elementary-audio-kit/core';
import { el } from '@elemaudio/core';

// Create a transport at 120 BPM in 4/4 time
const transport = createTransport({
  bpm: el.const({ key: 'bpm', value: 120 }),
  playing: el.const({ key: 'playing', value: 1 }),
  timeSignature: TimeSignatures.common,
});

// Use transport signals
transport.clock;      // Pulse on each beat
transport.clock16th;  // Pulse on each 16th note
transport.beat;       // Current beat count (0, 1, 2, ...)
transport.bar;        // Current bar count
transport.beatInBar;  // Beat within current bar (0-3 in 4/4)

Sequencing

Step sequencers, trigger patterns, and Euclidean rhythms.

import { euclideanTrigger, triggerPattern, patternFromString } from '@elementary-audio-kit/core';

// Euclidean rhythm - 5 hits distributed over 8 steps
const hihatTrigger = euclideanTrigger(5, 8, transport.clock);

// Manual trigger pattern
const kickTrigger = triggerPattern(
  [true, false, false, false, true, false, false, false],
  transport.clock
);

// String notation (x = hit, - = rest)
const snareTrigger = triggerPattern(
  patternFromString('----x-------x---'),
  transport.clock16th
);

Putting it together

import { createTransport, euclideanTrigger, triggerPattern } from '@elementary-audio-kit/core';
import { el } from '@elemaudio/core';

// Setup transport
const bpm = el.const({ key: 'bpm', value: 120 });
const playing = el.const({ key: 'playing', value: 1 });
const transport = createTransport({ bpm, playing });

// Create drum pattern
const kick = el.mul(
  el.sample({ path: 'kick', mode: 'trigger' },
    triggerPattern([true, false, false, false], transport.clock), 1),
  0.9
);

const hihat = el.mul(
  el.sample({ path: 'hihat', mode: 'trigger' },
    euclideanTrigger(5, 8, transport.clock), 1),
  0.4
);

// Mix and render
const mix = el.add(kick, hihat);
core.render(mix, mix);

API Reference

Timing Module

import { ... } from '@elementary-audio-kit/core/timing';

| Function | Description | |----------|-------------| | beatClock(bpm) | Creates a pulse train at the given BPM | | subdivisionClock(bpm, subdivision) | Creates a faster clock (2=8ths, 4=16ths) | | gatedClock(clock, gate) | Clock that only ticks when gate is high | | beatCounter(clock) | Counts beats from a clock signal | | barCounter(beats, beatsPerBar) | Returns current bar number | | beatInBar(beats, beatsPerBar) | Returns beat position within bar | | createTransport(config) | Creates a complete transport with all signals | | quantize(value, gridSize) | Snaps a value to the nearest grid point | | beatsToMs(beats, bpm) | Converts beats to milliseconds | | swing(clock, amount) | Adds swing to a clock signal | | accentPattern(clock, velocities) | Creates a velocity accent pattern |

Sequencing Module

import { ... } from '@elementary-audio-kit/core/sequencing';

| Function | Description | |----------|-------------| | stepSequencer(values, clock) | Cycles through values on each clock tick | | triggerPattern(hits, clock) | Creates a trigger pattern (1s and 0s) | | velocityPattern(velocities, clock) | Creates a velocity pattern (0-1 values) | | euclidean(hits, steps) | Generates a Euclidean rhythm pattern | | euclideanTrigger(hits, steps, clock) | Creates an Elementary signal from Euclidean pattern | | presetTrigger(preset, clock) | Creates a trigger from a named preset | | rotatePattern(pattern, steps) | Rotates a pattern by N steps | | patternFromString(notation) | Parses 'x--x--x-' notation to boolean array |

Roadmap

  • [ ] Instruments: Sampler, MonoSynth, PolySynth, DrumMachine
  • [ ] Effects: Tempo-synced delay, reverb, chorus
  • [ ] MIDI: Note scheduling, CC mapping
  • [ ] React hooks: useTransport, useSequencer (separate package)

Contributing

Contributions are welcome! This project aims to make Elementary Audio more accessible by providing musical building blocks that are missing from the core library.

License

MIT