Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/key/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @tonaljs/key

## 4.11.2

### Patch Changes

- @tonaljs/[email protected]

## 4.11.1

### Patch Changes
Expand Down
6 changes: 3 additions & 3 deletions packages/key/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tonaljs/key",
"version": "4.11.1",
"version": "4.11.2",
"description": "Functions to work with musical keys",
"keywords": [
"key",
Expand All @@ -16,12 +16,12 @@
"types": "dist/index.d.ts",
"dependencies": {
"@tonaljs/pitch-note": "6.1.0",
"@tonaljs/note": "4.12.0",
"@tonaljs/note": "4.12.1",
"@tonaljs/roman-numeral": "4.9.1"
},
"devDependencies": {
"@tonaljs/chord": "6.1.1",
"@tonaljs/scale": "4.13.2"
"@tonaljs/scale": "4.13.3"
},
"author": "[email protected]",
"license": "MIT",
Expand Down
6 changes: 6 additions & 0 deletions packages/midi/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @tonaljs/midi

## 4.10.2

### Patch Changes

- 3c89703: Fix octave displacement of Midi.pcsetNearest

## 4.10.1

### Patch Changes
Expand Down
19 changes: 19 additions & 0 deletions packages/midi/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,14 @@ export function pcset(notes: number[] | string): number[] {
return Array.isArray(notes) ? pcsetFromMidi(notes) : pcsetFromChroma(notes);
}

/**
* Returns a function that finds the nearest midi note of a pitch class set.
* Can be used to constrain a note to a scale.
* @param notes - a list of midi numbers or a chroma string (e.g. "100100100101")
* @example
* const nearest = Midi.pcsetNearest(Scale.get("D dorian").chroma);
* [60, 61, 62, 63, 64, 65, 66].map(nearest); // => [60, 62, 62, 63, 65, 65, 67]
*/
export function pcsetNearest(notes: number[] | string) {
const set = pcset(notes);
return (midi: number): number | undefined => {
Expand All @@ -142,6 +150,13 @@ export function pcsetNearest(notes: number[] | string) {
};
}

/**
* Returns a function to map a pitch class set over any note.
* Given a tonic a pitch class set, step 0 means the first note, step 1 the second, and so on.
* @example
* const steps = Midi.pcsetSteps(Scale.get("D dorian").chroma, 60);
* [-2, -1, 0, 1, 2, 3].map(steps); // => [ 57, 58, 60, 62, 63, 65 ]
*/
export function pcsetSteps(notes: number[] | string, tonic: number) {
const set = pcset(notes);
const len = set.length;
Expand All @@ -152,6 +167,10 @@ export function pcsetSteps(notes: number[] | string, tonic: number) {
};
}

/**
* Returns a function to map a pitch class set over any note.
* Same as pcsetSteps, but returns 1 for the first step
*/
export function pcsetDegrees(notes: number[] | string, tonic: number) {
const steps = pcsetSteps(notes, tonic);
return (degree: number): number | undefined => {
Expand Down
2 changes: 1 addition & 1 deletion packages/midi/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tonaljs/midi",
"version": "4.10.1",
"version": "4.10.2",
"description": "Functions to work with midi numbers",
"keywords": [
"note",
Expand Down
16 changes: 8 additions & 8 deletions packages/midi/test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Midi from "./index";
import * as Midi from "./index";

describe("midi", () => {
test("isMidi", () => {
Expand Down Expand Up @@ -64,17 +64,17 @@ describe("midi", () => {

test("chromatic to nearest C minor pentatonic", () => {
const nearest = Midi.pcsetNearest("100101010010");
expect([36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47].map(nearest)).toEqual([
36, 36, 39, 39, 41, 41, 43, 43, 43, 46, 46, 48
]);
expect(
[36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47].map(nearest),
).toEqual([36, 36, 39, 39, 41, 41, 43, 43, 43, 46, 46, 48]);
});

test("chromatic to nearest half octave", () => {
const nearest = Midi.pcsetNearest("100000100000");
expect([36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47].map(nearest)).toEqual([
36, 36, 36, 42, 42, 42, 42, 42, 42, 48, 48, 48
]);
})
expect(
[36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47].map(nearest),
).toEqual([36, 36, 36, 42, 42, 42, 42, 42, 42, 48, 48, 48]);
});

test("empty pcsets returns the note", () => {
expect([10, 30, 40].map(Midi.pcsetNearest([]))).toEqual([]);
Expand Down
7 changes: 7 additions & 0 deletions packages/modules/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @tonaljs/modules

## 4.8.11

### Patch Changes

- Updated dependencies [3c89703]
- [email protected]

## 4.8.10

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions packages/modules/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tonaljs/modules",
"version": "4.8.10",
"version": "4.8.11",
"description": "deprecated",
"keywords": [],
"main": "dist/index.js",
Expand All @@ -10,7 +10,7 @@
],
"types": "dist/index.d.ts",
"dependencies": {
"tonal": "6.4.1"
"tonal": "6.4.2"
},
"author": "[email protected]",
"license": "MIT",
Expand Down
7 changes: 7 additions & 0 deletions packages/note/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @tonaljs/note

## 4.12.1

### Patch Changes

- Updated dependencies [3c89703]
- @tonaljs/[email protected]

## 4.12.0

### Minor Changes
Expand Down
4 changes: 2 additions & 2 deletions packages/note/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tonaljs/note",
"version": "4.12.0",
"version": "4.12.1",
"description": "Parse and manipulate music notes in scientific notation",
"keywords": [
"note",
Expand All @@ -19,7 +19,7 @@
"@tonaljs/pitch-interval": "6.1.0",
"@tonaljs/pitch-distance": "5.0.5",
"@tonaljs/pitch-note": "6.1.0",
"@tonaljs/midi": "4.10.1"
"@tonaljs/midi": "4.10.2"
},
"author": "[email protected]",
"license": "MIT",
Expand Down
7 changes: 7 additions & 0 deletions packages/range/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @tonaljs/range

## 4.9.2

### Patch Changes

- Updated dependencies [3c89703]
- @tonaljs/[email protected]

## 4.9.1

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions packages/range/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tonaljs/range",
"version": "4.9.1",
"version": "4.9.2",
"description": "Create (musical) note ranges",
"keywords": [
"range",
Expand All @@ -16,7 +16,7 @@
"types": "dist/index.d.ts",
"dependencies": {
"@tonaljs/collection": "4.9.0",
"@tonaljs/midi": "4.10.1"
"@tonaljs/midi": "4.10.2"
},
"author": "[email protected]",
"license": "MIT",
Expand Down
6 changes: 6 additions & 0 deletions packages/scale/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @tonaljs/scale

## 4.13.3

### Patch Changes

- @tonaljs/[email protected]

## 4.13.2

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions packages/scale/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tonaljs/scale",
"version": "4.13.2",
"version": "4.13.3",
"description": "Musical scales and its relations",
"keywords": [
"scale",
Expand All @@ -20,7 +20,7 @@
"@tonaljs/collection": "4.9.0",
"@tonaljs/pitch-distance": "5.0.5",
"@tonaljs/pitch-note": "6.1.0",
"@tonaljs/note": "4.12.0",
"@tonaljs/note": "4.12.1",
"@tonaljs/pcset": "4.10.1",
"@tonaljs/scale-type": "4.9.1"
},
Expand Down
16 changes: 16 additions & 0 deletions packages/tonal/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# tonal

## 6.4.2

### Patch Changes

- 3c89703: Fix octave displacement of Midi.pcsetNearest

- Updated dependencies [3c89703]
- @tonaljs/[email protected]
- @tonaljs/[email protected]
- @tonaljs/[email protected]
- @tonaljs/[email protected]
- @tonaljs/[email protected]
- @tonaljs/[email protected]
- @tonaljs/[email protected]
- @tonaljs/[email protected]

## 6.4.x

- 72de4e4: Fix a bug where `Scale.tokenize` didn't lowercase scale type when tonic is not preset
Expand Down
18 changes: 9 additions & 9 deletions packages/tonal/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tonal",
"version": "6.4.1",
"version": "6.4.2",
"description": "tonaljs music theory library",
"keywords": [
"music",
Expand All @@ -24,21 +24,21 @@
"@tonaljs/core": "5.0.2",
"@tonaljs/duration-value": "4.9.0",
"@tonaljs/interval": "5.1.0",
"@tonaljs/key": "4.11.1",
"@tonaljs/midi": "4.10.1",
"@tonaljs/key": "4.11.2",
"@tonaljs/midi": "4.10.2",
"@tonaljs/mode": "4.9.1",
"@tonaljs/note": "4.12.0",
"@tonaljs/note": "4.12.1",
"@tonaljs/pcset": "4.10.1",
"@tonaljs/progression": "4.9.1",
"@tonaljs/range": "4.9.1",
"@tonaljs/range": "4.9.2",
"@tonaljs/rhythm-pattern": "1.0.0",
"@tonaljs/roman-numeral": "4.9.1",
"@tonaljs/scale-type": "4.9.1",
"@tonaljs/scale": "4.13.2",
"@tonaljs/scale": "4.13.3",
"@tonaljs/time-signature": "4.9.0",
"@tonaljs/voice-leading": "5.1.1",
"@tonaljs/voicing-dictionary": "5.1.1",
"@tonaljs/voicing": "5.1.1"
"@tonaljs/voice-leading": "5.1.2",
"@tonaljs/voicing-dictionary": "5.1.2",
"@tonaljs/voicing": "5.1.2"
},
"author": "[email protected]",
"license": "MIT",
Expand Down
6 changes: 6 additions & 0 deletions packages/voice-leading/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @tonaljs/voice-leading

## 5.1.2

### Patch Changes

- @tonaljs/[email protected]

## 5.1.1

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions packages/voice-leading/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tonaljs/voice-leading",
"version": "5.1.1",
"version": "5.1.2",
"description": "Voice leading logic for transitions between voicings",
"keywords": [
"chord",
Expand All @@ -17,7 +17,7 @@
],
"types": "dist/index.d.ts",
"dependencies": {
"@tonaljs/note": "4.12.0"
"@tonaljs/note": "4.12.1"
},
"author": "[email protected]",
"license": "MIT",
Expand Down
7 changes: 7 additions & 0 deletions packages/voicing-dictionary/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @tonaljs/voicing-dictionary

## 5.1.2

### Patch Changes

- @tonaljs/[email protected]
- @tonaljs/[email protected]

## 5.1.1

### Patch Changes
Expand Down
6 changes: 3 additions & 3 deletions packages/voicing-dictionary/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tonaljs/voicing-dictionary",
"version": "5.1.1",
"version": "5.1.2",
"description": "Collections of chord voicings",
"keywords": [
"chord",
Expand All @@ -18,8 +18,8 @@
"types": "dist/index.d.ts",
"dependencies": {
"@tonaljs/chord": "6.1.1",
"@tonaljs/note": "4.12.0",
"@tonaljs/voice-leading": "5.1.1"
"@tonaljs/note": "4.12.1",
"@tonaljs/voice-leading": "5.1.2"
},
"author": "[email protected]",
"license": "MIT",
Expand Down
9 changes: 9 additions & 0 deletions packages/voicing/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# @tonaljs/voicing

## 5.1.2

### Patch Changes

- @tonaljs/[email protected]
- @tonaljs/[email protected]
- @tonaljs/[email protected]
- @tonaljs/[email protected]

## 5.1.1

### Patch Changes
Expand Down
Loading
Loading