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

moment-of-symmetry

v0.8.4

Published

Moment of Symmetry (MOS) musical scale generation and analysis for Javascript

Downloads

208

Readme

moment-of-symmetry

Moment of Symmetry (MOS) musical scale generation and analysis for Javascript

MOS scales consist of two intervals that are distributed as evenly as possible

Installation

npm i moment-of-symmetry

Documentation

Documentation is hosted at the project Github pages.

To generate documentation locally run:

npm run doc

Examples

Generate a musical scale with 3 large steps and 4 small steps (3L 4s). The result is an array of degrees of 10edo.

import {mos} from 'moment-of-symmetry';

mos(3, 4);  // [2, 3,  5, 6, 8, 9, 10]

Generate a diatonic (5L 2s) scale as a subset of 31edo. The large step is 5 edo-steps while the small step is 3 edo-steps.

mos(5, 2, {sizeOfLargeStep: 5, sizeOfSmallStep: 3, down: 1});  // [5, 10, 13, 18, 23, 28, 31]

Generate the whole chromatic scale in 12edo with a diatonic scale marked by 'parent' values.

mosWithDaughter(5, 2);
/*
  Map(12) {
    1 => 'both',
    2 => 'parent',
    3 => 'both',
    4 => 'parent',
    5 => 'both',
    6 => 'parent',
    7 => 'parent',
    8 => 'both',
    9 => 'parent',
    10 => 'both',
    11 => 'parent',
    12 => 'parent'
  }
*/

Generate the whole chromatic scale in 17edo.

mosWithDaughter(5, 2, {sizeOfLargeStep: 3, accidentals: 'both'});
/*
  Map(17) {
    1 => 'flat',
    2 => 'sharp',
    3 => 'parent',
    4 => 'flat',
    5 => 'sharp',
    6 => 'parent',
    7 => 'flat',
    8 => 'sharp',
    9 => 'parent',
    10 => 'parent',
    11 => 'flat',
    12 => 'sharp',
    13 => 'parent',
    14 => 'flat',
    15 => 'sharp',
    16 => 'parent',
    17 => 'parent'
}
*/

Get information about the modes of smitonic (4L 3s).

mosModes(4, 3);
/*
  [
    {
      period: 7,
      numberOfPeriods: 1,
      udp: '0|6',
      mode: 'sLsLsLL',
      modeName: 'Dagothic'
    },
    {
      period: 7,
      numberOfPeriods: 1,
      udp: '1|5',
      mode: 'sLsLLsL',
      modeName: 'Almalexian'
    },
    ...
  ]
*/

Get an array of the MOS patterns of the Pythagorean temperament.

mosPatterns(Math.log2(3/2));
/*
  [
    ...,
    {
      size: 7,
      numberOfLargeSteps: 5,
      numberOfSmallSteps: 2,
      mosPattern: '5L 2s',
      name: 'diatonic'
    },
    {
      size: 12,
      numberOfLargeSteps: 5,
      numberOfSmallSteps: 7,
      mosPattern: '5L 7s',
      name: 'p-chromatic',
      prefix: 'pychro',
      abbreviation: 'pychro',
      familyPrefix: 'pychro'
    },
  ...
  ]
*/