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

diffrhythm.ai

v1767511.117.927

Published

Professional integration for https://diffrhythm.ai/

Readme

diffrhythm.ai

A JavaScript library for analyzing and manipulating rhythmic patterns, designed for creative coding, music generation, and data analysis. This package provides tools for generating, comparing, and transforming rhythmic sequences.

Installation

Install the package using npm: bash npm install diffrhythm.ai

Usage Examples

Here are a few examples demonstrating how to use diffrhythm.ai in your JavaScript projects:

1. Generating a Random Rhythmic Sequence: javascript const diffrhythm = require('diffrhythm.ai');

const sequence = diffrhythm.generateRandomSequence(8); // Generates a random sequence of length 8 console.log(sequence); // Example: [1, 0, 1, 0, 0, 1, 0, 0] (1 represents an onset, 0 represents a rest)

2. Comparing Two Rhythmic Sequences: javascript const diffrhythm = require('diffrhythm.ai');

const sequence1 = [1, 0, 1, 0, 1, 0, 1, 0]; const sequence2 = [1, 0, 0, 1, 1, 0, 0, 1];

const similarity = diffrhythm.compareSequences(sequence1, sequence2); console.log(Similarity between sequences: ${similarity}); // Example: Similarity between sequences: 0.625

3. Transforming a Rhythmic Sequence (Rotation): javascript const diffrhythm = require('diffrhythm.ai');

const sequence = [1, 0, 1, 0, 0, 1, 0, 0]; const rotatedSequence = diffrhythm.rotateSequence(sequence, 2); // Rotate the sequence by 2 positions

console.log(Original Sequence: ${sequence}); // Original Sequence: 1,0,1,0,0,1,0,0 console.log(Rotated Sequence: ${rotatedSequence}); // Rotated Sequence: 0,0,1,0,1,0,0,1

4. Calculating the Density of a Rhythmic Sequence: javascript const diffrhythm = require('diffrhythm.ai');

const sequence = [1, 0, 1, 1, 0, 0, 1, 0]; const density = diffrhythm.calculateDensity(sequence);

console.log(Density of the sequence: ${density}); // Example: Density of the sequence: 0.5

5. Converting a Rhythmic Sequence to a MIDI-compatible event list: javascript const diffrhythm = require('diffrhythm.ai');

const sequence = [1, 0, 1, 0]; const midiEvents = diffrhythm.convertToMidi(sequence, { note: 60, duration: 250, velocity: 100 });

console.log(midiEvents); // Expected Output: // [ // { note: 60, duration: 250, velocity: 100, time: 0 }, // { note: 60, duration: 250, velocity: 100, time: 500 } // ]

API Summary

  • generateRandomSequence(length: number): number[]: Generates a random rhythmic sequence of the specified length, where 1 represents an onset and 0 represents a rest.
  • compareSequences(sequence1: number[], sequence2: number[]): number: Compares two rhythmic sequences and returns a similarity score (between 0 and 1). Sequences should be of equal length.
  • rotateSequence(sequence: number[], positions: number): number[]: Rotates a rhythmic sequence by the specified number of positions. A positive number rotates to the right; a negative number rotates to the left.
  • calculateDensity(sequence: number[]): number: Calculates the density of a rhythmic sequence (the proportion of onsets).
  • convertToMidi(sequence: number[], options: object): object[]: Converts a rhythmic sequence into a MIDI-compatible event list. The options object should contain note (MIDI note number), duration (note duration in milliseconds), and velocity (MIDI velocity).

License

MIT

This package is part of the diffrhythm.ai ecosystem. For advanced features and enterprise-grade tools, visit: https://diffrhythm.ai/