New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

tonal-scale

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tonal-scale - npm Package Compare versions

Comparing version 2.2.1 to 2.2.2

12

package.json
{
"name": "tonal-scale",
"version": "2.2.1",
"version": "2.2.2",
"description": "Music scales creation and manipulation",

@@ -24,7 +24,7 @@ "repository": "https://github.com/danigb/tonal/packages/scale",

"dependencies": {
"tonal-array": "^2.2.1",
"tonal-dictionary": "^2.2.1",
"tonal-distance": "^2.2.1",
"tonal-note": "^2.2.1",
"tonal-pcset": "^2.2.1"
"tonal-array": "^2.2.2",
"tonal-dictionary": "^2.2.2",
"tonal-distance": "^2.2.2",
"tonal-note": "^2.2.2",
"tonal-pcset": "^2.2.2"
},

@@ -31,0 +31,0 @@ "babel": {

<a name="module_Scale"></a>
# Scale
[![npm version](https://img.shields.io/npm/v/tonal-scale.svg?style=flat-square)](https://www.npmjs.com/package/tonal-scale)

@@ -11,13 +10,10 @@

**Example**
**Example**
```js
// es6
import * as Scale from "tonal-scale";
import * as Scale from "tonal-scale"
// es5
const Scale = require("tonal-scale");
```
**Example**
**Example**
```js

@@ -28,14 +24,14 @@ Scale.notes("Ab bebop") // => [ "Ab", "Bb", "C", "Db", "Eb", "F", "Gb", "G" ]

- [Scale](#module_Scale)
- [`.props(name)`](#module_Scale.props) ⇒ <code>Object</code>
- [`.names([aliases])`](#module_Scale.names) ⇒ <code>Array</code>
- [`.intervals(name)`](#module_Scale.intervals) ⇒ <code>Array.&lt;string&gt;</code>
- [`.notes(tonic, nameOrTonic, [name])`](#module_Scale.notes) ⇒ <code>Array</code>
- [`.exists(name)`](#module_Scale.exists) ⇒ <code>Boolean</code>
- [`.tokenize(name)`](#module_Scale.tokenize) ⇒ <code>Array</code>
- [`.modeNames(name)`](#module_Scale.modeNames)
- [`.chords(name)`](#module_Scale.chords) ⇒ <code>Array.&lt;string&gt;</code>
- [`.toScale(notes)`](#module_Scale.toScale) ⇒ <code>Array</code>
- [`.supersets(name)`](#module_Scale.supersets) ⇒ <code>Array</code>
- [`.subsets(name)`](#module_Scale.subsets) ⇒ <code>Array</code>
* [Scale](#module_Scale)
* [`.props(name)`](#module_Scale.props) ⇒ <code>Object</code>
* [`.names([aliases])`](#module_Scale.names) ⇒ <code>Array</code>
* [`.intervals(name)`](#module_Scale.intervals) ⇒ <code>Array.&lt;string&gt;</code>
* [`.notes(tonic, nameOrTonic, [name])`](#module_Scale.notes) ⇒ <code>Array</code>
* [`.exists(name)`](#module_Scale.exists) ⇒ <code>Boolean</code>
* [`.tokenize(name)`](#module_Scale.tokenize) ⇒ <code>Array</code>
* [`.modeNames(name)`](#module_Scale.modeNames)
* [`.chords(name)`](#module_Scale.chords) ⇒ <code>Array.&lt;string&gt;</code>
* [`.toScale(notes)`](#module_Scale.toScale) ⇒ <code>Array</code>
* [`.supersets(name)`](#module_Scale.supersets) ⇒ <code>Array</code>
* [`.subsets(name)`](#module_Scale.subsets) ⇒ <code>Array</code>

@@ -45,16 +41,14 @@ <a name="module_Scale.props"></a>

## `Scale.props(name)` ⇒ <code>Object</code>
Get scale properties. It returns an object with:
- name: the scale name
- names: a list with all possible names (includes the current)
- intervals: an array with the scale intervals
- chroma: scale croma (see pcset)
- chroma: scale croma (see pcset)
- setnum: scale chroma number
**Kind**: static method of [<code>Scale</code>](#module_Scale)
**Kind**: static method of [<code>Scale</code>](#module_Scale)
| Param | Type | Description |
| ----- | ------------------- | ------------------------------ |
| name | <code>string</code> | the scale name (without tonic) |
| Param | Type | Description |
| --- | --- | --- |
| name | <code>string</code> | the scale name (without tonic) |

@@ -64,22 +58,18 @@ <a name="module_Scale.names"></a>

## `Scale.names([aliases])` ⇒ <code>Array</code>
Return the available scale names
**Kind**: static method of [<code>Scale</code>](#module_Scale)
**Returns**: <code>Array</code> - the scale names
**Returns**: <code>Array</code> - the scale names
| Param | Type | Default | Description |
| --------- | -------------------- | ------------------ | ----------------------- |
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [aliases] | <code>boolean</code> | <code>false</code> | true to include aliases |
**Example**
**Example**
```js
Scale.names(); // => ["maj7", ...]
Scale.names() // => ["maj7", ...]
```
<a name="module_Scale.intervals"></a>
## `Scale.intervals(name)` ⇒ <code>Array.&lt;string&gt;</code>
Given a scale name, return its intervals. The name can be the type and

@@ -92,18 +82,15 @@ optionally the tonic (which is ignored)

**Returns**: <code>Array.&lt;string&gt;</code> - the scale intervals if is a known scale or an empty
array if no scale found
array if no scale found
| Param | Type | Description |
| ----- | ------------------- | -------------------------------------------------- |
| name | <code>string</code> | the scale name (tonic and type, tonic is optional) |
| Param | Type | Description |
| --- | --- | --- |
| name | <code>string</code> | the scale name (tonic and type, tonic is optional) |
**Example**
**Example**
```js
Scale.intervals("major"); // => [ "1P", "2M", "3M", "4P", "5P", "6M", "7M" ]
Scale.intervals("major") // => [ "1P", "2M", "3M", "4P", "5P", "6M", "7M" ]
```
<a name="module_Scale.notes"></a>
## `Scale.notes(tonic, nameOrTonic, [name])` ⇒ <code>Array</code>
Get the notes (pitch classes) of a scale.

@@ -114,31 +101,28 @@

**Kind**: static method of [<code>Scale</code>](#module_Scale)
**Returns**: <code>Array</code> - a pitch classes array
**Returns**: <code>Array</code> - a pitch classes array
| Param | Type | Description |
| ----------- | ------------------- | -------------------------------------- |
| tonic | <code>string</code> | |
| Param | Type | Description |
| --- | --- | --- |
| tonic | <code>string</code> | |
| nameOrTonic | <code>string</code> | the scale name or tonic (if 2nd param) |
| [name] | <code>string</code> | the scale name without tonic |
| [name] | <code>string</code> | the scale name without tonic |
**Example**
**Example**
```js
Scale.notes("C", "major"); // => [ "C", "D", "E", "F", "G", "A", "B" ]
Scale.notes("C major"); // => [ "C", "D", "E", "F", "G", "A", "B" ]
Scale.notes("C4", "major"); // => [ "C", "D", "E", "F", "G", "A", "B" ]
Scale.notes("A4", "no-scale"); // => []
Scale.notes("blah", "major"); // => []
Scale.notes("C", "major") // => [ "C", "D", "E", "F", "G", "A", "B" ]
Scale.notes("C major") // => [ "C", "D", "E", "F", "G", "A", "B" ]
Scale.notes("C4", "major") // => [ "C", "D", "E", "F", "G", "A", "B" ]
Scale.notes("A4", "no-scale") // => []
Scale.notes("blah", "major") // => []
```
<a name="module_Scale.exists"></a>
## `Scale.exists(name)` ⇒ <code>Boolean</code>
Check if the given name is a known scale from the scales dictionary
**Kind**: static method of [<code>Scale</code>](#module_Scale)
**Kind**: static method of [<code>Scale</code>](#module_Scale)
| Param | Type | Description |
| ----- | ------------------- | -------------- |
| name | <code>string</code> | the scale name |
| Param | Type | Description |
| --- | --- | --- |
| name | <code>string</code> | the scale name |

@@ -148,3 +132,2 @@ <a name="module_Scale.tokenize"></a>

## `Scale.tokenize(name)` ⇒ <code>Array</code>
Given a string with a scale name and (optionally) a tonic, split

@@ -158,30 +141,26 @@ that components.

**Kind**: static method of [<code>Scale</code>](#module_Scale)
**Returns**: <code>Array</code> - an array [tonic, name]
**Returns**: <code>Array</code> - an array [tonic, name]
| Param | Type | Description |
| ----- | ------------------- | -------------- |
| name | <code>string</code> | the scale name |
| Param | Type | Description |
| --- | --- | --- |
| name | <code>string</code> | the scale name |
**Example**
**Example**
```js
Scale.tokenize("C mixolydean"); // => ["C", "mixolydean"]
Scale.tokenize("anything is valid"); // => ["", "anything is valid"]
Scale.tokenize(); // => ["", ""]
Scale.tokenize("C mixolydean") // => ["C", "mixolydean"]
Scale.tokenize("anything is valid") // => ["", "anything is valid"]
Scale.tokenize() // => ["", ""]
```
<a name="module_Scale.modeNames"></a>
## `Scale.modeNames(name)`
Find mode names of a scale
**Kind**: static method of [<code>Scale</code>](#module_Scale)
**Kind**: static method of [<code>Scale</code>](#module_Scale)
| Param | Type | Description |
| ----- | ------------------- | ----------- |
| name | <code>string</code> | scale name |
| Param | Type | Description |
| --- | --- | --- |
| name | <code>string</code> | scale name |
**Example**
**Example**
```js

@@ -196,46 +175,38 @@ Scale.modeNames("C pentatonic") // => [

```
<a name="module_Scale.chords"></a>
## `Scale.chords(name)` ⇒ <code>Array.&lt;string&gt;</code>
Get all chords that fits a given scale
**Kind**: static method of [<code>Scale</code>](#module_Scale)
**Returns**: <code>Array.&lt;string&gt;</code> - - the chord names
**Returns**: <code>Array.&lt;string&gt;</code> - - the chord names
| Param | Type | Description |
| ----- | ------------------- | -------------- |
| name | <code>string</code> | the scale name |
| Param | Type | Description |
| --- | --- | --- |
| name | <code>string</code> | the scale name |
**Example**
**Example**
```js
Scale.chords("pentatonic"); // => ["5", "64", "M", "M6", "Madd9", "Msus2"]
Scale.chords("pentatonic") // => ["5", "64", "M", "M6", "Madd9", "Msus2"]
```
<a name="module_Scale.toScale"></a>
## `Scale.toScale(notes)` ⇒ <code>Array</code>
Given an array of notes, return the scale: a pitch class set starting from
the first note of the array
**Kind**: static method of [<code>Scale</code>](#module_Scale)
**Kind**: static method of [<code>Scale</code>](#module_Scale)
| Param | Type |
| ----- | ------------------ |
| notes | <code>Array</code> |
| Param | Type |
| --- | --- |
| notes | <code>Array</code> |
**Example**
**Example**
```js
Scale.toScale(["C4", "c3", "C5", "C4", "c4"]); // => ["C"]
Scale.toScale(["D4", "c#5", "A5", "F#6"]); // => ["D", "F#", "A", "C#"]
Scale.toScale(['C4', 'c3', 'C5', 'C4', 'c4']) // => ["C"]
Scale.toScale(['D4', 'c#5', 'A5', 'F#6']) // => ["D", "F#", "A", "C#"]
```
<a name="module_Scale.supersets"></a>
## `Scale.supersets(name)` ⇒ <code>Array</code>
Get all scales names that are a superset of the given one

@@ -245,18 +216,15 @@ (has the same notes and at least one more)

**Kind**: static method of [<code>Scale</code>](#module_Scale)
**Returns**: <code>Array</code> - a list of scale names
**Returns**: <code>Array</code> - a list of scale names
| Param | Type |
| ----- | ------------------- |
| name | <code>string</code> |
| Param | Type |
| --- | --- |
| name | <code>string</code> |
**Example**
**Example**
```js
Scale.supersets("major"); // => ["bebop", "bebop dominant", "bebop major", "chromatic", "ichikosucho"]
Scale.supersets("major") // => ["bebop", "bebop dominant", "bebop major", "chromatic", "ichikosucho"]
```
<a name="module_Scale.subsets"></a>
## `Scale.subsets(name)` ⇒ <code>Array</code>
Find all scales names that are a subset of the given one

@@ -266,12 +234,11 @@ (has less notes but all from the given scale)

**Kind**: static method of [<code>Scale</code>](#module_Scale)
**Returns**: <code>Array</code> - a list of scale names
**Returns**: <code>Array</code> - a list of scale names
| Param | Type |
| ----- | ------------------- |
| name | <code>string</code> |
| Param | Type |
| --- | --- |
| name | <code>string</code> |
**Example**
**Example**
```js
Scale.subsets("major"); // => ["ionian pentatonic", "major pentatonic", "ritusen"]
Scale.subsets("major") // => ["ionian pentatonic", "major pentatonic", "ritusen"]
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc