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

drum-pattern-engine

v1.0.2

Published

Universal drum-pattern + song-arrangement generator. Emits a device-agnostic song structure (roles, velocity, micro-timing, meter). No runtime dependencies.

Readme

drum-pattern-engine (JS)

Universal drum-pattern + song-arrangement generator. No runtime dependencies.

The engine is device-agnostic: it emits a neutral song structure (instrument roles, steps, velocity, micro-timing, bars, repeats, meter). A separate builder package turns that into a concrete device format — e.g. smpltrek-builder writes a Sonicware SmplTrek project. The same song could drive MIDI, another groovebox, etc.

This is the single source of truth for the engine; the Python port (drum-pattern-engine-py) is kept byte-identical via a parity check.

Install

npm install drum-pattern-engine

Usage

import { arrange } from 'drum-pattern-engine';

const params = { density: 0.6, instrumentDensity: 0.65, energy: 0.75, swing: 0.15, ghost: 0.3 };
const song = arrange(params, { length: 'full', bpm: 124, seed: 12345, structure: 'electronic' });
// hand `song` to a builder, e.g. smpltrek-builder's buildProject()

The song structure (the reuse interface)

arrange(params, opts) returns:

{
  clips: [{
    idx, name, role, repeat, intensity,
    pattern: {
      steps: [{ step, inst, velocity, micro }],  // inst = role string; velocity 0..1; micro = timing offset in step-fractions
      bars,            // bars in the clip
      stepsPerBar,     // 16 for 4/4 at 1/16
      note,            // note-resolution code (default 9 = 1/16)
      timesig,         // time-signature code (2 = 4/4)
      role
    }
  }],
  bpm, totalBars, seconds, params
}

inst is a role (kick, snare, hat, ohh, ride, crash, tom1, perc, …) — not a note. A builder maps roles to notes. note/timesig use SmplTrek's index encoding today (a small coupling that a future version may make fully semantic).

Other exports: generatePattern, generateFill, engine (namespace).

Parameters (0..1)

density, instrumentDensity, syncopation, swing, complexity, energy, humanize, predictability, fillProbability, turnaround, densitySpread, ghost, oddMeter.

Options

length (loop/short/full), bpm, seed, structure, feel, meterMode, meterSet.

Develop

npm install        # eslint + prettier
npm run format
npm run lint

Legal

SmplTrek and Sonicware are trademarks of Sonicware Inc. This is an independent, unofficial tool — not affiliated with, endorsed by, or sponsored by Sonicware.

License

MIT — Alexander Schornberg.