vexflow 5.4.0 → 5.6.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/build/cjs/vexflow-bravura.js +2 -2
- package/build/cjs/vexflow-bravura.js.map +1 -1
- package/build/cjs/vexflow-core.js +2 -2
- package/build/cjs/vexflow-core.js.map +1 -1
- package/build/cjs/vexflow-debug-with-tests.js +1740 -372
- package/build/cjs/vexflow-debug-with-tests.js.map +1 -1
- package/build/cjs/vexflow-debug.js +565 -258
- package/build/cjs/vexflow-debug.js.map +1 -1
- package/build/cjs/vexflow.js +2 -2
- package/build/cjs/vexflow.js.map +1 -1
- package/build/esm/src/annotation.js +2 -1
- package/build/esm/src/continuouslayout.js +107 -16
- package/build/esm/src/continuousspan.js +9 -1
- package/build/esm/src/easyscore/composition.js +83 -18
- package/build/esm/src/factory.js +2 -9
- package/build/esm/src/formatter.js +1 -1
- package/build/esm/src/fretdiagram.js +6 -2
- package/build/esm/src/gracenotegroup.js +4 -3
- package/build/esm/src/guitarmodifiers.js +4 -1
- package/build/esm/src/metrics.js +24 -5
- package/build/esm/src/note.js +1 -0
- package/build/esm/src/notehead.js +21 -10
- package/build/esm/src/phraselayout.js +13 -5
- package/build/esm/src/publication.js +10 -5
- package/build/esm/src/publicationview.js +3 -2
- package/build/esm/src/stave.js +4 -2
- package/build/esm/src/stavenote.js +56 -13
- package/build/esm/src/stavesection.js +15 -10
- package/build/esm/src/stavetie.js +3 -2
- package/build/esm/src/strokes.js +1 -1
- package/build/esm/src/svgcontext.js +11 -3
- package/build/esm/src/tabnote.js +6 -8
- package/build/esm/src/tabtie.js +3 -0
- package/build/esm/src/version.js +3 -3
- package/build/esm/tests/chordsymbol_tests.js +4 -1
- package/build/esm/tests/demo_petzold_tests.js +26 -14
- package/build/esm/tests/demo_repertoire_tests.js +5 -1
- package/build/esm/tests/demos/ballade.js +15 -0
- package/build/esm/tests/demos/electric.js +1 -3
- package/build/esm/tests/demos/fugue.js +19 -0
- package/build/esm/tests/demos/greensleeves.js +1 -2
- package/build/esm/tests/demos/kesh.js +2 -3
- package/build/esm/tests/demos/saints.js +17 -5
- package/build/esm/tests/engraving/continuous-studies.mjs +24 -0
- package/build/esm/tests/engraving/publication-studies.mjs +30 -0
- package/build/esm/tests/font_tests.js +8 -0
- package/build/esm/tests/gracenote_tests.js +1 -1
- package/build/esm/tests/gracetabnote_tests.js +19 -3
- package/build/esm/tests/node/chord-kerning-tests.mjs +2 -2
- package/build/esm/tests/node/continuous-score-tests.mjs +157 -2
- package/build/esm/tests/node/easyscore-tests.mjs +38 -0
- package/build/esm/tests/node/engraving-layout-tests.mjs +33 -0
- package/build/esm/tests/node/instrument-profile-tests.mjs +40 -0
- package/build/esm/tests/node/local-engraving-tests.mjs +58 -0
- package/build/esm/tests/node/metrics-tests.mjs +2 -0
- package/build/esm/tests/node/phrase-layout-tests.mjs +58 -5
- package/build/esm/tests/node/publication-tests.mjs +158 -2
- package/build/esm/tests/node/svg-export-tests.mjs +50 -21
- package/build/esm/tests/scores/ballade.js +399 -0
- package/build/esm/tests/scores/drums.js +93 -0
- package/build/esm/tests/scores/electric.js +83 -0
- package/build/esm/tests/scores/falseta.js +46 -0
- package/build/esm/tests/scores/fugue.js +366 -0
- package/build/esm/tests/scores/guitar.js +32 -0
- package/build/esm/tests/scores/kesh.js +146 -0
- package/build/esm/tests/scores/prelude.js +84 -0
- package/build/esm/tests/scores/quartertones.js +78 -0
- package/build/esm/tests/scores/saints.js +70 -0
- package/build/esm/tests/scores/sumer.js +126 -0
- package/build/esm/tests/scores/viewer.js +162 -0
- package/build/esm/tests/tabnote_tests.js +43 -0
- package/build/esm/tests/vexflow_test_helpers.js +1 -0
- package/build/esm/tools/explorer/catalog/expression.mjs +16 -6
- package/build/esm/tools/explorer/catalog/guitar.mjs +2 -2
- package/build/types/src/continuouslayout.d.ts +4 -0
- package/build/types/src/continuousspan.d.ts +10 -2
- package/build/types/src/easyscore/composition.d.ts +19 -0
- package/build/types/src/fretdiagram.d.ts +2 -0
- package/build/types/src/instrumentprofile.d.ts +4 -0
- package/build/types/src/note.d.ts +2 -0
- package/build/types/src/notehead.d.ts +2 -0
- package/build/types/src/publication.d.ts +3 -1
- package/build/types/src/stave.d.ts +4 -2
- package/build/types/src/stavenote.d.ts +10 -0
- package/build/types/src/stavesection.d.ts +3 -0
- package/build/types/src/svgcontext.d.ts +2 -0
- package/build/types/src/typeguard.d.ts +1 -0
- package/changelog/CHANGELOG.md +16 -0
- package/package.json +4 -1
- package/tests/all.html +9 -0
- package/tests/demo_petzold_tests.ts +30 -16
- package/tests/demos/ballade.ts +36 -0
- package/tests/demos/ballade.webp +0 -0
- package/tests/demos/electric.ts +1 -3
- package/tests/demos/electric.webp +0 -0
- package/tests/demos/fugue.ts +27 -0
- package/tests/demos/fugue.webp +0 -0
- package/tests/demos/greensleeves.ts +1 -3
- package/tests/demos/greensleeves.webp +0 -0
- package/tests/demos/kesh.ts +2 -4
- package/tests/demos/kesh.webp +0 -0
- package/tests/demos/saints.ts +20 -7
- package/tests/demos/saints.webp +0 -0
- package/tests/flow.html +165 -52
- package/tests/minuet.webp +0 -0
- package/tests/scores/ballade.js +445 -0
- package/tests/scores/drums.js +101 -0
- package/tests/scores/drums.webp +0 -0
- package/tests/scores/electric.js +93 -0
- package/tests/scores/electric.webp +0 -0
- package/tests/scores/falseta.js +53 -0
- package/tests/scores/falseta.webp +0 -0
- package/tests/scores/fugue.js +433 -0
- package/tests/scores/guitar.js +34 -0
- package/tests/scores/index.html +48 -0
- package/tests/scores/kesh.js +171 -0
- package/tests/scores/kesh.webp +0 -0
- package/tests/scores/prelude.js +90 -0
- package/tests/scores/prelude.webp +0 -0
- package/tests/scores/quartertones.js +83 -0
- package/tests/scores/quartertones.webp +0 -0
- package/tests/scores/saints.js +85 -0
- package/tests/scores/saints.webp +0 -0
- package/tests/scores/sumer.js +139 -0
- package/tests/scores/sumer.webp +0 -0
- package/tests/scores/viewer.css +132 -0
- package/tests/scores/viewer.js +150 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// Patio al alba. A melodic call and two rasgueado answers over an Andalusian cadence.
|
|
2
|
+
(() => {
|
|
3
|
+
const { guitarScore } = window.FeaturedScores;
|
|
4
|
+
const title = 'Patio al alba';
|
|
5
|
+
const credit = 'Example piece · Flamenco guitar';
|
|
6
|
+
const intro =
|
|
7
|
+
'Answer the melody with a–m–i downstrokes and an index return. Tap the soundboard with the accented second beat. Close with a freely rolled E chord.';
|
|
8
|
+
const choices = ['String direction', 'Hand direction'];
|
|
9
|
+
const control = 'Stroke arrows';
|
|
10
|
+
function create(VF, score, choice) {
|
|
11
|
+
const guitar = new VF.FrettedInstrument();
|
|
12
|
+
const arrows = choice === 'Hand direction' ? 'hand' : 'strings';
|
|
13
|
+
const note = (str, fret, duration) => guitar.attack([{ str, fret }], duration);
|
|
14
|
+
const line = (last) => [
|
|
15
|
+
note(1, 0, '8'),
|
|
16
|
+
note(1, 1, '8'),
|
|
17
|
+
note(1, 3, 'q'),
|
|
18
|
+
note(2, 3, '8'),
|
|
19
|
+
note(2, 1, '8'),
|
|
20
|
+
note(2, last, 'q'),
|
|
21
|
+
];
|
|
22
|
+
const grip = (frets) => frets.map((fret, i) => ({ str: 4 - i, fret }));
|
|
23
|
+
const answer = (frets, final) =>
|
|
24
|
+
guitar.rasgueado(
|
|
25
|
+
grip(frets),
|
|
26
|
+
['a', 'm', 'i', 'i', 'i', 'p', 'i'].map((finger, i) => ({
|
|
27
|
+
finger,
|
|
28
|
+
arrows,
|
|
29
|
+
duration: i < 4 ? '16' : 'q',
|
|
30
|
+
direction: i === 3 ? 'treble-to-bass' : 'bass-to-treble',
|
|
31
|
+
golpe: i === 4,
|
|
32
|
+
roll: final && i === 6,
|
|
33
|
+
}))
|
|
34
|
+
);
|
|
35
|
+
const bars = [[line(0)], [answer([3, 2, 1, 1], false)], [line(3)], [answer([2, 1, 0, 0], true)]];
|
|
36
|
+
return {
|
|
37
|
+
spec: guitarScore(score, bars, '4/4'),
|
|
38
|
+
legend:
|
|
39
|
+
'a ring · m middle · i index · p thumb · + golpe. ' +
|
|
40
|
+
(arrows === 'strings' ? '↑ bass to treble' : '↓ bass to treble'),
|
|
41
|
+
decorate(c) {
|
|
42
|
+
for (const view of ['staff', 'tab'])
|
|
43
|
+
for (const m of [1, 3]) {
|
|
44
|
+
const n = (i) => c.getNote([view, m, 0, i].join('-'));
|
|
45
|
+
score.beam([0, 1, 2, 3].map(n));
|
|
46
|
+
n(4).addModifier(score.make.articulation({ type: 'accent', position: 'above' }));
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
window.FeaturedScores.falseta = { title, credit, intro, choices, control, create };
|
|
53
|
+
})();
|
|
Binary file
|
|
@@ -0,0 +1,433 @@
|
|
|
1
|
+
// J. S. Bach, BWV 851. Both editions use the same 44-bar transcription.
|
|
2
|
+
// Source: Bach-Gesellschaft (1866), public-domain engraving by Stelios Samelis for Mutopia, no. 988.
|
|
3
|
+
// Each bar lists treble then bass. Parallel voices on a staff are ordered high to low.
|
|
4
|
+
// A null staff has a whole-measure rest. Spacers let a voice enter partway through a bar.
|
|
5
|
+
var BachFugue = (() => {
|
|
6
|
+
const fugueBars = [
|
|
7
|
+
// Bar 1
|
|
8
|
+
['B4/8/r, D4/8[dynamic="mp"], E4/8, F4/8, G4/8, E4/8', null],
|
|
9
|
+
// Bar 2
|
|
10
|
+
[
|
|
11
|
+
'F4/16[id="r2-0-0"], D4/16, C#4/16, D4/16[id="r2-3-0"], Bb4/q[id="r2-4-0",articulations="staccatissimo.above"], G4/q[ornament="tr.above"]',
|
|
12
|
+
null,
|
|
13
|
+
],
|
|
14
|
+
// Bar 3
|
|
15
|
+
[
|
|
16
|
+
'A4/q[id="r3-0-0",dynamic="p"], A4/16[id="r3-4-0"], G4/16, F4/16, E4/16, G4/16, F4/16, E4/16, D4/16',
|
|
17
|
+
'C4/8/r, A3/8, B3/8, C4/8, D4/8, B3/8',
|
|
18
|
+
],
|
|
19
|
+
// Bar 4
|
|
20
|
+
[
|
|
21
|
+
[
|
|
22
|
+
'E4/8, C5/8[id="r4-2-0"], C5/16[id="r4-4-0"], B4/16, A4/16, B4/16, B4/16, A4/16, G#4/16, A4/16',
|
|
23
|
+
'B4/q/r[spacer="yes"], F4/q, D4/q[ornament="tr.below"]',
|
|
24
|
+
],
|
|
25
|
+
'C4/16, A3/16, G#3/16, A3/16, D3/h/r[spacer="yes"]',
|
|
26
|
+
],
|
|
27
|
+
// Bar 5
|
|
28
|
+
[
|
|
29
|
+
[
|
|
30
|
+
'A4/16[id="r5-0-0"], G4/16, F#4/16, G4/16, E5/q[articulations="staccatissimo.above"], G4/q[id="r5-8-0"]',
|
|
31
|
+
'E4/q[id="r5-0-1"], E4/16[id="r5-4-1"], D4/16, C#4/16, B3/16, D4/16, C#4/16, B3/16, A3/16',
|
|
32
|
+
],
|
|
33
|
+
null,
|
|
34
|
+
],
|
|
35
|
+
// Bar 6
|
|
36
|
+
[
|
|
37
|
+
[
|
|
38
|
+
'F4/8, D5/8[id="r6-2-0"], D5/16[id="r6-4-0"], C5/16, Bb4/16, A4/16, C5/16, Bb4/16, A4/16, G4/16',
|
|
39
|
+
'D4/q[dynamic="mf"], D4/q/r, D4/q/r',
|
|
40
|
+
],
|
|
41
|
+
'D3/8/r, D3/8, E3/8, F3/8, G3/8, E3/8',
|
|
42
|
+
],
|
|
43
|
+
// Bar 7
|
|
44
|
+
[
|
|
45
|
+
[
|
|
46
|
+
'A4/q, G4/h[id="r7-4-0"]',
|
|
47
|
+
'C4/8/r, F4/8[id="r7-2-1"], F4/16[id="r7-4-1"], E4/16, D4/16, E4/16, E4/16, D4/16, C#4/16, D4/16',
|
|
48
|
+
],
|
|
49
|
+
'F3/16, D3/16, C#3/16, D3/16, Bb3/q[articulations="staccatissimo.above"], G3/q[ornament="tr.above"]',
|
|
50
|
+
],
|
|
51
|
+
// Bar 8
|
|
52
|
+
[
|
|
53
|
+
['G4/8[id="r8-0-0"], E4/8, F4/8, G4/8, A4/8, F4/8', 'C#4/q, D4/8, E4/8, C#4/8, D4/8'],
|
|
54
|
+
'A3/q[id="l8-0-0"], A3/16[id="l8-4-0"], G3/16, F3/16, E3/16, G3/16, F3/16, E3/16, D3/16',
|
|
55
|
+
],
|
|
56
|
+
// Bar 9
|
|
57
|
+
[
|
|
58
|
+
[
|
|
59
|
+
'Bb4/16, G4/16, F#4/16, G4/16, Eb5/q[articulations="staccatissimo.above"], C#5/q[ornament="turn.above"]',
|
|
60
|
+
'Eb4/8, D4/8, G4/q, E4/q',
|
|
61
|
+
],
|
|
62
|
+
'G3/8, Bb3/8[id="l9-2-0"], Bb3/16[id="l9-4-0"], A3/16, G3/16, A3/16, A3/16, G3/16, F3/16, G3/16',
|
|
63
|
+
],
|
|
64
|
+
// Bar 10
|
|
65
|
+
[
|
|
66
|
+
[
|
|
67
|
+
'D5/q, D5/q[articulations="staccatissimo.above"], B4/q[ornament="turn.above"]',
|
|
68
|
+
'E4/16/r, A4/16, G4/16, A4/16, F4/q, D4/q',
|
|
69
|
+
],
|
|
70
|
+
'G3/16, F3/16, E3/16, F3/16, A3/16, G3/16, F3/16, G3/16, G3/16, F3/16, E3/16, F3/16',
|
|
71
|
+
],
|
|
72
|
+
// Bar 11
|
|
73
|
+
[
|
|
74
|
+
[
|
|
75
|
+
'C5/q, C5/q[articulations="staccatissimo.above"], A4/q[ornament="turn.above"]',
|
|
76
|
+
'E4/16/r, G4/16, F4/16, G4/16, Eb4/q, C4/q',
|
|
77
|
+
],
|
|
78
|
+
'F3/16, E3/16, D3/16, E3/16, G3/16, F3/16, Eb3/16, F3/16, F3/16, Eb3/16, D3/16, Eb3/16',
|
|
79
|
+
],
|
|
80
|
+
// Bar 12
|
|
81
|
+
[
|
|
82
|
+
['Bb4/h.[id="r12-0-0"]', 'E4/8/r, A4/8, G4/8, F4/8, E4/8, G4/8'],
|
|
83
|
+
'Eb3/16, D3/16, C#3/16, D3/16, Bb3/q[articulations="staccatissimo.above"], G3/q[ornament="tr.above"]',
|
|
84
|
+
],
|
|
85
|
+
// Bar 13
|
|
86
|
+
[
|
|
87
|
+
['Bb4/8[id="r13-0-0"], A4/8, B4/8, C#5/8, D5/8, B4/8', 'C#4/q[dynamic="p"], D4/8, E4/8, B4/q/r[spacer="yes"]'],
|
|
88
|
+
[
|
|
89
|
+
'A3/q[id="l13-0-0"], A3/16[id="l13-4-0"], G3/16, F3/16, E3/16, A3/q',
|
|
90
|
+
'D3/h/r[spacer="yes"], G3/16, F3/16, E3/16, D3/16',
|
|
91
|
+
],
|
|
92
|
+
],
|
|
93
|
+
// Bar 14
|
|
94
|
+
[
|
|
95
|
+
[
|
|
96
|
+
'C#5/16, A4/16, G#4/16, A4/16, F5/q[articulations="staccatissimo.above"], D5/q[ornament="tr.above"]',
|
|
97
|
+
'C4/8/r, E4/8, D4/8, C#4/8, B3/8, D4/8',
|
|
98
|
+
],
|
|
99
|
+
'E3/8, C#3/8, D3/8, E3/8, F3/8, D3/8',
|
|
100
|
+
],
|
|
101
|
+
// Bar 15
|
|
102
|
+
[
|
|
103
|
+
[
|
|
104
|
+
'E5/8, A5/8[id="r15-2-0"], A5/16[id="r15-4-0"], G5/16, F#5/16, E5/16, G5/16, F#5/16, E5/16, D5/16',
|
|
105
|
+
'C#4/16, E4/16, F4/16, E4/16, B4/q/r[spacer="yes"], C4/q',
|
|
106
|
+
],
|
|
107
|
+
['A3/q, A3/q, D3/q/r[spacer="yes"]', 'D3/q/r[spacer="yes"], F#3/8, E3/8, D3/8, F#3/8'],
|
|
108
|
+
],
|
|
109
|
+
// Bar 16
|
|
110
|
+
[
|
|
111
|
+
[
|
|
112
|
+
'Eb5/16, C6/16, Bb5/8, G5/16/r, A5/16, G#5/16, F#5/16, A5/16, G#5/16, F#5/16, E5/16',
|
|
113
|
+
'Bb3/16[dynamic="f"], D4/16, Eb4/16, D4/16, B3/q, E4/q[id="r16-8-1"]',
|
|
114
|
+
],
|
|
115
|
+
'G3/q, G#3/8, F#3/8, E3/8, G#3/8',
|
|
116
|
+
],
|
|
117
|
+
// Bar 17
|
|
118
|
+
[
|
|
119
|
+
[
|
|
120
|
+
'D5/16, C5/16, B4/16, C5/16, C5/16, B4/16, A4/16, B4/16, B4/16, A4/16, G#4/16, A4/16',
|
|
121
|
+
'E4/8[id="r17-0-1"], D4/8/r, D4/q/r, D4/q/r',
|
|
122
|
+
],
|
|
123
|
+
'A3/8, A2/8, B2/8, C3/8, D3/8, B2/8',
|
|
124
|
+
],
|
|
125
|
+
// Bar 18
|
|
126
|
+
[
|
|
127
|
+
'G4/q[id="r18-0-0"], G4/16[id="r18-4-0"], F4/16, E4/16, F4/16, F4/16, E4/16, D4/16, A4/16',
|
|
128
|
+
['B3/8/r, A3/8, B3/8, C#4/8, D4/8, B3/8', 'C#3/16, A2/16, G#2/16, A2/16, F3/q, D3/q[ornament="tr.below"]'],
|
|
129
|
+
],
|
|
130
|
+
// Bar 19
|
|
131
|
+
[
|
|
132
|
+
[
|
|
133
|
+
'A4/h.[id="r19-0-0"]',
|
|
134
|
+
'B4/q/r[spacer="yes"], F4/q[articulations="staccatissimo.below"], D4/q[ornament="tr.below"]',
|
|
135
|
+
],
|
|
136
|
+
[
|
|
137
|
+
'C4/16, A3/16, G#3/16, A3/16, E3/16, D3/16, C3/16, D3/16, D3/16, C3/16, B2/16, C3/16',
|
|
138
|
+
'E3/8, F3/8, D3/h/r[spacer="yes"]',
|
|
139
|
+
],
|
|
140
|
+
],
|
|
141
|
+
// Bar 20
|
|
142
|
+
[
|
|
143
|
+
[
|
|
144
|
+
'A4/q[id="r20-0-0"], A4/16[id="r20-4-0"], D#5/16, E5/16, A4/16, C5/16, B4/16, A4/16, G#4/16',
|
|
145
|
+
'E4/8, F4/8, B4/q/r[spacer="yes"], B4/q/r[spacer="yes"]',
|
|
146
|
+
],
|
|
147
|
+
['D3/q/r[spacer="yes"], B3/h[ornament="tr.above"]', 'C3/8, D3/8, E3/8, D3/8, E3/q'],
|
|
148
|
+
],
|
|
149
|
+
// Bar 21
|
|
150
|
+
[
|
|
151
|
+
'A4/q[id="r21-0-0",dynamic="mp",ornament="mordentInverted.above"], A4/16[id="r21-4-0"], G4/16, F4/16, E4/16, G4/16, F4/16, E4/16, D4/16',
|
|
152
|
+
['A3/q, B3/q/r, B3/q/r', 'A3/8[id="l21-0-1"], A2/8, B2/8[id="l21-4-1"], C#3/8, D3/8, B2/8'],
|
|
153
|
+
],
|
|
154
|
+
// Bar 22
|
|
155
|
+
[
|
|
156
|
+
'E4/8, E5/8, D5/8, C#5/8, B4/8, D5/8',
|
|
157
|
+
'C#3/16, A2/16, G#2/16, A2/16, F3/q[articulations="staccatissimo.above"], D3/q[ornament="tr.above"]',
|
|
158
|
+
],
|
|
159
|
+
// Bar 23
|
|
160
|
+
[
|
|
161
|
+
'C#5/16, E5/16, F5/16, E5/16, G4/q[articulations="staccatissimo.below"], Bb4/q[id="r23-8-0"]',
|
|
162
|
+
'A3/8, F3/8, E3/8, D3/8, C#3/8, E3/8',
|
|
163
|
+
],
|
|
164
|
+
// Bar 24
|
|
165
|
+
[
|
|
166
|
+
'Bb4/16[id="r24-0-0"], A4/16, G4/16, A4/16, A4/16, G4/16, F4/16, G4/16, G4/16, F4/16, E4/16, F4/16',
|
|
167
|
+
'D3/16, F3/16, G3/16, F3/16, A2/q[articulations="staccatissimo.above"], C#3/q[ornament="tr.above"]',
|
|
168
|
+
],
|
|
169
|
+
// Bar 25
|
|
170
|
+
[
|
|
171
|
+
'F4/q[id="r25-0-0",dynamic="p"], F4/16[id="r25-4-0"], E4/16, F#4/16, G4/16, F#4/16, G4/16, A4/16, G4/16',
|
|
172
|
+
['C4/8/r, D4/8, C4/8, Bb3/8, A3/8, C4/8', 'D3/h.'],
|
|
173
|
+
],
|
|
174
|
+
// Bar 26
|
|
175
|
+
[
|
|
176
|
+
'G4/16, A4/16, Bb4/16, A4/16, A4/16, B4/16, C5/16, B4/16, B4/16, C#5/16, D5/16, C#5/16',
|
|
177
|
+
['Bb3/q, D4/h', 'B2/8/r, G3/8, F#3/8, E3/8, D3/8, F3/8'],
|
|
178
|
+
],
|
|
179
|
+
// Bar 27
|
|
180
|
+
[
|
|
181
|
+
'C#5/8, A5/8, G5/8, F5/8, E5/8, G5/8',
|
|
182
|
+
[
|
|
183
|
+
'G3/q, B3/q/r, B3/q/r',
|
|
184
|
+
'E3/q[id="l27-0-1"], E3/16[id="l27-4-1"], D3/16, C#3/16, B2/16, D3/16, C#3/16, B2/16, A2/16',
|
|
185
|
+
],
|
|
186
|
+
],
|
|
187
|
+
// Bar 28
|
|
188
|
+
[
|
|
189
|
+
['F5/16, A5/16, Bb5/16, A5/16, C#5/q, E5/q[id="r28-8-0"]', 'E4/8/r, D4/8, E4/8, F4/8, G4/8, E4/8'],
|
|
190
|
+
'D3/q[id="l28-0-0"], D3/q/r[id="l28-4-0"], D3/q/r',
|
|
191
|
+
],
|
|
192
|
+
// Bar 29
|
|
193
|
+
[
|
|
194
|
+
[
|
|
195
|
+
'E5/8[id="r29-0-0"], A4/8, D5/q, C5/q[id="r29-8-0"]',
|
|
196
|
+
'F4/16, D4/16, C#4/16, D4/16, Bb4/q, G4/q[ornament="mordent.below"]',
|
|
197
|
+
],
|
|
198
|
+
'D3/8/r, A3/8, G3/8, F3/8, E3/8, G3/8',
|
|
199
|
+
],
|
|
200
|
+
// Bar 30
|
|
201
|
+
[
|
|
202
|
+
[
|
|
203
|
+
'C5/8[id="r30-0-0"], Eb5/8[id="r30-2-0"], Eb5/16[id="r30-4-0"], D5/16, C5/16, D5/16, D5/16, C5/16, Bb4/16, C5/16',
|
|
204
|
+
'A4/q, B4/h/r[spacer="yes"]',
|
|
205
|
+
],
|
|
206
|
+
[
|
|
207
|
+
'F#3/16, A3/16, Bb3/16, A3/16, F#3/q[articulations="staccatissimo.above"], A3/q[articulations="staccatissimo.above"]',
|
|
208
|
+
'D3/q/r[spacer="yes"], D3/q, F#3/q',
|
|
209
|
+
],
|
|
210
|
+
],
|
|
211
|
+
// Bar 31
|
|
212
|
+
[
|
|
213
|
+
'C5/16, Bb4/16, A4/16, Bb4/16, D5/16, C5/16, Bb4/16, C5/16, C5/16, Bb4/16, A4/16, Bb4/16',
|
|
214
|
+
[
|
|
215
|
+
'A3/16/r, G3/16, F#3/16, G3/16, E3/q[articulations="staccatissimo.above"], G3/q[articulations="staccatissimo.above"]',
|
|
216
|
+
'G2/q, C3/q, E3/q',
|
|
217
|
+
],
|
|
218
|
+
],
|
|
219
|
+
// Bar 32
|
|
220
|
+
[
|
|
221
|
+
'Bb4/16, A4/16, G4/16, A4/16, C5/16, Bb4/16, A4/16, Bb4/16, Bb4/16, A4/16, G4/16, A4/16',
|
|
222
|
+
[
|
|
223
|
+
'A3/16/r, F3/16, E3/16, F3/16, D3/q[articulations="staccatissimo.above"], F3/q[articulations="staccatissimo.above"]',
|
|
224
|
+
'F2/q, Bb2/q, D3/q',
|
|
225
|
+
],
|
|
226
|
+
],
|
|
227
|
+
// Bar 33
|
|
228
|
+
[
|
|
229
|
+
'A4/16, G4/16, F4/16, G4/16, E5/q[articulations="staccatissimo.above"], C#5/q[ornament="tr.above"]',
|
|
230
|
+
['C4/8/r, F3/8, G3/8, A3/8, Bb3/8, G3/8', 'E3/h.'],
|
|
231
|
+
],
|
|
232
|
+
// Bar 34
|
|
233
|
+
[
|
|
234
|
+
'D5/q[id="r34-0-0",dynamic="mf"], D5/16[id="r34-4-0"], C5/16, Bb4/16, A4/16, C5/16, Bb4/16, A4/16, G4/16',
|
|
235
|
+
['A3/8, F3/8, G3/8, A3/8, G3/q', 'F3/8, D3/8, E3/8, F#3/8, G3/8, E3/8'],
|
|
236
|
+
],
|
|
237
|
+
// Bar 35
|
|
238
|
+
[
|
|
239
|
+
'A4/8, F#4/8, G4/8, A4/8, Bb4/8, G4/8',
|
|
240
|
+
['C4/8/r, A3/8, G3/8, F3/8, E3/8, G3/8', 'F#3/16, D3/16, C#3/16, D3/16, Bb3/8, A3/8, G3/8, Bb3/8'],
|
|
241
|
+
],
|
|
242
|
+
// Bar 36
|
|
243
|
+
[
|
|
244
|
+
'A4/16, C5/16, Eb5/8[id="r36-2-0"], Eb5/16[id="r36-4-0"], D5/16, C5/16, Bb4/16, D5/16, C5/16, Bb4/16, A4/16',
|
|
245
|
+
['F#3/8, Bb3/8, A3/8, G3/8, F#3/8, A3/8', 'A3/8, G3/8, F#3/8, E3/8, D3/8, F#3/8'],
|
|
246
|
+
],
|
|
247
|
+
// Bar 37
|
|
248
|
+
[
|
|
249
|
+
'Bb4/16, D5/16, F5/8[id="r37-2-0"], F5/16[id="r37-4-0"], E5/16, D5/16, C#5/16, E5/16, D5/16, C#5/16, B4/16',
|
|
250
|
+
['G3/8, C4/8, B3/8, A3/8, G#3/8, B3/8', 'A2/8, A3/8, G#3/8, F#3/8, E3/8, G#3/8'],
|
|
251
|
+
],
|
|
252
|
+
// Bar 38
|
|
253
|
+
[
|
|
254
|
+
'C#5/16[id="r38-0-0"], E5/16, Bb5/8[id="r38-2-0"], Bb5/16[id="r38-4-0"], A5/16, G5/16, F5/16, A5/16, G5/16, F5/16, E5/16[id="r38-11-0"]',
|
|
255
|
+
['A3/8, F4/8, E4/8, D4/8, C#4/8, E4/8', 'A2/8, D4/8, C#4/8, B3/8, A3/8, C#4/8'],
|
|
256
|
+
],
|
|
257
|
+
// Bar 39
|
|
258
|
+
[
|
|
259
|
+
'G5/16[dynamic="f"], F5/16, E5/16, F5/16, F5/16, E5/16, D5/16, E5/16, E5/16, D5/16, C#5/16, D5/16',
|
|
260
|
+
['D4/8, D4/8/r, D4/q/r, D4/q/r', 'D4/8, D3/8, E3/8, F3/8, G3/8, E3/8'],
|
|
261
|
+
],
|
|
262
|
+
// Bar 40
|
|
263
|
+
[
|
|
264
|
+
[
|
|
265
|
+
'C5/q[id="r40-0-0"], C5/16[id="r40-4-0"], Bb4/16, A4/16, Bb4/16, Bb4/16, A4/16, G4/16, D5/16',
|
|
266
|
+
'D4/8/r, D4/8, E4/8, F#4/8, G4/8, E4/8',
|
|
267
|
+
],
|
|
268
|
+
'F#3/16, D3/16, C#3/16, D3/16, Bb3/q[articulations="staccatissimo.above"], G3/q[ornament="tr.above"]',
|
|
269
|
+
],
|
|
270
|
+
// Bar 41
|
|
271
|
+
[
|
|
272
|
+
[
|
|
273
|
+
'D5/h.[id="r41-0-0"]',
|
|
274
|
+
'F4/16, D#4/16, C#4/16, D4/16, Bb4/q[articulations="staccatissimo.below"], G4/q[ornament="tr.below"]',
|
|
275
|
+
],
|
|
276
|
+
'A3/8, Bb3/8, A3/16, G3/16, F3/16, G3/16, G3/16, F3/16, E3/16, F3/16',
|
|
277
|
+
],
|
|
278
|
+
// Bar 42
|
|
279
|
+
[
|
|
280
|
+
[
|
|
281
|
+
'D5/q[id="r42-0-0"], D5/16[id="r42-4-0"], G#5/16, A5/16, D5/16, F5/16, E5/16, D5/16, C#5/16',
|
|
282
|
+
'A4/8, Bb4/8, E4/h[ornament="tr.below"]',
|
|
283
|
+
],
|
|
284
|
+
'F3/8, G3/8, A3/8, G3/8, A3/q',
|
|
285
|
+
],
|
|
286
|
+
// Bar 43
|
|
287
|
+
[
|
|
288
|
+
['D5/h.[dynamic="mf"]', 'E4/8/r, (A4 C5)/8, (G4 Bb4)/8, (F#4 A4)/8, (E4 G4)/8, (G4 Bb4)/8'],
|
|
289
|
+
['D4/8/r, (D3 F#3)/8[id="l43-2-0"], (E3 G3)/8[id="l43-4-0"], (F#3 A3)/8, (G3 Bb3)/8, (E3 G3)/8', 'D3/h.'],
|
|
290
|
+
],
|
|
291
|
+
// Bar 44
|
|
292
|
+
[
|
|
293
|
+
['D5/h.[articulations="fermata.above"]', '(F#4 A4)/h.'],
|
|
294
|
+
['(F#3 A3)/h.', 'D3/h.[articulations="fermata.below"]'],
|
|
295
|
+
],
|
|
296
|
+
];
|
|
297
|
+
|
|
298
|
+
// Named endpoints keep sustained notes connected when the music wraps to a new system.
|
|
299
|
+
const fuguePhrases = [
|
|
300
|
+
['crescendo', 'r5-0-0', 'r5-8-0', 'below'],
|
|
301
|
+
['crescendo', 'r38-0-0', 'r38-11-0', 'below'],
|
|
302
|
+
['diminuendo', 'r2-0-0', 'r2-4-0', 'below'],
|
|
303
|
+
['slur', 'r2-0-0', 'r2-3-0', 'above'],
|
|
304
|
+
['tie', 'r3-0-0', 'r3-4-0', 'above'],
|
|
305
|
+
['tie', 'r4-2-0', 'r4-4-0', 'above'],
|
|
306
|
+
['tie', 'r6-2-0', 'r6-4-0', 'above'],
|
|
307
|
+
['tie', 'r7-4-0', 'r8-0-0', 'above'],
|
|
308
|
+
['tie', 'r12-0-0', 'r13-0-0', 'above'],
|
|
309
|
+
['tie', 'r15-2-0', 'r15-4-0', 'above'],
|
|
310
|
+
['tie', 'r5-0-1', 'r5-4-1', 'below'],
|
|
311
|
+
['tie', 'r7-2-1', 'r7-4-1', 'below'],
|
|
312
|
+
['tie', 'r16-8-1', 'r17-0-1', 'below'],
|
|
313
|
+
['tie', 'r18-0-0', 'r18-4-0', 'above'],
|
|
314
|
+
['tie', 'r19-0-0', 'r20-0-0', 'above'],
|
|
315
|
+
['tie', 'r20-0-0', 'r20-4-0', 'above'],
|
|
316
|
+
['tie', 'r21-0-0', 'r21-4-0', 'above'],
|
|
317
|
+
['tie', 'r23-8-0', 'r24-0-0', 'above'],
|
|
318
|
+
['tie', 'r25-0-0', 'r25-4-0', 'above'],
|
|
319
|
+
['tie', 'r28-8-0', 'r29-0-0', 'above'],
|
|
320
|
+
['tie', 'r29-8-0', 'r30-0-0', 'above'],
|
|
321
|
+
['tie', 'r30-2-0', 'r30-4-0', 'above'],
|
|
322
|
+
['tie', 'r34-0-0', 'r34-4-0', 'above'],
|
|
323
|
+
['tie', 'r36-2-0', 'r36-4-0', 'above'],
|
|
324
|
+
['tie', 'r37-2-0', 'r37-4-0', 'above'],
|
|
325
|
+
['tie', 'r38-2-0', 'r38-4-0', 'above'],
|
|
326
|
+
['tie', 'r40-0-0', 'r40-4-0', 'above'],
|
|
327
|
+
['tie', 'r41-0-0', 'r42-0-0', 'above'],
|
|
328
|
+
['tie', 'r42-0-0', 'r42-4-0', 'above'],
|
|
329
|
+
['tie', 'l8-0-0', 'l8-4-0', 'above'],
|
|
330
|
+
['tie', 'l9-2-0', 'l9-4-0', 'above'],
|
|
331
|
+
['tie', 'l13-0-0', 'l13-4-0', 'above'],
|
|
332
|
+
['tie', 'l27-0-1', 'l27-4-1', 'below'],
|
|
333
|
+
];
|
|
334
|
+
|
|
335
|
+
/** Format the ornaments on their own voice's side of the staff. Spacers carry time through a hand change. */
|
|
336
|
+
function fugueNoteMarks(VF) {
|
|
337
|
+
return ({ ornament, spacer, dynamic }, note, builder) => {
|
|
338
|
+
if (dynamic) {
|
|
339
|
+
const text = [...dynamic].map((letter) => VF.TextDynamics.GLYPHS[letter]).join('');
|
|
340
|
+
note.addModifier(
|
|
341
|
+
builder
|
|
342
|
+
.getFactory()
|
|
343
|
+
.Annotation({ text, vJustify: 'bottom', font: { family: 'Bravura', size: 23 } })
|
|
344
|
+
.setYShift(5)
|
|
345
|
+
);
|
|
346
|
+
}
|
|
347
|
+
if (ornament) {
|
|
348
|
+
const [type, position] = ornament.split('.');
|
|
349
|
+
note.addModifier(builder.getFactory().Ornament(type, { position }));
|
|
350
|
+
}
|
|
351
|
+
if (spacer) note.setStyle({ fillStyle: 'transparent', strokeStyle: 'transparent' });
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
/** Share the music through the requested bar, omitting ties that end beyond the excerpt.
|
|
356
|
+
* @returns {import('../../src/easyscore').EasyScoreCompositionSpec}
|
|
357
|
+
*/
|
|
358
|
+
function fugueMusic(VF, count) {
|
|
359
|
+
const bars = fugueBars.slice(0, count);
|
|
360
|
+
const staves = ['treble', 'bass'].map((clef, hand) => ({
|
|
361
|
+
id: clef,
|
|
362
|
+
clef,
|
|
363
|
+
key: 'Dm',
|
|
364
|
+
time: '3/4',
|
|
365
|
+
...(hand === 0 ? { name: 'Piano', shortName: 'Pno.' } : {}),
|
|
366
|
+
measures: bars.map((bar, index) => {
|
|
367
|
+
const music = bar[hand];
|
|
368
|
+
if (music === null) {
|
|
369
|
+
// A centered whole rest fills this silent 3/4 bar before the next subject entry.
|
|
370
|
+
return {
|
|
371
|
+
voices: [
|
|
372
|
+
{
|
|
373
|
+
notes: [
|
|
374
|
+
{ keys: ['d/3'], clef, duration: 'wr', alignCenter: true, durationOverride: new VF.Fraction(3, 4) },
|
|
375
|
+
],
|
|
376
|
+
},
|
|
377
|
+
],
|
|
378
|
+
};
|
|
379
|
+
}
|
|
380
|
+
// Beam the five eighths of the opening subject and its two answers as a single gesture.
|
|
381
|
+
const entrance = hand === 0 ? index === 0 : index === 2 || index === 5;
|
|
382
|
+
const autoBeam = entrance ? { groups: [new VF.Fraction(3, 4)] } : true;
|
|
383
|
+
const voices = Array.isArray(music)
|
|
384
|
+
? music.map((notes, i) => ({
|
|
385
|
+
notes,
|
|
386
|
+
stem: i === 0 ? 'up' : 'down',
|
|
387
|
+
autoBeam: { autoStem: false },
|
|
388
|
+
}))
|
|
389
|
+
: [{ notes: music, autoBeam }];
|
|
390
|
+
return { voices };
|
|
391
|
+
}),
|
|
392
|
+
}));
|
|
393
|
+
// Give the moving voices room. Catch only the held bass and release at the next attack.
|
|
394
|
+
const pedal = [
|
|
395
|
+
[8, 'l8-0-0', 'l8-4-0'],
|
|
396
|
+
[21, 'l21-0-1', 'l21-4-1'],
|
|
397
|
+
[28, 'l28-0-0', 'l28-4-0'],
|
|
398
|
+
[43, 'l43-2-0', 'l43-4-0'],
|
|
399
|
+
];
|
|
400
|
+
const sections = [
|
|
401
|
+
[1, 'Subject'],
|
|
402
|
+
[3, 'Answer'],
|
|
403
|
+
[6, 'Bass entry'],
|
|
404
|
+
[22, 'Inversion'],
|
|
405
|
+
[34, 'Stretto'],
|
|
406
|
+
[43, 'Cadence'],
|
|
407
|
+
];
|
|
408
|
+
const spans = fuguePhrases
|
|
409
|
+
.filter(([, , to]) => Number(to.slice(1).split('-')[0]) <= count)
|
|
410
|
+
.map(([kind, from, to, side]) => ({ kind, from, to, side, id: kind + '-' + from }));
|
|
411
|
+
for (const [bar, from, to] of pedal) {
|
|
412
|
+
if (bar <= count) spans.push({ kind: 'pedal', id: 'pedal-' + bar, from, to, text: 'Ped.' });
|
|
413
|
+
}
|
|
414
|
+
return {
|
|
415
|
+
accidentals: 'key-aware',
|
|
416
|
+
staves,
|
|
417
|
+
sheet: { measurePadding: 15 },
|
|
418
|
+
system: { spaceBetweenStaves: 9, details: { spacing: { mode: 'optical' } } },
|
|
419
|
+
continuous: {
|
|
420
|
+
measureNumbers: true,
|
|
421
|
+
boundaries: sections
|
|
422
|
+
.filter(([measure]) => measure <= count)
|
|
423
|
+
.map(([measure, rehearsal]) => ({ measure, rehearsal })),
|
|
424
|
+
groups: [{ first: 'treble', last: 'bass', type: 'brace', barlines: true }],
|
|
425
|
+
spans,
|
|
426
|
+
},
|
|
427
|
+
};
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
return { music: fugueMusic, noteMarks: fugueNoteMarks };
|
|
431
|
+
})();
|
|
432
|
+
// Bundled and ESM tests use the same namespace as the standalone, file-based reader.
|
|
433
|
+
globalThis.BachFugue = BachFugue;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// Project each fretted attack into written staff notation and rhythmic tablature.
|
|
2
|
+
(() => {
|
|
3
|
+
function guitarScore(score, bars, time, continuous = {}) {
|
|
4
|
+
return {
|
|
5
|
+
continuous,
|
|
6
|
+
staves: ['staff', 'tab'].map((view) => ({
|
|
7
|
+
id: view,
|
|
8
|
+
name: view === 'tab' ? 'TAB' : 'Guitar',
|
|
9
|
+
shortName: view === 'tab' ? 'TAB' : 'Gtr.',
|
|
10
|
+
kind: view === 'tab' ? 'tab' : 'stave',
|
|
11
|
+
time,
|
|
12
|
+
spaceAbove: view === 'tab' ? 6 : 0,
|
|
13
|
+
measures: bars.map((voices, m) => ({
|
|
14
|
+
voices: voices.map((events, v) => ({
|
|
15
|
+
notes: events.map((attack, i) => {
|
|
16
|
+
const id = [view, m, v, i].join('-');
|
|
17
|
+
const stemDirection = v === 0 ? 1 : -1;
|
|
18
|
+
// A silent bass subdivision balances the voice without drawing a fret number.
|
|
19
|
+
if (typeof attack === 'string')
|
|
20
|
+
return view === 'tab'
|
|
21
|
+
? score.make.ghostNote({ duration: attack })
|
|
22
|
+
: { id, note: { keys: ['b/4'], duration: attack + 'r', stemDirection } };
|
|
23
|
+
return view === 'tab'
|
|
24
|
+
? { id, tab: { ...attack.tab, stemDirection }, drawStem: true }
|
|
25
|
+
: { id, note: { ...attack.note, stemDirection } };
|
|
26
|
+
}),
|
|
27
|
+
})),
|
|
28
|
+
})),
|
|
29
|
+
})),
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
window.FeaturedScores.guitarScore = guitarScore;
|
|
34
|
+
})();
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
|
6
|
+
<title>Featured score · VexFlow</title>
|
|
7
|
+
<link rel="stylesheet" href="viewer.css" />
|
|
8
|
+
<script defer src="../../build/cjs/vexflow-debug.js"></script>
|
|
9
|
+
<script defer src="viewer.js"></script>
|
|
10
|
+
</head>
|
|
11
|
+
<body>
|
|
12
|
+
<main>
|
|
13
|
+
<header>
|
|
14
|
+
<a id="gallery" href="../flow.html">← Featured scores</a><a id="source" hidden>View score code</a>
|
|
15
|
+
</header>
|
|
16
|
+
<h1 id="title">Featured score</h1>
|
|
17
|
+
<p id="credit"></p>
|
|
18
|
+
<p id="intro"></p>
|
|
19
|
+
<form id="tools" hidden>
|
|
20
|
+
<label id="edition-label" hidden
|
|
21
|
+
><span></span
|
|
22
|
+
><select id="edition"></select
|
|
23
|
+
></label>
|
|
24
|
+
<label id="width-label"
|
|
25
|
+
>Layout
|
|
26
|
+
<select id="width">
|
|
27
|
+
<option>Page width</option>
|
|
28
|
+
<option>Narrow</option>
|
|
29
|
+
</select></label
|
|
30
|
+
>
|
|
31
|
+
<button type="button" id="action" hidden></button
|
|
32
|
+
><button type="button" id="print" hidden>Print this edition</button>
|
|
33
|
+
</form>
|
|
34
|
+
<p id="legend" hidden></p>
|
|
35
|
+
<label id="reading" hidden
|
|
36
|
+
>Score events
|
|
37
|
+
<select id="events"></select
|
|
38
|
+
></label>
|
|
39
|
+
<div id="page">
|
|
40
|
+
<div id="frame">
|
|
41
|
+
<div id="score"></div>
|
|
42
|
+
<div id="highlight" hidden></div>
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
<p id="status" role="status">Loading score…</p>
|
|
46
|
+
</main>
|
|
47
|
+
</body>
|
|
48
|
+
</html>
|