Skip to content

Commit

Permalink
Update Note module documentation (#429)
Browse files Browse the repository at this point in the history
* fix: incorrect note documentation
* feat: add new documentation for certain scenario
  • Loading branch information
Robert-LC authored Apr 11, 2024
1 parent 2e30d71 commit b3a3115
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions packages/note/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ It has several shorthands to retrieve properties easily:
```js
Note.name("fx4"); // => "F##4"
Note.pitchClass("Ab5"); // => "Ab"
Note.accidentals("Eb"); // => 'Eb'
Note.accidentals("Eb"); // => 'b'
Note.octave("C4"); // => 4
Note.midi("A4"); // => 69
Note.freq("A4"); // => 440
Expand Down Expand Up @@ -145,13 +145,19 @@ Note.distance("C3", "E4").toEqual("10M");
Get note names of an array of anything. Notice that names are normalized:

```js
Note.names(["fx", "bb", 12, "nothing", {}, null])) // => ["F##", "Bb"];
Note.names(["fx", "bb", 12, "nothing", {}, null]); // => ["F##", "Bb"];
```

Without parameters, it returns a list of natural pitch classes:

```js
Note.names(); // =>["C", "D", "E", "F", "G", "A", "B"]
Note.names(); // => ["C", "D", "E", "F", "G", "A", "B"]
```

You may be in a situation where you have note names with octaves, but don't want them, remove them like this:

```js
Note.names(["C2", "C#3", "Db4", 12, "nothing", {}, null]).map(Note.pitchClass); // => ['C', 'C#', 'Db']
```

#### `sortedNames(array?: any[], comparator?: NoteComparator) => string[]`
Expand Down

0 comments on commit b3a3115

Please sign in to comment.