text-guitar-chart 0.0.4 → 0.1.1
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/FORMAT.md +90 -1
- package/docs/bundle.js +350 -100
- package/docs/bundle.js.map +3 -3
- package/lib/editableSVGuitar.js +399 -52
- package/lib/fingeringToString.js +8 -6
- package/lib/stringToFingering.js +54 -93
- package/package.json +1 -1
- package/test/editableSVGuitar.test.js +216 -0
- package/test/fingeringToString.test.js +279 -0
- package/test/stringToFingering.test.js +357 -77
- package/types/editableSVGuitar.d.ts +52 -0
package/FORMAT.md
CHANGED
|
@@ -37,7 +37,8 @@ Note: Position 1 can be represented in two ways:
|
|
|
37
37
|
This section contains up to 6 elements (one for each string). Trailing spaces are trimmed from the line. Each position can be:
|
|
38
38
|
- " " (space) means that the string at this position is neither muted nor played
|
|
39
39
|
- "x" means that the string at this position is muted
|
|
40
|
-
- "o" means that the string at this position is played (open string)
|
|
40
|
+
- "o" means that the string at this position is played (open string)
|
|
41
|
+
- Any other character means the string is played as an open string (fret 0) with that character displayed as a text label. If multiple characters are provided, only the first character is used. The color field is ignored for open strings - they always render with the default appearance regardless of color value.
|
|
41
42
|
|
|
42
43
|
### fretboard section
|
|
43
44
|
This section is mandatory and at least 3 rows long (3 frets).
|
|
@@ -92,6 +93,14 @@ Examples:
|
|
|
92
93
|
||||o|
|
|
93
94
|
|||o|o
|
|
94
95
|
|
|
96
|
+
A min
|
|
97
|
+
######
|
|
98
|
+
Ro o
|
|
99
|
+
------
|
|
100
|
+
||||o|
|
|
101
|
+
||o*||
|
|
102
|
+
||||||
|
|
103
|
+
|
|
95
104
|
```
|
|
96
105
|
|
|
97
106
|
## unicode format
|
|
@@ -112,6 +121,7 @@ This section contains up to 6 elements (one for each string) separated by spaces
|
|
|
112
121
|
- " " (space) means that the string at this position is neither muted nor played
|
|
113
122
|
- "×" means that the string at this position is muted
|
|
114
123
|
- "○" means that the string at this position is played (open string)
|
|
124
|
+
- Any other character means the string is played as an open string (fret 0) with that character displayed as a text label. If multiple characters are provided, only the first character is used. The color field is ignored for open strings - they always render with the default appearance regardless of color value.
|
|
115
125
|
|
|
116
126
|
### fretboard section
|
|
117
127
|
This section is mandatory and at least 3 frets long. It is built as a grid:
|
|
@@ -189,6 +199,17 @@ Example:
|
|
|
189
199
|
│ │ │ ○ │ ○
|
|
190
200
|
└─┴─┴─┴─┴─┘
|
|
191
201
|
|
|
202
|
+
A min
|
|
203
|
+
‾‾‾‾‾‾‾‾‾‾‾
|
|
204
|
+
R ○ ○
|
|
205
|
+
┌─┬─┬─┬─┬─┐
|
|
206
|
+
│ │ │ │ ○ │
|
|
207
|
+
├─┼─┼─┼─┼─┤
|
|
208
|
+
│ │ ○ ● │ │
|
|
209
|
+
├─┼─┼─┼─┼─┤
|
|
210
|
+
│ │ │ │ │ │
|
|
211
|
+
└─┴─┴─┴─┴─┘
|
|
212
|
+
|
|
192
213
|
```
|
|
193
214
|
|
|
194
215
|
## Edge cases and special behaviors
|
|
@@ -275,3 +296,71 @@ Unicode format:
|
|
|
275
296
|
│ │ │ │ │ │
|
|
276
297
|
└─┴─┴─┴─┴─┘
|
|
277
298
|
```
|
|
299
|
+
|
|
300
|
+
## Open strings with text labels
|
|
301
|
+
|
|
302
|
+
Open strings can display custom text labels by using any character other than space, 'o'/'○', or 'x'/'×' in the open string section. These labels are useful for showing note names, scale degrees, intervals, or other musical information.
|
|
303
|
+
|
|
304
|
+
### ASCII format examples
|
|
305
|
+
|
|
306
|
+
Single character labels:
|
|
307
|
+
```
|
|
308
|
+
12xoxx
|
|
309
|
+
------
|
|
310
|
+
||||||
|
|
311
|
+
||||||
|
|
312
|
+
||||||
|
|
313
|
+
```
|
|
314
|
+
This shows string 6 with label "1", string 5 with label "2", string 4 muted, string 3 open (no label), strings 2 and 1 muted.
|
|
315
|
+
|
|
316
|
+
Mixed labels and symbols:
|
|
317
|
+
```
|
|
318
|
+
AxBoCx
|
|
319
|
+
------
|
|
320
|
+
||||||
|
|
321
|
+
||||||
|
|
322
|
+
```
|
|
323
|
+
This shows strings with labels "A", "B", and "C" mixed with muted and open strings.
|
|
324
|
+
|
|
325
|
+
Special characters as labels:
|
|
326
|
+
```
|
|
327
|
+
#♭♯oxx
|
|
328
|
+
------
|
|
329
|
+
||||||
|
|
330
|
+
||||||
|
|
331
|
+
```
|
|
332
|
+
Musical symbols like sharp (#), flat (♭), and natural (♯) can be used as labels.
|
|
333
|
+
|
|
334
|
+
### Unicode format examples
|
|
335
|
+
|
|
336
|
+
Labels with spacing:
|
|
337
|
+
```
|
|
338
|
+
× ○ A 5
|
|
339
|
+
┌─┬─┬─┬─┬─┐
|
|
340
|
+
│ │ │ │ │ │
|
|
341
|
+
├─┼─┼─┼─┼─┤
|
|
342
|
+
│ │ │ │ │ │
|
|
343
|
+
└─┴─┴─┴─┴─┘
|
|
344
|
+
```
|
|
345
|
+
This shows string 6 muted, string 5 open (no label), string 4 with label "A", and string 1 with label "5".
|
|
346
|
+
|
|
347
|
+
Complete chord with labeled open strings:
|
|
348
|
+
```
|
|
349
|
+
G 7
|
|
350
|
+
‾‾‾‾‾‾‾‾‾‾‾
|
|
351
|
+
× ○ A 5
|
|
352
|
+
╒═╤═╤═╤═╤═╕
|
|
353
|
+
│ │ ● │ │ │
|
|
354
|
+
├─┼─┼─┼─┼─┤
|
|
355
|
+
│ │ │ │ ○ │
|
|
356
|
+
├─┼─┼─┼─┼─┤
|
|
357
|
+
│ │ │ ○ │ ○
|
|
358
|
+
└─┴─┴─┴─┴─┘
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
### Important notes about text labels on open strings
|
|
362
|
+
|
|
363
|
+
1. **Multi-character text**: If multiple characters are provided for a single string position (e.g., "Root"), only the first character will be displayed.
|
|
364
|
+
2. **Color ignored**: The color field is ignored for open strings. Even if a non-black color (like `#e74c3c`) is specified in the data structure, open strings always render with the default appearance and do not show root markers.
|
|
365
|
+
3. **Muted strings override text**: Strings marked as muted ('x' or fret value "x") always display as muted regardless of any text field in the data structure.
|
|
366
|
+
```
|