barmark 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -1
- package/dist/chords/parse.js +15 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,20 @@ Releases follow the process in [RELEASING.md](RELEASING.md).
|
|
|
9
9
|
|
|
10
10
|
## [Unreleased]
|
|
11
11
|
|
|
12
|
+
## [0.4.0] - 2026-11-01
|
|
13
|
+
|
|
14
|
+
Charts written in Logic Pro's chord spelling read as they are. A grammar
|
|
15
|
+
decision (two new aliases, §3 and Appendix A.5); no chart that read
|
|
16
|
+
before changes meaning. Implements the
|
|
17
|
+
[grammar v0.1 draft](https://github.com/kevinpeckham/barmark/blob/main/docs/grammar-v0.1-draft.md).
|
|
18
|
+
|
|
19
|
+
### Added
|
|
20
|
+
|
|
21
|
+
- **Logic Pro's parentheses are read.** Groups in a row are one list
|
|
22
|
+
(`C7(b9)(#11)` is `C7(b9,#11)`), and `(5)` on a bare root is the power
|
|
23
|
+
chord (`F#(5)(7)` is `F#5(7)`: F♯ C♯ E). Both print in the canonical
|
|
24
|
+
form. Grammar §3, Appendix A.5 and the decisions log.
|
|
25
|
+
|
|
12
26
|
## [0.3.0] - 2026-11-01
|
|
13
27
|
|
|
14
28
|
A chart in another format no longer reads as an empty one. A grammar
|
|
@@ -85,7 +99,8 @@ The first working release: the reference parser and printer for the
|
|
|
85
99
|
|
|
86
100
|
- **A placeholder package that holds the `barmark` name** while the spec and parser are written.
|
|
87
101
|
|
|
88
|
-
[Unreleased]: https://github.com/kevinpeckham/barmark/compare/barmark-v0.
|
|
102
|
+
[Unreleased]: https://github.com/kevinpeckham/barmark/compare/barmark-v0.4.0...HEAD
|
|
103
|
+
[0.4.0]: https://github.com/kevinpeckham/barmark/compare/barmark-v0.3.0...barmark-v0.4.0
|
|
89
104
|
[0.3.0]: https://github.com/kevinpeckham/barmark/compare/barmark-v0.2.0...barmark-v0.3.0
|
|
90
105
|
[0.2.0]: https://github.com/kevinpeckham/barmark/compare/v0.1.0...barmark-v0.2.0
|
|
91
106
|
[0.1.0]: https://github.com/kevinpeckham/barmark/compare/v0.0.3...v0.1.0
|
package/dist/chords/parse.js
CHANGED
|
@@ -61,6 +61,20 @@ function tokenize(symbol) {
|
|
|
61
61
|
return `cannot read "${rest}"`;
|
|
62
62
|
return { root, quality, extension: ext, sus, tones, bass };
|
|
63
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* Logic Pro's spellings (Appendix A.5): groups in a row are one list
|
|
66
|
+
* (`(5)(7)` is `(5,7)`), and `5` in a bare root's group is the power chord
|
|
67
|
+
* (`F#(5,7)` is `F#5(7)`). After a quality or extension, `(5)` stays an error.
|
|
68
|
+
*/
|
|
69
|
+
function logicGroups(rest) {
|
|
70
|
+
const joined = rest.replace(/\)\(/g, ",");
|
|
71
|
+
const group = /^\(([^)]*)\)/.exec(joined);
|
|
72
|
+
const tones = group?.[1]?.split(",").map((t) => t.trim()) ?? [];
|
|
73
|
+
if (!group || !tones.includes("5"))
|
|
74
|
+
return joined;
|
|
75
|
+
const others = tones.filter((t) => t !== "5");
|
|
76
|
+
return `5${others.length ? `(${others.join(",")})` : ""}${joined.slice(group[0].length)}`;
|
|
77
|
+
}
|
|
64
78
|
/** Appendix A.5 and A.6: Unicode, rejections, then aliases into canonical vocabulary. */
|
|
65
79
|
function normalizeSymbol(symbol) {
|
|
66
80
|
const text = symbol.replace(/♯/g, "#").replace(/♭/g, "b");
|
|
@@ -71,6 +85,7 @@ function normalizeSymbol(symbol) {
|
|
|
71
85
|
let rest = text.slice(root.length);
|
|
72
86
|
for (const [pattern, replacement] of ALIASES)
|
|
73
87
|
rest = rest.replace(pattern, replacement);
|
|
88
|
+
rest = logicGroups(rest);
|
|
74
89
|
const added = [...rest.matchAll(/add(2|4|9|11)/g)].map((m) => m[1] ?? "");
|
|
75
90
|
if (added.length) {
|
|
76
91
|
rest = rest.replace(/add(2|4|9|11)/g, "");
|