Skip to content

Commit

Permalink
chore: update eharmonic examples (#434)
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert-LC authored Apr 23, 2024
1 parent 7076fc7 commit c96f25b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/note/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,15 @@ Given a note name, returns its enharmonic (or "" if not valid note):
Note.enharmonic("C#"); // => "Db"
Note.enharmonic("C##"); // => "D"
Note.enharmonic("C###"); // => "Eb"

Note.eharmoinic("C##b"); // => ""
```

Using eharmonic on a natural will return the same value passed in:

```js
Note.eharmonic("C"); // => "C"
Note.eharmonic("C4"); // => "C4"
```

The destination pitch class can be enforced to calculate the octave:
Expand Down
1 change: 1 addition & 0 deletions packages/note/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ export const simplify = (noteName: NoteName | Pitch): string => {
* Note.enharmonic("Db") // => "C#"
* Note.enharmonic("C") // => "C"
* Note.enharmonic("F2","E#") // => "E#2"
* Note.eharmoinic("C##b"); // => ""
*/
export function enharmonic(noteName: string, destName?: string) {
const src = get(noteName);
Expand Down

0 comments on commit c96f25b

Please sign in to comment.