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

@joshuawilliams/interval

v1.0.4

Published

Find any music interval. Enter the note, the interval, and can specify if you want a downward interval. The enharmonically correct note name will be returned.

Downloads

12

Readme

Interval

Find any musical interval and the interval between two notes. Enter the note, the interval, and specify if you want a downward interval. The enharmonically correct note name will be returned.

Example:


const { interval, between } = require('@joshuawilliams/interval');

// Perfect
interval('Gb','P4') // => 'Cb'
// Minor
interval('A','m7') // => 'G'
// Major
interval('C#','M3') // => 'E#'
// Augmented
interval('Bb','A5') // => 'F#'
// Diminished
interval('A','d7') // => 'Gb'

// Intervals down
interval('Bb','m3','down') // => 'G'
interval('C#','M6','down') // => 'E'

// Double sharps and flats
interval('Dx','d5') // => 'A#'
interval('Ebb','A2') // => 'F'

// Triple (or more) sharps and flats
interval('Bx#', 'm2') // => 'Cx#'

// Extended intervals
interval('F','M13') // => 'D'
interval('G', 'm9') // => 'Ab'

// Tritone
interval('A', 'TT') // => 'D#'

// Doubly diminished and augmented
interval('E','dd3') // => 'Gbb'
interval('F','AA5') // => 'Cx'

// Intervals between two notes
between('A','E') // => 'P5'
between('Db','F') // => 'M3'
between('G#','D') // => 'd5'
between('Cb','F') // => 'A4'
between('E', 'G') // => 'm3'

interval(note, interval, direction)

  1. The first argument is the note. It should be a letter from 'A'-'G', and can be flatted with 'b', sharped with '#', double flatted with 'bb', and double sharped with 'x'.
  2. The second argument is the interval, consisting of an interval quality and the interval number.
  3. The third argument can be used to indicate a descending interval with either 'down' or 'descending'

Interval options:

| Quality | Description| Number options | | -- | -- |-- | | P | Perfect | 1, 4, 5, 8, 11, 12, etc. | | m | minor | 2, 3, 6, 7, 9, 10, 13, etc. | | M | Major | 2, 3, 6, 7, 9, 10, 13, etc. | | d | diminished* | Any | | A | Augmented* | Any| | TT | Tritone | None | *Diminished and augmented can be doubled or tripled (or more) by repeating the 'd' or 'A'. 'ddd4' for example would represent a triply diminished 4th.

between(note1, note2)

  1. Both arguments are notes. Each note needs to be a letter from 'A'-'G', and can be flatted with 'b', sharped with '#', double flatted with 'bb', and double sharped with 'x'.
  2. between() will return the interval between both the notes. It will interpret the note1 as the lower note and note 2 as the higher note.