vexflow 4.0.1-beta.0 → 4.0.1-beta.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 (328) hide show
  1. package/build/cjs/vexflow-bravura.js +2 -2
  2. package/build/cjs/vexflow-bravura.js.map +1 -1
  3. package/build/cjs/vexflow-core.js +2 -2
  4. package/build/cjs/vexflow-core.js.map +1 -1
  5. package/build/cjs/vexflow-debug-with-tests.js +126 -26
  6. package/build/cjs/vexflow-debug-with-tests.js.map +1 -1
  7. package/build/cjs/vexflow-debug.js +94 -26
  8. package/build/cjs/vexflow-debug.js.map +1 -1
  9. package/build/cjs/vexflow-gonville.js +2 -2
  10. package/build/cjs/vexflow-gonville.js.map +1 -1
  11. package/build/cjs/vexflow-petaluma.js +2 -2
  12. package/build/cjs/vexflow-petaluma.js.map +1 -1
  13. package/build/cjs/vexflow.js +2 -2
  14. package/build/cjs/vexflow.js.map +1 -1
  15. package/build/esm/src/version.js +3 -3
  16. package/package.json +1 -1
  17. package/src/note.ts +2 -2
  18. package/src/stavenote.ts +80 -16
  19. package/build/esm/entry/vexflow-bravura.js +0 -11
  20. package/build/esm/entry/vexflow-core.js +0 -54
  21. package/build/esm/entry/vexflow-debug-with-tests.js +0 -4
  22. package/build/esm/entry/vexflow-debug.js +0 -3
  23. package/build/esm/entry/vexflow-font-bravura.js +0 -7
  24. package/build/esm/entry/vexflow-font-custom.js +0 -7
  25. package/build/esm/entry/vexflow-font-gonville.js +0 -7
  26. package/build/esm/entry/vexflow-font-petaluma.js +0 -7
  27. package/build/esm/entry/vexflow-gonville.js +0 -11
  28. package/build/esm/entry/vexflow-petaluma.js +0 -11
  29. package/build/esm/entry/vexflow.js +0 -9
  30. package/build/esm/src/accidental.js +0 -348
  31. package/build/esm/src/annotation.js +0 -213
  32. package/build/esm/src/articulation.js +0 -264
  33. package/build/esm/src/barnote.js +0 -58
  34. package/build/esm/src/beam.js +0 -632
  35. package/build/esm/src/bend.js +0 -202
  36. package/build/esm/src/boundingbox.js +0 -59
  37. package/build/esm/src/boundingboxcomputation.js +0 -107
  38. package/build/esm/src/canvascontext.js +0 -202
  39. package/build/esm/src/chordsymbol.js +0 -578
  40. package/build/esm/src/clef.js +0 -153
  41. package/build/esm/src/clefnote.js +0 -65
  42. package/build/esm/src/crescendo.js +0 -77
  43. package/build/esm/src/curve.js +0 -118
  44. package/build/esm/src/dot.js +0 -137
  45. package/build/esm/src/easyscore.js +0 -374
  46. package/build/esm/src/element.js +0 -216
  47. package/build/esm/src/factory.js +0 -440
  48. package/build/esm/src/flow.js +0 -275
  49. package/build/esm/src/font.js +0 -264
  50. package/build/esm/src/fonts/bravura_glyphs.js +0 -3239
  51. package/build/esm/src/fonts/bravura_metrics.js +0 -507
  52. package/build/esm/src/fonts/custom_glyphs.js +0 -78
  53. package/build/esm/src/fonts/custom_metrics.js +0 -5
  54. package/build/esm/src/fonts/gonville_glyphs.js +0 -828
  55. package/build/esm/src/fonts/gonville_metrics.js +0 -421
  56. package/build/esm/src/fonts/load_all.js +0 -10
  57. package/build/esm/src/fonts/load_bravura.js +0 -6
  58. package/build/esm/src/fonts/load_custom.js +0 -6
  59. package/build/esm/src/fonts/load_gonville.js +0 -6
  60. package/build/esm/src/fonts/load_petaluma.js +0 -6
  61. package/build/esm/src/fonts/petaluma_glyphs.js +0 -1335
  62. package/build/esm/src/fonts/petaluma_metrics.js +0 -536
  63. package/build/esm/src/fonts/petalumascript_glyphs.js +0 -863
  64. package/build/esm/src/fonts/robotoslab_glyphs.js +0 -863
  65. package/build/esm/src/fonts/textfonts.js +0 -44
  66. package/build/esm/src/formatter.js +0 -568
  67. package/build/esm/src/fraction.js +0 -171
  68. package/build/esm/src/frethandfinger.js +0 -156
  69. package/build/esm/src/ghostnote.js +0 -50
  70. package/build/esm/src/glyph.js +0 -331
  71. package/build/esm/src/glyphnote.js +0 -55
  72. package/build/esm/src/gracenote.js +0 -133
  73. package/build/esm/src/gracenotegroup.js +0 -128
  74. package/build/esm/src/gracetabnote.js +0 -12
  75. package/build/esm/src/index.js +0 -91
  76. package/build/esm/src/keymanager.js +0 -99
  77. package/build/esm/src/keysignature.js +0 -250
  78. package/build/esm/src/keysignote.js +0 -28
  79. package/build/esm/src/modifier.js +0 -128
  80. package/build/esm/src/modifiercontext.js +0 -110
  81. package/build/esm/src/multimeasurerest.js +0 -173
  82. package/build/esm/src/music.js +0 -322
  83. package/build/esm/src/note.js +0 -371
  84. package/build/esm/src/notehead.js +0 -169
  85. package/build/esm/src/notesubgroup.js +0 -59
  86. package/build/esm/src/ornament.js +0 -206
  87. package/build/esm/src/parenthesis.js +0 -76
  88. package/build/esm/src/parser.js +0 -164
  89. package/build/esm/src/pedalmarking.js +0 -192
  90. package/build/esm/src/registry.js +0 -81
  91. package/build/esm/src/rendercontext.js +0 -24
  92. package/build/esm/src/renderer.js +0 -112
  93. package/build/esm/src/repeatnote.js +0 -22
  94. package/build/esm/src/stave.js +0 -547
  95. package/build/esm/src/stavebarline.js +0 -182
  96. package/build/esm/src/staveconnector.js +0 -196
  97. package/build/esm/src/stavehairpin.js +0 -120
  98. package/build/esm/src/staveline.js +0 -218
  99. package/build/esm/src/stavemodifier.js +0 -77
  100. package/build/esm/src/stavenote.js +0 -799
  101. package/build/esm/src/staverepetition.js +0 -155
  102. package/build/esm/src/stavesection.js +0 -58
  103. package/build/esm/src/stavetempo.js +0 -91
  104. package/build/esm/src/stavetext.js +0 -82
  105. package/build/esm/src/stavetie.js +0 -141
  106. package/build/esm/src/stavevolta.js +0 -67
  107. package/build/esm/src/stem.js +0 -131
  108. package/build/esm/src/stemmablenote.js +0 -193
  109. package/build/esm/src/stringnumber.js +0 -231
  110. package/build/esm/src/strokes.js +0 -200
  111. package/build/esm/src/svgcontext.js +0 -414
  112. package/build/esm/src/system.js +0 -116
  113. package/build/esm/src/tables.js +0 -1102
  114. package/build/esm/src/tabnote.js +0 -299
  115. package/build/esm/src/tabslide.js +0 -76
  116. package/build/esm/src/tabstave.js +0 -17
  117. package/build/esm/src/tabtie.js +0 -19
  118. package/build/esm/src/textbracket.js +0 -144
  119. package/build/esm/src/textdynamics.js +0 -81
  120. package/build/esm/src/textformatter.js +0 -177
  121. package/build/esm/src/textnote.js +0 -176
  122. package/build/esm/src/tickable.js +0 -214
  123. package/build/esm/src/tickcontext.js +0 -170
  124. package/build/esm/src/timesigglyph.js +0 -85
  125. package/build/esm/src/timesignature.js +0 -89
  126. package/build/esm/src/timesignote.js +0 -32
  127. package/build/esm/src/tremolo.js +0 -47
  128. package/build/esm/src/tuning.js +0 -54
  129. package/build/esm/src/tuplet.js +0 -240
  130. package/build/esm/src/typeguard.js +0 -30
  131. package/build/esm/src/util.js +0 -58
  132. package/build/esm/src/vex.js +0 -51
  133. package/build/esm/src/vibrato.js +0 -100
  134. package/build/esm/src/vibratobracket.js +0 -50
  135. package/build/esm/src/voice.js +0 -187
  136. package/build/esm/src/web.js +0 -15
  137. package/build/esm/tests/accidental_tests.js +0 -974
  138. package/build/esm/tests/annotation_tests.js +0 -377
  139. package/build/esm/tests/articulation_tests.js +0 -365
  140. package/build/esm/tests/auto_beam_formatting_tests.js +0 -548
  141. package/build/esm/tests/bach_tests.js +0 -335
  142. package/build/esm/tests/barline_tests.js +0 -52
  143. package/build/esm/tests/beam_tests.js +0 -595
  144. package/build/esm/tests/bend_tests.js +0 -215
  145. package/build/esm/tests/boundingbox_tests.js +0 -53
  146. package/build/esm/tests/boundingboxcomputation_tests.js +0 -183
  147. package/build/esm/tests/chordsymbol_tests.js +0 -320
  148. package/build/esm/tests/clef_tests.js +0 -131
  149. package/build/esm/tests/curve_tests.js +0 -118
  150. package/build/esm/tests/dot_tests.js +0 -123
  151. package/build/esm/tests/easyscore_tests.js +0 -459
  152. package/build/esm/tests/factory_tests.js +0 -44
  153. package/build/esm/tests/font_tests.js +0 -135
  154. package/build/esm/tests/formatter/framestack.js +0 -61
  155. package/build/esm/tests/formatter/tests.js +0 -203
  156. package/build/esm/tests/formatter_tests.js +0 -669
  157. package/build/esm/tests/fraction_tests.js +0 -72
  158. package/build/esm/tests/ghostnote_tests.js +0 -77
  159. package/build/esm/tests/glyphnote_tests.js +0 -113
  160. package/build/esm/tests/gracenote_tests.js +0 -370
  161. package/build/esm/tests/gracetabnote_tests.js +0 -79
  162. package/build/esm/tests/index.js +0 -68
  163. package/build/esm/tests/key_clef_tests.js +0 -103
  164. package/build/esm/tests/keymanager_tests.js +0 -68
  165. package/build/esm/tests/keysignature_tests.js +0 -308
  166. package/build/esm/tests/mocks.js +0 -71
  167. package/build/esm/tests/modifier_tests.js +0 -24
  168. package/build/esm/tests/multimeasurerest_tests.js +0 -141
  169. package/build/esm/tests/music_tests.js +0 -161
  170. package/build/esm/tests/notehead_tests.js +0 -137
  171. package/build/esm/tests/notesubgroup_tests.js +0 -149
  172. package/build/esm/tests/offscreencanvas_tests.js +0 -47
  173. package/build/esm/tests/ornament_tests.js +0 -298
  174. package/build/esm/tests/parser_tests.js +0 -122
  175. package/build/esm/tests/pedalmarking_tests.js +0 -64
  176. package/build/esm/tests/percussion_tests.js +0 -180
  177. package/build/esm/tests/registry_tests.js +0 -64
  178. package/build/esm/tests/renderer_tests.js +0 -113
  179. package/build/esm/tests/rests_tests.js +0 -248
  180. package/build/esm/tests/rhythm_tests.js +0 -357
  181. package/build/esm/tests/stave_tests.js +0 -560
  182. package/build/esm/tests/staveconnector_tests.js +0 -402
  183. package/build/esm/tests/stavehairpin_tests.js +0 -90
  184. package/build/esm/tests/staveline_tests.js +0 -122
  185. package/build/esm/tests/stavemodifier_tests.js +0 -51
  186. package/build/esm/tests/stavenote_tests.js +0 -835
  187. package/build/esm/tests/stavetie_tests.js +0 -108
  188. package/build/esm/tests/stringnumber_tests.js +0 -259
  189. package/build/esm/tests/strokes_tests.js +0 -275
  190. package/build/esm/tests/style_tests.js +0 -98
  191. package/build/esm/tests/support/qunit.js +0 -2765
  192. package/build/esm/tests/tabnote_tests.js +0 -474
  193. package/build/esm/tests/tabslide_tests.js +0 -135
  194. package/build/esm/tests/tabstave_tests.js +0 -23
  195. package/build/esm/tests/tabtie_tests.js +0 -173
  196. package/build/esm/tests/textbracket_tests.js +0 -100
  197. package/build/esm/tests/textformatter_tests.js +0 -24
  198. package/build/esm/tests/textnote_tests.js +0 -215
  199. package/build/esm/tests/threevoice_tests.js +0 -132
  200. package/build/esm/tests/tickcontext_tests.js +0 -36
  201. package/build/esm/tests/timesignature_tests.js +0 -134
  202. package/build/esm/tests/tremolo_tests.js +0 -75
  203. package/build/esm/tests/tuning_tests.js +0 -56
  204. package/build/esm/tests/tuplet_tests.js +0 -450
  205. package/build/esm/tests/typeguard_tests.js +0 -82
  206. package/build/esm/tests/vexflow_test_helpers.js +0 -266
  207. package/build/esm/tests/vf_prefix_tests.js +0 -115
  208. package/build/esm/tests/vibrato_tests.js +0 -92
  209. package/build/esm/tests/vibratobracket_tests.js +0 -45
  210. package/build/esm/tests/voice_tests.js +0 -69
  211. package/build/types/entry/vexflow-bravura.d.ts +0 -3
  212. package/build/types/entry/vexflow-core.d.ts +0 -3
  213. package/build/types/entry/vexflow-debug.d.ts +0 -3
  214. package/build/types/entry/vexflow-font-bravura.d.ts +0 -3771
  215. package/build/types/entry/vexflow-font-custom.d.ts +0 -86
  216. package/build/types/entry/vexflow-font-gonville.d.ts +0 -1267
  217. package/build/types/entry/vexflow-font-petaluma.d.ts +0 -1896
  218. package/build/types/entry/vexflow-gonville.d.ts +0 -3
  219. package/build/types/entry/vexflow-petaluma.d.ts +0 -3
  220. package/build/types/entry/vexflow.d.ts +0 -3
  221. package/build/types/src/accidental.d.ts +0 -66
  222. package/build/types/src/annotation.d.ts +0 -60
  223. package/build/types/src/articulation.d.ts +0 -62
  224. package/build/types/src/barnote.d.ts +0 -29
  225. package/build/types/src/beam.d.ts +0 -124
  226. package/build/types/src/bend.d.ts +0 -73
  227. package/build/types/src/boundingbox.d.ts +0 -42
  228. package/build/types/src/boundingboxcomputation.d.ts +0 -33
  229. package/build/types/src/canvascontext.d.ts +0 -89
  230. package/build/types/src/chordsymbol.d.ts +0 -149
  231. package/build/types/src/clef.d.ts +0 -48
  232. package/build/types/src/clefnote.d.ts +0 -25
  233. package/build/types/src/crescendo.d.ts +0 -27
  234. package/build/types/src/curve.d.ts +0 -41
  235. package/build/types/src/dot.d.ts +0 -20
  236. package/build/types/src/easyscore.d.ts +0 -148
  237. package/build/types/src/element.d.ts +0 -202
  238. package/build/types/src/factory.d.ts +0 -271
  239. package/build/types/src/flow.d.ts +0 -245
  240. package/build/types/src/font.d.ts +0 -181
  241. package/build/types/src/fonts/bravura_glyphs.d.ts +0 -3239
  242. package/build/types/src/fonts/bravura_metrics.d.ts +0 -533
  243. package/build/types/src/fonts/custom_glyphs.d.ts +0 -78
  244. package/build/types/src/fonts/custom_metrics.d.ts +0 -5
  245. package/build/types/src/fonts/gonville_glyphs.d.ts +0 -828
  246. package/build/types/src/fonts/gonville_metrics.d.ts +0 -440
  247. package/build/types/src/fonts/load_all.d.ts +0 -1
  248. package/build/types/src/fonts/load_bravura.d.ts +0 -1
  249. package/build/types/src/fonts/load_custom.d.ts +0 -1
  250. package/build/types/src/fonts/load_gonville.d.ts +0 -1
  251. package/build/types/src/fonts/load_petaluma.d.ts +0 -1
  252. package/build/types/src/fonts/petaluma_glyphs.d.ts +0 -1335
  253. package/build/types/src/fonts/petaluma_metrics.d.ts +0 -562
  254. package/build/types/src/fonts/petalumascript_glyphs.d.ts +0 -863
  255. package/build/types/src/fonts/robotoslab_glyphs.d.ts +0 -863
  256. package/build/types/src/fonts/textfonts.d.ts +0 -1
  257. package/build/types/src/formatter.d.ts +0 -203
  258. package/build/types/src/fraction.d.ts +0 -62
  259. package/build/types/src/frethandfinger.d.ts +0 -22
  260. package/build/types/src/ghostnote.d.ts +0 -16
  261. package/build/types/src/glyph.d.ts +0 -139
  262. package/build/types/src/glyphnote.d.ts +0 -17
  263. package/build/types/src/gracenote.d.ts +0 -19
  264. package/build/types/src/gracenotegroup.d.ts +0 -33
  265. package/build/types/src/gracetabnote.d.ts +0 -5
  266. package/build/types/src/index.d.ts +0 -91
  267. package/build/types/src/keymanager.d.ts +0 -25
  268. package/build/types/src/keysignature.d.ts +0 -50
  269. package/build/types/src/keysignote.d.ts +0 -11
  270. package/build/types/src/modifier.d.ts +0 -97
  271. package/build/types/src/modifiercontext.d.ts +0 -45
  272. package/build/types/src/multimeasurerest.d.ts +0 -61
  273. package/build/types/src/music.d.ts +0 -91
  274. package/build/types/src/note.d.ts +0 -230
  275. package/build/types/src/notehead.d.ts +0 -70
  276. package/build/types/src/notesubgroup.d.ts +0 -18
  277. package/build/types/src/ornament.d.ts +0 -76
  278. package/build/types/src/parenthesis.d.ts +0 -22
  279. package/build/types/src/parser.d.ts +0 -45
  280. package/build/types/src/pedalmarking.d.ts +0 -69
  281. package/build/types/src/registry.d.ts +0 -40
  282. package/build/types/src/rendercontext.d.ts +0 -64
  283. package/build/types/src/renderer.d.ts +0 -35
  284. package/build/types/src/repeatnote.d.ts +0 -6
  285. package/build/types/src/stave.d.ts +0 -186
  286. package/build/types/src/stavebarline.d.ts +0 -28
  287. package/build/types/src/staveconnector.d.ts +0 -67
  288. package/build/types/src/stavehairpin.d.ts +0 -56
  289. package/build/types/src/staveline.d.ts +0 -57
  290. package/build/types/src/stavemodifier.d.ts +0 -44
  291. package/build/types/src/stavenote.d.ts +0 -154
  292. package/build/types/src/staverepetition.d.ts +0 -32
  293. package/build/types/src/stavesection.d.ts +0 -15
  294. package/build/types/src/stavetempo.d.ts +0 -25
  295. package/build/types/src/stavetext.d.ts +0 -25
  296. package/build/types/src/stavetie.d.ts +0 -59
  297. package/build/types/src/stavevolta.d.ts +0 -21
  298. package/build/types/src/stem.d.ts +0 -58
  299. package/build/types/src/stemmablenote.d.ts +0 -39
  300. package/build/types/src/stringnumber.d.ts +0 -27
  301. package/build/types/src/strokes.d.ts +0 -33
  302. package/build/types/src/svgcontext.d.ts +0 -131
  303. package/build/types/src/system.d.ts +0 -92
  304. package/build/types/src/tables.d.ts +0 -96
  305. package/build/types/src/tabnote.d.ts +0 -44
  306. package/build/types/src/tabslide.d.ts +0 -34
  307. package/build/types/src/tabstave.d.ts +0 -7
  308. package/build/types/src/tabtie.d.ts +0 -18
  309. package/build/types/src/textbracket.d.ts +0 -55
  310. package/build/types/src/textdynamics.d.ts +0 -39
  311. package/build/types/src/textformatter.d.ts +0 -109
  312. package/build/types/src/textnote.d.ts +0 -49
  313. package/build/types/src/tickable.d.ts +0 -140
  314. package/build/types/src/tickcontext.d.ts +0 -82
  315. package/build/types/src/timesigglyph.d.ts +0 -14
  316. package/build/types/src/timesignature.d.ts +0 -26
  317. package/build/types/src/timesignote.d.ts +0 -11
  318. package/build/types/src/tremolo.d.ts +0 -17
  319. package/build/types/src/tuning.d.ts +0 -23
  320. package/build/types/src/tuplet.d.ts +0 -105
  321. package/build/types/src/typeguard.d.ts +0 -99
  322. package/build/types/src/util.d.ts +0 -27
  323. package/build/types/src/version.d.ts +0 -3
  324. package/build/types/src/vex.d.ts +0 -18
  325. package/build/types/src/vibrato.d.ts +0 -29
  326. package/build/types/src/vibratobracket.d.ts +0 -33
  327. package/build/types/src/voice.d.ts +0 -108
  328. package/build/types/src/web.d.ts +0 -2
@@ -1,173 +0,0 @@
1
- import { VexFlowTests } from './vexflow_test_helpers.js';
2
- import { Annotation } from '../src/annotation.js';
3
- import { Flow } from '../src/flow.js';
4
- import { Formatter } from '../src/formatter.js';
5
- import { TabNote } from '../src/tabnote.js';
6
- import { TabStave } from '../src/tabstave.js';
7
- import { TabTie } from '../src/tabtie.js';
8
- import { Voice } from '../src/voice.js';
9
- const TabTieTests = {
10
- Start() {
11
- QUnit.module('TabTie');
12
- const run = VexFlowTests.runTests;
13
- run('Simple TabTie', simple);
14
- run('Hammerons', simpleHammerOn);
15
- run('Pulloffs', simplePullOff);
16
- run('Tapping', tap);
17
- run('Continuous', continuous);
18
- },
19
- };
20
- const tabNote = (noteStruct) => new TabNote(noteStruct);
21
- function setupContext(options, w = 0, h = 0) {
22
- const context = options.contextBuilder(options.elementId, w || 350, h || 160);
23
- context.fillStyle = '#221';
24
- context.strokeStyle = '#221';
25
- context.setFont('Arial', VexFlowTests.Font.size);
26
- const stave = new TabStave(10, 10, w || 350).addTabGlyph().setContext(context).draw();
27
- return { context, stave };
28
- }
29
- function tieNotes(notes, indices, stave, ctx, text) {
30
- const voice = new Voice(Flow.TIME4_4);
31
- voice.addTickables(notes);
32
- new Formatter().joinVoices([voice]).format([voice], 100);
33
- voice.draw(ctx, stave);
34
- const tie = new TabTie({
35
- first_note: notes[0],
36
- last_note: notes[1],
37
- first_indices: indices,
38
- last_indices: indices,
39
- }, text !== null && text !== void 0 ? text : 'Annotation');
40
- tie.setContext(ctx);
41
- tie.draw();
42
- }
43
- function simple(options, contextBuilder) {
44
- options.contextBuilder = contextBuilder;
45
- const { context, stave } = setupContext(options);
46
- const note1 = tabNote({ positions: [{ str: 4, fret: 4 }], duration: 'h' });
47
- const note2 = tabNote({ positions: [{ str: 4, fret: 6 }], duration: 'h' });
48
- tieNotes([note1, note2], [0], stave, context);
49
- ok(true, 'Simple Test');
50
- }
51
- function simpleHammerOn(options, contextBuilder) {
52
- options.contextBuilder = contextBuilder;
53
- multiTest(options, TabTie.createHammeron);
54
- }
55
- function simplePullOff(options, contextBuilder) {
56
- options.contextBuilder = contextBuilder;
57
- multiTest(options, TabTie.createPulloff);
58
- }
59
- function multiTest(options, createTabTie) {
60
- const { context, stave } = setupContext(options, 440, 140);
61
- const notes = [
62
- tabNote({ positions: [{ str: 4, fret: 4 }], duration: '8' }),
63
- tabNote({ positions: [{ str: 4, fret: 4 }], duration: '8' }),
64
- tabNote({
65
- positions: [
66
- { str: 4, fret: 4 },
67
- { str: 5, fret: 4 },
68
- ],
69
- duration: '8',
70
- }),
71
- tabNote({
72
- positions: [
73
- { str: 4, fret: 6 },
74
- { str: 5, fret: 6 },
75
- ],
76
- duration: '8',
77
- }),
78
- tabNote({ positions: [{ str: 2, fret: 14 }], duration: '8' }),
79
- tabNote({ positions: [{ str: 2, fret: 16 }], duration: '8' }),
80
- tabNote({
81
- positions: [
82
- { str: 2, fret: 14 },
83
- { str: 3, fret: 14 },
84
- ],
85
- duration: '8',
86
- }),
87
- tabNote({
88
- positions: [
89
- { str: 2, fret: 16 },
90
- { str: 3, fret: 16 },
91
- ],
92
- duration: '8',
93
- }),
94
- ];
95
- const voice = new Voice(Flow.TIME4_4).addTickables(notes);
96
- new Formatter().joinVoices([voice]).format([voice], 300);
97
- voice.draw(context, stave);
98
- createTabTie({
99
- first_note: notes[0],
100
- last_note: notes[1],
101
- first_indices: [0],
102
- last_indices: [0],
103
- })
104
- .setContext(context)
105
- .draw();
106
- ok(true, 'Single note');
107
- createTabTie({
108
- first_note: notes[2],
109
- last_note: notes[3],
110
- first_indices: [0, 1],
111
- last_indices: [0, 1],
112
- })
113
- .setContext(context)
114
- .draw();
115
- ok(true, 'Chord');
116
- createTabTie({
117
- first_note: notes[4],
118
- last_note: notes[5],
119
- first_indices: [0],
120
- last_indices: [0],
121
- })
122
- .setContext(context)
123
- .draw();
124
- ok(true, 'Single note high-fret');
125
- createTabTie({
126
- first_note: notes[6],
127
- last_note: notes[7],
128
- first_indices: [0, 1],
129
- last_indices: [0, 1],
130
- })
131
- .setContext(context)
132
- .draw();
133
- ok(true, 'Chord high-fret');
134
- }
135
- function tap(options, contextBuilder) {
136
- options.contextBuilder = contextBuilder;
137
- const { context, stave } = setupContext(options);
138
- const note1 = tabNote({ positions: [{ str: 4, fret: 12 }], duration: 'h' }).addModifier(new Annotation('T'), 0);
139
- const note2 = tabNote({ positions: [{ str: 4, fret: 10 }], duration: 'h' });
140
- tieNotes([note1, note2], [0], stave, context, 'P');
141
- ok(true, 'Tapping Test');
142
- }
143
- function continuous(options, contextBuilder) {
144
- options.contextBuilder = contextBuilder;
145
- const { context, stave } = setupContext(options, 440, 140);
146
- const notes = [
147
- tabNote({ positions: [{ str: 4, fret: 4 }], duration: 'q' }),
148
- tabNote({ positions: [{ str: 4, fret: 5 }], duration: 'q' }),
149
- tabNote({ positions: [{ str: 4, fret: 6 }], duration: 'h' }),
150
- ];
151
- const voice = new Voice(Flow.TIME4_4).addTickables(notes);
152
- new Formatter().joinVoices([voice]).format([voice], 300);
153
- voice.draw(context, stave);
154
- TabTie.createHammeron({
155
- first_note: notes[0],
156
- last_note: notes[1],
157
- first_indices: [0],
158
- last_indices: [0],
159
- })
160
- .setContext(context)
161
- .draw();
162
- TabTie.createPulloff({
163
- first_note: notes[1],
164
- last_note: notes[2],
165
- first_indices: [0],
166
- last_indices: [0],
167
- })
168
- .setContext(context)
169
- .draw();
170
- ok(true, 'Continuous Hammeron');
171
- }
172
- VexFlowTests.register(TabTieTests);
173
- export { TabTieTests };
@@ -1,100 +0,0 @@
1
- import { VexFlowTests } from './vexflow_test_helpers.js';
2
- const TextBracketTests = {
3
- Start() {
4
- QUnit.module('TextBracket');
5
- const run = VexFlowTests.runTests;
6
- run('Simple TextBracket', simple0);
7
- run('TextBracket Styles', simple1);
8
- },
9
- };
10
- function simple0(options) {
11
- const f = VexFlowTests.makeFactory(options, 550);
12
- const stave = f.Stave();
13
- const score = f.EasyScore();
14
- const notes = score.notes('c4/4, c4, c4, c4, c4', { stem: 'up' });
15
- const voice = score.voice(notes, { time: '5/4' });
16
- f.TextBracket({
17
- from: notes[0],
18
- to: notes[4],
19
- text: '15',
20
- options: {
21
- superscript: 'va',
22
- position: 'top',
23
- },
24
- });
25
- f.TextBracket({
26
- from: notes[0],
27
- to: notes[4],
28
- text: '8',
29
- options: {
30
- superscript: 'vb',
31
- position: 'bottom',
32
- line: 3,
33
- },
34
- });
35
- f.Formatter().joinVoices([voice]).formatToStave([voice], stave);
36
- f.draw();
37
- ok(true);
38
- }
39
- function simple1(options) {
40
- const f = VexFlowTests.makeFactory(options, 550);
41
- const stave = f.Stave();
42
- const score = f.EasyScore();
43
- const notes = score.notes('c4/4, c4, c4, c4, c4', { stem: 'up' });
44
- const voice = score.voice(notes, { time: '5/4' });
45
- const topOctaves = [
46
- f.TextBracket({
47
- from: notes[0],
48
- to: notes[1],
49
- text: 'Cool notes',
50
- options: {
51
- superscript: '',
52
- position: 'top',
53
- },
54
- }),
55
- f.TextBracket({
56
- from: notes[2],
57
- to: notes[4],
58
- text: 'Testing',
59
- options: {
60
- position: 'top',
61
- superscript: 'superscript',
62
- font: { family: 'Arial', size: 15, weight: 'normal', style: 'normal' },
63
- },
64
- }),
65
- ];
66
- const bottomOctaves = [
67
- f.TextBracket({
68
- from: notes[0],
69
- to: notes[1],
70
- text: '8',
71
- options: {
72
- superscript: 'vb',
73
- position: 'bottom',
74
- line: 3,
75
- font: { size: 30 },
76
- },
77
- }),
78
- f.TextBracket({
79
- from: notes[2],
80
- to: notes[4],
81
- text: 'Not cool notes',
82
- options: {
83
- superscript: ' super uncool',
84
- position: 'bottom',
85
- line: 4,
86
- },
87
- }),
88
- ];
89
- topOctaves[1].render_options.line_width = 2;
90
- topOctaves[1].render_options.show_bracket = false;
91
- bottomOctaves[0].render_options.underline_superscript = false;
92
- bottomOctaves[0].setDashed(false);
93
- bottomOctaves[1].render_options.bracket_height = 40;
94
- bottomOctaves[1].setDashed(true, [2, 2]);
95
- f.Formatter().joinVoices([voice]).formatToStave([voice], stave);
96
- f.draw();
97
- ok(true);
98
- }
99
- VexFlowTests.register(TextBracketTests);
100
- export { TextBracketTests };
@@ -1,24 +0,0 @@
1
- import { VexFlowTests } from './vexflow_test_helpers.js';
2
- import { TextFormatter } from '../src/textformatter.js';
3
- const TextFormatterTests = {
4
- Start() {
5
- QUnit.module('TextFormatter');
6
- test('Basic', basic);
7
- },
8
- };
9
- function basic() {
10
- var _a;
11
- const registeredFamilies = TextFormatter.getFontFamilies();
12
- equal(registeredFamilies.length, 2, `There are two registered font families: 'Roboto Slab' & 'PetalumaScript'`);
13
- const petalumaFormatterInfo = TextFormatter.getInfo('PetalumaScript');
14
- equal((_a = petalumaFormatterInfo === null || petalumaFormatterInfo === void 0 ? void 0 : petalumaFormatterInfo.glyphs) === null || _a === void 0 ? void 0 : _a.C.advanceWidth, 623, 'PetalumaScript advanceWidth of C character is 623.');
15
- const formatterForPetalumaScript = TextFormatter.create({ family: 'PetalumaScript', size: '100px' });
16
- const metricsPetalumaScriptH = formatterForPetalumaScript.getGlyphMetrics('H');
17
- equal(metricsPetalumaScriptH.leftSideBearing, 37);
18
- const formatterForRobotoSlab = TextFormatter.create({ family: 'Roboto Slab', size: '100px', style: 'italic' });
19
- const metricsRobotoSlabH = formatterForRobotoSlab.getGlyphMetrics('H');
20
- equal(metricsRobotoSlabH.advanceWidth, 1578);
21
- equal(formatterForRobotoSlab.cacheKey, 'Roboto_Slab%75%normal%normal');
22
- }
23
- VexFlowTests.register(TextFormatterTests);
24
- export { TextFormatterTests };
@@ -1,215 +0,0 @@
1
- import { VexFlowTests } from './vexflow_test_helpers.js';
2
- import { Crescendo } from '../src/crescendo.js';
3
- import { Flow } from '../src/flow.js';
4
- import { Font } from '../src/font.js';
5
- import { Note } from '../src/note.js';
6
- import { Stave } from '../src/stave.js';
7
- import { TextNote } from '../src/textnote.js';
8
- const TextNoteTests = {
9
- Start() {
10
- QUnit.module('TextNote');
11
- const run = VexFlowTests.runTests;
12
- run('TextNote Formatting', formatTextNotes);
13
- run('TextNote Formatting 2', formatTextNotes2);
14
- run('TextNote Superscript and Subscript', superscriptAndSubscript);
15
- run('TextNote Formatting With Glyphs 0', formatTextGlyphs0);
16
- run('TextNote Formatting With Glyphs 1', formatTextGlyphs1);
17
- run('Crescendo', crescendo);
18
- run('Text Dynamics', textDynamics);
19
- },
20
- };
21
- function formatTextNotes(options) {
22
- const f = VexFlowTests.makeFactory(options, 400, 200);
23
- const stave = f.Stave({ y: 40 });
24
- const score = f.EasyScore();
25
- const voice1 = score.voice([
26
- f
27
- .StaveNote({ keys: ['c/4', 'e/4', 'a/4'], stem_direction: -1, duration: 'h' })
28
- .addModifier(f.Accidental({ type: 'b' }), 0)
29
- .addModifier(f.Accidental({ type: '#' }), 1),
30
- f.StaveNote({ keys: ['d/4', 'e/4', 'f/4'], stem_direction: -1, duration: 'q' }),
31
- f
32
- .StaveNote({ keys: ['c/4', 'f/4', 'a/4'], stem_direction: -1, duration: 'q' })
33
- .addModifier(f.Accidental({ type: 'n' }), 0)
34
- .addModifier(f.Accidental({ type: '#' }), 1),
35
- ]);
36
- const voice2 = score.voice([
37
- f.TextNote({ text: 'Center Justification', duration: 'h' }).setJustification(TextNote.Justification.CENTER),
38
- f.TextNote({ text: 'Left Line 1', duration: 'q' }).setLine(1),
39
- f.TextNote({ text: 'Right', duration: 'q' }).setJustification(TextNote.Justification.RIGHT),
40
- ]);
41
- const formatter = f.Formatter();
42
- formatter.joinVoices([voice1, voice2]).formatToStave([voice1, voice2], stave);
43
- f.draw();
44
- ok(true);
45
- }
46
- function formatTextNotes2(options) {
47
- const f = VexFlowTests.makeFactory(options, 600, 200);
48
- const stave = f.Stave({ y: 40 });
49
- const score = f.EasyScore();
50
- const voice1 = score.voice([
51
- f.StaveNote({ keys: ['g/4'], stem_direction: 1, duration: '16' }),
52
- f.StaveNote({ keys: ['g/4'], stem_direction: 1, duration: '16' }),
53
- f.StaveNote({ keys: ['g/4'], stem_direction: 1, duration: '16' }),
54
- f.StaveNote({ keys: ['g/5'], stem_direction: -1, duration: '16' }),
55
- f.StaveNote({ keys: ['g/5'], stem_direction: -1, duration: '16' }),
56
- f.StaveNote({ keys: ['g/5'], stem_direction: -1, duration: '16' }),
57
- f.StaveNote({ keys: ['g/5', 'a/5'], stem_direction: -1, duration: '16' }),
58
- f.StaveNote({ keys: ['g/5', 'a/5'], stem_direction: -1, duration: '16' }),
59
- f.StaveNote({ keys: ['g/5', 'a/5'], stem_direction: -1, duration: '16' }),
60
- f.StaveNote({ keys: ['g/4', 'a/4'], stem_direction: 1, duration: '16' }),
61
- f.StaveNote({ keys: ['g/4', 'a/4'], stem_direction: 1, duration: '16' }),
62
- f.StaveNote({ keys: ['g/4', 'a/4'], stem_direction: 1, duration: '16' }),
63
- f.StaveNote({ keys: ['g/4', 'a/4'], stem_direction: 1, duration: 'q' }),
64
- ]);
65
- const voice2 = score.voice([
66
- f.TextNote({ text: 'C', duration: '16' }).setJustification(TextNote.Justification.CENTER),
67
- f.TextNote({ text: 'L', duration: '16' }),
68
- f.TextNote({ text: 'R', duration: '16' }).setJustification(TextNote.Justification.RIGHT),
69
- f.TextNote({ text: 'C', duration: '16' }).setJustification(TextNote.Justification.CENTER),
70
- f.TextNote({ text: 'L', duration: '16' }),
71
- f.TextNote({ text: 'R', duration: '16' }).setJustification(TextNote.Justification.RIGHT),
72
- f.TextNote({ text: 'C', duration: '16' }).setJustification(TextNote.Justification.CENTER),
73
- f.TextNote({ text: 'L', duration: '16' }),
74
- f.TextNote({ text: 'R', duration: '16' }).setJustification(TextNote.Justification.RIGHT),
75
- f.TextNote({ text: 'C', duration: '16' }).setJustification(TextNote.Justification.CENTER),
76
- f.TextNote({ text: 'L', duration: '16' }),
77
- f.TextNote({ text: 'R', duration: '16' }).setJustification(TextNote.Justification.RIGHT),
78
- f.TextNote({ text: 'R', duration: 'q' }).setJustification(TextNote.Justification.RIGHT),
79
- ]);
80
- f.Formatter().joinVoices([voice1, voice2]).formatToStave([voice1, voice2], stave);
81
- voice2.getTickables().forEach((note) => Note.plotMetrics(f.getContext(), note, 170));
82
- f.draw();
83
- ok(true);
84
- }
85
- function superscriptAndSubscript(options) {
86
- const f = VexFlowTests.makeFactory(options, 600, 230);
87
- const stave = f.Stave({ y: 40 });
88
- const score = f.EasyScore();
89
- const voice1 = score.voice([
90
- f
91
- .StaveNote({ keys: ['c/4', 'e/4', 'a/4'], stem_direction: 1, duration: 'h' })
92
- .addModifier(f.Accidental({ type: 'b' }), 0)
93
- .addModifier(f.Accidental({ type: '#' }), 1),
94
- f.StaveNote({ keys: ['d/4', 'e/4', 'f/4'], stem_direction: 1, duration: 'q' }),
95
- f
96
- .StaveNote({ keys: ['c/4', 'f/4', 'a/4'], stem_direction: 1, duration: 'q' })
97
- .addModifier(f.Accidental({ type: 'n' }), 0)
98
- .addModifier(f.Accidental({ type: '#' }), 1),
99
- ]);
100
- const voice2 = score.voice([
101
- f.TextNote({ text: Flow.unicode.flat + 'I', superscript: '+5', duration: '8' }),
102
- f.TextNote({ text: 'D' + Flow.unicode.sharp + '/F', duration: '4d', superscript: 'sus2' }),
103
- f.TextNote({ text: 'ii', superscript: '6', subscript: '4', duration: '8' }),
104
- f.TextNote({ text: 'C', superscript: Flow.unicode.triangle + '7', subscript: '', duration: '8' }),
105
- f.TextNote({ text: 'vii', superscript: Flow.unicode['o-with-slash'] + '7', duration: '8' }),
106
- f.TextNote({ text: 'V', superscript: '7', duration: '8' }),
107
- ]);
108
- voice2.getTickables().forEach((note) => {
109
- const textNote = note;
110
- textNote.setFont({ family: Font.SERIF, size: 15 });
111
- textNote.setLine(13);
112
- textNote.setJustification(TextNote.Justification.LEFT);
113
- });
114
- f.Formatter().joinVoices([voice1, voice2]).formatToStave([voice1, voice2], stave);
115
- f.draw();
116
- ok(true);
117
- }
118
- function formatTextGlyphs0(options) {
119
- const f = VexFlowTests.makeFactory(options, 600, 230);
120
- const stave = f.Stave({ y: 40 });
121
- const score = f.EasyScore();
122
- const voice1 = score.voice([
123
- f
124
- .StaveNote({ keys: ['c/4', 'e/4', 'a/4'], stem_direction: -1, duration: 'h' })
125
- .addModifier(f.Accidental({ type: 'b' }), 0)
126
- .addModifier(f.Accidental({ type: '#' }), 1),
127
- f.StaveNote({ keys: ['d/4', 'e/4', 'f/4'], stem_direction: -1, duration: '8' }),
128
- f.StaveNote({ keys: ['c/4', 'f/4', 'a/4'], stem_direction: -1, duration: '8' }),
129
- f.StaveNote({ keys: ['c/4', 'f/4', 'a/4'], stem_direction: -1, duration: '8' }),
130
- f.StaveNote({ keys: ['c/4', 'f/4', 'a/4'], stem_direction: -1, duration: '8' }),
131
- ]);
132
- const voice2 = score.voice([
133
- f.TextNote({ text: 'Center', duration: '8' }).setJustification(TextNote.Justification.CENTER),
134
- f.TextNote({ glyph: 'f', duration: '8' }),
135
- f.TextNote({ glyph: 'p', duration: '8' }),
136
- f.TextNote({ glyph: 'm', duration: '8' }),
137
- f.TextNote({ glyph: 'z', duration: '8' }),
138
- f.TextNote({ glyph: 'mordent_upper', duration: '16' }),
139
- f.TextNote({ glyph: 'mordent_lower', duration: '16' }),
140
- f.TextNote({ glyph: 'segno', duration: '8' }),
141
- f.TextNote({ glyph: 'coda', duration: '8' }),
142
- ]);
143
- voice2.getTickables().forEach((n) => n.setJustification(TextNote.Justification.CENTER));
144
- f.Formatter().joinVoices([voice1, voice2]).formatToStave([voice1, voice2], stave);
145
- f.draw();
146
- ok(true);
147
- }
148
- function formatTextGlyphs1(options) {
149
- const f = VexFlowTests.makeFactory(options, 600, 230);
150
- const stave = f.Stave({ y: 40 });
151
- const score = f.EasyScore();
152
- const voice1 = score.voice([
153
- f
154
- .StaveNote({ keys: ['c/4', 'e/4', 'a/4'], stem_direction: -1, duration: 'h' })
155
- .addModifier(f.Accidental({ type: 'b' }), 0)
156
- .addModifier(f.Accidental({ type: '#' }), 1),
157
- f.StaveNote({ keys: ['d/4', 'e/4', 'f/4'], stem_direction: -1, duration: '8' }),
158
- f.StaveNote({ keys: ['c/4', 'f/4', 'a/4'], stem_direction: -1, duration: '8' }),
159
- f.StaveNote({ keys: ['c/4', 'f/4', 'a/4'], stem_direction: -1, duration: '8' }),
160
- f.StaveNote({ keys: ['c/4', 'f/4', 'a/4'], stem_direction: -1, duration: '8' }),
161
- ]);
162
- const voice2 = score.voice([
163
- f.TextNote({ glyph: 'turn', duration: '16' }),
164
- f.TextNote({ glyph: 'turn_inverted', duration: '16' }),
165
- f.TextNote({ glyph: 'pedal_open', duration: '8' }).setLine(10),
166
- f.TextNote({ glyph: 'pedal_close', duration: '8' }).setLine(10),
167
- f.TextNote({ glyph: 'caesura_curved', duration: '8' }).setLine(3),
168
- f.TextNote({ glyph: 'caesura_straight', duration: '8' }).setLine(3),
169
- f.TextNote({ glyph: 'breath', duration: '8' }).setLine(2),
170
- f.TextNote({ glyph: 'tick', duration: '8' }).setLine(3),
171
- f.TextNote({ glyph: 'tr', duration: '8', smooth: true }).setJustification(TextNote.Justification.CENTER),
172
- ]);
173
- voice2.getTickables().forEach((n) => n.setJustification(TextNote.Justification.CENTER));
174
- f.Formatter().joinVoices([voice1, voice2]).formatToStave([voice1, voice2], stave);
175
- f.draw();
176
- ok(true);
177
- }
178
- function crescendo(options) {
179
- const f = VexFlowTests.makeFactory(options, 600, 230);
180
- const stave = f.Stave({ y: 40 });
181
- const score = f.EasyScore();
182
- const voice = score.voice([
183
- f.TextNote({ glyph: 'p', duration: '16' }),
184
- new Crescendo({ duration: '4d' }).setLine(0).setHeight(25).setStave(stave),
185
- f.TextNote({ glyph: 'f', duration: '16' }),
186
- new Crescendo({ duration: '4' }).setLine(5).setStave(stave),
187
- new Crescendo({ duration: '4' }).setLine(10).setDecrescendo(true).setHeight(5).setStave(stave),
188
- ]);
189
- f.Formatter().joinVoices([voice]).formatToStave([voice], stave);
190
- f.draw();
191
- ok(true);
192
- }
193
- function textDynamics(options) {
194
- const f = VexFlowTests.makeFactory(options, 600, 230);
195
- const score = f.EasyScore();
196
- const voice = score.voice([
197
- f.TextDynamics({ text: 'sfz', duration: '4' }),
198
- f.TextDynamics({ text: 'rfz', duration: '4' }),
199
- f.TextDynamics({ text: 'mp', duration: '4' }),
200
- f.TextDynamics({ text: 'ppp', duration: '4' }),
201
- f.TextDynamics({ text: 'fff', duration: '4' }),
202
- f.TextDynamics({ text: 'mf', duration: '4' }),
203
- f.TextDynamics({ text: 'sff', duration: '4' }),
204
- ], { time: '7/4' });
205
- const formatter = f.Formatter();
206
- formatter.joinVoices([voice]);
207
- const width = formatter.preCalculateMinTotalWidth([voice]);
208
- formatter.format([voice]);
209
- const stave = f.Stave({ y: 40, width: width + Stave.defaultPadding });
210
- stave.draw();
211
- voice.draw(f.getContext(), stave);
212
- ok(true);
213
- }
214
- VexFlowTests.register(TextNoteTests);
215
- export { TextNoteTests };
@@ -1,132 +0,0 @@
1
- import { concat, VexFlowTests } from './vexflow_test_helpers.js';
2
- import { Beam } from '../src/beam.js';
3
- const ThreeVoicesTests = {
4
- Start() {
5
- QUnit.module('Three Voice Rests');
6
- const run = VexFlowTests.runTests;
7
- run('Three Voices - #1', threeVoices1);
8
- run('Three Voices - #2 Complex', threeVoices2);
9
- run('Three Voices - #3', threeVoices3);
10
- run('Auto Adjust Rest Positions - Two Voices', autoRestTwoVoices);
11
- run('Auto Adjust Rest Positions - Three Voices #1', autoRestThreeVoices1);
12
- run('Auto Adjust Rest Positions - Three Voices #2', autoRestThreeVoices2);
13
- },
14
- };
15
- function createThreeVoicesTest(noteGroup1, noteGroup2, noteGroup3, setup) {
16
- return (options) => {
17
- const factory = VexFlowTests.makeFactory(options, 600, 200);
18
- const stave = factory.Stave().addClef('treble').addTimeSignature('4/4');
19
- const score = factory.EasyScore();
20
- const noteGroups = [noteGroup1, noteGroup2, noteGroup3].map((args) => score.notes(...args));
21
- const voices = noteGroups.map((notes) => score.voice(notes));
22
- setup(factory, voices);
23
- const beams = [
24
- Beam.applyAndGetBeams(voices[0], +1),
25
- Beam.applyAndGetBeams(voices[1], -1),
26
- Beam.applyAndGetBeams(voices[2], -1),
27
- ].reduce(concat);
28
- factory.Formatter().joinVoices(voices).formatToStave(voices, stave);
29
- factory.draw();
30
- for (let i = 0; i < beams.length; i++) {
31
- beams[i].setContext(factory.getContext()).draw();
32
- }
33
- ok(true);
34
- };
35
- }
36
- const threeVoices1 = createThreeVoicesTest(['e5/2, e5', { stem: 'up' }], ['(d4 a4 d#5)/8, b4, (d4 a4 c5), b4, (d4 a4 c5), b4, (d4 a4 c5), b4', { stem: 'down' }], ['b3/4, e3, f3, a3', { stem: 'down' }], (f, voices) => {
37
- voices[0].getTickables()[0].addModifier(f.Fingering({ number: '0', position: 'left' }), 0);
38
- voices[1]
39
- .getTickables()[0]
40
- .addModifier(f.Fingering({ number: '0', position: 'left' }), 0)
41
- .addModifier(f.Fingering({ number: '4', position: 'left' }), 1);
42
- });
43
- const threeVoices2 = createThreeVoicesTest(['(a4 e5)/16, e5, e5, e5, e5/8, e5, e5/2', { stem: 'up' }], ['(d4 d#5)/16, (b4 c5), d5, e5, (d4 a4 c5)/8, b4, (d4 a4 c5), b4, (d4 a4 c5), b4', { stem: 'down' }], ['b3/8, b3, e3/4, f3, a3', { stem: 'down' }], (f, voices) => {
44
- voices[0]
45
- .getTickables()[0]
46
- .addModifier(f.Fingering({ number: '2', position: 'left' }), 0)
47
- .addModifier(f.Fingering({ number: '0', position: 'above' }), 1);
48
- voices[1]
49
- .getTickables()[0]
50
- .addModifier(f.Fingering({ number: '0', position: 'left' }), 0)
51
- .addModifier(f.Fingering({ number: '4', position: 'left' }), 1);
52
- });
53
- const threeVoices3 = createThreeVoicesTest(['(g4 e5)/4, e5, (g4 e5)/2', { stem: 'up' }], ['c#5/4, b4/8, b4/8/r, a4/4., g4/8', { stem: 'down' }], ['c4/4, b3, a3, g3', { stem: 'down' }], (f, voices) => {
54
- voices[0]
55
- .getTickables()[0]
56
- .addModifier(f.Fingering({ number: '0', position: 'left' }), 0)
57
- .addModifier(f.Fingering({ number: '0', position: 'left' }), 1);
58
- voices[1].getTickables()[0].addModifier(f.Fingering({ number: '1', position: 'left' }), 0);
59
- voices[2].getTickables()[0].addModifier(f.Fingering({ number: '3', position: 'left' }), 0);
60
- });
61
- function autoRestTwoVoices(options) {
62
- const f = VexFlowTests.makeFactory(options, 900, 200);
63
- const score = f.EasyScore();
64
- let x = 10;
65
- let beams = [];
66
- function createMeasure(measureTitle, width, align_rests) {
67
- const stave = f.Stave({ x: x, y: 50, width: width }).setBegBarType(1);
68
- x += width;
69
- const noteArrays = [
70
- score.notes('b4/8/r, e5/16, b4/r, b4/8/r, e5/16, b4/r, b4/8/r, d5/16, b4/r, e5/4', { stem: 'up' }),
71
- score.notes('c5/16, c4, b4/r, d4, e4, f4, b4/r, g4, g4[stem="up"], a4[stem="up"], b4/r, b4[stem="up"], e4/4', {
72
- stem: 'down',
73
- }),
74
- [f.TextNote({ text: measureTitle, line: -1, duration: '1', smooth: true })],
75
- ];
76
- const voices = noteArrays.map((notes) => score.voice(notes));
77
- beams = beams.concat(Beam.applyAndGetBeams(voices[0], 1)).concat(Beam.applyAndGetBeams(voices[1], -1));
78
- f.Formatter().joinVoices(voices).formatToStave(voices, stave, { align_rests });
79
- }
80
- createMeasure('Default Rest Positions', 400, false);
81
- createMeasure('Rests Repositioned To Avoid Collisions', 400, true);
82
- f.draw();
83
- for (let i = 0; i < beams.length; i++) {
84
- beams[i].setContext(f.getContext()).draw();
85
- }
86
- ok(true, 'Auto Adjust Rests - Two Voices');
87
- }
88
- function autoRestThreeVoices1(options) {
89
- const f = VexFlowTests.makeFactory(options, 850, 200);
90
- const score = f.EasyScore();
91
- let x = 10;
92
- function createMeasure(measureTitle, width, align_rests) {
93
- const stave = f.Stave({ x: x, y: 50, width: width }).setBegBarType(1);
94
- const voices = [
95
- score.voice(score.notes('b4/4/r, e5, e5/r, e5/r, e5, e5, e5, e5/r', { stem: 'up' }), { time: '8/4' }),
96
- score.voice(score.notes('b4/4/r, b4/r, b4/r, b4, b4/r, b4/r, b4, b4', { stem: 'down' }), { time: '8/4' }),
97
- score.voice(score.notes('e4/4/r, e4/r, f4, b4/r, g4, c4, e4/r, c4', { stem: 'down' }), { time: '8/4' }),
98
- score.voice([
99
- f.TextNote({ text: measureTitle, duration: '1', line: -1, smooth: true }),
100
- f.TextNote({ text: '', duration: '1', line: -1, smooth: true }),
101
- ], { time: '8/4' }),
102
- ];
103
- f.Formatter().joinVoices(voices).formatToStave(voices, stave, { align_rests });
104
- x += width;
105
- }
106
- createMeasure('Default Rest Positions', 400, false);
107
- createMeasure('Rests Repositioned To Avoid Collisions', 400, true);
108
- f.draw();
109
- ok(true);
110
- }
111
- function autoRestThreeVoices2(options) {
112
- const f = VexFlowTests.makeFactory(options, 850, 200);
113
- const score = f.EasyScore();
114
- let x = 10;
115
- function createMeasure(measureTitle, width, align_rests) {
116
- const stave = f.Stave({ x: x, y: 50, width: width }).setBegBarType(1);
117
- const voices = [
118
- score.voice(score.notes('b4/16/r, e5, e5/r, e5/r, e5, e5, e5, e5/r'), { time: '2/4' }),
119
- score.voice(score.notes('b4/16/r, b4/r, b4/r, b4, b4/r, b4/r, b4, b4'), { time: '2/4' }),
120
- score.voice(score.notes('e4/16/r, e4/r, f4, b4/r, g4, c4, e4/r, c4'), { time: '2/4' }),
121
- score.voice([f.TextNote({ text: measureTitle, duration: 'h', line: -1, smooth: true })], { time: '2/4' }),
122
- ];
123
- f.Formatter().joinVoices(voices).formatToStave(voices, stave, { align_rests });
124
- x += width;
125
- }
126
- createMeasure('Default Rest Positions', 400, false);
127
- createMeasure('Rests Repositioned To Avoid Collisions', 400, true);
128
- f.draw();
129
- ok(true);
130
- }
131
- VexFlowTests.register(ThreeVoicesTests);
132
- export { ThreeVoicesTests };