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

note-harmonizer

v1.0.4

Published

Harmonize notes or create harmonizers functions

Downloads

20

Readme

note-harmonizer npm version

tonal

note-harmonizer is a module with a function to harmonize notes, create harmonizers (like chords, for example) or get relative intervals from a collection of notes:

var harmonize = require('note-harmonizer')

// harmonize a note
harmonize('1 3 5', 'G2') // => ['G2', 'B2', 'D3']

// create an harmonizer
var maj7Chord = harmonize('1 3 5 7')
var maj7Chord('A4') // => ['A4', 'C#5', 'E5', 'G#5']

// get relative intervals
harmonize('C Eb G Bb', false) // => ['P1', 'm3', 'P5', 'm7']

This is part of tonal

Install

Via npm: npm i --save note-harmonizer

Usage

Harmonize notes

You can harmonize notes using a collection of intervals. If the note is a pitch class (a note without octave), the result is a collection of pitch classes:

harmonize('1 b3 5 b7 9', 'C2') // => ['C2', 'Eb2', 'G2', 'Bb2', 'D3']
harmonize('1 b3 5 b7 9', 'C') // => ['C', 'Eb', 'G', 'Bb', 'D']

You can harmonize from a list of notes (the first is considered to be the tonic):

harmonize('C E G', 'A') // => ['A', 'C#', 'E']
var domChord = harmonize('A C# E G')
domChord('D') // => ['D', 'F#', 'G', 'C']

Create harmonizers

Like most tonal functions, it can be partially applied (very useful to create chord-like structures):

var m7 = harmonize('1 b3 5 b7')
m7('C') // => ['C', 'Eb', 'G', 'Bb']

Get intervals

If false is passed as tonic, you can extract intervals:

harmonize('D F A C', false) // => ['1P', '3m', '5P', '7m']

Filter pitches

Finally, it tonic is null you get the notes or intervals without transformation:

harmonize('c2 D4 blah P4', null) // => ['C2', 'D4', null, '4P']

License

MIT License