@mcqj/vexflow 0.0.1-alpha.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.
Files changed (300) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +208 -0
  3. package/build/cjs/vexflow-bravura.js +2 -0
  4. package/build/cjs/vexflow-bravura.js.map +1 -0
  5. package/build/cjs/vexflow-core.js +2 -0
  6. package/build/cjs/vexflow-core.js.map +1 -0
  7. package/build/cjs/vexflow-debug-with-tests.js +43475 -0
  8. package/build/cjs/vexflow-debug-with-tests.js.map +1 -0
  9. package/build/cjs/vexflow-debug.js +19194 -0
  10. package/build/cjs/vexflow-debug.js.map +1 -0
  11. package/build/cjs/vexflow.js +2 -0
  12. package/build/cjs/vexflow.js.map +1 -0
  13. package/build/esm/entry/vexflow-bravura.js +17 -0
  14. package/build/esm/entry/vexflow-core.js +4 -0
  15. package/build/esm/entry/vexflow-debug-with-tests.js +38 -0
  16. package/build/esm/entry/vexflow-debug.js +31 -0
  17. package/build/esm/entry/vexflow.js +31 -0
  18. package/build/esm/package.json +3 -0
  19. package/build/esm/src/accidental.js +330 -0
  20. package/build/esm/src/annotation.js +231 -0
  21. package/build/esm/src/articulation.js +281 -0
  22. package/build/esm/src/barnote.js +56 -0
  23. package/build/esm/src/beam.js +644 -0
  24. package/build/esm/src/bend.js +186 -0
  25. package/build/esm/src/boundingbox.js +59 -0
  26. package/build/esm/src/canvascontext.js +216 -0
  27. package/build/esm/src/chordsymbol.js +325 -0
  28. package/build/esm/src/clef.js +120 -0
  29. package/build/esm/src/clefnote.js +35 -0
  30. package/build/esm/src/crescendo.js +78 -0
  31. package/build/esm/src/curve.js +126 -0
  32. package/build/esm/src/dot.js +129 -0
  33. package/build/esm/src/easyscore.js +374 -0
  34. package/build/esm/src/element.js +409 -0
  35. package/build/esm/src/factory.js +463 -0
  36. package/build/esm/src/flag.js +22 -0
  37. package/build/esm/src/font.js +237 -0
  38. package/build/esm/src/fonts/academico.js +1 -0
  39. package/build/esm/src/fonts/academicobold.js +1 -0
  40. package/build/esm/src/fonts/bravura.js +1 -0
  41. package/build/esm/src/fonts/gonville.js +1 -0
  42. package/build/esm/src/fonts/petaluma.js +1 -0
  43. package/build/esm/src/fonts/petalumascript.js +1 -0
  44. package/build/esm/src/formatter.js +610 -0
  45. package/build/esm/src/fraction.js +170 -0
  46. package/build/esm/src/frethandfinger.js +141 -0
  47. package/build/esm/src/ghostnote.js +50 -0
  48. package/build/esm/src/glyphnote.js +44 -0
  49. package/build/esm/src/glyphs.js +2936 -0
  50. package/build/esm/src/gracenote.js +106 -0
  51. package/build/esm/src/gracenotegroup.js +138 -0
  52. package/build/esm/src/gracetabnote.js +11 -0
  53. package/build/esm/src/index.js +86 -0
  54. package/build/esm/src/keymanager.js +99 -0
  55. package/build/esm/src/keysignature.js +220 -0
  56. package/build/esm/src/keysignote.js +28 -0
  57. package/build/esm/src/metrics.js +237 -0
  58. package/build/esm/src/modifier.js +121 -0
  59. package/build/esm/src/modifiercontext.js +110 -0
  60. package/build/esm/src/multimeasurerest.js +127 -0
  61. package/build/esm/src/music.js +322 -0
  62. package/build/esm/src/note.js +383 -0
  63. package/build/esm/src/notehead.js +89 -0
  64. package/build/esm/src/notesubgroup.js +59 -0
  65. package/build/esm/src/ornament.js +192 -0
  66. package/build/esm/src/parenthesis.js +61 -0
  67. package/build/esm/src/parser.js +164 -0
  68. package/build/esm/src/pedalmarking.js +168 -0
  69. package/build/esm/src/registry.js +81 -0
  70. package/build/esm/src/rendercontext.js +20 -0
  71. package/build/esm/src/renderer.js +112 -0
  72. package/build/esm/src/repeatnote.js +17 -0
  73. package/build/esm/src/stave.js +579 -0
  74. package/build/esm/src/stavebarline.js +237 -0
  75. package/build/esm/src/staveconnector.js +180 -0
  76. package/build/esm/src/stavehairpin.js +115 -0
  77. package/build/esm/src/staveline.js +199 -0
  78. package/build/esm/src/stavemodifier.js +56 -0
  79. package/build/esm/src/stavenote.js +861 -0
  80. package/build/esm/src/staverepetition.js +120 -0
  81. package/build/esm/src/stavesection.js +36 -0
  82. package/build/esm/src/stavetempo.js +110 -0
  83. package/build/esm/src/stavetext.js +55 -0
  84. package/build/esm/src/stavetie.js +186 -0
  85. package/build/esm/src/stavevolta.js +53 -0
  86. package/build/esm/src/stem.js +133 -0
  87. package/build/esm/src/stemmablenote.js +193 -0
  88. package/build/esm/src/stringnumber.js +228 -0
  89. package/build/esm/src/strokes.js +164 -0
  90. package/build/esm/src/svgcontext.js +402 -0
  91. package/build/esm/src/system.js +166 -0
  92. package/build/esm/src/tables.js +696 -0
  93. package/build/esm/src/tabnote.js +278 -0
  94. package/build/esm/src/tabslide.js +68 -0
  95. package/build/esm/src/tabstave.js +17 -0
  96. package/build/esm/src/tabtie.js +19 -0
  97. package/build/esm/src/textbracket.js +128 -0
  98. package/build/esm/src/textdynamics.js +53 -0
  99. package/build/esm/src/textnote.js +116 -0
  100. package/build/esm/src/tickable.js +224 -0
  101. package/build/esm/src/tickcontext.js +189 -0
  102. package/build/esm/src/timesignature.js +169 -0
  103. package/build/esm/src/timesignote.js +30 -0
  104. package/build/esm/src/tremolo.js +30 -0
  105. package/build/esm/src/tuning.js +55 -0
  106. package/build/esm/src/tuplet.js +258 -0
  107. package/build/esm/src/typeguard.js +30 -0
  108. package/build/esm/src/util.js +67 -0
  109. package/build/esm/src/version.js +3 -0
  110. package/build/esm/src/vexflow.js +309 -0
  111. package/build/esm/src/vibrato.js +68 -0
  112. package/build/esm/src/vibratobracket.js +44 -0
  113. package/build/esm/src/voice.js +178 -0
  114. package/build/esm/src/web.js +15 -0
  115. package/build/esm/tests/accidental_tests.js +1055 -0
  116. package/build/esm/tests/annotation_tests.js +381 -0
  117. package/build/esm/tests/articulation_tests.js +432 -0
  118. package/build/esm/tests/auto_beam_formatting_tests.js +551 -0
  119. package/build/esm/tests/barline_tests.js +52 -0
  120. package/build/esm/tests/beam_tests.js +669 -0
  121. package/build/esm/tests/bend_tests.js +223 -0
  122. package/build/esm/tests/boundingbox_tests.js +53 -0
  123. package/build/esm/tests/browser_test_runner.js +128 -0
  124. package/build/esm/tests/chordsymbol_tests.js +405 -0
  125. package/build/esm/tests/clef_tests.js +141 -0
  126. package/build/esm/tests/crossbeam_tests.js +306 -0
  127. package/build/esm/tests/curve_tests.js +152 -0
  128. package/build/esm/tests/demo_petzold_tests.js +335 -0
  129. package/build/esm/tests/dot_tests.js +119 -0
  130. package/build/esm/tests/easyscore_tests.js +488 -0
  131. package/build/esm/tests/factory_tests.js +44 -0
  132. package/build/esm/tests/font_tests.js +134 -0
  133. package/build/esm/tests/formatter/framestack.js +61 -0
  134. package/build/esm/tests/formatter/tests.js +251 -0
  135. package/build/esm/tests/formatter_tests.js +759 -0
  136. package/build/esm/tests/fraction_tests.js +72 -0
  137. package/build/esm/tests/ghostnote_tests.js +77 -0
  138. package/build/esm/tests/glyphnote_tests.js +119 -0
  139. package/build/esm/tests/gracenote_tests.js +414 -0
  140. package/build/esm/tests/gracetabnote_tests.js +79 -0
  141. package/build/esm/tests/index.js +68 -0
  142. package/build/esm/tests/key_clef_tests.js +106 -0
  143. package/build/esm/tests/keymanager_tests.js +68 -0
  144. package/build/esm/tests/keysignature_tests.js +322 -0
  145. package/build/esm/tests/mocks.js +70 -0
  146. package/build/esm/tests/modifier_tests.js +24 -0
  147. package/build/esm/tests/multimeasurerest_tests.js +141 -0
  148. package/build/esm/tests/music_tests.js +161 -0
  149. package/build/esm/tests/node_test_runner.js +31 -0
  150. package/build/esm/tests/notehead_tests.js +224 -0
  151. package/build/esm/tests/notesubgroup_tests.js +149 -0
  152. package/build/esm/tests/offscreencanvas_tests.js +47 -0
  153. package/build/esm/tests/ornament_tests.js +333 -0
  154. package/build/esm/tests/parser_tests.js +122 -0
  155. package/build/esm/tests/pedalmarking_tests.js +91 -0
  156. package/build/esm/tests/percussion_tests.js +184 -0
  157. package/build/esm/tests/playwright/flow.spec.js +127 -0
  158. package/build/esm/tests/playwright/visual_helpers.js +30 -0
  159. package/build/esm/tests/registry_tests.js +64 -0
  160. package/build/esm/tests/renderer_tests.js +113 -0
  161. package/build/esm/tests/rests_tests.js +266 -0
  162. package/build/esm/tests/rhythm_tests.js +357 -0
  163. package/build/esm/tests/stave_tests.js +570 -0
  164. package/build/esm/tests/staveconnector_tests.js +402 -0
  165. package/build/esm/tests/stavehairpin_tests.js +90 -0
  166. package/build/esm/tests/staveline_tests.js +123 -0
  167. package/build/esm/tests/stavemodifier_tests.js +51 -0
  168. package/build/esm/tests/stavenote_tests.js +936 -0
  169. package/build/esm/tests/stavetie_tests.js +137 -0
  170. package/build/esm/tests/stringnumber_tests.js +283 -0
  171. package/build/esm/tests/strokes_tests.js +289 -0
  172. package/build/esm/tests/style_tests.js +96 -0
  173. package/build/esm/tests/tabnote_tests.js +462 -0
  174. package/build/esm/tests/tabslide_tests.js +133 -0
  175. package/build/esm/tests/tabstave_tests.js +24 -0
  176. package/build/esm/tests/tabtie_tests.js +171 -0
  177. package/build/esm/tests/test_runner.js +23 -0
  178. package/build/esm/tests/textbracket_tests.js +100 -0
  179. package/build/esm/tests/textnote_tests.js +216 -0
  180. package/build/esm/tests/threevoice_tests.js +132 -0
  181. package/build/esm/tests/tickcontext_tests.js +36 -0
  182. package/build/esm/tests/timesignature_tests.js +173 -0
  183. package/build/esm/tests/tremolo_tests.js +34 -0
  184. package/build/esm/tests/tuning_tests.js +56 -0
  185. package/build/esm/tests/tuplet_tests.js +711 -0
  186. package/build/esm/tests/typeguard_tests.js +82 -0
  187. package/build/esm/tests/unison_tests.js +74 -0
  188. package/build/esm/tests/vexflow_test_helpers.js +318 -0
  189. package/build/esm/tests/vf_prefix_tests.js +101 -0
  190. package/build/esm/tests/vibrato_tests.js +93 -0
  191. package/build/esm/tests/vibratobracket_tests.js +45 -0
  192. package/build/esm/tests/vitest/job-0.test.js +2 -0
  193. package/build/esm/tests/vitest/job-1.test.js +2 -0
  194. package/build/esm/tests/vitest/job-2.test.js +2 -0
  195. package/build/esm/tests/vitest/job-3.test.js +2 -0
  196. package/build/esm/tests/vitest/run.js +5 -0
  197. package/build/esm/tests/vitest.setup.js +44 -0
  198. package/build/esm/tests/voice_tests.js +69 -0
  199. package/build/types/entry/vexflow-bravura.d.ts +3 -0
  200. package/build/types/entry/vexflow-core.d.ts +3 -0
  201. package/build/types/entry/vexflow-debug.d.ts +3 -0
  202. package/build/types/entry/vexflow.d.ts +3 -0
  203. package/build/types/src/accidental.d.ts +60 -0
  204. package/build/types/src/annotation.d.ts +58 -0
  205. package/build/types/src/articulation.d.ts +78 -0
  206. package/build/types/src/barnote.d.ts +29 -0
  207. package/build/types/src/beam.d.ts +158 -0
  208. package/build/types/src/bend.d.ts +67 -0
  209. package/build/types/src/boundingbox.d.ts +42 -0
  210. package/build/types/src/canvascontext.d.ts +93 -0
  211. package/build/types/src/chordsymbol.d.ts +109 -0
  212. package/build/types/src/clef.d.ts +38 -0
  213. package/build/types/src/clefnote.d.ts +17 -0
  214. package/build/types/src/crescendo.d.ts +26 -0
  215. package/build/types/src/curve.d.ts +42 -0
  216. package/build/types/src/dot.d.ts +19 -0
  217. package/build/types/src/easyscore.d.ts +152 -0
  218. package/build/types/src/element.d.ts +278 -0
  219. package/build/types/src/factory.d.ts +273 -0
  220. package/build/types/src/flag.d.ts +12 -0
  221. package/build/types/src/font.d.ts +96 -0
  222. package/build/types/src/fonts/academico.d.ts +1 -0
  223. package/build/types/src/fonts/academicobold.d.ts +1 -0
  224. package/build/types/src/fonts/bravura.d.ts +1 -0
  225. package/build/types/src/fonts/gonville.d.ts +1 -0
  226. package/build/types/src/fonts/petaluma.d.ts +1 -0
  227. package/build/types/src/fonts/petalumascript.d.ts +1 -0
  228. package/build/types/src/formatter.d.ts +226 -0
  229. package/build/types/src/fraction.d.ts +65 -0
  230. package/build/types/src/frethandfinger.d.ts +19 -0
  231. package/build/types/src/ghostnote.d.ts +16 -0
  232. package/build/types/src/glyphnote.d.ts +14 -0
  233. package/build/types/src/glyphs.d.ts +2935 -0
  234. package/build/types/src/gracenote.d.ts +17 -0
  235. package/build/types/src/gracenotegroup.d.ts +33 -0
  236. package/build/types/src/gracetabnote.d.ts +5 -0
  237. package/build/types/src/index.d.ts +86 -0
  238. package/build/types/src/keymanager.d.ts +25 -0
  239. package/build/types/src/keysignature.d.ts +50 -0
  240. package/build/types/src/keysignote.d.ts +11 -0
  241. package/build/types/src/metrics.d.ts +25 -0
  242. package/build/types/src/modifier.d.ts +90 -0
  243. package/build/types/src/modifiercontext.d.ts +48 -0
  244. package/build/types/src/multimeasurerest.d.ts +61 -0
  245. package/build/types/src/music.d.ts +91 -0
  246. package/build/types/src/note.d.ts +232 -0
  247. package/build/types/src/notehead.d.ts +50 -0
  248. package/build/types/src/notesubgroup.d.ts +18 -0
  249. package/build/types/src/ornament.d.ts +71 -0
  250. package/build/types/src/parenthesis.d.ts +21 -0
  251. package/build/types/src/parser.d.ts +45 -0
  252. package/build/types/src/pedalmarking.d.ts +63 -0
  253. package/build/types/src/registry.d.ts +40 -0
  254. package/build/types/src/rendercontext.d.ts +59 -0
  255. package/build/types/src/renderer.d.ts +35 -0
  256. package/build/types/src/repeatnote.d.ts +6 -0
  257. package/build/types/src/stave.d.ts +181 -0
  258. package/build/types/src/stavebarline.d.ts +38 -0
  259. package/build/types/src/staveconnector.d.ts +53 -0
  260. package/build/types/src/stavehairpin.d.ts +56 -0
  261. package/build/types/src/staveline.d.ts +49 -0
  262. package/build/types/src/stavemodifier.d.ts +35 -0
  263. package/build/types/src/stavenote.d.ts +150 -0
  264. package/build/types/src/staverepetition.d.ts +30 -0
  265. package/build/types/src/stavesection.d.ts +8 -0
  266. package/build/types/src/stavetempo.d.ts +43 -0
  267. package/build/types/src/stavetext.d.ts +11 -0
  268. package/build/types/src/stavetie.d.ts +104 -0
  269. package/build/types/src/stavevolta.d.ts +15 -0
  270. package/build/types/src/stem.d.ts +58 -0
  271. package/build/types/src/stemmablenote.d.ts +39 -0
  272. package/build/types/src/stringnumber.d.ts +26 -0
  273. package/build/types/src/strokes.d.ts +35 -0
  274. package/build/types/src/svgcontext.d.ts +135 -0
  275. package/build/types/src/system.d.ts +121 -0
  276. package/build/types/src/tables.d.ts +86 -0
  277. package/build/types/src/tabnote.d.ts +45 -0
  278. package/build/types/src/tabslide.d.ts +36 -0
  279. package/build/types/src/tabstave.d.ts +7 -0
  280. package/build/types/src/tabtie.d.ts +18 -0
  281. package/build/types/src/textbracket.d.ts +45 -0
  282. package/build/types/src/textdynamics.d.ts +34 -0
  283. package/build/types/src/textnote.d.ts +48 -0
  284. package/build/types/src/tickable.d.ts +149 -0
  285. package/build/types/src/tickcontext.d.ts +112 -0
  286. package/build/types/src/timesignature.d.ts +75 -0
  287. package/build/types/src/timesignote.d.ts +11 -0
  288. package/build/types/src/tremolo.d.ts +12 -0
  289. package/build/types/src/tuning.d.ts +23 -0
  290. package/build/types/src/tuplet.d.ts +98 -0
  291. package/build/types/src/typeguard.d.ts +100 -0
  292. package/build/types/src/util.d.ts +42 -0
  293. package/build/types/src/version.d.ts +3 -0
  294. package/build/types/src/vexflow.d.ts +261 -0
  295. package/build/types/src/vibrato.d.ts +20 -0
  296. package/build/types/src/vibratobracket.d.ts +28 -0
  297. package/build/types/src/voice.d.ts +109 -0
  298. package/build/types/src/web.d.ts +2 -0
  299. package/package.json +145 -0
  300. package/tests/flow.html +256 -0
@@ -0,0 +1,669 @@
1
+ import { concat, VexFlowTests } from './vexflow_test_helpers.js';
2
+ import { AnnotationVerticalJustify, Beam, Dot, FontStyle, FontWeight, Stem, Voice, } from '../src/index.js';
3
+ import { Metrics } from '../src/metrics.js';
4
+ const BeamTests = {
5
+ Start() {
6
+ VexFlowTests.module('Beam');
7
+ const run = VexFlowTests.runTests;
8
+ run('Simple Beam', simple);
9
+ run('Multi Beam', multi);
10
+ run('Sixteenth Beam', sixteenth);
11
+ run('Slopey Beam', slopey);
12
+ run('Auto-stemmed Beam', autoStem);
13
+ run('Mixed Beam 1', mixed);
14
+ run('Mixed Beam 2', mixed2);
15
+ run('Mixed Beam 3', mixed3);
16
+ run('Dotted Beam', dotted);
17
+ run('Partial Beam', partial);
18
+ run('Close Trade-offs Beam', tradeoffs);
19
+ run('Insane Beam', insane);
20
+ run('Lengthy Beam', lenghty);
21
+ run('Outlier Beam', outlier);
22
+ run('Break Secondary Beams', breakSecondaryBeams);
23
+ run('Partial Beam Direction', partialBeamDirection);
24
+ run('TabNote Beams Up', tabBeamsUp);
25
+ run('TabNote Beams Down', tabBeamsDown);
26
+ run('TabNote Auto Create Beams', autoTabBeams);
27
+ run('TabNote Beams Auto Stem', tabBeamsAutoStem);
28
+ run('Complex Beams with Annotations', complexWithAnnotation);
29
+ run('Complex Beams with Articulations', complexWithArticulation);
30
+ run('Complex Beams with Articulations two Staves', complexWithArticulation2);
31
+ },
32
+ };
33
+ function simple(options) {
34
+ const f = VexFlowTests.makeFactory(options);
35
+ const stave = f.Stave();
36
+ const score = f.EasyScore();
37
+ const beam = score.beam.bind(score);
38
+ const notes = score.notes.bind(score);
39
+ const voice = score.voice([
40
+ notes('(cb4 e#4 a4)/2'),
41
+ beam(notes('(cb4 e#4 a4)/8, (d4 f4 a4), (ebb4 g##4 b4), (f4 a4 c5)', { stem: 'up' })),
42
+ ].reduce(concat), { time: '2/2' });
43
+ f.Formatter().joinVoices([voice]).formatToStave([voice], stave);
44
+ f.draw();
45
+ options.assert.ok(true, 'Simple Test');
46
+ }
47
+ function multi(options) {
48
+ const f = VexFlowTests.makeFactory(options);
49
+ const stave = f.Stave();
50
+ const score = f.EasyScore();
51
+ const voice = score.voice.bind(score);
52
+ const beam = score.beam.bind(score);
53
+ const notes = score.notes.bind(score);
54
+ const voices = [
55
+ voice([beam(notes('f5/8, e5, d5, c5', { stem: 'up' })), beam(notes('c5, d5, e5, f5', { stem: 'up' }))].reduce(concat)),
56
+ voice([beam(notes('f4/8, e4, d4, c4', { stem: 'down' })), beam(notes('c4/8, d4, e4, f4', { stem: 'down' }))].reduce(concat)),
57
+ ];
58
+ f.Formatter().joinVoices(voices).formatToStave(voices, stave);
59
+ f.draw();
60
+ options.assert.ok(true, 'Multi Test');
61
+ }
62
+ function sixteenth(options) {
63
+ const f = VexFlowTests.makeFactory(options);
64
+ const stave = f.Stave();
65
+ const score = f.EasyScore();
66
+ const voice = score.voice.bind(score);
67
+ const beam = score.beam.bind(score);
68
+ const notes = score.notes.bind(score);
69
+ const voices = [
70
+ voice([
71
+ beam(notes('f5/16, f5, d5, c5', { stem: 'up' })),
72
+ beam(notes('c5/16, d5, f5, e5', { stem: 'up' })),
73
+ notes('f5/2', { stem: 'up' }),
74
+ ].reduce(concat)),
75
+ voice([
76
+ beam(notes('f4/16, e4/16, d4/16, c4/16', { stem: 'down' })),
77
+ beam(notes('c4/16, d4/16, f4/16, e4/16', { stem: 'down' })),
78
+ notes('f4/2', { stem: 'down' }),
79
+ ].reduce(concat)),
80
+ ];
81
+ f.Formatter().joinVoices(voices).formatToStave(voices, stave);
82
+ f.draw();
83
+ options.assert.ok(true, 'Sixteenth Test');
84
+ }
85
+ function breakSecondaryBeams(options) {
86
+ const f = VexFlowTests.makeFactory(options, 600, 200);
87
+ const stave = f.Stave({ y: 20 });
88
+ const score = f.EasyScore();
89
+ const voice = score.voice.bind(score);
90
+ const beam = score.beam.bind(score);
91
+ const notes = score.notes.bind(score);
92
+ const voices = [
93
+ voice([
94
+ beam(notes('f5/16., f5/32, c5/16., d5/32, c5/16., d5/32', { stem: 'up' }), { secondaryBeamBreaks: [1, 3] }),
95
+ beam(notes('f5/16, e5, e5, e5, e5, e5', { stem: 'up' }), { secondaryBeamBreaks: [2] }),
96
+ ].reduce(concat), { time: '3/4' }),
97
+ voice([
98
+ beam(notes('f4/32, d4, e4, c4, d4, c4, f4, d4, e4, c4, c4, d4', { stem: 'down' }), {
99
+ secondaryBeamBreaks: [3, 7],
100
+ }),
101
+ beam(notes('d4/16, f4, d4, e4, e4, e4', { stem: 'down' }), { secondaryBeamBreaks: [3] }),
102
+ ].reduce(concat), { time: '3/4' }),
103
+ ];
104
+ f.Formatter().joinVoices(voices).formatToStave(voices, stave);
105
+ f.draw();
106
+ options.assert.ok(true, 'Breaking Secondary Beams Test');
107
+ }
108
+ function partialBeamDirection(options) {
109
+ const f = VexFlowTests.makeFactory(options, 600, 200);
110
+ const stave = f.Stave({ y: 20 });
111
+ const score = f.EasyScore();
112
+ const voice = score.voice.bind(score);
113
+ const beam = score.beam.bind(score);
114
+ const notes = score.notes.bind(score);
115
+ const voices = [
116
+ voice([
117
+ beam(notes('f4/8, f4/16, f4/8, f4/16', { stem: 'up' })),
118
+ beam(notes('f4/8, f4/16, f4/8, f4/16', { stem: 'up' }), { partialBeamDirections: { '1': 'R' } }),
119
+ beam(notes('f4/8, f4/16, f4/8, f4/16', { stem: 'up' }), { partialBeamDirections: { '1': 'L' } }),
120
+ ].reduce(concat), { time: '9/8' }),
121
+ ];
122
+ f.Formatter().joinVoices(voices).formatToStave(voices, stave);
123
+ f.draw();
124
+ options.assert.ok(true, 'Partial beam direction test');
125
+ }
126
+ function slopey(options) {
127
+ const f = VexFlowTests.makeFactory(options, 350, 140);
128
+ const stave = f.Stave({ y: 20 });
129
+ const score = f.EasyScore();
130
+ const beam = score.beam.bind(score);
131
+ const notes = score.notes.bind(score);
132
+ const voice = score.voice([
133
+ beam(notes('c4/8, f4/8, d5/8, g5/8', { stem: 'up' })),
134
+ beam(notes('d6/8, f5/8, d4/8, g3/8', { stem: 'up' })),
135
+ ].reduce(concat));
136
+ f.Formatter().joinVoices([voice]).formatToStave([voice], stave);
137
+ f.draw();
138
+ options.assert.ok(true, 'Slopey Test');
139
+ }
140
+ function autoStem(options) {
141
+ const f = VexFlowTests.makeFactory(options, 350, 140);
142
+ const stave = f.Stave({ y: 20 });
143
+ const score = f.EasyScore();
144
+ const voice = score.voice(score.notes('a4/8, b4/8, g4/8, c5/8, f4/8, d5/8, e4/8, e5/8, b4/8, b4/8, g4/8, d5/8'), {
145
+ time: '6/4',
146
+ });
147
+ const notes = voice.getTickables();
148
+ const beams = [
149
+ f.Beam({ notes: notes.slice(0, 2), options: { autoStem: true } }),
150
+ f.Beam({ notes: notes.slice(2, 4), options: { autoStem: true } }),
151
+ f.Beam({ notes: notes.slice(4, 6), options: { autoStem: true } }),
152
+ f.Beam({ notes: notes.slice(6, 8), options: { autoStem: true } }),
153
+ f.Beam({ notes: notes.slice(8, 10), options: { autoStem: true } }),
154
+ f.Beam({ notes: notes.slice(10, 12), options: { autoStem: true } }),
155
+ ];
156
+ f.Formatter().joinVoices([voice]).formatToStave([voice], stave);
157
+ const UP = Stem.UP;
158
+ const DOWN = Stem.DOWN;
159
+ options.assert.equal(beams[0].getStemDirection(), UP);
160
+ options.assert.equal(beams[1].getStemDirection(), UP);
161
+ options.assert.equal(beams[2].getStemDirection(), UP);
162
+ options.assert.equal(beams[3].getStemDirection(), UP);
163
+ options.assert.equal(beams[4].getStemDirection(), DOWN);
164
+ options.assert.equal(beams[5].getStemDirection(), DOWN);
165
+ f.draw();
166
+ options.assert.ok(true, 'AutoStem Beam Test');
167
+ }
168
+ function mixed(options) {
169
+ const f = VexFlowTests.makeFactory(options, 350, 140);
170
+ const stave = f.Stave({ y: 20 });
171
+ const score = f.EasyScore();
172
+ const voice1 = score.voice(score.notes('f5/8, d5/16, c5/16, c5/16, d5/16, e5/8, f5/8, d5/16, c5/16, c5/16, d5/16, e5/8', { stem: 'up' }));
173
+ const voice2 = score.voice(score.notes('f4/16, e4/8, d4/16, c4/16, d4/8, f4/16, f4/16, e4/8, d4/16, c4/16, d4/8, f4/16', { stem: 'down' }));
174
+ [
175
+ [0, 4],
176
+ [4, 8],
177
+ [8, 12],
178
+ ].forEach((range) => f.Beam({ notes: voice1.getTickables().slice(range[0], range[1]) }));
179
+ [
180
+ [0, 4],
181
+ [4, 8],
182
+ [8, 12],
183
+ ].forEach((range) => f.Beam({ notes: voice2.getTickables().slice(range[0], range[1]) }));
184
+ f.Formatter().joinVoices([voice1, voice2]).formatToStave([voice1, voice2], stave);
185
+ f.draw();
186
+ options.assert.ok(true, 'Multi Test');
187
+ }
188
+ function mixed2(options) {
189
+ const f = VexFlowTests.makeFactory(options, 450, 180);
190
+ const stave = f.Stave({ y: 20 });
191
+ const score = f.EasyScore();
192
+ const voice = score.voice(score.notes('f5/32, d5/16, c5/32, c5/64, d5/128, e5/8, f5/16, d5/32, c5/64, c5/32, d5/16, e5/128', {
193
+ stem: 'up',
194
+ }), { time: '31/64' });
195
+ const voice2 = score.voice(score.notes('f4/32, d4/16, c4/32, c4/64, d4/128, e4/8, f4/16, d4/32, c4/64, c4/32, d4/16, e4/128', {
196
+ stem: 'down',
197
+ }), { time: '31/64' });
198
+ f.Beam({ notes: voice.getTickables().slice(0, 12) });
199
+ f.Beam({ notes: voice2.getTickables().slice(0, 12) });
200
+ f.Formatter().joinVoices([voice, voice2]).formatToStave([voice, voice2], stave);
201
+ f.draw();
202
+ options.assert.ok(true, 'Multi Test');
203
+ }
204
+ function mixed3(options) {
205
+ const f = VexFlowTests.makeFactory(options, 450, 230);
206
+ const stave = f.Stave({ y: 25 });
207
+ const score = f.EasyScore();
208
+ const voice = score.voice(score.notes('f5/32, d5/16, c5/32, c5/64, d5/128, e5/8, f5/16, d5/32, c5/64, c5/32, d5/16, e5/1024, e5/512, e5/512, e5/512, e5/1024', {
209
+ stem: 'up',
210
+ }), { time: '31/64' });
211
+ const voice2 = score.voice(score.notes('f4/32, d4/16, c4/32, c4/64, d4/128, e4/8, f4/16, e4/256, e4/512, e4/1024, e4/1024, d4/32, c4/64, c4/32, d4/16', {
212
+ stem: 'down',
213
+ }), { time: '31/64' });
214
+ f.Beam({ notes: voice.getTickables() });
215
+ f.Beam({ notes: voice2.getTickables() });
216
+ f.Formatter().joinVoices([voice, voice2]).formatToStave([voice, voice2], stave);
217
+ f.draw();
218
+ options.assert.ok(true, 'Multi Test with 1024th, 512th, and 256th notes');
219
+ }
220
+ function dotted(options) {
221
+ const f = VexFlowTests.makeFactory(options);
222
+ const stave = f.Stave();
223
+ const score = f.EasyScore();
224
+ const voice = score.voice(score.notes('d4/8, b3/8., a3/16, a3/8, b3/8., c4/16, d4/8, b3/8, a3/8., a3/16, b3/8., c4/16', { stem: 'up' }), { time: '6/4' });
225
+ const notes = voice.getTickables();
226
+ f.Beam({ notes: notes.slice(0, 4) });
227
+ f.Beam({ notes: notes.slice(4, 8) });
228
+ f.Beam({ notes: notes.slice(8, 12) });
229
+ f.Formatter().joinVoices([voice]).formatToStave([voice], stave);
230
+ f.draw();
231
+ options.assert.ok(true, 'Dotted Test');
232
+ }
233
+ function partial(options) {
234
+ const f = VexFlowTests.makeFactory(options);
235
+ const stave = f.Stave();
236
+ const score = f.EasyScore();
237
+ const voice = score.voice(score.notes('d4/8, b3/32, c4/16., d4/16., e4/8, c4/64, c4/32, a3/8., b3/32., c4/8, e4/64, b3/16., b3/64, f4/8, e4/8, g4/64, e4/8'), { time: '89/64' });
238
+ const notes = voice.getTickables();
239
+ f.Beam({ notes: notes.slice(0, 3) });
240
+ f.Beam({ notes: notes.slice(3, 9) });
241
+ f.Beam({ notes: notes.slice(9, 13) });
242
+ f.Beam({ notes: notes.slice(13, 17) });
243
+ f.Formatter().joinVoices([voice]).formatToStave([voice], stave);
244
+ f.draw();
245
+ options.assert.ok(true, 'Partial Test');
246
+ }
247
+ function tradeoffs(options) {
248
+ const f = VexFlowTests.makeFactory(options);
249
+ const stave = f.Stave();
250
+ const score = f.EasyScore();
251
+ const voice = score.voice(score.notes('a4/8, b4/8, c4/8, d4/8, g4/8, a4/8, b4/8, c4/8', { stem: 'up' }));
252
+ const notes = voice.getTickables();
253
+ f.Beam({ notes: notes.slice(0, 4) });
254
+ f.Beam({ notes: notes.slice(4, 8) });
255
+ f.Formatter().joinVoices([voice]).formatToStave([voice], stave);
256
+ f.draw();
257
+ options.assert.ok(true, 'Close Trade-offs Test');
258
+ }
259
+ function insane(options) {
260
+ const f = VexFlowTests.makeFactory(options, 450, 180);
261
+ const stave = f.Stave({ y: 20 });
262
+ const score = f.EasyScore();
263
+ const voice = score.voice(score.notes('g4/8, g5/8, c4/8, b5/8, g4/8[stem="down"], a5[stem="down"], b4[stem="down"], c4/8', { stem: 'up' }));
264
+ const notes = voice.getTickables();
265
+ f.Beam({ notes: notes.slice(0, 4) });
266
+ f.Beam({ notes: notes.slice(4, 7) });
267
+ f.Formatter().joinVoices([voice]).formatToStave([voice], stave);
268
+ f.draw();
269
+ options.assert.ok(true, 'Insane Test');
270
+ }
271
+ function lenghty(options) {
272
+ const f = VexFlowTests.makeFactory(options, 450, 180);
273
+ const stave = f.Stave({ y: 20 });
274
+ const score = f.EasyScore();
275
+ const voice = score.voice(score.beam(score.notes('g4/8, g4, g4, a4', { stem: 'up' })), { time: '2/4' });
276
+ f.Formatter().joinVoices([voice]).formatToStave([voice], stave);
277
+ f.draw();
278
+ options.assert.ok(true, 'Lengthy Test');
279
+ }
280
+ function outlier(options) {
281
+ const f = VexFlowTests.makeFactory(options, 450, 180);
282
+ const stave = f.Stave({ y: 20 });
283
+ const score = f.EasyScore();
284
+ const voice = score.voice(score.notes([
285
+ 'g4/8[stem="up"], f4[stem="up"], d5[stem="up"], e4[stem="up"]',
286
+ 'd5/8[stem="down"], d5[stem="down"], c5[stem="down"], d5[stem="down"]',
287
+ ].join()));
288
+ const notes = voice.getTickables();
289
+ f.Beam({ notes: notes.slice(0, 4) });
290
+ f.Beam({ notes: notes.slice(4, 8) });
291
+ f.Formatter().joinVoices([voice]).formatToStave([voice], stave, { stave: stave });
292
+ f.draw();
293
+ options.assert.ok(true, 'Outlier Test');
294
+ }
295
+ function tabBeamsUp(options) {
296
+ const f = VexFlowTests.makeFactory(options, 600, 200);
297
+ const stave = f.TabStave({ y: 20 });
298
+ const specs = [
299
+ {
300
+ positions: [
301
+ { str: 3, fret: 6 },
302
+ { str: 4, fret: 25 },
303
+ ],
304
+ duration: '4',
305
+ },
306
+ {
307
+ positions: [
308
+ { str: 2, fret: 10 },
309
+ { str: 5, fret: 12 },
310
+ ],
311
+ duration: '8',
312
+ },
313
+ {
314
+ positions: [
315
+ { str: 1, fret: 6 },
316
+ { str: 4, fret: 5 },
317
+ ],
318
+ duration: '8',
319
+ },
320
+ {
321
+ positions: [
322
+ { str: 1, fret: 6 },
323
+ { str: 4, fret: 5 },
324
+ ],
325
+ duration: '16',
326
+ },
327
+ {
328
+ positions: [
329
+ { str: 1, fret: 6 },
330
+ { str: 4, fret: 5 },
331
+ ],
332
+ duration: '32',
333
+ },
334
+ {
335
+ positions: [
336
+ { str: 1, fret: 6 },
337
+ { str: 4, fret: 5 },
338
+ ],
339
+ duration: '64',
340
+ },
341
+ {
342
+ positions: [
343
+ { str: 1, fret: 6 },
344
+ { str: 4, fret: 5 },
345
+ ],
346
+ duration: '128',
347
+ },
348
+ { positions: [{ str: 3, fret: 6 }], duration: '8' },
349
+ { positions: [{ str: 3, fret: 6 }], duration: '8' },
350
+ { positions: [{ str: 3, fret: 6 }], duration: '8' },
351
+ { positions: [{ str: 3, fret: 6 }], duration: '8' },
352
+ ];
353
+ const notes = specs.map((struct) => {
354
+ const tabNote = f.TabNote(struct);
355
+ tabNote.renderOptions.drawStem = true;
356
+ return tabNote;
357
+ });
358
+ f.Beam({ notes: notes.slice(1, 7) });
359
+ f.Beam({ notes: notes.slice(8, 11) });
360
+ f.Tuplet({ notes: notes.slice(8, 11), options: { ratioed: true } });
361
+ const voice = f.Voice().setMode(Voice.Mode.SOFT).addTickables(notes);
362
+ f.Formatter().joinVoices([voice]).formatToStave([voice], stave);
363
+ f.draw();
364
+ options.assert.ok(true, 'All objects have been drawn');
365
+ }
366
+ function tabBeamsDown(options) {
367
+ const f = VexFlowTests.makeFactory(options, 600, 250);
368
+ const stave = f.TabStave({ options: { numLines: 10 } });
369
+ const specs = [
370
+ {
371
+ stemDirection: -1,
372
+ positions: [
373
+ { str: 3, fret: 6 },
374
+ { str: 4, fret: 25 },
375
+ ],
376
+ duration: '4',
377
+ },
378
+ {
379
+ stemDirection: -1,
380
+ positions: [
381
+ { str: 2, fret: 10 },
382
+ { str: 5, fret: 12 },
383
+ ],
384
+ duration: '8dd',
385
+ },
386
+ {
387
+ stemDirection: -1,
388
+ positions: [
389
+ { str: 1, fret: 6 },
390
+ { str: 4, fret: 5 },
391
+ ],
392
+ duration: '8',
393
+ },
394
+ {
395
+ stemDirection: -1,
396
+ positions: [
397
+ { str: 1, fret: 6 },
398
+ { str: 4, fret: 5 },
399
+ ],
400
+ duration: '16',
401
+ },
402
+ {
403
+ stemDirection: -1,
404
+ positions: [
405
+ { str: 1, fret: 6 },
406
+ { str: 4, fret: 5 },
407
+ ],
408
+ duration: '32',
409
+ },
410
+ {
411
+ stemDirection: -1,
412
+ positions: [
413
+ { str: 1, fret: 6 },
414
+ { str: 4, fret: 5 },
415
+ ],
416
+ duration: '64',
417
+ },
418
+ {
419
+ stemDirection: -1,
420
+ positions: [
421
+ { str: 1, fret: 6 },
422
+ { str: 4, fret: 5 },
423
+ ],
424
+ duration: '128',
425
+ },
426
+ { stemDirection: -1, positions: [{ str: 1, fret: 6 }], duration: '8' },
427
+ { stemDirection: -1, positions: [{ str: 1, fret: 6 }], duration: '8' },
428
+ { stemDirection: -1, positions: [{ str: 1, fret: 6 }], duration: '8' },
429
+ { stemDirection: -1, positions: [{ str: 7, fret: 6 }], duration: '8' },
430
+ { stemDirection: -1, positions: [{ str: 7, fret: 6 }], duration: '8' },
431
+ { stemDirection: -1, positions: [{ str: 10, fret: 6 }], duration: '8' },
432
+ { stemDirection: -1, positions: [{ str: 10, fret: 6 }], duration: '8' },
433
+ ];
434
+ const notes = specs.map((struct) => {
435
+ const tabNote = f.TabNote(struct);
436
+ tabNote.renderOptions.drawStem = true;
437
+ tabNote.renderOptions.drawDots = true;
438
+ return tabNote;
439
+ });
440
+ Dot.buildAndAttach([notes[1], notes[1]]);
441
+ f.Beam({ notes: notes.slice(1, 7) });
442
+ f.Beam({ notes: notes.slice(8, 11) });
443
+ f.Tuplet({ notes: notes.slice(8, 11), options: { location: -1 } });
444
+ f.Tuplet({ notes: notes.slice(11, 14), options: { location: -1 } });
445
+ const voice = f.Voice().setMode(Voice.Mode.SOFT).addTickables(notes);
446
+ f.Formatter().joinVoices([voice]).formatToStave([voice], stave);
447
+ f.draw();
448
+ options.assert.ok(true, 'All objects have been drawn');
449
+ }
450
+ function autoTabBeams(options) {
451
+ const f = VexFlowTests.makeFactory(options, 600, 200);
452
+ const stave = f.TabStave();
453
+ const specs = [
454
+ {
455
+ positions: [
456
+ { str: 1, fret: 6 },
457
+ { str: 4, fret: 5 },
458
+ ],
459
+ duration: '8',
460
+ },
461
+ {
462
+ positions: [
463
+ { str: 1, fret: 6 },
464
+ { str: 4, fret: 5 },
465
+ ],
466
+ duration: '8',
467
+ },
468
+ {
469
+ positions: [
470
+ { str: 1, fret: 6 },
471
+ { str: 4, fret: 5 },
472
+ ],
473
+ duration: '16',
474
+ },
475
+ {
476
+ positions: [
477
+ { str: 1, fret: 6 },
478
+ { str: 4, fret: 5 },
479
+ ],
480
+ duration: '16',
481
+ },
482
+ { positions: [{ str: 1, fret: 6 }], duration: '32' },
483
+ { positions: [{ str: 1, fret: 6 }], duration: '32' },
484
+ { positions: [{ str: 1, fret: 6 }], duration: '32' },
485
+ { positions: [{ str: 6, fret: 6 }], duration: '32' },
486
+ { positions: [{ str: 6, fret: 6 }], duration: '16' },
487
+ { positions: [{ str: 6, fret: 6 }], duration: '16' },
488
+ { positions: [{ str: 6, fret: 6 }], duration: '16' },
489
+ { positions: [{ str: 6, fret: 6 }], duration: '16' },
490
+ ];
491
+ const notes = specs.map((struct) => {
492
+ const tabNote = f.TabNote(struct);
493
+ tabNote.renderOptions.drawStem = true;
494
+ tabNote.renderOptions.drawDots = true;
495
+ return tabNote;
496
+ });
497
+ const voice = f.Voice().setMode(Voice.Mode.SOFT).addTickables(notes);
498
+ const beams = Beam.applyAndGetBeams(voice, -1);
499
+ f.Formatter().joinVoices([voice]).formatToStave([voice], stave);
500
+ f.draw();
501
+ beams.forEach((beam) => beam.setContext(f.getContext()).drawWithStyle());
502
+ options.assert.ok(true, 'All objects have been drawn');
503
+ }
504
+ function tabBeamsAutoStem(options) {
505
+ const f = VexFlowTests.makeFactory(options, 600, 300);
506
+ const stave = f.TabStave();
507
+ const specs = [
508
+ {
509
+ positions: [
510
+ { str: 1, fret: 6 },
511
+ { str: 4, fret: 5 },
512
+ ],
513
+ duration: '8',
514
+ stemDirection: -1,
515
+ },
516
+ {
517
+ positions: [
518
+ { str: 1, fret: 6 },
519
+ { str: 4, fret: 5 },
520
+ ],
521
+ duration: '8',
522
+ stemDirection: 1,
523
+ },
524
+ {
525
+ positions: [
526
+ { str: 1, fret: 6 },
527
+ { str: 4, fret: 5 },
528
+ ],
529
+ duration: '16',
530
+ stemDirection: -1,
531
+ },
532
+ {
533
+ positions: [
534
+ { str: 1, fret: 6 },
535
+ { str: 4, fret: 5 },
536
+ ],
537
+ duration: '16',
538
+ stemDirection: 1,
539
+ },
540
+ { positions: [{ str: 1, fret: 6 }], duration: '32', stemDirection: 1 },
541
+ { positions: [{ str: 1, fret: 6 }], duration: '32', stemDirection: -1 },
542
+ { positions: [{ str: 1, fret: 6 }], duration: '32', stemDirection: -1 },
543
+ { positions: [{ str: 6, fret: 6 }], duration: '32', stemDirection: -1 },
544
+ { positions: [{ str: 6, fret: 6 }], duration: '16', stemDirection: 1 },
545
+ { positions: [{ str: 6, fret: 6 }], duration: '16', stemDirection: 1 },
546
+ { positions: [{ str: 6, fret: 6 }], duration: '16', stemDirection: 1 },
547
+ { positions: [{ str: 6, fret: 6 }], duration: '16', stemDirection: -1 },
548
+ ];
549
+ const notes = specs.map((struct) => {
550
+ const tabNote = f.TabNote(struct);
551
+ tabNote.renderOptions.drawStem = true;
552
+ tabNote.renderOptions.drawDots = true;
553
+ return tabNote;
554
+ });
555
+ f.Beam({ notes: notes.slice(0, 8), options: { autoStem: true } });
556
+ f.Beam({ notes: notes.slice(8, 12), options: { autoStem: true } });
557
+ const voice = f.Voice().setMode(Voice.Mode.SOFT).addTickables(notes);
558
+ f.Formatter().joinVoices([voice]).formatToStave([voice], stave);
559
+ f.draw();
560
+ options.assert.ok(true, 'All objects have been drawn');
561
+ }
562
+ function complexWithAnnotation(options) {
563
+ const factory = VexFlowTests.makeFactory(options, 500, 200);
564
+ const stave = factory.Stave({ y: 40 });
565
+ const s1 = [
566
+ { keys: ['e/4'], duration: '128', stemDirection: 1 },
567
+ { keys: ['d/4'], duration: '16', stemDirection: 1 },
568
+ { keys: ['e/4'], duration: '8', stemDirection: 1 },
569
+ { keys: ['c/4', 'g/4'], duration: '32', stemDirection: 1 },
570
+ { keys: ['c/4'], duration: '32', stemDirection: 1 },
571
+ { keys: ['c/4'], duration: '32', stemDirection: 1 },
572
+ { keys: ['c/4'], duration: '32', stemDirection: 1 },
573
+ ];
574
+ const s2 = [
575
+ { keys: ['e/5'], duration: '128', stemDirection: -1 },
576
+ { keys: ['d/5'], duration: '16', stemDirection: -1 },
577
+ { keys: ['e/5'], duration: '8', stemDirection: -1 },
578
+ { keys: ['c/5', 'g/5'], duration: '32', stemDirection: -1 },
579
+ { keys: ['c/5'], duration: '32', stemDirection: -1 },
580
+ { keys: ['c/5'], duration: '32', stemDirection: -1 },
581
+ { keys: ['c/5'], duration: '32', stemDirection: -1 },
582
+ ];
583
+ const font = {
584
+ family: Metrics.get('Annotation.fontFamily'),
585
+ size: 14,
586
+ weight: FontWeight.BOLD,
587
+ style: FontStyle.ITALIC,
588
+ };
589
+ const notes1 = s1.map((struct) => factory
590
+ .StaveNote(struct)
591
+ .addModifier(factory.Annotation({ text: '1', vJustify: AnnotationVerticalJustify.TOP, font }), 0));
592
+ const notes2 = s2.map((struct) => factory
593
+ .StaveNote(struct)
594
+ .addModifier(factory.Annotation({ text: '3', vJustify: AnnotationVerticalJustify.BOTTOM, font }), 0));
595
+ factory.Beam({ notes: notes1 });
596
+ factory.Beam({ notes: notes2 });
597
+ const voice = factory.Voice().setMode(Voice.Mode.SOFT).addTickables(notes1).addTickables(notes2);
598
+ factory.Formatter().joinVoices([voice]).formatToStave([voice], stave, { stave: stave });
599
+ factory.draw();
600
+ options.assert.ok(true, 'Complex beam annotations');
601
+ }
602
+ function complexWithArticulation(options) {
603
+ const f = VexFlowTests.makeFactory(options, 500, 200);
604
+ const stave = f.Stave({ y: 40 });
605
+ const s1 = [
606
+ { keys: ['e/4'], duration: '128', stemDirection: 1 },
607
+ { keys: ['d/4'], duration: '16', stemDirection: 1 },
608
+ { keys: ['e/4'], duration: '8', stemDirection: 1 },
609
+ { keys: ['c/4', 'g/4'], duration: '32', stemDirection: 1 },
610
+ { keys: ['c/4'], duration: '32', stemDirection: 1 },
611
+ { keys: ['c/4'], duration: '32', stemDirection: 1 },
612
+ { keys: ['c/4'], duration: '32', stemDirection: 1 },
613
+ ];
614
+ const s2 = [
615
+ { keys: ['e/5'], duration: '128', stemDirection: -1 },
616
+ { keys: ['d/5'], duration: '16', stemDirection: -1 },
617
+ { keys: ['e/5'], duration: '8', stemDirection: -1 },
618
+ { keys: ['c/5', 'g/5'], duration: '32', stemDirection: -1 },
619
+ { keys: ['c/5'], duration: '32', stemDirection: -1 },
620
+ { keys: ['c/5'], duration: '32', stemDirection: -1 },
621
+ { keys: ['c/5'], duration: '32', stemDirection: -1 },
622
+ ];
623
+ const notes1 = s1.map((struct) => f.StaveNote(struct).addModifier(f.Articulation({ type: 'am', position: 'above' }), 0));
624
+ const notes2 = s2.map((struct) => f.StaveNote(struct).addModifier(f.Articulation({ type: 'a>', position: 'below' }), 0));
625
+ f.Beam({ notes: notes1 });
626
+ f.Beam({ notes: notes2 });
627
+ const voice = f.Voice().setMode(Voice.Mode.SOFT).addTickables(notes1).addTickables(notes2);
628
+ f.Formatter().joinVoices([voice]).formatToStave([voice], stave, { stave: stave });
629
+ f.draw();
630
+ options.assert.ok(true, 'Complex beam articulations');
631
+ }
632
+ function complexWithArticulation2(options) {
633
+ const f = VexFlowTests.makeFactory(options, 500, 300);
634
+ const system = f.System();
635
+ const s1 = [
636
+ { keys: ['e/4'], duration: '128', stemDirection: 1 },
637
+ { keys: ['d/4'], duration: '16', stemDirection: 1 },
638
+ { keys: ['e/4'], duration: '8', stemDirection: 1 },
639
+ { keys: ['c/4', 'g/4'], duration: '32', stemDirection: 1 },
640
+ { keys: ['c/4'], duration: '32', stemDirection: 1 },
641
+ { keys: ['c/4'], duration: '32', stemDirection: 1 },
642
+ { keys: ['c/4'], duration: '32', stemDirection: 1 },
643
+ ];
644
+ const s2 = [
645
+ { keys: ['e/5'], duration: '128', stemDirection: -1 },
646
+ { keys: ['d/5'], duration: '16', stemDirection: -1 },
647
+ { keys: ['e/5'], duration: '8', stemDirection: -1 },
648
+ { keys: ['c/5', 'g/5'], duration: '32', stemDirection: -1 },
649
+ { keys: ['c/5'], duration: '32', stemDirection: -1 },
650
+ { keys: ['c/5'], duration: '32', stemDirection: -1 },
651
+ { keys: ['c/5'], duration: '32', stemDirection: -1 },
652
+ ];
653
+ const notes1 = s1.map((struct) => f.StaveNote(struct).addModifier(f.Articulation({ type: 'am', position: 'above' }), 0));
654
+ const notes2 = s2.map((struct) => f.StaveNote(struct).addModifier(f.Articulation({ type: 'a>', position: 'below' }), 0));
655
+ const notes3 = s1.map((struct) => f.StaveNote(struct).addModifier(f.Articulation({ type: 'am', position: 'above' }), 0));
656
+ const notes4 = s2.map((struct) => f.StaveNote(struct).addModifier(f.Articulation({ type: 'a>', position: 'below' }), 0));
657
+ f.Beam({ notes: notes1 });
658
+ f.Beam({ notes: notes2 });
659
+ f.Beam({ notes: notes3 });
660
+ f.Beam({ notes: notes4 });
661
+ const voice1 = f.Voice().setMode(Voice.Mode.SOFT).addTickables(notes1).addTickables(notes2);
662
+ const voice2 = f.Voice().setMode(Voice.Mode.SOFT).addTickables(notes3).addTickables(notes4);
663
+ system.addStave({ voices: [voice1] });
664
+ system.addStave({ voices: [voice2] });
665
+ f.draw();
666
+ options.assert.ok(true, 'Complex beam articulations two staves');
667
+ }
668
+ VexFlowTests.register(BeamTests);
669
+ export { BeamTests };