Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Difference From d6636870ae43e9ac To 1f1e9ecb656a9e71
|
2024-02-01
| ||
| 10:50 | core: keep the multi-measure rests of the second voices of the staves - asked by Gerhard Schacherl ... (check-in: fc7af4436c user: jef tags: trunk) | |
|
2024-01-30
| ||
| 16:56 | New release v1.22.13 ... (check-in: 1f1e9ecb65 user: jef tags: trunk, v1.22.13) | |
|
2024-01-27
| ||
| 15:05 | core: better vertical offset of rests when many voices ... (check-in: e8149de154 user: jef tags: trunk) | |
|
2023-01-07
| ||
| 14:29 | modules: nns: fix: add 'roman=2' to %%nns and fix some chords - reported by Robert Bley-Vroman ... (check-in: 8365017fa6 user: jef tags: trunk) | |
| 07:38 | New release v1.22.6 ... (check-in: d6636870ae user: jef tags: trunk, v1.22.6) | |
| 07:35 | source: copyright update ... (check-in: d49a8df607 user: jef tags: trunk) | |
Changes to README.md.
| ︙ | |||
324 325 326 327 328 329 330 | 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 | - - + + - - + + + + - + | The abc2svg music font (`abc2svf.woff` or `abc2svg.ttf`) must be installed in the local system for displaying and/or converting the .abw file. Example: ` abcmjs toabw.js my_file.abc > my_file.abw` - `tomei.js` This script outputs the music as a [MEI](https://music-encoding.org/) file. |
| ︙ | |||
459 460 461 462 463 464 465 | 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 | - + | the core interface (actually '`-1`'). #### 4.3 More about the web scripts Here are the scripts which are used in a web context: - `abcweb-1.js` |
| ︙ | |||
537 538 539 540 541 542 543 | 539 540 541 542 543 544 545 546 547 548 549 550 551 552 | - - - - - - - - - - - - - - - | When one or many tunes are displayed, a menu in the top/right corner offers to go back to the tune list or to modify the ABC source. - `snd-1.js` This script may be used with `abcweb-1.js` or `abcweb1-1.js` to play the rendered ABC music. |
| ︙ |
Changes to abc2svg.ttf.
cannot compute difference between binary files
Changes to abctopdf.
| ︙ | |||
86 87 88 89 90 91 92 | 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | + - - + + | done # check if some chromium-based browser is available for c in "$BROWSER" chromium-browser vivaldi opera brave-browser epic google-chrome; do if command -v "$c" >/dev/null 2>&1; then echo "and $c" command $abcscr "$@" > /tmp/o.html # --headless=new does not work |
| ︙ |
Changes to build.ninja.
| ︙ | |||
10 11 12 13 14 15 16 17 18 19 20 21 22 23 | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | + |
rule cpm
command = sed "s+@MAJOR@+$MAJOR+" $in > $out
rule font
command = fontforge -c 'open("font/abc2svg.sfd").generate("abc2svg.ttf")';$
fontforge -c 'open("font/abc2svg.sfd").generate("abc2svg.woff")';$
fontforge -c 'open("font/abc2svg.sfd").generate("abc2svg.woff2")';$
echo '// abc2svg music font' > font.js;$
echo "var musicfont = 'url(\"data:application/octet-stream;base64,\\" >> font.js;$
base64 abc2svg.ttf | sed 's/$$/\\/' >> font.js;$
echo "\") format(\"truetype\")'" >> font.js
rule jsc
command = if [ -e .fslckout ] && command -v fossil >/dev/null 2>&1; then $
|
| ︙ | |||
90 91 92 93 94 95 96 | 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | - - - - | build sf: sf | Scc1t2/ build abc2svg-$MAJOR.js: jsc core/abc2svg.js core/deco.js core/draw.js $ font.js core/format.js core/front.js core/music.js core/parse.js core/subs.js $ core/svg.js core/tune.js core/lyrics.js core/gchord.js core/tail.js $ core/modules.js #| package.json |
| ︙ | |||
150 151 152 153 154 155 156 | 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | - | combine-$MAJOR.js diag-$MAJOR.js equalbars-$MAJOR.js gamelan-$MAJOR.js $ grid-$MAJOR.js grid2-$MAJOR.js grid3-$MAJOR.js jianpu-$MAJOR.js $ jazzchord-$MAJOR.js mdnn-$MAJOR.js MIDI-$MAJOR.js $ nns-$MAJOR.js page-$MAJOR.js pedline-$MAJOR.js perc-$MAJOR.js psvg-$MAJOR.js $ roman-$MAJOR.js soloffs-$MAJOR.js sth-$MAJOR.js strtab-$MAJOR.js $ temper-$MAJOR.js tropt-$MAJOR.js edit-$MAJOR.css edit-$MAJOR.js edit-$MAJOR.xhtml $ abckbd-$MAJOR.js abckbd2-$MAJOR.js |
| ︙ |
Changes to cmdline.js.
1 2 | 1 2 3 4 5 6 7 8 9 10 | - + | // abc2svg - cmdline.js - command line // |
| ︙ | |||
46 47 48 49 50 51 52 | 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | - + |
// convert the file content into a Unix string
i = file.indexOf('\r')
if (i >= 0) {
if (file[i + 1] == '\n')
file = file.replace(/\r\n/g, '\n') // M$
else
|
| ︙ | |||
78 79 80 81 82 83 84 | 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | - - - - - - - |
if (fn != "default.abc")
user.errmsg("Cannot read file '" + fn + "'")
return
}
// if (typeof(utf_convert) == "function")
// file = utf_convert(file)
|
| ︙ |
Changes to core/abc2svg.js.
| ︙ | |||
110 111 112 113 114 115 116 | 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | - + - - - + - - - - - - - - + + - - - - - + + + + - + - - | abc2svg.b40_m = new Int8Array( // base-40 to midi // C D [-2, -1, 0, 1, 2, 0, 0, 1, 2, 3, 4, 0, // E F G 2, 3, 4, 5, 6, 3, 4, 5, 6, 7, 0, 5, 6, 7, 8, 9, 0, // A B 7, 8, 9, 10, 11, 0, 9, 10, 11, 12, 13 ]) |
| ︙ | |||
175 176 177 178 179 180 181 182 183 184 185 186 187 188 | 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | + + + + |
"aug7": "+7",
"7+5": "+7",
"7#5": "+7",
"sus": "sus4",
"7sus": "7sus4"
} // ch_alias
// global fonts
abc2svg.font_tb = [] // fonts - index = font.fid
abc2svg.font_st = {} // font style => font_tb index for incomplete user fonts
// font weight
// reference:
// https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight
abc2svg.ft_w = {
thin: 100,
extralight: 200,
light: 300,
|
| ︙ | |||
239 240 241 242 243 244 245 | 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 | - + + + |
// constants
var C = abc2svg.C;
// mask some unsafe functions
var require = empty_function,
system = empty_function,
write = empty_function,
|
| ︙ | |||
417 418 419 420 421 422 423 | 412 413 414 415 416 417 418 419 420 | - - + - - |
}
error(sev, s, msg, a1, a2, a3, a4)
}
// inject javascript code
function js_inject(js) {
|
Changes to core/deco.js.
1 2 | 1 2 3 4 5 6 7 8 9 10 | - + | // abc2svg - deco.js - decorations // |
| ︙ | |||
53 54 55 56 57 58 59 | 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | - - - - - + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + + - - + + - - - - - - - + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + |
var dd_tb = {}, // definition of the decorations
a_de, // array of the decoration elements
cross // cross voice decorations
// decorations - populate with standard decorations
var decos = {
|
| ︙ | |||
187 188 189 190 191 192 193 | 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 | - + | null, null, null, d_upstaff, // 3 - tied to note d_upstaff // 4 (below the staff) ], f_staff = [ null, null, null, null, null, d_upstaff, // 5 (above the staff) |
| ︙ | |||
324 325 326 327 328 329 330 | 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - + | de.has_val = true; de.val = h; // de.x = s.x - xc; de.x -= xc; de.y = 3 * ((s.notes[0].pit + s.notes[s.nhd].pit) / 2 - 18) - h / 2 - 3 } |
| ︙ | |||
473 474 475 476 477 478 479 | 371 372 373 374 375 376 377 378 379 380 381 382 383 384 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | s.ymx = de.y + dd.h } } } } } |
| ︙ | |||
556 557 558 559 560 561 562 | 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 | - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + - - - - - - - - - - - - + - - - - + - - + + - - + - - - + + - - + |
de.y = 3 * (yc - 18)
}
// special case for long decoration
function d_trill(de) {
if (de.ldst)
return
|
| ︙ | |||
639 640 641 642 643 644 645 | 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 | - + + - + + - + - - - + - + - - - - - - - + + + + + + + + + - - - - + + + + - | } de.lden = false; de.has_val = true; de.val = w; de.x = x; de.y = y |
| ︙ | |||
826 827 828 829 830 831 832 | 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 | - - + + + + + + + |
dd.hd = Number(hd)
dd.wl = wl;
dd.wr = wr;
str = text.replace(a[0], '').trim()
if (str) { // optional string
if (str[0] == '"')
str = str.slice(1, -1);
|
| ︙ | |||
928 929 930 931 932 933 934 | 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 | - + |
dd.ty = ty
}
return dd
} // get_dd()
/* -- convert the decorations -- */
function deco_cnv(s, prev) {
|
| ︙ | |||
953 954 955 956 957 958 959 960 961 962 963 964 965 966 | 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 | + + + + + + + + + + + + + |
case 1: // slide
case 2: // arp
// if (s.type != C.NOTE && s.type != C.REST) {
if (!s.notes) {
error(1, s, errs.must_note_rest, nm)
continue
}
break
case 4: // below the staff
case 5: // above the staff
i = nm.match(/1?[85]([vm])([ab])([()])/)
if (i) { // if ottava
j = i[1] == 'v' ? 1 : 2
if (i[2] == 'b')
j = -j
if (!s.ottava)
s.ottava = []
s.ottava[i[3] == '(' ? 0 : 1] = j
glovar.ottava = 1 //true
}
break
case 8: // gliss
if (s.type != C.NOTE) {
error(1, s, errs.must_note, nm)
continue
}
note = s.notes[s.nhd] // move to the upper note of the chord
|
| ︙ | |||
1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 | 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 | + + + + + + + + + + + + |
case 40: /* stemless */
s.stemless = true
break
case 41: /* rbend */
s.rbstop = 2 // with end
break
case 42: // editorial
if (s.type != C.NOTE) {
error(1, s, errs.must_note, nm)
continue
}
if (!s.notes[0].acc)
continue
nm = "sacc" + s.notes[0].acc.toString() // small accidental
dd = dd_tb[nm]
if (!dd) {
dd = deco_def(nm)
if (!dd) {
error(1, s, errs.bad_val, "!editorial!")
continue
}
}
delete s.notes[0].acc
curvoice.acc[s.notes[0].pit + 19] = 0 // ignore the accidental
break
case 43: // courtesy
if (s.type != C.NOTE) {
error(1, s, errs.must_note, nm)
continue
}
j = curvoice.acc[s.notes[0].pit + 19]
if (s.notes[0].acc || !j)
continue
court = 1 // defer
break
case 44: // cross-voice ties
if (s.type != C.NOTE) {
error(1, s, errs.must_note, nm)
continue
}
do_ctie(nm, s, s.notes[0]) // (only one note for now)
continue
// default:
// break
}
// add the decoration in the symbol
|
| ︙ | |||
1126 1127 1128 1129 1130 1131 1132 | 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 | - + + + | default: // case 2: // arpeggio // case 5: // trill // case 7: // d_cresc error(1, s, "Cannot have !$1! on a head", nm) continue case 9: // head replacement |
| ︙ | |||
1161 1162 1163 1164 1165 1166 1167 | 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 | - + - + + - - - - - + + + + + + + - + - + - - - + | de = a_de[i] if (de.s == s) de.x += dx } } /* -- adjust the symbol width -- */ |
| ︙ | |||
1275 1276 1277 1278 1279 1280 1281 | 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 | - - + + | set_sscale(s.st) else set_scale(s); st = de.st; if (!staff_tb[st].topbar) continue // invisible staff |
| ︙ | |||
1324 1325 1326 1327 1328 1329 1330 | 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 | + - - - - + + + + + - + |
if (stv_g.scale != 1)
y += stv_g.dy / 2
}
}
}
// check if user JS decoration
if (user.deco) {
|
| ︙ | |||
1353 1354 1355 1356 1357 1358 1359 | 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 | - - - + + + - - - - - - - + | || stv_g.st < 0) // or not staff scale // || voice_tb[s.v].scale != 1) out_deco_val(x, y, f, de.val / stv_g.scale, de.defl) else out_deco_val(x, y, f, de.val, de.defl) if (de.cont) new_de.push(de.start) // to be continued next line |
| ︙ | |||
1402 1403 1404 1405 1406 1407 1408 | 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 | - + |
de.s.x = de.x = x;
de.defl.nost = true
}
}
/* -- create the deco elements, and treat the near ones -- */
function create_deco(s) {
|
| ︙ | |||
1424 1425 1426 1427 1428 1429 1430 | 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 | - - + - - - - + | if (dd.func >= 10) continue pos = 0 break case 3: /* d_upstaff */ case 4: case 5: // after slurs |
| ︙ | |||
1471 1472 1473 1474 1475 1476 1477 | 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 | - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + |
de = {
s: s,
dd: dd,
st: s.st,
ix: a_de.length,
defl: {},
x: x,
|
| ︙ | |||
1512 1513 1514 1515 1516 1517 1518 | 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 | - + - + + + - - + + + |
s: s,
dd: dd,
st: s.st,
m: m,
ix: 0,
defl: {},
x: x,
|
| ︙ | |||
1636 1637 1638 1639 1640 1641 1642 | 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 | - + | st: de2.st, dd: de2.dd.dd_st, ix: a_de.length - 1, // x: s.x - s.wl - 4, y: s.y, ldst: true } |
| ︙ | |||
1701 1702 1703 1704 1705 1706 1707 | 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 | - + |
// -- define the music elements tied to the staff --
// - decoration tied to the staves
// - chord symbols
// - repeat brackets
/* (the staves are not yet defined) */
/* (unscaled delayed output) */
function draw_deco_staff() {
|
| ︙ | |||
1731 1732 1733 1734 1735 1736 1737 | 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 | + + + - + - + - + |
for (;;) {
if (!s.next)
break
s = s.next
if (s.rbstop)
break
}
x = s1.x
if (s1.xsh) // volta shift
x += s1.xsh
|
| ︙ | |||
1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 | 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 | + + |
s = s.next
if (s.rbstop)
break
}
if (s1 == s)
break
x = s1.x
if (s1.xsh) // volta shift
x += s1.xsh
if (cfmt.measurenb > 0 & s.bar_num
&& s.bar_num % cfmt.measurenb)
x += 6
if (s.type != C.BAR) {
w = s.rbstop ? 0 : s.x - realwidth + 4
} else if ((s.bar_type.length > 1 // if complex bar
&& s.bar_type != "[]")
|
| ︙ | |||
1823 1824 1825 1826 1827 1828 1829 | 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 | - + - + + + + - + + - + - + - - + + + + + + + + + + + + + + + + + - - + + + + + + + - + + + - + + + + + + + + + + + + + + + + | output+= 'h' + w.toFixed(1) if (s.rbstop == 2) output += 'v10'; output += '"/>\n'; y_set(s1.st, true, x, w, y + 2) if (s.rbstart) |
| ︙ | |||
1948 1949 1950 1951 1952 1953 1954 | 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 | + + - + |
if (s.type != C.BAR || !s.bar_num) {
any_nb = true;
w = w0
if (bar_num >= 10)
w *= bar_num >= 100 ? 3 : 2
if (gene.curfont.pad)
w += gene.curfont.pad * 2
x = (s.prev
? s.prev.x + s.prev.wr / 2
|
| ︙ | |||
2018 2019 2020 2021 2022 2023 2024 | 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 | - - - - - - + + + + + + + + + + + + + + - + - - + + - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - + + - - - - - - + + + - + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + |
gene.nbar = bar_num
if (font_size)
param_set_font("measurefont", "* " + font_size.toString());
}
/* -- draw the parts and the tempo information -- */
|
Changes to core/draw.js.
| ︙ | |||
94 95 96 97 98 99 100 | 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | - + |
[STEM_CH_MIN, STEM_CH_MIN,
STEM_CH_MIN2, STEM_CH_MIN3, STEM_CH_MIN4, STEM_CH_MIN4]
]
// (possible hook)
Abc.prototype.calculate_beam = function(bm, s1) {
var s, s2, g, notes, nflags, st, v, two_staves, two_dir,
|
| ︙ | |||
193 194 195 196 197 198 199 | 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 | - - + + - - + + - + + + + + + + + - + - + + - - - - - + + + + + + + + + + - - - - - + + + + + + + + + + + + |
for (s = s1; ; s = s.next) {
if (s.type != C.NOTE)
continue
if ((scale = s.p_v.scale) == 1)
scale = staff_tb[s.st].staffscale
if (s.stem >= 0) {
x = stem_xoff + s.notes[0].shhd
|
| ︙ | |||
335 336 337 338 339 340 341 | 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 | - + - - + | break } } if (max_stem_err > 0) /* shift beam if stems too short */ b += s1.stem * max_stem_err |
| ︙ | |||
456 457 458 459 460 461 462 | 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 | - + + |
bm.nflags = nflags
return true
}
/* -- draw the beams for one word -- */
/* (the staves are defined) */
function draw_beams(bm) {
|
| ︙ | |||
516 517 518 519 520 521 522 | 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 | - + | bh = 1.8 } bh /= stv_g.scale /*fixme: quick hack for stubs at end of beam and different stem directions*/ beam_dir = s1.stem if (s1.stem != s2.stem |
| ︙ | |||
591 592 593 594 595 596 597 | 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 | - + | break s = k } k2 = s while (k2.type != C.NOTE) k2 = k2.prev; x1 = k1.xs |
| ︙ | |||
621 622 623 624 625 626 627 | 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 | + - + + - + + + + + + + + + + + + + - + |
&& k1.dots < k.dots))
x1 += bstub
else
x1 -= bstub
}
}
if (k1.stem != beam_dir) {
osh -= bshift
|
| ︙ | |||
1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 | 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + |
// -- draw a multi-measure rest --
// (the staves are defined)
function draw_mrest(s) {
var x1, x2, prev,
p_st = staff_tb[s.st],
y = p_st.y + (p_st.topbar + p_st.botbar) / 2,
p = s.nmes.toString()
// output an old multimeasure rest
function omrest() {
var x = s.x,
y = p_st.y + 12,
n = s.nmes,
k = n >> 2 // number of rests
if (n & 3) {
k++
if (n & 3 == 3)
k++
}
//dx = 6
x -= 3 * (k - 1)
while (n >= 4) {
xygl(x, y, "r00")
n -= 4
x += 6
}
if (n >= 2) {
xygl(x, y, "r0")
n -= 2
x += 6
}
if (n)
xygl(x + 2, y, "r1")
} // omrest()
if (!s.next) {
error(1, s, "Lack of bar after multi-measure rest")
return
}
set_scale(s)
prev = s // search the start of the previous time sequence
while (!prev.seqst)
prev = prev.ts_prev
prev = prev.ts_prev
while (!prev.seqst)
prev = prev.ts_prev
x1 = prev.x + 20
x2 = s.next.x - 20
s.x = (x1 + x2) / 2
anno_start(s)
if (!cfmt.oldmrest || s.nmes > cfmt.oldmrest) {
|
| ︙ | |||
1744 1745 1746 1747 1748 1749 1750 | 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 | - + + - + - + - + - - - - + - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | } // draw a slur between two chords / notes /* (the staves are not yet defined) */ /* (delayed output) */ /* (not a pretty routine, this) */ function draw_slur(path, // list of symbols under the slur |
| ︙ | |||
1958 1959 1960 1961 1962 1963 1964 | 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 | - - |
h = 0;
a = (y2 - y1) / (x2 - x1)
if (k1 != k2
&& k1.v == k2.v) {
addy = y1 - a * x1
for (i = 1; i < i2; i++) {
k = path[i]
|
| ︙ | |||
2050 2051 2052 2053 2054 2055 2056 | 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 | - + + + - - - + - + - - + + - - - - - - - - - - - - - - - - - - + - - + + + - + - + - - - - - + + + + + + + + + + + + + + |
addy = y1 - a * x1
if (height > 0)
addy += 4 * Math.sqrt(height) - 2
else
addy -= 4 * Math.sqrt(-height) - 2
for (i = 0; i < i2; i++) {
k = path[i]
|
| ︙ | |||
2193 2194 2195 2196 2197 2198 2199 | 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 | - + - |
s = s.next
else
s = s.ts_next
}
if (!s2.grace) { // if end on a normal note
while (s) {
|
| ︙ | |||
2275 2276 2277 2278 2279 2280 2281 | 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 | - + - - + - - + + + + + + |
/* -- draw a tuplet -- */
/* (the staves are not yet defined) */
/* (delayed output) */
/* See http://moinejf.free.fr/abcm2ps-doc/tuplets.html
* for the value of 'tp.f' */
function draw_tuplet(s1) {
|
| ︙ | |||
2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 | 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 | + |
dir = tp.f[3] // 'where'
if (!dir) { // if auto
s3 = s1
while (s3 && !s3.stem) // (may have tuplets of rests!)
s3 = s3.next
dir = (s3 && s3.stem < 0) ? C.SL_BELOW : C.SL_ABOVE
}
set_dscale(dir == C.SL_ABOVE ? stu : std)
if (s1 == s2 // tuplet with 1 note (!)
|| tp.f[1] == 2) { // what == nothing
nb_only = true
} else if (tp.f[1] == 1) { /* 'what' == slur */
nb_only = true;
draw_slur([s1, s2], {ty: dir})
|
| ︙ | |||
2393 2394 2395 2396 2397 2398 2399 | 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 | - + - + - + - + + - + - + - + - + - + |
/* if number only, draw it */
if (nb_only) {
if (tp.f[2] == 1) /* if 'which' == none */
return
set_font("tuplet")
xm = (s2.x + s1.x) / 2
if (dir == C.SL_ABOVE) // 8 = width around the middle
|
| ︙ | |||
2453 2454 2455 2456 2457 2458 2459 | 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 | - + - + - - - + + + + + + - + - - + - - - - - - - + + + + - - - + - - - - - - + |
//fixme: s3 cannot be null (bar at end of staff)
x2 = s3 ? s3.x - s3.wl - 5 : realwidth - 6
} else {
x2 = s2.x + 4
r = s2.stem >= 0 ? 0 : s2.nhd
if (s2.notes[r].shhd > 0)
x2 += s2.notes[r].shhd
|
| ︙ | |||
2511 2512 2513 2514 2515 2516 2517 | 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 | - + - + - + - + - - - - + + + + - - - - + - + + - - + + - - + + + + - + |
if (a * a < .1 * .1)
a = 0
/* shift up bracket if needed */
dy = 0
for (s3 = s1; ; s3 = s3.next) {
if (!s3.dur /* not a note or a rest */
|
| ︙ | |||
2589 2590 2591 2592 2593 2594 2595 | 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 | - + - + - + - + - + - + |
if (a * a < .1 * .1)
a = 0
/* shift down the bracket if needed */
dy = 0
for (s3 = s1; ; s3 = s3.next) {
if (!s3.dur /* not a note nor a rest */
|
| ︙ | |||
2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 | 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 | + |
* - tuplets and slurs
* - not scaled
* - measure numbers
* - lyrics
* - staff decorations
* - chord symbols
* - repeat brackets
* - parts and tempos
* The buffer output is delayed until the definition of the staff system
*/
function draw_sym_near() {
var p_voice, p_st, s, v, st, y, g, w, i, st, dx, top, bot, ymn,
output_sav = output;
// set the staff offsets of a beam
|
| ︙ | |||
3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 | 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 | + + + + + - + + |
draw_all_lyrics()
break
}
}
draw_deco_staff()
draw_partempo() // draw the parts and tempo indications if any
set_dscale(-1);
output = output_sav
}
/* -- draw the name/subname of the voices -- */
function draw_vname(indent, stl) {
var p_voice, n, st, v, a_p, p, y, h, h2,
staff_d = []
if (!gene.vnt)
return
|
| ︙ | |||
3103 3104 3105 3106 3107 3108 3109 | 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 | - + - + + + - - + + - - + - - - - - - + - - + + |
y -= h
}
}
}
// -- set the y offset of the staves and return the height of the whole system --
function set_staff() {
|
| ︙ | |||
3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 | 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 | + |
if (!/[\[|]/.test(stafflines))
return // no line
w = x2 - x1;
set_sscale(-1)
// check if default staff
if (cache && cache.st_l == stafflines
&& staff_tb[st].staffscale == 1
&& cache.st_w == (w | 0)) {
xygl(x1, staff_tb[st].y, 'stdef' + cfmt.fullsvg)
return
}
for (i = 0; i < l; i++, y -= il) {
if (stafflines[i] == '.')
continue
|
| ︙ | |||
3321 3322 3323 3324 3325 3326 3327 | 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 | - + + | '" d="m0 ' + y + 'h' + w.toFixed(1); dy = 0 } ln += '"/>' } y = staff_tb[st].y if (!cache |
| ︙ | |||
3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 | 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 | + + + + + + + + + + + + + + + + - + - - + - - - - - |
case '[':
break
default:
set_hl(p_st, j, x, -7, 7)
break
}
} // hl_rest()
// return the left x offset of a new staff
// s is the %%staves
function st1(st, s) {
var tim = s.time
do { // search a voice of this staff
s = s.ts_next
} while (s.st != st)
while (s.prev // search the first symbol of this voice
&& s.prev.time >= tim)
s = s.prev
if (s.bar_type)
return s.x
return s.x - s.wl
} // st1()
// ---- draw_systems() ----
/* draw the staff, skipping the staff breaks */
for (st = 0; st <= nstaff; st++) {
|
| ︙ | |||
3559 3560 3561 3562 3563 3564 3565 | 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 | - + + + |
&& s.ts_prev.st == s.st)))
break
ba.push([s, bar_bot[s.st], bar_height[s.st]])
break
case C.STBRK:
if (cur_sy.voices[s.v]
&& cur_sy.voices[s.v].range == 0) {
|
| ︙ | |||
3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 | 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 | + + + + |
var bm = {},
s, x, y, st;
// bm.s2 = undefined
for (s = p_voice.sym; s; s = s.next) {
if (s.invis) {
switch (s.type) {
case C.CLEF:
if (s.time >= staff_tb[s.st].clef.time)
staff_tb[s.st].clef = s
continue
case C.KEY:
p_voice.ckey = s
default:
continue
case C.NOTE: // (beams may start on invisible notes)
break
}
|
| ︙ | |||
3683 3684 3685 3686 3687 3688 3689 | 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 | - + + | break case C.BAR: break /* drawn in draw_systems */ case C.CLEF: if (s.time >= staff_tb[st].clef.time) staff_tb[st].clef = s if (s.second |
| ︙ | |||
3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 | 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + |
set_scale(p_voice.sym);
}
/* -- draw all symbols -- */
function draw_all_sym() {
var p_voice, v,
n = voice_tb.length
// draw the slurs on 2 staves
// sl = [symbol of 1st staff, symbol of 2nd staff, slur type, <path .../>
function draw_sl2() {
var i, a, d, dy, dy2, dy2o, dz, n, sl
while (1) {
sl = gene.a_sl.shift()
if (!sl)
break
// extract the path header and the values
i = sl[3].indexOf('d="M') + 4
output += sl[3].slice(0, i) // <path .. >d="M
a = new Float32Array(sl[3].slice(i).match(/[\d.-]+/g))
// update the starting point of the slur
a[1] -= staff_tb[sl[0].st].y // absolute vertical offset
// [0][1] = M
// [2][3] [4][5] [6][7] = c
// [8] = v second curve if not dotted
// [9][10] [11][12] [13][14] = c
//
// y: 3-------5
// / 12---10 \
// / / \ \
// / / \ \ 7
// 1 14 \| 8
//
// x: 0 2 4 6
// 13 11 9
// deltas between staves, original and now
dy2o = sl[0].fmt.sysstaffsep + 24
dy2 = staff_tb[sl[1].st].y - staff_tb[sl[0].st].y
switch (sl[2]) { // slur type
case "//": // '~' like
case "\\\\":
// get the middle of the '~' slur (* 2)
d = -(sl[1].prev.prev.y + staff_tb[sl[0].st].y
+ sl[1].prev.next.y + staff_tb[sl[1].st].y)
- 2 * (a[1] - posy)
a[5] = d - a[5]
a[7] = d - a[7]
if (a.length > 8) {
d = sl[2][0] == '/' ? 3 : -3
a[8] = -a[8]
a[10] = -a[3] + d
a[12] = -a[5] + d
a[14] = -a[7]
}
break
case "/\\":
case "\\/":
d = sl[2][0] == '/'
? dy2 - dy2o - 10
: dy2 + dy2o + 10
a[3] += d
a[5] += d
if (a.length > 8) {
a[10] += d
a[12] += d
}
break
default: // /+, /-, \+ or \-
d = sl[2][0] == '/' ? dy2 - dy2o : -dy2 - dy2o
a[5] += d
a[7] += d
if (a.length > 8) {
a[12] -= d
a[14] -= d
}
break
}
// output the slur
output += a[0].toFixed(1) + ' ' + a[1].toFixed(1)
+ 'c' + a[2].toFixed(1) + ' ' + a[3].toFixed(1)
+ ' ' + a[4].toFixed(1) + ' ' + a[5].toFixed(1)
+ ' ' + a[6].toFixed(1) + ' ' + a[7].toFixed(1)
if (a.length > 8)
output += 'v' + a[8].toFixed(1)
+ 'c' + a[9].toFixed(1)
+ ' ' + a[10].toFixed(1)
+ ' ' + a[11].toFixed(1)
+ ' ' + a[12].toFixed(1)
+ ' ' + a[13].toFixed(1)
+ ' ' + a[14].toFixed(1)
output += '"/>\n'
}
} // draw_sl2()
for (v = 0; v < n; v++) {
p_voice = voice_tb[v]
if (p_voice.sym
&& p_voice.sym.x != undefined) {
self.draw_symbols(p_voice)
draw_all_ties(p_voice);
// no need to reset the scale as in abcm2ps
set_color()
}
}
self.draw_all_deco()
glout() // output the symbols
anno_put() // before outputting the symbol annotations
set_sscale(-1) /* restore the scale */
if (gene.a_sl) // if slurs on two staves
draw_sl2()
}
/* -- set the tie directions for one voice -- */
function set_tie_dir(s) {
var i, ntie, dir, sec, pit, ty, s2
for ( ; s; s = s.next) {
|
| ︙ |
Changes to core/format.js.
1 2 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | - + - - - + - + | // abc2svg - format.js - formatting functions // |
| ︙ | |||
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | + - + |
staffsep: 46,
stemheight: 21, // one octave
stretchlast: .25,
stretchstaff: true,
subtitlefont: {name: txt_ff, size: 16},
subtitlespace: 3,
sysstaffsep: 34,
systnames: -1,
tempofont: {name: txt_ff, weight: "bold", size: 12},
textfont: {name: txt_ff, size: 16},
// textoption: undefined,
textspace: 14,
tieheight: 1.0,
titlefont: {name: txt_ff, size: 20},
// titleleft: false,
titlespace: 6,
titletrim: true,
// transp: 0, // global transpose
// topmargin: .7 * IN,
topspace: 22,
tuplets: [0, 0, 0, 0],
|
| ︙ | |||
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | + + |
measrepnb: true,
rbmax: true,
rbmin: true,
shiftunison: true,
slurheight: true,
squarebreve: true,
staffsep: true,
systnames: 1, //
stemheight: true,
stretchlast: true,
stretchstaff: true,
tieheight: true,
timewarn: true,
trimsvg: 1, //true
vocalspace: true
} // sfmt
function get_bool(param) {
return !param || !/^(0|n|f)/i.test(param) // accept void as true !
}
|
| ︙ | |||
192 193 194 195 196 197 198 | 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 | - + - + - - - + - - - - - - - - - - - - - - - |
if (!scale)
scale = 1.1;
font.swfac = font.size * scale
}
// %%xxxfont fontname|* [encoding] [size|*]
function param_set_font(xxxfont, p) {
|
| ︙ | |||
271 272 273 274 275 276 277 | 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 | - - - - + + + - - - - + + + - - + - - - - - - - - - + + - - - - + + + + + + + + + + - + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + |
a = p.match(/\s+([0-9.]+|\*)$/)
if (a) {
if (a[1] != "*")
font.size = +a[1]
p = p.replace(a[0], "")
}
|
| ︙ | |||
403 404 405 406 407 408 409 | 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 | - + + + + + + + + | align: 'j', center: 'c', fill: 'f', justify: 'j', obeylines: 'l', ragged: 'f', right: 'r', |
| ︙ | |||
510 511 512 513 514 515 516 517 518 519 520 521 522 523 | 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 | + |
case "barsperstaff":
case "infoline":
case "measurenb":
case "rbmax":
case "rbmin":
case "measrepnb":
case "shiftunison":
case "systnames":
v = parseInt(param)
if (isNaN(v)) {
syntax(1, "Bad integer value");
break
}
cfmt[cmd] = v
break
|
| ︙ | |||
536 537 538 539 540 541 542 | 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 | - + + + | case "pagescale": case "parskipfac": case "scale": case "slurheight": case "stemheight": case "tieheight": f = +param |
| ︙ | |||
579 580 581 582 583 584 585 586 587 588 589 590 591 592 | 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 | + | case "squarebreve": case "splittune": case "straightflags": case "stretchstaff": case "timewarn": case "titlecaps": case "titleleft": case "trimsvg": cfmt[cmd] = get_bool(param) break case "dblrepbar": param = ":: " + param // fall thru case "bardef": // %%bardef oldbar newbar v = param.split(/\s+/) |
| ︙ | |||
651 652 653 654 655 656 657 658 659 660 661 662 663 | 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 | + + + - | case "concert-score": if (cfmt.sound != "play") cfmt.sound = "concert" break case "writefields": set_writefields(param) break case "volume": cmd = "dynamic" // fall thru case "dynamic": case "gchord": case "gstemdir": case "ornament": case "stemdir": case "vocal": |
| ︙ | |||
762 763 764 765 766 767 768 769 770 771 772 773 774 775 | 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 | + + | break case C.SL_HIDDEN: curvoice.tup[2] = 1 break } break } if (cmd[1].slice(0, 3) == "vol") cmd[1] = "dyn" // compatibility set_pos(cmd[1], cmd[2]) break case "sounding-score": if (cfmt.sound != "play") cfmt.sound = "sounding" break case "staffwidth": |
| ︙ | |||
813 814 815 816 817 818 819 820 821 822 823 824 825 826 | 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 | + + + + + + |
break
case "voicemap":
set_v_param("map", param)
break
case "voicescale":
set_v_param("scale", param)
break
case "unsizedsvg":
if (get_bool(param))
user.imagesize = ""
else
delete user.imagesize
break
// deprecated
case "rbdbstop":
v = get_bool(param)
if (v && cfmt["abc-version"] >= "2.2")
cfmt["abc-version"] = "1"
else if (!v && cfmt["abc-version"] < "2.2")
cfmt["abc-version"] = "2.2"
|
| ︙ | |||
869 870 871 872 873 874 875 | 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 | - - + + + + + + + + + + |
}
// use the font
function use_font(font) {
if (!font.used) {
font.used = true;
if (font.fid == undefined) { // if default font
|
| ︙ | |||
925 926 927 928 929 930 931 | 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 | - + - - + + |
if (font.size)
font2.size = font.size
st = st_font(font2)
if (font.class) {
font2.class = font.class
st += ' '+ font.class
}
|
Changes to core/front.js.
1 2 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | - + - + + | // abc2svg - front.js - ABC parsing front-end // |
| ︙ | |||
279 280 281 282 283 284 285 | 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 | - + | glovar = sav.glovar; maps = sav.maps; mac = sav.mac; maci = sav.maci; parse.tune_v_opts = null; parse.scores = null; parse.ufmt = false |
| ︙ | |||
378 379 380 381 382 383 384 | 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 | - - - + + + + + + + + | parse.tune_v_opts[j]. concat(opts[j]) } } } // tune_filter() // export functions and/or set module hooks |
| ︙ | |||
433 434 435 436 437 438 439 | 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 | + - - + + - - | parse.istart = parse.bol = bol; parse.iend = eol; parse.line.index = 0; // check if the line is a pseudo-comment or I: line0 = file[bol]; line1 = file[bol + 1] if ((line0 == 'I' && line1 == ':') |
| ︙ | |||
531 532 533 534 535 536 537 | 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 | - - + + - - + + - - - + - - + - + |
if (!parse.tune_opts)
parse.tune_opts = {};
parse.tune_opts[select] = opt = {
t_opts: []
// v_opts: {}
};
while (1) {
|
| ︙ | |||
737 738 739 740 741 742 743 744 745 746 747 748 | 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 | + + + + |
continue
}
txt_add = '\n';
last_info = line0
}
if (include)
return
if (parse.state == 1) {
syntax(1, "End of file in tune header")
get_key("C")
}
if (parse.state >= 2)
end_tune();
parse.state = 0
}
Abc.prototype.tosvg = tosvg
|
Changes to core/gchord.js.
1 2 | 1 2 3 4 5 6 7 8 9 10 | - + | // abc2svg - gchord.js - chord symbols // |
| ︙ | |||
124 125 126 127 128 129 130 | 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | - - - - - - - |
}
gch.type = type
while (1) {
c = text[i]
if (!c)
break
switch (c) {
|
| ︙ | |||
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | + - - - - - + + - + - - - + + + + + + - - - + + + - - + + + + + + + + - - + - - - + + + + + + + |
}
if (c == ';') {
i++;
gch.text += c
continue
}
break
case '\n': // abcm2ps compatibility
case ';':
break
}
i++
break
}
gch.otext = gch.text // save for play accompaniment
if (!a_gch)
a_gch = []
a_gch.push(gch)
}
}
// transpose a chord symbol
|
| ︙ | |||
224 225 226 227 228 229 230 | 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 | - + |
}
}
if (curvoice.tr_sco) {
for (i = 0; i < a_gch.length; i++) {
gch = a_gch[i]
if (gch.type == 'g')
|
| ︙ | |||
278 279 280 281 282 283 284 | 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 | + + - - + + - - - - - - |
/* set the offsets and widths */
set_font(gch.font);
gch.text = str2svg(gch.text)
wh = gch.text.wh
switch (gch.type) {
case '@':
break
default:
// case 'g': // chord symbol
|
| ︙ | |||
391 392 393 394 395 396 397 | 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 | - + - + - + - + |
if (y2 < staff_tb[s.st].ann_bot)
staff_tb[s.st].ann_bot = y2
}
break
}
if (an.type != '@') {
|
| ︙ | |||
487 488 489 490 491 492 493 494 495 | 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 | + + + - + - + |
san1 = s // first chord symbol / annotation
i = an.length
if (i > n_an)
n_an = i
while (--i >= 0) {
if (an[i].type == 'g') {
an = an[i]
x = s.x + an.x
w = an.text.wh[0]
if (w && x + w > realwidth)
x = realwidth - w
if (an.pos == C.SL_ABOVE) {
|
| ︙ |
Changes to core/license.
1 2 | 1 2 3 | - + | // abc2svg - ABC to SVG translator // @source: https://chiselapp.com/user/moinejf/repository/abc2svg |
Changes to core/lyrics.js.
1 2 | 1 2 3 4 5 6 7 8 9 10 | - + | // abc2svg - lyrics.js - lyrics // |
| ︙ | |||
181 182 183 184 185 186 187 | 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | - + | } s = s.next; i++ continue case '-': case '_': word = p[i] |
| ︙ | |||
285 286 287 288 289 290 291 | 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 | - + - - + + + - + - - + + |
if (!s2.a_ly)
continue
i = s2.a_ly.length
while (--i >= 0) {
ly = s2.a_ly[i]
if (!ly)
continue
|
| ︙ | |||
414 415 416 417 418 419 420 421 422 423 | 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 | + - - - + + + - + - + - + - + |
}
}
continue
}
if (ly.font != gene.curfont) /* font change */
gene.curfont = ly.font
p = ly.t;
ln = ly.ln || 0
w = p.wh[0]
shift = ly.shift
if (hyflag) {
|
| ︙ | |||
481 482 483 484 485 486 487 | 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 | - + |
/* see if any underscore in the next line */
for (p_voice.s_next; s; s = s.next) {
if (s.type == C.NOTE) {
if (!s.a_ly)
break
ly = s.a_ly[j]
|
| ︙ | |||
508 509 510 511 512 513 514 | 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 | - + + - + - + |
set_font("vocal")
if (incr > 0) { /* under the staff */
if (y > -tsfirst.fmt.vocalspace)
y = -tsfirst.fmt.vocalspace;
y *= sc
for (j = 0; j < nly; j++) {
y -= a_h[j] * 1.1;
|
| ︙ | |||
656 657 658 659 660 661 662 | 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 | - + - + |
for (v = 0; v < nv; v++) {
p_voice = voice_tb[v]
if (!p_voice.sym)
continue
st = p_voice.st;
if (lyst_tb[st].a) {
top = lyst_tb[st].top + 2
|
Changes to core/mei.js.
1 2 | 1 2 3 4 5 6 7 8 9 10 | - + | // abc2svg - mei.js - MEI front-end // |
| ︙ | |||
1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 | 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 | + |
not2 = s2.notes[m2]
if (not1.pit == not2.pit) {
not1.tie_ty = ty
not1.tie_e = not2
not2.tie_s = not1
}
}
}
}
s1.ti1 = s2.ti2 = true
}, // tie()
trill: function(tag) {
var s2,
s = get_ref(tag)
|
| ︙ |
Changes to core/modules.js.
| ︙ | |||
52 53 54 55 56 57 58 | 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | - - |
soloffs: {},
sth: {},
strtab: {},
temperament: { fn: 'temper' },
tropt: {},
nreq: 0,
|
| ︙ |
Changes to core/music.js.
1 2 | 1 2 3 4 5 6 7 8 9 10 | - + | // abc2svg - music.js - music generation // |
| ︙ | |||
236 237 238 239 240 241 242 | 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 | + - + |
if (p1 > ps + 4) { // if interval greater than a sixth
if (dx1 > dx2)
dx2 = dx1 // align the accidentals
notes[i1].shac = notes[i2].shac = dx2
} else {
notes[i1].shac = dx1
if (notes[i1].pit != notes[i2].pit)
|
| ︙ | |||
345 346 347 348 349 350 351 | 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 | - - + + - + | //fixme error(2, s, "Bad linkage") s.ts_prev = null } s.seqst = !s.ts_prev || s.time != s.ts_prev.time || (w_tb[s.ts_prev.type] != w_tb[s.type] |
| ︙ | |||
743 744 745 746 747 748 749 | 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 | - + | wlnote -= 3 break } } /* room for the decorations */ if (s.a_dd) |
| ︙ | |||
779 780 781 782 783 784 785 | 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 | - - - - + + + + + + + + |
&& wlnote < 20)
wlnote = 20
wlw = wlnote
if (s2) {
switch (s2.type) {
|
| ︙ | |||
804 805 806 807 808 809 810 811 812 813 814 815 816 817 | 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 | + + + | break case C.CLEF: /* extra space at start of line */ if (s2.second || s2.clef_small) break // fall thru case C.KEY: if (s.a_gch) wlw += 4 // have some room for the chord symbols // fall thru case C.METER: wlw += 3 break } } /* leave room for guitar chord */ |
| ︙ | |||
830 831 832 833 834 835 836 | 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 | - + | return case C.SPACE: xx = s.width / 2; s.wr = xx if (s.a_gch) xx = gchord_width(s, xx, xx) if (s.a_dd) |
| ︙ | |||
864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 | 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 | + + + + + + - + + + + + + + - - - - |
s.wl = w
if (s.next
&& s.next.type != C.METER)
s.wr = 7
else
s.wr = 5
// s.notes[0].shhd = (w - 5) * -.5
// special case for (mainly) "|| !invisible! |:"
if (s.invis)
//fixme
// && s.prev && s.prev.bar_type)
s.wl = s.wr = 2
/* if preceeded by a grace note sequence, adjust */
s2 = s.prev
if (s2 && s2.type == C.GRACE)
s.wl -= 6
for ( ; s2; s2 = s2.prev) {
if (w_tb[s2.type]) {
if (s2.type == C.STBRK)
s.wl -= 12
break
}
}
if (s.a_dd)
|
| ︙ | |||
1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 | 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 | + + + + |
s_chs = s;
self.set_width(s);
st = s.st
if (xl[st] == undefined)
xl[st] = 0
if (wr[st] == undefined)
wr[st] = 0;
if (s.prev && s.prev.st != st) {
xl[st] = xl[s.prev.st]
wr[st] = wr[s.prev.st]
}
val = xl[st] + wr[st] + s.wl
if (val > maxx)
maxx = val
if (s.dur && s.dur != s.notes[0].dur // if in tuplet
&& first) // (first time only)
itup = 1
s = s.ts_next
|
| ︙ | |||
1308 1309 1310 1311 1312 1313 1314 | 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 | - + - + - - + + + + + + |
stup = s2
} else if (stup && stup.v == s2.v) {
set_sp_tup(stup, s2)
stup = null
}
if (!s2.shrink) {
|
| ︙ | |||
1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 | 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 | + + |
if (s2.st != st)
continue
if (s2.type == C.BAR) {
if (s2.v == v)
break
continue
}
if (!s2.dur)
continue
s2.invis = s2.play = true
if (s2.seqst && s2.ts_next.seqst)
s2.seqst = false
}
s3 = to_rest(s3)
s3.dur = s3.notes[0].dur = dur;
s3.invis = true;
|
| ︙ | |||
1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 | 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 | + + |
if (s2.st != st)
continue
if (s2.type == C.BAR) {
if (s2.v == v)
break
continue
}
if (!s2.dur)
continue
s2.invis = s2.play = true
if (s2.seqst && s2.ts_next.seqst)
s2.seqst = false
}
s3 = to_rest(s3)
s3.dur = s3.notes[0].dur = dur;
|
| ︙ | |||
1636 1637 1638 1639 1640 1641 1642 | 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 | + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + - + + + + - - - + + + - - - + - + + + + + - + - - - - - - + - + - - - - + - - - - - - - + + + - - - - - - + + + + + + + + + - - - + + + + - - + + - - + + + + + + - + - + | // :][: -> :|] [|: i = (t[2].length / 2) | 0 t1 = t[1] + '|' + t[2].slice(0, i) t2 = t[2].slice(i) +'|' + t[3] } } // new_typ() // change or add a bar for the voice in the previous line function eol_bar(s, // bar |: |
| ︙ | |||
1780 1781 1782 1783 1784 1785 1786 | 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 | + - + + + + + + - + - - + + + + + + + + + + + + + - + |
lkvsym(s3, s1) // voice link
// care with spacing
if (s3.seqst) {
self.set_width(s3)
s3.shrink = s3.wl
s4 = s3.ts_prev
w = 0
|
| ︙ | |||
2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 | 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 | + + + |
mc = {
lm: cfmt.leftmargin,
rm: cfmt.rightmargin
}
break
case "mc_new":
case "mc_end":
if (!mc)
break
cfmt.leftmargin = mc.lm
cfmt.rightmargin = mc.rm
img.chg = 1 //true
break
}
}
if (!s.ts_next) {
s = null
} else if (!s.soln) {
continue
} else {
s.soln = false
//fixme what if new line wanted?
if (s.time == s2.time)
continue // empty music line!
while (!s.seqst)
s = s.ts_prev
}
set_page()
lwidth = get_lwidth() - lsh[1] - ckw[0]
|
| ︙ | |||
2228 2229 2230 2231 2232 2233 2234 | 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 | - + - + - + - - - - - - + - - - - + - - - - + + - - - - - - - - - - - - - - - - - - - - + - + - - - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | // s.ymx = top; s.ymx = 24; s.ymn = 0 break } } |
| ︙ | |||
2327 2328 2329 2330 2331 2332 2333 | 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 | - + - + + + | s.notes[0].dur = s.dur = s.dur_orig = dur s.nflags = -2 s.head = C.FULL s.fmr = 1 // full measure rest /* add the bar(s) and rest(s) */ tim = s.time + dur |
| ︙ | |||
2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 | 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 | + + |
s3 = s3.ts_next
while (s3 && s3.v < s.v) {
s3 = s3.ts_next // keep in order
if (s3 && s3.seqst)
break
}
if (s3) {
if (s3.dur)
s3.seqst = 0 //false
lktsym(s4, s3)
} else {
s3 = s
while (s3.ts_next)
s3 = s3.ts_next
s3.ts_next = s4
s4.ts_prev = s3
|
| ︙ | |||
2772 2773 2774 2775 2776 2777 2778 | 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 | - - + + - - - - + + + + + + + + + + - + | } /* upper and lower space needed by rests */ var rest_sp = [ [18, 18], [12, 18], [12, 12], |
| ︙ | |||
2851 2852 2853 2854 2855 2856 2857 | 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 | - - - + + + - - + + - - - - - - - - - | if (s.invis) break s.y = 12; s.ymx = 24 + 15; s.ymn = -2 break case C.REST: |
| ︙ | |||
3018 3019 3020 3021 3022 3023 3024 | 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 | - + | || s.invis) break if (s.ts_next.a_dd) s.a_dd = s.ts_next.a_dd if (s.ts_next.a_gch) s.a_gch = s.ts_next.a_gch unlksym(s.ts_next) |
| ︙ | |||
3086 3087 3088 3089 3090 3091 3092 | 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 | - + - + + + + + + + + + + + + + + + + + + + + + + - + + + + + - - - - + + + + - - + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - - - + - - - - - - + + + + + + - - - - + + + + + + - - - - - - - - + + + + + + + - - - - + + + + + - - + - - - - - - - + - - + - - - + + + + - - - - + + + + + - - - - + + + + + + + - - - - - - - + + + + + + + - - - - - - + + + + + + + + + + + - - + - - - - - + + - - - + - - + - - - - - + + + + + + + + + + + + - - + - - + - - - + + - - - - + + - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - - - - - - |
s = s.ts_next
}
}
/* -- adjust the offset of the rests when many voices -- */
/* this function is called only once per tune */
function set_rest_offset() {
|
| ︙ | |||
3286 3287 3288 3289 3290 3291 3292 | 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 | - - + + |
case C.KEY:
s.p_v.ckey = s
break
case C.METER:
s.p_v.meter = s
insert_meter = cfmt.writefields.indexOf('M') >= 0
&& s.a_meter.length
|
| ︙ | |||
3341 3342 3343 3344 3345 3346 3347 | 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 | - + + + | delete s.seqst } if (last_s) last_s.ts_prev = s delete s.clef_small; delete s.part s.second = cur_sy.voices[v].second |
| ︙ | |||
3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 | 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 | + + + + + + | self.set_pitch(last_s); s = tsfirst s.seqst = true for (s = last_s; s.ts_next && !s.ts_next.seqst; s = s.ts_next) ; if (s.ts_next // a bit further in case different keys per voice && s.ts_next.type != C.CLEF // (the clef may move in allsymwidth) && !s.tp // (start of a tuplet) && !s.ts_next.a_ly) // (don't update next .shrink) for (s = s.ts_next; s.ts_next && !s.ts_next.seqst; s = s.ts_next) ; s2 = s.ts_next s.ts_next = null set_allsymwidth() s.ts_next = s2 } // init_music_line() // check if the tune ends on a measure bar |
| ︙ | |||
3547 3548 3549 3550 3551 3552 3553 | 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 | - + | trem_adj(s) break } nflags = s.nflags if (s.ntrem) |
| ︙ | |||
3758 3759 3760 3761 3762 3763 3764 | 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 | - + + - + - + + + |
return [lsh1, lsho]
} // get_lshift()
/* -- return the left indentation of the staves -- */
function set_indent(lsh) {
var st, v, w, p_voice, p, i, j, font,
vnt = 0,
|
| ︙ | |||
4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 | 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 | + + + + + + + + + + + + + |
case "pagescale":
case "pagewidth":
case "scale":
case "staffwidth":
self.set_format(s.subtype, s.param)
break
case "mc_start": // multicol start
if (multicol) {
error(1, s, "No end of the previous %%multicol")
break
}
multicol = {
state: parse.state,
posy: posy,
maxy: posy,
lm: cfmt.leftmargin,
rm: cfmt.rightmargin,
w: cfmt.pagewidth,
sc: cfmt.scale
}
break
case "mc_new": // multicol new
if (!multicol || multicol.state != parse.state) {
error(1, s, "%%multicol new without start")
break
}
if (posy > multicol.maxy)
multicol.maxy = posy
cfmt.leftmargin = multicol.lm
cfmt.rightmargin = multicol.rm
cfmt.pagewidth = multicol.w
cfmt.scale = multicol.sc
posy = multicol.posy
img.chg = 1 //true
break
case "mc_end": // multicol end
if (!multicol || multicol.state != parse.state) {
error(1, s, "%%multicol end without start")
break
}
if (posy < multicol.maxy)
posy = multicol.maxy
cfmt.leftmargin = multicol.lm
cfmt.rightmargin = multicol.rm
cfmt.pagewidth = multicol.w
cfmt.scale = multicol.sc
multicol = undefined
|
| ︙ | |||
4664 4665 4666 4667 4668 4669 4670 | 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 | - - - - - - - - - - - - - - - + - | break case "vskip": vskip(s.sk); break } } |
| ︙ | |||
4766 4767 4768 4769 4770 4771 4772 | 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 | - + + |
if (!non_empty_gl[st])
continue
// define the helper lines
p_staff.hll = 17 + i * 2 // pitch of lowest note
// without helper line
// ('D' when standard staff)
|
| ︙ | |||
4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 | 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 | + - + - + |
s.next.prev = null
}
/* reset the staves */
nstaff = sy.nstaff
for (st = 0; st <= nstaff; st++)
reset_staff(st);
non_empty = new Uint8Array(nstaff + 1)
/*
* search the next end of line,
* and mark the empty staves
*/
for (s = tsfirst; s; s = s.ts_next) {
if (s.nl)
break
switch (s.type) {
case C.STAVES:
set_brace();
|
| ︙ | |||
4871 4872 4873 4874 4875 4876 4877 | 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 | - + - - - - - - - - - - - - - - - - - + + + + + + + - - + - + - + + + + + + + + - + + + + + + + + + + - - - - - - + + + + + + + + + + - - - - - - - - - - - + + + + + - - + + + + + + + + + + + + + + - - - - - - - - - - - - | } non_empty_gl[st] = non_empty[st] = true } tsnext = s; /* set the last empty staves */ set_brace() |
| ︙ | |||
5045 5046 5047 5048 5049 5050 5051 | 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 | - + + + + |
function set_sym_line() {
var p_v, s,
v = voice_tb.length
// set the first symbol of each voice
while (--v >= 0) {
p_v = voice_tb[v]
|
| ︙ | |||
5117 5118 5119 5120 5121 5122 5123 | 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 | - - - - + + + + + | self.set_stem_dir() // set the stems direction in 'multi' for (v = 0; v < nv; v++) set_beams(voice_tb[v].sym); /* decide on beams */ self.set_stems() // set the stem lengths |
| ︙ | |||
5153 5154 5155 5156 5157 5158 5159 | 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 | - + + + - - + + + + + - - + | // save symbol pointers for play ts1st = tsfirst v = nv while (--v >= 0) voice_tb[v].osym = voice_tb[v].sym |
| ︙ |
Changes to core/parse.js.
1 2 | 1 2 3 4 5 6 7 8 9 10 | - + | // abc2svg - parse.js - ABC parse // |
| ︙ | |||
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | + - - - - - |
case 'F':
s.clef_type = "b";
s.clef_line = 4
break
case 'n': // none
i = 4
s.invis = true
s.clef_none = 1 //true
break
case 't':
if (clef_def[1] == 'e') { // tenor
s.clef_type = "c";
s.clef_line = 4
break
}
i = 6
case 'G':
// s.clef_type = "t" // treble
break
case 'p':
i = 4
case 'P': // perc
s.clef_type = "p";
s.clef_line = 3;
|
| ︙ | |||
186 187 188 189 190 191 192 | 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | - + | a = 0 // no accidental } nt.acc = a return an } // set the microtonal accidental after transposition |
| ︙ | |||
327 328 329 330 331 332 333 | 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 | + - + + + + |
if (isNaN(n) || n < 0 || n > 16)
return //undefined
return "||||||||||||||||".slice(0, n)
}
// create a block symbol in the tune body
function new_block(subtype) {
var c_v,
|
| ︙ | |||
527 528 529 530 531 532 533 534 535 536 537 538 539 540 | 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 | + + + + |
case "staffscale=":
val = +a.shift()
if (isNaN(val) || val < .3 || val > 2)
syntax(1, "Bad %%staffscale value")
else
curvoice.staffscale = val
break
case "tacet=":
val = a.shift()
curvoice.tacet = val || undefined
break
case "transpose=": // (abcMIDI compatibility)
if (cfmt.nedo) {
syntax(1, errs.notransp)
break
}
val = get_transp(a.shift())
if (val == undefined) {
|
| ︙ | |||
578 579 580 581 582 583 584 | 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 | - - - - - - - - - + | if (clefpit) s.clefpit = clefpit get_clef(s) } } // if transposition |
| ︙ | |||
908 909 910 911 912 913 914 | 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 | - + |
if (p[i] != ' ' && p[i] != '+')
break
if (i >= p.length
|| p[i + 1] == '(') /* "M:5 (2/4+3/4)" */
break
meter.top += p[i++]
}
|
| ︙ | |||
974 975 976 977 978 979 980 981 982 983 984 985 986 987 | 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + |
sym_link(s)
// set the meter of the overlay voices
for (p_v = curvoice.voice_down; p_v; p_v = p_v.voice_down)
p_v.wmeasure = wmeasure
}
}
// link P: or Q:
function link_pq(s, text) {
var p_v, s2
if (curvoice.v == par_sy.top_voice) {
sym_link(s)
} else if (voice_tb[par_sy.top_voice].time == s.time) {
p_v = curvoice
curvoice = voice_tb[par_sy.top_voice]
sym_link(s)
curvoice = p_v
} else if (voice_tb[par_sy.top_voice].time > s.time) {
p_v = voice_tb[par_sy.top_voice]
for (s2 = p_v.sym; ; s2 = s2.next) {
if (s2.time >= s.time) {
set_ref(s)
s.fmt = cfmt
s.next = s2
s.prev = s2.prev
if (s2.prev)
s.prev.next = s
else
p_v.sym = s
s2.prev = s
s.v = s2.v
s.p_v = p_v
s.st = p_v.st
break
}
}
} else {
set_ref(s)
s.fmt = cfmt
if (!parse.pq_d)
parse.pq_d = []
parse.pq_d.push(s) // delayed insertion
}
if (!parse.pq)
parse.pq = {}
parse.pq[text] = s.time
} // link_pq()
/* Q: tempo */
function new_tempo(text) {
var i, c, d, nd,
txt = text, // (for info.Q)
s = {
type: C.TEMPO,
|
| ︙ | |||
1067 1068 1069 1070 1071 1072 1073 | 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 | - - - - - - + + + + - - - - - + + |
if (parse.state < 2 // if in tune header
|| (!curvoice.time && !glovar.tempo)) {
info.Q = txt
glovar.tempo = s
return
}
|
| ︙ | |||
1147 1148 1149 1150 1151 1152 1153 | 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 | - - - + - + + + + + + + + - - - + + + - - - - - - + - - - |
case 'P':
if (!parse.state)
break
if (parse.state == 1) {
info.P = text
break
}
|
| ︙ | |||
1231 1232 1233 1234 1235 1236 1237 | 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 | - - + - - - - - - - - - - - - - - - | return while (s2.type != C.BAR && s2.prev) s2 = s2.prev; time = s2.time; auto_time = curvoice.time - time fac = curvoice.wmeasure / auto_time |
| ︙ | |||
1311 1312 1313 1314 1315 1316 1317 | 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 | - - - - - - - - - - - - - - - - - - - | // set the annotations and the decorations if (a_gch) csan_add(s) if (a_dcn.length) deco_cnv(s) |
| ︙ | |||
1382 1383 1384 1385 1386 1387 1388 | 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 | - + |
if (s.text
&& bar_type.slice(-1) == '['
&& bar_type != '[')
bar_type = bar_type.slice(0, -1)
// there cannot be variants on a left repeat bar
if (bar_type.slice(-1) == ':') { // left repeat
|
| ︙ | |||
1404 1405 1406 1407 1408 1409 1410 | 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 | - - - - - - - + + + + + + - + + + - - + - - - - - - - - + - + - + - - - + - - - - + + + + + + - - + + - + - + + - - - - - + - - |
else if (curvoice.acc_tie_rep)
curvoice.acc_tie_rep = null
} else {
curvoice.tie_s = curvoice.tie_s_rep
if (curvoice.acc_tie_rep)
curvoice.acc_tie = curvoice.acc_tie_rep.slice()
}
|
| ︙ | |||
1502 1503 1504 1505 1506 1507 1508 | 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 | - + - - - - - + + - - - - - - + - - - - - - - + - - - | if (!curvoice.sym_restart) curvoice.sym_restart = s sym_link(s); s.st = curvoice.st /* original staff */ |
| ︙ | |||
1789 1790 1791 1792 1793 1794 1795 | 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 | - - - - + + + + - - + + - - - - - + + + + + + + + + + + + + + | // - key = 'k' + scale index // - all = 'all' // The 'map' is stored in the note. It is an array of // [0] array of heads (glyph names) // [1] print (note) // [2] color // [3] play (note) |
| ︙ | |||
1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 | 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 | + + + |
switch (line.next_char()) {
case "'":
line.index++
return ty + C.SL_ABOVE
case ",":
line.index++
return ty + C.SL_BELOW
case '?': // slur between staves (like ~)
line.index++
return ty + C.SL_CENTER
}
return ty + C.SL_AUTO
}
// on end of slur, create the slur
function slur_add(s, nt) { // nt = note if slur ending on note
var i, s2, sl
|
| ︙ | |||
1987 1988 1989 1990 1991 1992 1993 | 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 | - |
if (!not1.tie_ty)
continue
if (not1.midi == mid
&& (!se
|| !not1.tie_e)) { // (if unison)
not2.tie_s = not1
not2.s = s
|
| ︙ | |||
2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 | 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 | + + + + |
s.fmr = 1 // full measure rest
s.notes = [{
pit: 18,
dur: s.dur
}]
} else {
glovar.mrest_p = true
if (par_sy.voices.length == 1) {
s.tacet = curvoice.tacet
delete s.invis // show the 'H' when 'Xn'
}
}
break
case 'y':
s.type = C.SPACE;
s.invis = true;
s.dur = 0;
c = line.next_char()
|
| ︙ | |||
2198 2199 2200 2201 2202 2203 2204 | 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 | - - - - - + + + + + | else if (cfmt["propagate-accidentals"][0] != 'n') curvoice.acc[apit] = i } if (acc_tie && acc_tie[apit]) i = acc_tie[apit] // tied note |
| ︙ | |||
2454 2455 2456 2457 2458 2459 2460 | 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 | - - - + + - - - - |
curvoice.sym_restart = s
}
if (a_dcn_sav.length) {
a_dcn = a_dcn_sav
deco_cnv(s, s.prev)
}
|
| ︙ | |||
2517 2518 2519 2520 2521 2522 2523 | 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 | - - - - - + - | syntax(1, "No end of decoration") return } if (c == '!') break dcn += c } |
| ︙ | |||
2563 2564 2565 2566 2567 2568 2569 | 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 | - + - - |
"d", "d", "d", "d", /* h i j k */
"d", "d", "d", "d", /* l m n o */
"d", "d", "d", "d", /* p q r s */
"d", "!upbow!",
"!downbow!", "d", /* t u v w */
"n", "n", "n", "{", /* x y z { */
"|", "}", "!gmark!", nil, /* | } ~ (del) */
|
| ︙ |
Changes to core/subs.js.
1 2 | 1 2 3 4 5 6 7 8 9 10 | - + | // abc2svg - subs.js - text output // |
| ︙ | |||
82 83 84 85 86 87 88 | 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | - - + + + + + + + + + + + + + + + + + + - + - + - + + - | .722,.278,.500,.667,.556,.833,.722,.778, .667,.778,.722,.667,.611,.722,.667,.944, // 50 .667,.667,.611,.278,.278,.278,.469,.556, .333,.556,.556,.500,.556,.556,.278,.556, // 60 .556,.222,.222,.500,.222,.833,.556,.556, .556,.556,.333,.500,.278,.556,.500,.722, // 70 .500,.500,.500,.334,.260,.334,.584,.512]), |
| ︙ | |||
217 218 219 220 221 222 223 | 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 | - + |
j = str.indexOf(';', i)
if (j > 0 && j - i < 10) {
i = j;
c = 'a' // XML character reference
}
break
}
|
| ︙ | |||
299 300 301 302 303 304 305 | 315 316 317 318 319 320 321 322 323 324 325 326 327 328 | - |
return o
} // str2svg()
// set the default and current font
function set_font(xxx) {
if (typeof xxx == "string")
xxx = get_font(xxx)
|
| ︙ | |||
321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 | 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 | + + + + + + + + + + + + + + + + - - |
function xy_str(x, y,
str, // string or object String with attribute 'wh'
action, // default: align left
w, // needed for justify
wh) { // optional [width, height]
if (!wh)
wh = str.wh || strwh(str)
if (cfmt.trimsvg) {
var wx = wh[0]
switch (action) {
case 'c':
wx = wh[0] / 2
break
case 'j':
wx = w
break
case 'r':
wx = 0
break
}
if (img.wx < x + wx)
img.wx = x + wx
}
output += '<text class="' + font_class(gene.deffont)
if (action != 'j' && str.length > 5
&& gene.deffont.wadj)
output += '" lengthAdjust="' + gene.deffont.wadj +
'" textLength="' + wh[0].toFixed(1);
output += '" x="';
out_sxsy(x, '" y="', y)
switch (action) {
case 'c':
|
| ︙ | |||
378 379 380 381 382 383 384 385 386 387 388 389 390 391 | 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 | + + |
if (cfmt.titlecaps)
return title.toUpperCase()
return title
}
// return the width of the music line
function get_lwidth() {
if (img.chg)
set_page()
return (img.width - img.lm - img.rm
- 2) // for bar thickness at eol
/ cfmt.scale
}
// header generation functions
function write_title(title, is_subtitle) {
|
| ︙ | |||
401 402 403 404 405 406 407 | 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 | - + |
} else {
set_font("title");
h = cfmt.titlespace
}
wh = strwh(title)
wh[1] += gene.curfont.pad * 2
vskip(wh[1] + h + gene.curfont.pad)
|
| ︙ | |||
671 672 673 674 675 676 677 | 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 | - + - + + + + + - + - + | h = gene.curfont.size * cfmt.lineskipfac } head = names[i].slice(2) if (head[0] == '"') head = head.slice(1, -1); vskip(h); wh = strwh(head); |
| ︙ | |||
925 926 927 928 929 930 931 | 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 | - - - + + - - - - + - - + - + + - + - - - - - + + + - - - - - - - - - + + + + + + + + - - + | } write_title(info.T.slice(i, j), i != 0); i = j + 1 } } /* rhythm, composer, origin */ |
Changes to core/svg.js.
1 2 | 1 2 3 4 5 6 7 8 9 10 | - + | // abc2svg - svg.js - svg functions // |
| ︙ | |||
28 29 30 31 32 33 34 | 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | - - + + + |
\n.box{outline:1px solid black;outline-offset:1px}',
font_style = '',
posx = cfmt.leftmargin / cfmt.scale, // default x offset of the images
posy = 0, // y offset in the block
img = { // image
width: cfmt.pagewidth, // width
lm: cfmt.leftmargin, // left and right margins
|
| ︙ | |||
58 59 60 61 62 63 64 | 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | - - - - + + + + |
brace: {x:0, y:0, c:"\ue000"},
lphr: {x:0, y:23, c:"\ue030"},
mphr: {x:0, y:23, c:"\ue038"},
sphr: {x:0, y:26, c:"\ue039"},
short: {x:0, y:32, c:"\ue038"},
tick: {x:0, y:29, c:"\ue039"},
rdots: {x:-1, y:0, c:"\ue043"}, // repeat dots
|
| ︙ | |||
127 128 129 130 131 132 133 | 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | - - - - + + + + - + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - - - - - - - + + + + + + + |
sacc1: {x:-2, y:0, sc: .7, c:"\ue262"}, // small sharp (editorial)
acc2: {x:-3, y:0, c:"\ue263"}, // double sharp
"acc-2": {x:-3, y:0, c:"\ue264"}, // double flat
"acc-1_2": {x:-2, y:0, c:"\ue280"}, // quarter-tone flat
"acc-3_2": {x:-3, y:0, c:"\ue281"}, // three-quarter-tones flat
acc1_2: {x:-1, y:0, c:"\ue282"}, // quarter-tone sharp
acc3_2: {x:-3, y:0, c:"\ue283"}, // three-quarter-tones sharp
|
| ︙ | |||
881 882 883 884 885 886 887 | 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 | - + - + + - + - + - + - - - - - + + - + + + - - + + - - - - + + + + - - - - - - + + + + + + + + + + + + - + - + - + - |
function out_wln(x, y, w) {
out_XYAB('<path class="stroke" stroke-width="0.8" d="mX YhF"/>\n',
x, y + 1, w)
}
// decorations with string
var deco_str_style = {
|
| ︙ | |||
1130 1131 1132 1133 1134 1135 1136 | 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 | + - + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + |
var deco_l_tb = {
glisq: out_glisq,
gliss: out_gliss
}
function out_deco_long(x, y, de) {
var s, p_v, m, nt, i,
|
| ︙ | |||
1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 | 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 | + + + + - - + + - - - + - - - - + + - - + - - + - - - - + + - - - - - - - - + + + + + + + + + - |
// create the SVG image of the block
function svg_flush() {
if (multicol || !output || !user.img_out || posy == 0)
return
var i, font,
fmt = tsnext ? tsnext.fmt : cfmt,
w = Math.ceil((fmt.trimsvg || fmt.singleline == 1)
? (cfmt.leftmargin + img.wx * cfmt.scale + cfmt.rightmargin + 2)
: img.width),
head = '<svg xmlns="http://www.w3.org/2000/svg" version="1.1"\n\
xmlns:xlink="http://www.w3.org/1999/xlink"\n\
fill="currentColor" stroke-width=".7"',
g = ''
glout()
font = get_font("music")
head += ' class="' + font_class(font) +
' tune' + tunes.length + '"\n' // tune index for play
posy *= cfmt.scale
|
| ︙ | |||
1348 1349 1350 1351 1352 1353 1354 | 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 | - - + + + |
}
user.img_out(head + output + g + "</svg>");
output = ""
font_style = ''
if (cfmt.fullsvg) {
defined_glyph = {}
|
Changes to core/tail.js.
1 2 | 1 2 3 4 5 6 7 8 9 10 | - + | // abc2svg - tail.js // |
| ︙ | |||
19 20 21 22 23 24 25 26 27 28 29 30 31 32 | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | + |
// initialize
init_tune()
// Abc functions used by the modules
Abc.prototype.a_de = function() { return a_de }
Abc.prototype.add_style = function(s) { style += s };
Abc.prototype.anno_a = anno_a
Abc.prototype.cfmt = function() { return cfmt };
Abc.prototype.clone = clone;
Abc.prototype.deco_put = function(nm, s) {
a_dcn.push(nm)
deco_cnv(s)
}
Abc.prototype.defs_add = defs_add
|
| ︙ | |||
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | + - + - - + - - - - - - - - - - - - - - - - - - - - - - - - - |
Abc.prototype.psdeco = empty_function;
Abc.prototype.psxygl = empty_function;
Abc.prototype.set_cur_sy = function(sy) { cur_sy = sy };
Abc.prototype.set_dscale = set_dscale;
Abc.prototype.set_font = set_font;
Abc.prototype.set_a_gch = function(s, a) { a_gch = a; csan_add(s) }
Abc.prototype.set_hl = set_hl
Abc.prototype.set_page = set_page
Abc.prototype.set_pagef = function() { blkdiv = 1 }
Abc.prototype.set_realwidth = function(v) { realwidth = v }
Abc.prototype.set_scale = set_scale;
Abc.prototype.set_sscale = set_sscale
Abc.prototype.set_tsfirst = function(s) { tsfirst = s };
Abc.prototype.set_v_param = set_v_param;
Abc.prototype.strwh = strwh;
Abc.prototype.stv_g = function() { return stv_g };
Abc.prototype.svg_flush = svg_flush;
Abc.prototype.syntax = syntax;
Abc.prototype.tunes = tunes
Abc.prototype.unlksym = unlksym;
Abc.prototype.use_font = use_font;
Abc.prototype.vskip = vskip
Abc.prototype.xy_str = xy_str;
Abc.prototype.xygl = xygl;
|
Changes to core/tune.js.
1 2 | 1 2 3 4 5 6 7 8 9 10 | - + | // abc2svg - tune.js - tune generation // |
| ︙ | |||
65 66 67 68 69 70 71 72 73 74 75 76 77 78 | 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | + + |
set_ref(s)
if (!curvoice.ignore) {
s.prev = curvoice.last_sym
if (curvoice.last_sym)
curvoice.last_sym.next = s
else
curvoice.sym = s
} else if (s.bar_type) {
curvoice.last_bar = s
}
curvoice.last_sym = s
s.v = curvoice.v;
s.p_v = curvoice;
s.st = curvoice.cst;
s.time = tim
if (s.dur && !s.grace)
|
| ︙ | |||
112 113 114 115 116 117 118 | 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 | - - + + - - + + - + - + - + - + - - - - - - - - - - - - - - - - - + - - + - + + + + + + + - - + + + + + + + + + + + + + + + - - + + + + + - + + + - - + + + + + + + + + + + + - - + + - - - + + + + + + + + + + + + + + + + - - - + + + + + + + + + | } return s } /* -- sort all symbols by time and vertical sequence -- */ // weight of the symbols !! depends on the symbol type !! var w_tb = new Uint8Array([ |
| ︙ | |||
248 249 250 251 252 253 254 | 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 | - - + + + + + + + + + + + + + + + |
if (nv == 1) {
s = tsfirst
s.ts_next = s.next
while (1) {
s = s.next
if (!s)
return
|
| ︙ | |||
296 297 298 299 300 301 302 | 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 | - + - + + + - + + + + + - - + + + + + + + + + + + + + + + - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | } } if (wmin > 127) break // done // check the type of the measure bars |
| ︙ | |||
383 384 385 386 387 388 389 390 391 392 393 394 395 396 | 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 | + + + + + + + + |
// terminate voice cloning
if (curvoice && curvoice.clone) {
parse.istart = parse.eol
do_cloning()
}
// if only one voice and a time skip,
// fill the voice with the sequence "Z |" (multi-rest and bar)
if (par_sy.one_v) // if one voice
fill_mr_ba(voice_tb[par_sy.top_voice])
if (parse.pq_d)
ins_pq() // insert delayed P: and Q:
for (v = 0; v < voice_tb.length; v++) {
p_voice = voice_tb[v]
if (!sys_chg) { // if not %%score
delete p_voice.eoln
while (1) { // set the end of slurs
sl = p_voice.sls.shift()
if (!sl)
|
| ︙ | |||
451 452 453 454 455 456 457 | 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 | - - - - + + + + + + + + | s.a_ly = s2.a_ly; s2.a_ly = null break } break } continue |
| ︙ | |||
542 543 544 545 546 547 548 | 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 | - + + - - - - + + + + - + - + - + - + - + - - - + - - + + - - - + - |
break
}
break
}
// at start of tune, check for an anacrusis
for (s2 = s.ts_next; s2; s2 = s2.ts_next) {
|
| ︙ | |||
679 680 681 682 683 684 685 | 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 | - + |
return
var i, note, notes, map, tmp, ns,
ty = '',
a = text.split(/\s+/)
if (a.length < 3) {
|
| ︙ | |||
737 738 739 740 741 742 743 | 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 | - + + - + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + |
}
}
for (; i < a.length; i++) {
switch (a[i]) {
case "heads=":
if (!a[++i]) {
|
| ︙ | |||
912 913 914 915 916 917 918 | 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 | - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + - + + + + - - + + + + + + + | } par_sy.voices[curvoice.v][cmd[0] == 'm' ? "maxsep" : "sep"] = val return } break case "multicol": |
| ︙ | |||
1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 | 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 | + + + + |
}
s.xmx = val
} else {
s.xmx = 14
}
sym_link(s)
return
case "tacet":
if (param[0] == '"')
param = param.slice(1, -1)
// fall thru
case "stafflines":
case "staffscale":
case "staffnonote":
set_v_param(cmd, param)
return
case "staves":
case "score":
|
| ︙ | |||
1132 1133 1134 1135 1136 1137 1138 | 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 | - - + + | case 0: cfmt.transp = 0 // fall thru case 1: cfmt.transp = (cfmt.transp || 0) + val return } |
| ︙ | |||
1262 1263 1264 1265 1266 1267 1268 | 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 | - + - + + + + + - - - |
}
/* -- generate a piece of tune -- */
function generate() {
var s, v, p_voice;
if (a_dcn.length) {
|
| ︙ | |||
1317 1318 1319 1320 1321 1322 1323 | 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 | - - - + + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + |
if (tsfirst) { // if non void, keep tune data for upper layers
tunes.push([tsfirst, voice_tb, info, cfmt])
tsfirst = null
}
}
|
| ︙ | |||
1421 1422 1423 1424 1425 1426 1427 | 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 | - - + + + + + + + + + + |
staves_found = maxtime
/* initialize the (old) voices */
for (v = 0; v < nv; v++) {
p_voice = voice_tb[v]
delete p_voice.second
|
| ︙ | |||
1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 | 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 | + + |
p_voice = p_voice.voice_down
if (!p_voice)
break
v = p_voice.v
}
}
par_sy.top_voice = a_vf[0][0].v
if (a_vf.length == 1)
par_sy.one_v = 1 //true // one voice
/* change the behavior from %%staves to %%score */
if (cmd[1] == 't') { /* if %%staves */
for (i = 0; i < a_vf.length; i++) {
flags = a_vf[i][1]
if (!(flags & (OPEN_BRACE | OPEN_BRACE2)))
continue
|
| ︙ | |||
1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 | 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 | + - + - - |
if (!par_sy.voices[v])
continue
// set the staff of the overlay voices
p_voice2 = p_voice.voice_down
while (p_voice2) {
p_voice2.second = 1 //true
i = p_voice2.v
p_voice2.st = p_voice2.cst =
par_sy.voices[i].st = st
p_voice2 = p_voice2.voice_down
}
par_sy.voices[v].second = p_voice.second;
st = p_voice.st
|
| ︙ | |||
1708 1709 1710 1711 1712 1713 1714 | 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 | - + |
p_voice2.ulen = curvoice.ulen
p_voice2.dur_fact = curvoice.dur_fact
p_voice2.acc = [] // no accidental
if (!vover) { /* first '&' in a measure */
time = p_voice2.time
if (curvoice.ignore)
|
| ︙ | |||
1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 | 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 | + + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + - + + + + + - + - + + + + + + + - - + + + - - - - - - + + + - + - - - + - - + - - - - - - + + + - - - - - - - + + + + + + + + - - - - + - - - - + + - - - - + + + + - - - + + + - + - - - - - - - - |
if (w_tb[s.type])
return false
return true
}
// treat a clef found in the tune body
function get_clef(s) {
var s2, s3
// special case for percussion
if (s.clef_type == 'p') { // if percussion clef
s2 = curvoice.ckey
s2.k_drum = 1 //true
s2.k_sf = 0
s2.k_b40 = 2
s2.k_map = abc2svg.keys[7]
if (!curvoice.key)
curvoice.key = s2 // new root key
}
if (!curvoice.time // (force a clef when new voice)
&& is_voice_sig()) {
curvoice.clef = s
s.fmt = cfmt
return
}
|
| ︙ | |||
1897 1898 1899 1900 1901 1902 1903 | 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 | - - + + - + + + + + + + + + + + | // vol: 0 }, scale: 1, // st: 0, // cst: 0, ulen: glovar.ulen, dur_fact: 1, |
| ︙ | |||
1942 1943 1944 1945 1946 1947 1948 | 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 | - + - + |
// treat V: with many voices
function do_cloning() {
var i,
clone = curvoice.clone,
vs = clone.vs,
a = clone.a,
bol = clone.bol,
|
| ︙ | |||
2006 2007 2008 2009 2010 2011 2012 | 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 | - + - - - - + + |
curvoice = new_voice(vs[0])
// if many voices, memorize the start of sequence
if (vs.length > 1) {
vs.shift()
curvoice.clone = {
vs: vs,
|
| ︙ | |||
2064 2065 2066 2067 2068 2069 2070 | 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 | - - - - - - - - - - - - + |
glovar.new_nbar = 0
} else {
gene.nbar = 1
}
parse.state = 3 // in tune body
|
| ︙ |
Changes to dist_bin.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | + | COPYING COPYING.LESSER MIDI-1.js Scc1t2/ abc2svg-1.js abc2svg.ttf abc2svg.woff abc2svg.woff2 abcdoc-1.js abcjsc abcmjs abcnode abcqjs abctopdf abcweb1-1.js |
| ︙ |
Changes to editor/edit.js.
1 2 | 1 2 3 4 5 6 7 8 9 10 | - + | // edit.js - file used in the abc2svg editor // |
| ︙ | |||
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | + + + + + + + |
"\nLine: " + line)
else if (typeof msg == 'object')
alert("window error: " + msg.type + ' ' + msg.target.src)
else
alert("window error: " + msg)
return false
}
// function called before the page is closed
window.onbeforeunload = function () {
if (chg) // if the textarea has been modified
return "" // ask close page confirmation
}
var abc_images, // image buffer
abc_fname = ["noname.abc", ""], // file names
abc_mtime = [], // associated last modification time
abc, // Abc object
syms, // music symbol at source index
ctxMenu, // context menu for play
elt_ref = {}, // pointers to page HTML elements
selx = [0, 0], // selected source indexes
selx_sav = [], // (saved while playing/printing)
play = {}, // play data
pop, // current popup message
texts = {}, // language specific texts
chg = 0, // > 0 when the textarea is modified
jsdir = document.currentScript ?
document.currentScript.src.match(/.*\//) :
(function() {
var s_a = document.getElementsByTagName('script')
for (var k = 0; k < s_a.length; k++) {
if (s_a[k].src.indexOf('edit-') >= 0)
return s_a[k].src.match(/.*\//) || ''
|
| ︙ | |||
164 165 166 167 168 169 170 171 172 173 174 175 176 177 | 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | + |
// Closure to capture the file information
reader.onloadend = function(evt) {
var s = srcidx == 0 ? "source" : "src1";
elt_ref[s].value = evt.target.result;
elt_ref["s" + srcidx].value = abc_fname[srcidx];
chg = -1 // no change yet
src_change()
}
// Read the file as text
reader.readAsText(files[0], "UTF-8")
}
|
| ︙ | |||
207 208 209 210 211 212 213 214 215 216 217 218 219 220 | 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 | + |
selsrc(1);
alert(texts.load + sl.value)
return
}
}
elt_ref.diverr.innerHTML = '';
selx[0] = selx[1] = 0;
chg++ // textarea modified
render2()
}
function render2() {
var content = elt_ref.source.value,
def = (abc2svg.a_inc && abc2svg.a_inc["default.abc"]) || ''
// load the required modules
|
| ︙ | |||
447 448 449 450 451 452 453 454 455 456 457 458 459 460 | 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 | + + |
link.style.display = "none";
// add the link to the DOM
document.body.appendChild(link);
// click the new link
link.click()
chg = 0 // no change anymore
}
// destroy the clicked element
function destroyClickedElement(evt) {
document.body.removeChild(evt.target)
}
|
| ︙ | |||
535 536 537 538 539 540 541 | 546 547 548 549 550 551 552 553 554 555 556 557 558 559 | - | play.stop = -1; play.abcplay.stop() } return } // search a symbol to play |
| ︙ | |||
569 570 571 572 573 574 575 576 577 578 579 580 581 582 | 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 | + |
return gprn(sym, 1)
return sym
}
sym = sym.ts_next
}
// not reached
}
function gprn(sym, loop) { // go to the previous real note (not tied)
var i
while (1) {
switch (sym.type) {
// case C.BAR:
//fixme: there may be a right repeat!
// break
|
| ︙ | |||
607 608 609 610 611 612 613 | 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 | + + + + - + |
}
sym = sym.ts_prev
}
// not reached
}
function gsot(si) { // go to the first symbol of a tune
var sym = syms[si].p_v.sym
while (!sym.seqst)
sym = sym.ts_prev
|
| ︙ | |||
891 892 893 894 895 896 897 898 899 900 901 902 903 904 | 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 | + |
if (data.length) {
var reader = new FileReader(),
s = srcidx == 0 ? "source" : "src1"
elt_ref["s" + srcidx].value = abc_fname[srcidx] = data[0].name
reader.onload = function(evt) {
elt_ref[s].value = evt.target.result
chg = -1 // no change yet
src_change()
}
reader.readAsText(data[0],"UTF-8")
// return
}
}
|
| ︙ |
Changes to editor/edit.xhtml.
| ︙ | |||
12 13 14 15 16 17 18 | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | - + - + - + - + - + - + - + - + - + - + - + - + - - + + |
<body ontouchstart="" bgcolor="#faf0e6" spellcheck="false">
<!-- left -->
<div id="dleft">
<!-- menu bar -->
<ul id="nav">
|
| ︙ | |||
140 141 142 143 144 145 146 | 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | - + |
</ul>
</div>
<!-- about popup window -->
<div id="about" class="popup" style="width: 350px">
<div class="close" onclick="popshow('about')">x</div>
<p id="abc2svg">abc2svg</p>
|
Changes to err-de.js.
| ︙ | |||
74 75 76 77 78 79 80 | 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | - + + |
"Cannot have %%beginml with %%pageheight":
"Cannot have %%beginml with %%pageheight",
"Cannot have a bar in grace notes": "Taktstrich in Vorschlagnote nicht erlaubt",
"Cannot have a broken rhythm in grace notes": "gebrochener Rythmus in Ziernoten nicht erlaubt",
"Cannot have V:* in tune body": "V:* im Notenbereich nicht erlaubt",
"Cannot read file '$1'": "File '$1' kann nicht gelesen werden",
"Decoration ignored": "Dekoration ignoriert",
|
| ︙ | |||
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | + + |
"Probleme beim Aufteilen der Zeile - justiere maxshrink und/oder breaklimit",
"Line too much shrunk $1 $2 $3": "Zeile zu stark geschrumpft $1 $2 $3",
"Line underfull ($1pt of $2pt)": "Zeile nicht voll genug ($1pt of $2pt)",
"Microtone transposition not coded":
"Microtone transposition not coded",
"Misplaced '$1' in %%score": "'$1' fehlerhaft platziert in %%score",
"Misplaced dot": "fehlerhaft platzierter Punkt",
"Misplaced P:": "Misplaced P:",
"Mix of old and new transposition syntaxes":
"Mix von alter und neuer Transponierungs-syntax",
"multi-measure rest, but no measure!":
"multi-measure rest, but no measure!",
"No $1 after %%$2": "kein $1 nach %%$2",
"No </defs> in %%beginsvg sequence": "kein </defs> in %%beginsvg squenz",
"No </style> in %%beginsvg sequence": "kein </style> in %%beginsvg sequenz",
"No accidental after 'exp'": "kein Vorzeichen nach 'exp'",
"No end of decoration": "kein Ende der Dekoration",
"No end of grace note sequence": "kein Ende der Vorschlagnoten",
"No end of chord symbol/annotation": "kein Ende des Akkordsymbols",
"No end of repeat string": "kein Ende des Wiederholungszeichens",
"No end of string in font family": "No end of string in font family",
"No end of the previous %%multicol": "No end of the previous %%multicol",
"No end of tuplet": "kein Ende des Tuplets",
"No end of tuplet in this music line":
"Kein Ende des Tuplets in dieser Zeile",
"No end of url in font family": "No end of url in font family",
"No end of voice overlay": "kein Ende der Stimmüberlagerung",
"No function for decoration '$1'": "keine Funktion für Dekoration '$1'",
"No note before '-'": "keine Note vor '-'",
|
| ︙ |
Changes to err-fr.js.
| ︙ | |||
80 81 82 83 84 85 86 | 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | + - + + + | "Il ne peut pas y avoir de barre dans les notes d'agrément", "Cannot have a broken rhythm in grace notes": "Il ne peut pas y avoir '<' ou '>' dans les notes d'agrément", "Cannot have V:* in tune body": "Il ne peut pas y avoir V:* dans le corps du morceau", "Cannot read file '$1'": "Fichier '$1' inexistant", "Decoration ignored": "Décoration ignorée", "Decoration(s) without symbol: $1": |
| ︙ | |||
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | + + | "Problème de découpe en lignes - ajuster maxshrink et/ou breaklimit", "Line too much shrunk $1 $2 $3": "Ligne trop compressée $1 $2 $3", "Line underfull ($1pt of $2pt)": "Trop d'espacement ($1pt of $2pt)", "Microtone transposition not coded": "Transposition de microtonalité pas codée", "Misplaced '$1' in %%score": "'$1' mal placé dans %%score", "Misplaced dot": "Point mal placé", "Misplaced P:": "P: mal placé", "Mix of old and new transposition syntaxes": "Mélange des syntaxes de transposition ancienne et nouvelle", "multi-measure rest, but no measure!": "silence multi-mesure, mais pas de mesure!", "No $1 after %%$2": "Pas de $1 après %%$2", "No </defs> in %%beginsvg sequence": "Pas de </defs> dans séquence %%beginsvg", "No </style> in %%beginsvg sequence": "Pas de </style> dans séquence %%beginsvg", "No accidental after 'exp'": "Pas d'altération après 'exp'", "No end of decoration": "Pas de fin de décoration", "No end of grace note sequence": "Pas de fin de notes d'agrément", "No end of chord symbol/annotation": "Pas de fin d'accord/annotation", "No end of repeat string": "Chaine de répétition non terminée", "No end of string in font family": "Pas de fin de chaine dans le nom de famille de la police", "No end of the previous %%multicol": "Pas de 'end' du %%multicol précédent", "No end of tuplet": "Pas de fin de tuplet", "No end of tuplet in this music line": "Pas de fin de tuplet dans cette ligne de musique", "No end of url in font family": "Pas de fin de l'url de la police", "No end of voice overlay": "Pas de fin de superposition de voix", "No function for decoration '$1'": "Pas de fonction pour décoration '$1'", "No note before '-'": "Pas de note devant '-'", |
| ︙ |
Changes to err-it.js.
| ︙ | |||
80 81 82 83 84 85 86 | 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | - + + | "Stanghette non consentite nelle note di abbellimento", "Cannot have a broken rhythm in grace notes": "'Broken rhythm' non consentito nelle note di abbellimento", "Cannot have V:* in tune body": "V:* non consentito nel corpo del brano", "Cannot read file '$1'": "File '$1' inesistente", "Decoration ignored": "Decorazione ignorata", |
| ︙ | |||
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | + + | "Problema di linea divisa - modificare maxshrink e/o breaklimit", "Line too much shrunk $1 $2 $3": "Linea troppo compressa $1 $2 $3", "Line underfull ($1pt of $2pt)": "Linea troppo vuota ($1pt di $2pt)", "Microtone transposition not coded": "Microtone transposition not coded", "Misplaced '$1' in %%score": "'$1' in posizione errata in %%score", "Misplaced dot": "Punto in posizione errata", "Misplaced P:": "Misplaced P:", "Mix of old and new transposition syntaxes": "Sintassi di trasposizione vecchia e nuova allo stesso tempo", "multi-measure rest, but no measure!": "multi-measure rest, but no measure!", "No $1 after %%$2": "Manca $1 dopo %%$2", "No </defs> in %%beginsvg sequence": "Manca </defs> nella sequenza %%beginsvg", "No </style> in %%beginsvg sequence": "manca </style> nella sequenza %%beginsvg", "No accidental after 'exp'": "Manca l'alterazione dopo 'exp'", "No end of chord symbol/annotation": "Accordo di accompagnamento non terminato", "No end of decoration": "Decorazione non terminata", "No end of grace note sequence": "Sequenza di note di abbellimento non terminata", "No end of repeat string": "Stringa di ripetizione non terminata", "No end of string in font family": "No end of string in font family", "No end of the previous %%multicol": "No end of the previous %%multicol", "No end of tuplet": "Gruppo irregolare non terminato", "No end of tuplet in this music line": "Gruppo irregolare non terminato in questa linea", "No end of url in font family": "No end of url in font family", "No end of voice overlay": "No end of voice overlay", "No function for decoration '$1'": "Funzione inesistente per la decorazione '$1'", "No note before '-'": "Nota mancante davanti a '-'", |
| ︙ |
Changes to err-pt_BR.js.
| ︙ | |||
78 79 80 81 82 83 84 | 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | - + + - + | "Cannot have a bar in grace notes": "Não pode haver barra de compasso em grupo de notinhas ornamentais", "Cannot have a broken rhythm in grace notes": "Não pode haver ritmo quebrado em notinhas ornamentais", "Cannot have V:* in tune body": "Não pode haver V:* no corpo da música", "Cannot read file '$1'": "Arquivo '$1' não pôde ser aberto ou não existe", "Decoration ignored": "Decoração ignorada", |
| ︙ | |||
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | + + |
"Problema de quebra de linha - ajuste maxshrink e/ou breaklimit",
"Line too much shrunk $1 $2 $3": "Linha muito encolhida $1 $2 $3",
"Line underfull ($1pt of $2pt)": "Linha muito espaçada ($1pt de $2pt)",
"Microtone transposition not coded":
"A transposição de microtons não está codificada",
"Misplaced '$1' in %%score": "'$1' deslocado em %%score",
"Misplaced dot": "Ponto fora de lugar",
"Misplaced P:": "P: fora de lugar",
"Mix of old and new transposition syntaxes":
"Mistura de sintaxes de transposição antiga e nova",
"multi-measure rest, but no measure!":
"Pausa de múltiplos compassos, porém o compasso não foi definido!",
"No $1 after %%$2": "Falta $1 após %%$2",
"No </defs> in %%beginsvg sequence":
"Falta </defs> em bloco %%beginsvg",
"No </style> in %%beginsvg sequence":
"Falta </style> em bloco %%beginsvg",
"No accidental after 'exp'": "Falta acidente após 'exp'",
"No end of decoration": "Decoração sem término",
"No end of grace note sequence": "Grupo de notinhas ornamentais não terminado",
"No end of chord symbol/annotation": "Acorde cifrado/anotação sem término",
"No end of repeat string": "Cadeia de repetição não terminada",
"No end of string in font family":
"Cadeia de caracteres incompleta em família de fonte",
"No end of the previous %%multicol": "Falta fechar ('end') o %%multicol anterior",
"No end of tuplet": "Quiáltera incompleta",
"No end of tuplet in this music line":
"Falta terminar quiáltera nesta linha de música",
"No end of url in font family": "URL incompleta em família de fonte",
"No end of voice overlay": "Falta fim de divisão de vozes",
"No function for decoration '$1'": "Falta função para decoração '$1'",
"No note before '-'": "Falta nota antes de '-'",
|
| ︙ |
Changes to font.js.
1 2 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 | - - - - - - + + + + + + - - - + + + - + - + - - - + - - - + + + - - - - - + + + + + + + + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + - - - - - - - - - - + + + + + + + + + + + + - - - - - + + + + + + + - - - - + + + + + + + + - - - - - + + + - - - - - - + - - - - - - - + + + + + + + + - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - + + + - - - - - - - + + + + + + + - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - + + + - - - - - - - - - - - - + + + + - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - |
// abc2svg music font
var musicfont = 'url("data:application/octet-stream;base64,\
|
Changes to font/abc2svg.sfd.
1 2 3 4 5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | - + + - + | SplineFontDB: 3.2 FontName: abc2svg FullName: abc2svg FamilyName: abc2svg Weight: Regular |
| ︙ | |||
40 41 42 43 44 45 46 | 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | - - + | HheadDescent: 0 HheadDOffset: 1 OS2Vendor: 'PfEd' MarkAttachClasses: 1 DEI: 91125 LangName: 1033 Encoding: Custom |
| ︙ | |||
1335 1336 1337 1338 1339 1340 1341 | 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 | - - + + - - - - - + + + + + - - - + - - - - - + + + + - | 361 129 450 70 450 0 c 4 EndSplineSet Validated: 1 EndChar StartChar: uniE0A3 Encoding: 38 57507 38 |
| ︙ |
Changes to modules/MIDI.js.
| ︙ | |||
35 36 37 38 39 40 41 42 43 44 45 46 47 48 | 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | + + + |
// This name must be used if some print map is required:
// %%MIDI drummap g 42
// %%map MIDIdrum g heads=x
// A same effect may be done by
// %%percmap g 42 x
// but this is not abcMIDI compatible!
if (typeof abc2svg == "undefined")
var abc2svg = {}
abc2svg.MIDI = {
// parse %%MIDI commands
do_midi: function(parm) {
// build the equal temperament as a b40 float array
function tb40(qs) {
|
| ︙ | |||
291 292 293 294 295 296 297 298 299 300 301 302 303 304 | 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 | + + + |
// set the MIDI parameters in the current voice
set_vp: function(of, a) {
var i, item, s,
abc = this,
curvoice = abc.get_curvoice()
// set the voice parameters before inserting any block
of(a.slice(0)) // (copy because the parameters are removed)
for (i = 0; i < a.length; i++) {
switch (a[i]) {
case "channel=": // %%MIDI channel
s = abc.new_block("midiprog")
s.play = s.invis = 1 //true
s.chn = curvoice.chn = a[++i]
break
|
| ︙ | |||
322 323 324 325 326 327 328 | 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 | - - - + + - - + |
case "mididrum=": // %%MIDI drummap note midipitch
if (!curvoice.map)
curvoice.map = {}
curvoice.map = a[++i]
break
}
}
|
Changes to modules/ambitus.js.
1 2 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | - + + + + | // ambitus.js - module to insert an ambitus at start of a voice // |
| ︙ | |||
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | + + + + + + + + + + + + + + + + + + + + + + - - + + - - + |
set_fmt: function(of, cmd, param) {
if (cmd == "ambitus") {
this.cfmt().ambitus = param
return
}
of(cmd, param)
},
set_glue: function(of, w) {
var v, s,
voice_tb = this.get_voice_tb()
of(w)
if (this.cfmt().ambitus) {
for (v = 0; v < voice_tb.length; v++) {
s = voice_tb[v].sym
while (!s.time && !s.clef_type)
s = s.next
if (s && s.nhd) { // draw the helper lines if any
s.x -= 26
this.draw_hl(s)
s.ymn = 3 * (s.notes[0].pit - 18) - 2
s.ymx = 3 * (s.notes[1].pit - 18) + 2
s.x += 26
}
}
}
}, // set_glue()
set_width: function(of, s) {
if (s.clef_type != undefined && s.nhd > 0) {
s.wl = 40;
s.wr = 12
} else {
of(s)
}
},
set_hooks: function(abc) {
abc.draw_symbols = abc2svg.ambitus.draw_symbols.bind(abc, abc.draw_symbols);
abc.set_pitch = abc2svg.ambitus.set_pitch.bind(abc, abc.set_pitch);
abc.set_format = abc2svg.ambitus.set_fmt.bind(abc, abc.set_format);
abc.set_sym_glue = abc2svg.ambitus.set_glue.bind(abc, abc.set_sym_glue)
abc.set_width = abc2svg.ambitus.set_width.bind(abc, abc.set_width)
}
} // ambitus
|
Changes to modules/break.js.
1 2 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | - + + + + | // break.js - module to handle the %%break command // |
| ︙ | |||
121 122 123 124 125 126 127 | 124 125 126 127 128 129 130 131 132 133 | - - + + - - + |
set_hooks: function(abc) {
abc.do_pscom = abc2svg.break.do_pscom.bind(abc, abc.do_pscom);
abc.set_bar_num = abc2svg.break.set_bar_num.bind(abc, abc.set_bar_num)
}
} // break
|
Changes to modules/capo.js.
1 2 | 1 2 3 4 5 6 7 8 9 10 | - + | // capo.js - module to add a capo chord line // |
| ︙ | |||
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | + + + + + + |
// along with abc2svg. If not, see <http://www.gnu.org/licenses/>.
//
// This module is loaded when "%%capo" appears in a ABC source.
//
// Parameters
// %%capo n 'n' is the capo fret number
if (typeof abc2svg == "undefined")
var abc2svg = {}
abc2svg.capo = {
// b40 intervals of capo
icb40: [0, 5, 6,11,16,17,22,23,28,33,34,39],
// e f ^f g _a a _b b c _d d _e
gch_build: function(of, s) {
var t, i, gch, gch2, i2,
abc = this,
p_v = abc.get_curvoice(),
a_gch = s.a_gch
|
| ︙ | |||
41 42 43 44 45 46 47 | 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | - + | return } if (gch.type == 'g') break } gch2 = Object.create(gch) gch2.capo = false // (would be erased when setting gch) |
| ︙ | |||
90 91 92 93 94 95 96 | 96 97 98 99 100 101 102 103 104 105 | - - + + - - + |
set_hooks: function(abc) {
abc.gch_build = abc2svg.capo.gch_build.bind(abc, abc.gch_build);
abc.set_format = abc2svg.capo.set_fmt.bind(abc, abc.set_format)
abc.set_vp = abc2svg.capo.set_vp.bind(abc, abc.set_vp)
}
} // capo
|
Changes to modules/chordnames.js.
1 2 | 1 2 3 4 5 6 7 8 9 10 | - + | // abc2svg - chordnames.js - change the names of the chord symbols // |
| ︙ | |||
25 26 27 28 29 30 31 32 33 34 35 36 37 38 | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | + + + |
// Each name replace one chord. The order is:
// CDEFGAB<N.C.>
// 2nd syntax:
// %%chordnames <comma separated list of key ':' value>
// The key may be a chord letter ('A') with/or an accidental
// Example:
// %%chordnames Bb:B,B:H,b:s % German chords
if (typeof abc2svg == "undefined")
var abc2svg = {}
abc2svg.chordnames = {
gch_build: function(of, s) {
var gch, ix, t,
cfmt = this.cfmt()
|
| ︙ | |||
83 84 85 86 87 88 89 | 86 87 88 89 90 91 92 93 94 95 | - - + + + |
set_hooks: function(abc) {
abc.gch_build = abc2svg.chordnames.gch_build.bind(abc, abc.gch_build)
abc.set_format = abc2svg.chordnames.set_fmt.bind(abc, abc.set_format)
} // set_hooks()
} // chordnames
|
Changes to modules/clair.js.
1 2 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | - + + + + | // clair.js - module to output Clairnote sheets (https:clairnote.org) // |
| ︙ | |||
377 378 379 380 381 382 383 | 380 381 382 383 384 385 386 387 388 389 | - - + + - - + |
abc.set_format = abc2svg.clair.set_fmt.bind(abc, abc.set_format);
abc.set_pitch = abc2svg.clair.set_pitch.bind(abc, abc.set_pitch);
abc.set_vp = abc2svg.clair.set_vp.bind(abc, abc.set_vp);
abc.set_width = abc2svg.clair.set_width.bind(abc, abc.set_width)
}
} // clair
|
Changes to modules/clip.js.
1 2 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | - + + + + | // clip.js - module to handle the %%clip command // |
| ︙ | |||
208 209 210 211 212 213 214 | 211 212 213 214 215 216 217 218 219 220 | - - + + - - + |
set_hooks: function(abc) {
abc.do_pscom = abc2svg.clip.do_pscom.bind(abc, abc.do_pscom);
abc.set_bar_num = abc2svg.clip.set_bar_num.bind(abc, abc.set_bar_num)
}
} // clip
|
Changes to modules/combine.js.
1 2 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | - + + + + | // combine.js - module to add a combine chord line // |
| ︙ | |||
62 63 64 65 66 67 68 | 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | - - + + + + + + |
return false
// if (s2.a_dd) { //fixme: should check the double decorations
// return false
// }
if (s.a_gch && s2.a_gch)
return false
if (s.type == C.REST) {
|
| ︙ | |||
135 136 137 138 139 140 141 142 143 144 145 146 147 148 | 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | + |
s2 = s;
s = s2.ts_next
}
} else if (s.type == C.REST) {
if (s.invis
&& !s2.invis)
delete s.invis
s.multi = 0
} else {
combine_notes(s, s2)
if (s2.ti1)
s.ti1 = true
if (s2.ti2)
s.ti2 = true
}
|
| ︙ | |||
276 277 278 279 280 281 282 | 284 285 286 287 288 289 290 291 292 293 | - - + + - - + |
abc.do_pscom = abc2svg.combine.do_pscom.bind(abc, abc.do_pscom);
abc.new_note = abc2svg.combine.new_note.bind(abc, abc.new_note);
abc.set_stem_dir = abc2svg.combine.set_stem_dir.bind(abc, abc.set_stem_dir);
abc.set_vp = abc2svg.combine.set_vp.bind(abc, abc.set_vp)
}
} // combine
|
Changes to modules/diag.js.
1 2 | 1 2 3 4 5 6 7 8 9 10 | - + | // diag.js - module to insert guitar chord diagrams // |
| ︙ | |||
36 37 38 39 40 41 42 43 44 45 46 47 48 49 | 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | + + + |
// <chord> = chord symbol
// <dots> = list of diagram offset of dots on the strings - '0 or 'x': no dot
// <label> = text to write on the left of the <pos>th fret
// (<pos> default = 1, fret #0 is no text)
// <fingers> = finger numbers ou 'x' (mute) or '0'/'y' (no finger)
// barre=<num>-<num> draw a bar between the two string numbers in the first fret
// (numbering order 654321 for E,A,D,GBe)
if (typeof abc2svg == "undefined")
var abc2svg = {}
abc2svg.diag = {
cd4: {},
// common diagrams by Guido Gonzato from http://www.guitar-chord.org/ (2021-08-27)
cd6: {
C: "x32010 ,0 x32010",
|
| ︙ | |||
87 88 89 90 91 92 93 | 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 | + + + - + - - + - - - + - + - + - + - + - + + + - + - - + + + - - + - - + - + - + - + + - - - + + + - - - - - - - + + + + + + + + - - + + + + + + + - + - - - - - - - |
B7: "021202 ,0 x21304",
Bm7: "003020 fr2 x03020 barre=5-1",
BM7: "003230 fr2 x03240 barre=5-1",
Bsus4: "x03340 fr2 x02340 barre=5-1",
}, // cd6{}
// function called before tune generation
draw_gchord: function(of, i, s, x, y) {
var gch, nm,
cfmt = this.cfmt(),
|
| ︙ | |||
246 247 248 249 250 251 252 | 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 | - + - - + + - - + |
this.syntax(1, this.errs.bad_val, "%%setdiag")
return
}
of(cmd, param)
},
set_hooks: function(abc) {
|
Changes to modules/equalbars.js.
1 2 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | - + + + + | // equalbars.js - module to set equal spaced measure bars // |
| ︙ | |||
41 42 43 44 45 46 47 | 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | - + |
fmt.stretchlast = 1
},
// adjust the symbol offsets of a music line
// only the bars of the first voice are treated
set_sym_glue: function(of, width) {
var C = abc2svg.C,
|
| ︙ | |||
69 70 71 72 73 74 75 | 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | - + - - + + |
}
if (!s2)
return
// build an array of the bars
t0 = t = s2.time
for (s = s2; s.next; s = s.next) {
|
| ︙ | |||
105 106 107 108 109 110 111 | 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | - + - - + + + + + + + - + + | } if (w * n < width) width = w * n this.set_realwidth(width) } // set the measure parameters |
| ︙ | |||
151 152 153 154 155 156 157 | 160 161 162 163 164 165 166 167 168 169 | - - + + - - + |
set_hooks: function(abc) {
abc.output_music = abc2svg.equalbars.output_music.bind(abc, abc.output_music);
abc.set_format = abc2svg.equalbars.set_fmt.bind(abc, abc.set_format);
abc.set_sym_glue = abc2svg.equalbars.set_sym_glue.bind(abc, abc.set_sym_glue)
}
} // equalbars
|
Changes to modules/gamelan.js.
| ︙ | |||
37 38 39 40 41 42 43 44 45 46 47 48 49 50 | 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | + + + |
// bem D_E ^G A _B 12456
// barang _E F A _B c 23567
// numbers
// ?? E F G B c
// ?? C ^C _E G _A (or ^C D E ^G A)
// dot = continuation (not rest)
if (typeof abc2svg == "undefined")
var abc2svg = {}
abc2svg.gamelan = {
cde2fcg: new Int8Array([0, 2, 4, -1, 1, 3, 5]),
cgd2cde: new Int8Array([0, -4, -1, -5, -2, -6, -3,
0, -4, -1, -5, -2, -6, -3, 0]),
acc2: new Int8Array([-2, -1, 3, 1, 2]),
|
| ︙ | |||
460 461 462 463 464 465 466 | 463 464 465 466 467 468 469 470 471 472 | - - + + - - + |
abc.get_glyphs().gstc = '<circle id="gstc" cx="0" cy="-3" r="2"/>'
abc.get_decos().gstc = "0 gstc 5 1 1"
abc.add_style("\n.bn {font-family:sans-serif; font-size:16px}")
} // set_hooks()
} // gamelan
|
Changes to modules/grid.js.
1 2 | 1 2 3 4 5 6 7 8 9 10 | - + | // abc2svg - grid.js - module to insert a chord grid before or after a tune // |
| ︙ | |||
25 26 27 28 29 30 31 32 33 34 35 36 37 38 | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | + + + |
// > 0: above the tune, < 0: under the tune
// <list> = comma separated list of (continuous) measure numbers
// 'nomusic' displays only the grid
// 'norepeat' omits the ':' indications
// 'repbrk' starts a new grid line on start/stop repeat
// 'parts' displays the parts on the left side of the grid
// %%gridfont font_name size (default: 'serif 16')
if (typeof abc2svg == "undefined")
var abc2svg = {}
abc2svg.grid = {
pl: '<path class="stroke" stroke-width="1" d="M',
// generate the grid
block_gen: function(of, s) {
if (s.subtype != "grid") {
|
| ︙ | |||
298 299 300 301 302 303 304 305 306 307 308 309 310 311 | 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 | + |
}
abc.vskip(hr * (nr + 1) + 6)
} // build_grid()
// ----- block_gen() -----
var p_voice, n, font, f2
abc.set_page()
img = abc.get_img()
// set the text style
font = abc.get_font('grid')
if (font.class)
font.class += ' mid'
else
|
| ︙ | |||
397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 | 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 | + - + + |
cur_beat += beat
}
if (s.part)
parts[chords.length] = s.part.text
switch (s.type) {
case C.NOTE:
case C.REST:
case C.SPACE:
if (!s.a_gch || chord[beat_i])
break
bt = cs_filter(s.a_gch)
if (!bt)
break
w = abc.strwh(bt.replace(
/<[^>]+>/gm,''))
if (w[0] > wmx)
wmx = w[0]
bt = new String(bt)
bt.wh = w
chord[beat_i] = bt
break
case C.BAR:
i = s.bar_num // check if normal measure bar
bt = s.bar_type
while (s.ts_next && s.ts_next.time == s.time) {
|
| ︙ | |||
579 580 581 582 583 584 585 | 585 586 587 588 589 590 591 592 593 594 | - - + + - - + |
set_hooks: function(abc) {
abc.block_gen = abc2svg.grid.block_gen.bind(abc, abc.block_gen)
abc.set_stems = abc2svg.grid.set_stems.bind(abc, abc.set_stems)
abc.set_format = abc2svg.grid.set_fmt.bind(abc, abc.set_format)
}
} // grid
|
Changes to modules/grid2.js.
| ︙ | |||
19 20 21 22 23 24 25 26 27 28 29 30 31 32 | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | + + + |
//
// This module is loaded when "%%grid2" appears in a ABC source.
//
// Parameters
// %%grid2 y
// This command may appear globally or in a voice.
if (typeof abc2svg == "undefined")
var abc2svg = {}
abc2svg.grid2 = {
// function called before tune generation
do_grid: function() {
var s, v, p_v, ix, cs, c_a_cs, bt, gch,
voice_tb = this.get_voice_tb()
|
| ︙ | |||
117 118 119 120 121 122 123 | 120 121 122 123 124 125 126 127 128 129 | - - + + - - + |
set_hooks: function(abc) {
abc.draw_gchord = abc2svg.grid2.draw_gchord.bind(abc, abc.draw_gchord);
abc.output_music = abc2svg.grid2.output_music.bind(abc, abc.output_music);
abc.set_format = abc2svg.grid2.set_fmt.bind(abc, abc.set_format)
}
} // grid2
|
Changes to modules/grid3.js.
1 2 | 1 2 3 4 5 6 7 8 9 10 | - + | // grid3.js - module to insert a manual chords // |
| ︙ | |||
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | + + + + |
// %%gridfont font_name size (default: 'serif 16')
//
// When this command appears inside a tune and when 'chord-define' is present,
// the chords are used to define the chord symbols that are displayed
// above the staff system.
// When 'noprint' is also present, the grid itself is not displayed.
if (typeof abc2svg == "undefined")
var abc2svg = {}
abc2svg.grid3 = {
// generate the grid
block_gen: function(of, s) {
if (s.subtype != "grid3") {
of(s)
return
}
this.set_page()
this.blk_flush()
var abc = this,
cfmt = abc.cfmt(),
img = abc.get_img(),
posy = abc.get_posy(),
txt = s.text,
|
| ︙ | |||
464 465 466 467 468 469 470 | 468 469 470 471 472 473 474 475 476 477 | - - + + - - + |
set_hooks: function(abc) {
abc.block_gen = abc2svg.grid3.block_gen.bind(abc, abc.block_gen)
abc.do_begin_end = abc2svg.grid3.do_begin_end.bind(abc, abc.do_begin_end)
abc.output_music = abc2svg.grid3.output_music.bind(abc, abc.output_music)
}
} // grid3
|
Changes to modules/jazzchord.js.
1 2 | 1 2 3 4 5 6 7 8 9 10 | - + | // abc2svg - jazzchord.js - Adds jazz chord styling to chord symbols // |
| ︙ | |||
20 21 22 23 24 25 26 27 28 29 30 31 32 33 | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | + + + |
// Code adapted from Chris Fargen.
// https://gist.github.com/chrisfargen/4324c6cf6fed2c8f9a6eae1680e53169
//
// This module is loaded by %%jazzchord.
//
// Parameters
// %%jazzchord [ string '=' replacement-string ]*
if (typeof abc2svg == "undefined")
var abc2svg = {}
abc2svg.jazzchord = {
// default replacements
defrep: {
"-": "–",
"°": "o",
|
| ︙ | |||
57 58 59 60 61 62 63 64 | 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | + + + + + + + + + + + + - + - + |
a = t.match(/(\[?[A-G])([#♯b♭]?)([^/]*)\/?(.*)\)?/)
// a[1]=note, a[2]=acc, a[3]=quality, a[4]=bass
if (!a)
return t
if (a[2])
r = "$7" + a[2]
if (a[3][0] == 'm' // if minor
&& a[3].slice(0, 3) != "maj") {
if (!r)
r += "$7"
if (a[3].slice(0, 3) == "min") {
r += a[3].slice(0, 3)
a[3] = a[3].slice(3)
} else { // assume 'm'
r += 'm'
a[3] = a[3].slice(1)
}
}
if (a[3])
|
| ︙ | |||
155 156 157 158 159 160 161 | 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 | - + - - + + + |
}, // set_fmt()
set_hooks: function(abc) {
abc.gch_build = abc2svg.jazzchord.gch_build.bind(abc, abc.gch_build)
abc.set_format = abc2svg.jazzchord.set_fmt.bind(abc, abc.set_format)
abc.add_style("\
|
Changes to modules/jianpu.js.
1 2 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | - + + + + | // jianpu.js - module to output jiănpŭ (简谱) music sheets // |
| ︙ | |||
66 67 68 69 70 71 72 73 74 75 76 77 78 79 | 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | + + |
break
s1 = s1.prev
}
//add deco '{' on s1
while (!s1.bar_type) {
s1.dy = 14
s1.notes[0].pit = 30
if (s1.type == C.REST)
s1.combine = -1
s1 = s1.next
}
// add deco '}' on s1
while (1) {
s.dy = -14
s.notes[0].pit = 20
|
| ︙ | |||
144 145 146 147 148 149 150 | 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | + + + + + + + + + + + + + + + + + - + | if (s.dur >= C.BLEN) n = 3 else if (s.dur == C.BLEN / 2) n = 1 else n = 2 // duplicate the note/rest for display s2 = abc.clone(s) s2.invis = s2.play = 1 //true s2.next = s if (s2.prev) s2.prev.next = s2 s.prev = s2 s2.ts_next = s if (s2.ts_prev) s2.ts_prev.ts_next = s2 s.ts_prev = s2 delete s.seqst s.noplay = 1 // true // create the continuation symbols |
| ︙ | |||
323 324 325 326 327 328 329 | 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 | - + + |
set_head()
for (v = 0; v < voice_tb.length; v++) {
p_v = voice_tb[v]
if (p_v.jianpu) {
set_sym(p_v)
|
| ︙ | |||
443 444 445 446 447 448 449 450 451 452 453 454 455 456 | 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 | + |
if (s.nflags >= 0 && s.dots)
out_mus(x + 8 * sc, y + 13 * sc, dot)
if (s.grace) {
out_svg('</g>\n')
abc.stv_g().g--
}
anno_a.push(s)
} // draw_note()
// -- draw_symbols --
for (s = p_voice.sym; s; s = s.next) {
if (s.invis)
continue
switch (s.type) {
|
| ︙ | |||
599 600 601 602 603 604 605 | 623 624 625 626 627 628 629 630 631 632 | - - + + - - + |
abc.get_glyphs().gstc = '<circle id="gstc" cx="0" cy="-3" r="2"/>'
abc.get_decos().gstc = "0 gstc 5 1 1"
abc.add_style("\n.fj{font:15px sans-serif}")
} // set_hooks()
} // jianpu
|
Changes to modules/mdnn.js.
| ︙ | |||
53 54 55 56 57 58 59 60 61 62 63 64 65 66 | 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | + + + |
return to;
},
writable: true,
configurable: true
});
}
if (typeof abc2svg == "undefined")
var abc2svg = {}
abc2svg.mdnn = {
cde2fcg: new Int8Array([0, 2, 4, -1, 1, 3, 5]),
cgd2cde: new Int8Array([0, -4, -1, -5, -2, -6, -3,
0, -4, -1, -5, -2, -6, -3, 0]),
acc_tb: ["aff", "af", "n", "s", "ss"],
|
| ︙ | |||
280 281 282 283 284 285 286 | 283 284 285 286 287 288 289 290 291 292 | - - + + - - + |
Object.assign(abc.get_glyphs(), abc2svg.mdnn.glyphs)
Object.assign(abc.get_decos(), abc2svg.mdnn.decos)
abc.add_style("\n.bn {font-family:sans-serif; font-size:15px}")
}
} // mdnn
|
Changes to modules/nns.js.
1 2 3 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | - + - + - + + + + + + - - - - + + + + + + + | // abc2svg - nns.js - module to output chords in the NNS // (Nashville Notation System) // |
| ︙ | |||
243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 | 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 | + - + - + |
abc.vskip(hr * nr + 6)
} // build_nns()
// ----- block_gen() -----
var p_voice, n, font, f2
abc.set_page()
img = abc.get_img()
// set the text style
if (!cfmt.nnsfont)
abc.param_set_font("nnsfont", "monospace 16")
font = abc.get_font('nns')
// create the chord list
abc.blk_flush()
build_nns(s, font)
abc.blk_flush()
}, // block_gen()
// hook before the generation
set_stems: function(of) {
|
| ︙ | |||
317 318 319 320 321 322 323 | 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 | - - - - + - - - + + + + + + + + - - + + + + + + - + | a-- o2++ } n = ([0, 2, 4, 5, 7, 9, 11] [abc2svg.nns.note_nm.indexOf(p[o])] + a + tr) % 12 |
| ︙ | |||
428 429 430 431 432 433 434 | 443 444 445 446 447 448 449 450 451 452 453 454 455 456 | - |
// -------- set_stems --------
// create a specific block
if (nns) {
C = abc2svg.C
tsfirst = this.get_tsfirst()
|
| ︙ | |||
499 500 501 502 503 504 505 | 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 | - + + + - - + + - - + |
nns.n = 1
}
while (parm.length) {
var item = parm.shift()
if (item == "nomusic")
nns.nomusic = true
else if (item == "roman")
|
Changes to modules/page.js.
1 2 | 1 2 3 4 5 6 7 8 9 10 | - + | // page.js - module to generate pages // |
| ︙ | |||
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | + + + + + + + + + + + + + + + + + + + + + + - + |
// along with abc2svg. If not, see <http://www.gnu.org/licenses/>.
//
// This module is loaded when "%%pageheight" appears in a ABC source.
//
// Parameters
// %%pageheight <unit>
if (typeof abc2svg == "undefined")
var abc2svg = {}
abc2svg.page = {
// function called at end of generation
abc_end: function(of) {
if (this.cfmt().pageheight) {
var page = this.page
if (page && page.in_page)
abc2svg.page.close_page(page)
if (abc2svg.page.user_out) {
user.img_out = abc2svg.page.user_out
abc2svg.page.user_out = null
}
}
of()
}, // abc_end()
// output the SVG tag
svg_tag: function(w, h, ty) {
w = Math.ceil(w)
h = Math.ceil(h)
abc2svg.page.user_out(
'<svg xmlns="http://www.w3.org/2000/svg" version="1.1"\n\
xmlns:xlink="http://www.w3.org/1999/xlink"\n\
class="'
+ ty + '" '
+ (user.imagesize != undefined
? (user.imagesize)
: ('width="' + w + 'px" height="' + h + 'px"')
)
+ ' viewBox="0 0 ' + w + ' ' + h + '">'
)
}, // svg_tag()
// generate a header or a footer in page.hf and return its height
gen_hf: function(page, ty) {
var a, i, j, k, x, y, y0, s, str,
|
| ︙ | |||
89 90 91 92 93 94 95 | 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | + + - + | if (c == 'D') d = new Date() if (cfmt.dateformat[0] == '"') cfmt.dateformat = cfmt.dateformat.slice(1, -1) d = strftime(cfmt.dateformat, d) break case 'F': d = typeof document != "undefined" ? window.location.href |
| ︙ | |||
250 251 252 253 254 255 256 257 258 259 260 261 262 263 | 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 | + + + - + - - - - - - + - + - - - - - + |
page.hmax = cfmt.pageheight - page.botmargin - ht
// define the header/footer
page.hf = ''
if (page.header) {
l = abc.get_font_style().length
h = abc2svg.page.gen_hf(page, "header")
if (!h && page.pn == 1 && page.header1)
h = abc2svg.page.gen_hf(page, "header1")
sty = abc.get_font_style().slice(l) // new style(s)
if (cfmt.fullsvg || sty != page.hsty) {
page.hsty = sty
sty = '<style>' + sty + '\n</style>\n'
} else {
sty = ''
}
abc2svg.page.svg_tag(cfmt.pagewidth, ht + h, "header")
|
| ︙ | |||
299 300 301 302 303 304 305 | 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 | - + - - - - - + - + |
close_page: function(page) {
var h,
cfmt = page.abc.cfmt()
page.in_page = false
if (page.footer) {
h = page.hmax + page.fh - page.h
|
| ︙ | |||
396 397 398 399 400 401 402 | 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 | - + + + + + + + |
if (isNaN(v)) {
this.syntax(1, this.errs.bad_val, '%%' + cmd)
return
}
if (!user.img_out || !abc2svg.abc_end)
v = 0
cfmt.pageheight = v
|
| ︙ | |||
421 422 423 424 425 426 427 428 429 430 431 432 433 434 | 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 | + + + + |
page.header = cfmt.header;
cfmt.header = null
}
if (cfmt.footer) {
page.footer = cfmt.footer;
cfmt.footer = null
}
if (cfmt.header1) {
page.header1 = cfmt.header1
cfmt.header1 = null
}
if (cfmt.header2) {
page.header2 = cfmt.header2
cfmt.header2 = null
}
if (cfmt.footer2) {
page.footer2 = cfmt.footer2
cfmt.footer2 = null
|
| ︙ | |||
464 465 466 467 468 469 470 471 472 473 474 475 476 477 | 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 | + |
}
return
}
if (page) {
switch (cmd) {
case "header":
case "footer":
case "header1":
case "header2":
case "footer2":
page[cmd] = parm
return
case "newpage":
if (!parm)
break
|
| ︙ | |||
503 504 505 506 507 508 509 | 528 529 530 531 532 533 534 535 536 537 | - - + + - - + |
set_hooks: function(abc) {
abc.set_format = abc2svg.page.set_fmt.bind(abc, abc.set_format)
user.page_format = true // do page formatting
abc.set_pagef()
}
} // page
|
Changes to modules/pedline.js.
1 2 | 1 2 3 4 5 6 7 8 9 10 | - + | // pedline.js - module to draw pedal lines instead of 'Ped .. *' // |
| ︙ | |||
18 19 20 21 22 23 24 25 26 | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | + + + - + + - + - + + + - - - - - + + + + + + + + + - - + + + - + + - - + + + + + + - - - - - + + + + + + + + + - - + + - - + |
// along with abc2svg. If not, see <http://www.gnu.org/licenses/>.
//
// This module is loaded when "%%pedline" appears in a ABC source.
//
// Parameters
// %%pedline 1
if (typeof abc2svg == "undefined")
var abc2svg = {}
abc2svg.pedline = {
draw_all_deco: function(of) {
|
Changes to modules/perc.js.
| ︙ | |||
23 24 25 26 27 28 29 30 31 32 33 34 35 36 | 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | + + + |
// %%percmap ABC_note percussion [note_head]
// The percussion may be a number (MIDI percussion number range 35..81),
// a ABC note or a possibly abbreviated percussion name.
// See https://wim.vree.org/js2/tabDrumDoc.html for more information.
// Using this command creates a voicemap named "MIDIdrum".
if (typeof abc2svg == "undefined")
var abc2svg = {}
abc2svg.perc = {
// parse %%percmap
do_perc: function(parm) {
var pits = new Int8Array([0, 0, 1, 2, 2, 3, 3, 4, 5, 5, 6, 6]),
accs = new Int8Array([3, 1, 3, -1, 3, 3, 1, 3, -1, 3, -1, 3])
|
| ︙ | |||
240 241 242 243 244 245 246 | 243 244 245 246 247 248 249 250 251 252 | - - + + - - + |
set_hooks: function(abc) {
abc.do_pscom = abc2svg.perc.do_pscom.bind(abc, abc.do_pscom);
abc.set_vp = abc2svg.perc.set_vp.bind(abc, abc.set_vp)
}
} // perc
|
Changes to modules/psvg.js.
1 2 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | - + + + + | // psvg.js - small PS to SVG convertor for abc2svg |
| ︙ | |||
561 562 563 564 565 566 567 | 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 | - + + | wps.parse(script + (x / abcobj.stv_g().scale).toFixed(1) + ' ' + y.toFixed(1) + ' ' + f); ps_flush(true) // + setg(0) return true } // try to generate a decoration by PS |
| ︙ | |||
750 751 752 753 754 755 756 | 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 | - + - + - - + + - - + | } if (opt == 'nosvg') return if (!this.psvg) this.psvg = new Psvg(this); this.psvg.ps_eval.call(this.psvg, text) }, |
Changes to modules/roman.js.
1 2 3 | 1 2 3 4 5 6 7 8 9 10 11 | - + | // abc2svg - roman.js - convert the chord symbols to the RNN // (Roman Numeral Notation) // |
| ︙ | |||
21 22 23 24 25 26 27 28 29 30 31 32 33 34 | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | + + + |
// This module is loaded by %%roman.
//
// Parameters
// %%roman int
// <int>
// = '1': use uppercase letters with 'm' for minor chords
// = '2': user lowercase letters for minor chords
if (typeof abc2svg == "undefined")
var abc2svg = {}
abc2svg.roman = {
note_nm: "CDEFGAB",
// chord names
nm_M: ["I", "♯I", "II", "♭III", "III", "IV", "♯IV",
"V", "♯V", "VI", "♭VII", "VII"],
|
| ︙ | |||
141 142 143 144 145 146 147 | 144 145 146 147 148 149 150 151 152 153 | - - + + + |
set_hooks: function(abc) {
abc.gch_build = abc2svg.roman.gch_build.bind(abc, abc.gch_build)
abc.output_music = abc2svg.roman.o_mus.bind(abc, abc.output_music)
abc.set_format = abc2svg.roman.set_fmt.bind(abc, abc.set_format)
} // set_hooks()
} // roman
|
Changes to modules/soloffs.js.
1 2 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | - + + + + | // soloffs.js - module to set the X offset of some elements at start of music line // |
| ︙ | |||
79 80 81 82 83 84 85 | 82 83 84 85 86 87 88 89 90 91 | - - + + - - + |
set_hooks: function(abc) {
abc.set_sym_glue = abc2svg.soloffs.set_sym_glue.bind(abc, abc.set_sym_glue);
abc.set_format = abc2svg.soloffs.set_fmt.bind(abc, abc.set_format)
}
} // soloffs
|
Changes to modules/sth.js.
1 2 | 1 2 3 4 5 6 7 8 9 10 | - + | // sth.js - module to set the stem heights // |
| ︙ | |||
20 21 22 23 24 25 26 27 28 29 30 31 32 33 | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | + + + |
// This module is loaded when "%%sth" appears in a ABC source.
//
// Parameters
// %%sth h1 h2 h3 ...
// The values h1, h2, .. are applied to the following notes which
// have a stem and which are not inside a beam.
// The value may be '*' for keeping the original stem length.
if (typeof abc2svg == "undefined")
var abc2svg = {}
abc2svg.sth = {
// function called after beam calculation
recal_beam: function(bm, s) {
var staff_tb = this.get_staff_tb(),
y = staff_tb[s.st].y,
|
| ︙ | |||
134 135 136 137 138 139 140 | 137 138 139 140 141 142 143 144 145 146 | - - + + - - + |
abc.calculate_beam = abc2svg.sth.calculate_beam.bind(abc, abc.calculate_beam);
abc.new_note = abc2svg.sth.new_note.bind(abc, abc.new_note);
abc.set_format = abc2svg.sth.set_fmt.bind(abc, abc.set_format);
abc.set_stems = abc2svg.sth.set_stems.bind(abc, abc.set_stems)
}
} // sth
|
Changes to modules/strtab.js.
1 2 | 1 2 3 4 5 6 7 8 9 10 | - + | // abc2svg - strtab.js - tablature for string instruments // |
| ︙ | |||
30 31 32 33 34 35 36 37 38 39 40 41 42 43 | 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | + + + |
// The command %%minfret permits to force upper frets.
// Syntax:
// %%minfret [ <string number> : <fret number> ]*
// Each command replaces the previous value.
//
// This module accepts Willem Vree's tablature syntax:
// https://wim.vree.org/svgParse/abc2xml.html#tab
if (typeof abc2svg == "undefined")
var abc2svg = {}
abc2svg.strtab = {
// draw the tablature
draw_symbols: function(of, p_v) {
var s, m, not, stb, x, y, g,
C = abc2svg.C,
|
| ︙ | |||
204 205 206 207 208 209 210 211 212 213 | 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - + |
case C.NOTE:
draw_heads(stb, s)
break
}
}
abc.out_svg('</g>\n')
}, // draw_symbols()
// change the font size of the chord symbols
csan_bld: function(of, s) {
if (s.p_v.tab) {
var i, gch,
fmt = this.cfmt()
for (i = 0; i < s.a_gch.length; i++) {
gch = s.a_gch[i]
if (gch.type != 'g')
continue
// create the smaller font if not done yet
if (!fmt.cstabfont) {
var f = gch.font
this.param_set_font("cstabfont",
f.name + ' ' + (f.size / 1.6).toFixed(1))
}
gch.font = this.get_font("cstab")
}
}
of(s)
}, // set_csan()
// set a format parameter
set_fmt: function(of, cmd, parm) {
switch (cmd) {
case "cstabfont":
this.param_set_font("cstabfont", parm)
return
|
| ︙ | |||
388 389 390 391 392 393 394 | 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 | - + |
switch (s.type) {
case C.KEY:
case C.REST:
case C.TIME:
s.invis = true
default:
delete s.a_dd
|
| ︙ | |||
642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 | 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 | + - - + + + |
// p_v.straightflags = true
}
of(a)
}, // set_vp()
set_hooks: function(abc) {
abc.draw_symbols = abc2svg.strtab.draw_symbols.bind(abc, abc.draw_symbols)
abc.gch_build = abc2svg.strtab.csan_bld.bind(abc, abc.gch_build)
abc.set_format = abc2svg.strtab.set_fmt.bind(abc, abc.set_format);
abc.set_stems = abc2svg.strtab.set_stems.bind(abc, abc.set_stems)
abc.set_vp = abc2svg.strtab.set_vp.bind(abc, abc.set_vp)
// define specific decorations used to force the string number
var decos = abc.get_decos()
decos["1s"] = "0 nul 0 0 0"
decos["2s"] = "0 nul 0 0 0"
decos["3s"] = "0 nul 0 0 0"
decos["4s"] = "0 nul 0 0 0"
decos["5s"] = "0 nul 0 0 0"
decos["6s"] = "0 nul 0 0 0"
if (!user.nul)
user.nul = function() {}
abc.add_style("\n.bn{font:bold 7px sans-serif}")
} // set_hooks()
} // strtab
|
Changes to modules/temper.js.
1 2 | 1 2 3 4 5 6 7 8 9 10 | - + | // temper.js - module to define the temperament // |
| ︙ | |||
35 36 37 38 39 40 41 42 43 44 45 46 47 48 | 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | + + + |
// %%temperament +00 -24 -07 +10 -14 +03 -21 -03 -27 +10 +07 -17
//
// % Andreas Werckmeister III (1681)
// %%temperament +00 -04 +04 +00 -04 +04 +00 +02 -08 +00 +02 -02
//
// % well temperament (F.A. Vallotti 1754)
// %%temperament +00 -06 -04 -02 -08 +02 -08 -02 -04 -06 +00 -10
if (typeof abc2svg == "undefined")
var abc2svg = {}
abc2svg.temper = {
// get the temperament
set_fmt: function(of, cmd, param) {
if (cmd == "temperament") {
var i, tb,
|
| ︙ | |||
77 78 79 80 81 82 83 | 80 81 82 83 84 85 86 87 88 89 | - - - + + + - - |
},
set_hooks: function(abc) {
abc.set_format = abc2svg.temper.set_fmt.bind(abc, abc.set_format)
}
} // temper
|
Changes to modules/tropt.js.
1 2 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | - + + + + - + | // tropt.js - module to optimize the notes after transposition // |
| ︙ | |||
49 50 51 52 53 54 55 | 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | - + |
s = s.next
}
return 1 //true
} // ok()
for (v = 0; v < nv; v++) {
p_v = vo_tb[v]
|
| ︙ | |||
113 114 115 116 117 118 119 | 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | - + | nt.pit = np nt.acc = na } } } } of(last_s) |
| ︙ | |||
139 140 141 142 143 144 145 | 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | - + - - + + - - + |
}
}
of(a)
}, // set_vp()
set_hooks: function(abc) {
abc.do_pscom = abc2svg.tropt.do_pscom.bind(abc, abc.do_pscom)
|
Changes to toabc.js.
1 2 | 1 2 3 4 5 6 7 8 9 10 | - + | // abc2svg - toabc.js - convert ABC to ABC // |
| ︙ | |||
491 492 493 494 495 496 497 | 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 | - + - - - + - - - - - - - |
return ln
} // meter_dump()
function note_dump(s, note, tie_ch) {
var p, j, sl, s2, a, d,
ln = ""
|
| ︙ | |||
736 737 738 739 740 741 742 | 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 | + + + + + - - - - + + + + + - - - - + + + + - + |
' ' + s.repeat_k + ']'
}
if (s.tp)
tuplet_dump(s)
if (s.sls) {
for (i = 0; i < s.sls.length; i++) {
sl = s.sls[i];
if (sl.loc != 'i'
&& !s.bar_type) {
if (sl.nts)
sl.nts.sl1 = sl.ty
else
|
| ︙ | |||
879 880 881 882 883 884 885 | 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 | + + + - - - + + + | break case C.STAVES: if (nv == 1) break staves_dump(s) break case C.STBRK: if (vo[v].length && vo[v].slice(-1) != '\n') line += '[I:staffbreak ' + s.xmx.toString() + (s.stbrk_forced ? ' f' : '') + ']' |
| ︙ |
Changes to tohtml.js.
1 2 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | - + - + + + | // abc2svg - tohtml.js - HTML+SVG generation // |
| ︙ | |||
178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 | + + + + + + |
abc2svg.print('</table>')
}
user.page_format = true
// output the html header
user.img_out = function(str) {
if (!str)
return
if (init_done) {
abc2svg.print(str)
return
}
if (/^<style>[^<]+<\/style>$/.test(str)) {
h_sty = str.replace(/^<style>\n|<\/style>$/g,'')
return
}
var header = cfmt.header,
footer = cfmt.footer,
topmargin = cfmt.topmargin || "1cm",
botmargin = cfmt.botmargin || "1cm",
media_s = '@media print {\n\
|
| ︙ | |||
251 252 253 254 255 256 257 | 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 | - + - + |
((header || footer) ? media_f : media_s))
// important for chrome and --headless (abctopdf)
if (abc.page)
abc2svg.print('@page{size:' +
(cfmt.pagewidth / 96).toFixed(2) + 'in ' +
(cfmt.pageheight / 96).toFixed(2) + 'in;margin:0}')
|
| ︙ |
Changes to tonotes.js.
| ︙ | |||
57 58 59 60 61 62 63 | 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | - + |
tgen: 3600, // generate by (for) 1 hour
get_time: function() { return -.3}, // (move the time origin)
midi_ctrl: function(po, s, t) {
abc2svg.print(' v:' + s.v
+ ' MIDI control ' + s.ctrl + ' ' + s.val)
}, // midi_ctrl()
midi_prog: function(po, s) {
|
| ︙ |
Changes to toodt.js.
1 2 | 1 2 3 4 5 6 7 8 9 10 | - + | // abc2svg - toodt.js - ABC translation to ODT+SVG // |
| ︙ | |||
29 30 31 32 33 34 35 36 37 38 39 | 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | + - - - - - + + + + + + + + + + + + + + + + |
//
// Constraints:
// This module runs only with the nodeJS script 'abc2svg' and asks for
// the npm module 'jszip' to be installed.
var margins, page_size, page_type, page_left, page_mid, page_right,
header, footer, headerfont, footerfont, in_p, t_info, title,
init_done,
style = '',
content = '',
imgs = '',
seq = 0,
|
| ︙ | |||
210 211 212 213 214 215 216 217 218 219 220 221 222 223 | 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 | + + + |
content + '\
</office:text>\n\
</office:body>\n\
</office:document-content>\n',
{ compression: "DEFLATE" });
// Fonts/abc2svg.ttf
if (typeof std != "undefined") // quickjs
os.exec(["cp", path + '/abc2svg.ttf', '/tmp/odt/Fonts/abc2svg.ttf'])
else
zip.file('Fonts/abc2svg.ttf',
fs.readFileSync(__dirname + sep + 'abc2svg.ttf'),
{ compression: "STORE" });
// manifest.rdf (?)
// META-INF/manifest.xml
|
| ︙ | |||
339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 | 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 | + + + + + + + + + + + |
(footer || '') + '\
</style:master-page>\n\
</office:master-styles>\n\
</office:document-styles>',
{ compression: "DEFLATE" });
// - generate the ODT file
if (typeof os != "undefined") {
if (outfn[0] != '/')
outfn = os.getcwd() + outfn
os.exec(["zip", "-0", "-X", outfn,
"mimetype", "Fonts/abc2svg.ttf"],
{cwd: "/tmp/odt"})
os.exec(["zip", "-r", outfn,
".", "-x", "mimetype", "Fonts/abc2svg.ttf"],
{cwd: "/tmp/odt"})
} else {
zip .generateNodeStream({streamFiles:true})
.pipe(fs.createWriteStream(outfn))
.on('finish', function () {
console.log(outfn + ' created')
})
}
}
abc2svg.abort = function(e) {
abc.blk_flush();
if (typeof abc2svg.printErr == 'function')
abc2svg.printErr(e.message + "\n*** Abort ***\n" + e.stack)
else
|
| ︙ | |||
524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 | 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 | + + + + + + + + + + + + + + + |
}
// entry point from cmdline
abc2svg.abc_init = function(args) {
console.log('ODT generation started');
get_args(args);
// create the odt hierarchy and clear the odt out file
if (typeof std != "undefined") {
os.exec(["rm", "-r", "/tmp/odt", outfn])
os.mkdir("/tmp/odt")
os.mkdir("/tmp/odt/Fonts")
os.mkdir("/tmp/odt/META-INF")
os.mkdir("/tmp/odt/Pictures")
}
// generate mimetype which is the first item and without compression
zip.file('mimetype',
'application/vnd.oasis.opendocument.text',
{ compression: "STORE" });
// define some functions in the Abc object
abc.tosvg("toodt", "\
%%fullsvg 1\n\
%%musicfont abc2svg")
// get the page parameters
user.img_out = function(str) {
if (init_done) {
svg_out(str)
return
}
init_done = 1
var cfmt = abc.cfmt(),
pw = cfmt.pagewidth;
// page size
if (pw > 800) {
page_type = 'Letter';
page_size = 'fo:page-width="8.5in" fo:page-height="11in"';
|
| ︙ | |||
566 567 568 569 570 571 572 | 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 | - - - | margins = 'fo:margin-top="' + set_unit(cfmt.topmargin || 37.8) + '" fo:margin-bottom="' + set_unit(cfmt.botmargin || 37.8) + '"'; // output the first generated string svg_out(str); |
Changes to util/abcweb.js.
1 2 | 1 2 3 4 5 6 7 8 9 10 | - + | // abcweb-1.js file to include in html pages // |
| ︙ | |||
171 172 173 174 175 176 177 | 171 172 173 174 175 176 177 178 179 180 181 182 183 184 | - | + s.getPropertyValue(k) + '\n' } return o } // get_p() // move the musique sequences to <script> text/vnd.abc |
| ︙ | |||
243 244 245 246 247 248 249 | 242 243 244 245 246 247 248 249 250 251 252 253 254 255 | - - - - - - - - - - - - - - - - - |
document.body.innerHTML = out
} // move_music()
// save the music sequences and replace them by empty <div>'s
function save_music() {
var i, k, div, c, s, sa
|
| ︙ | |||
303 304 305 306 307 308 309 | 285 286 287 288 289 290 291 292 293 294 295 296 297 298 | - - - | n: "mus" + abc2svg.music.length, t: c + s.innerHTML, d: div }) } s.parentNode.replaceChild(div, s) } |
| ︙ | |||
328 329 330 331 332 333 334 335 336 337 338 339 340 341 | 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 | + + + + |
var i, j, e
// start the generation
outb = err = ""
abc.tosvg(mu.n, t) // music source
abc2svg.abc_end() // close the page if %%pageheight
// mu.d can be null when parameters in query string
// and no ABC script with global parameters
if (mu.d) {
if (err)
outb += '<pre class="nop" style="background:#ff8080">'
+ err + "</pre>\n"
if (abc.cfmt().with_source && outb)
outb = '<pre class="source">'
|
| ︙ | |||
355 356 357 358 359 360 361 362 363 364 365 366 367 368 | 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 | + |
continue // (page formatting)
j = j.match(/tune(\d+)/)
if (!j)
continue
j = j[1] // tune number
tune_lst[j] = null // get new play references
}
} // if (mu.d)
// if some generation waiting, start it
mu.w = busy = 0 //false
for (i = 1; i < abc2svg.music.length; i++) {
if (abc2svg.music[i].w) {
musgen(abc2svg.music[i])
break
|
| ︙ | |||
411 412 413 414 415 416 417 | 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 | - - + + | r.send() } // include() // load the required modules and the include files before rendering if (abc2svg.modules.load(t, include)) include() } // musgen() |
| ︙ | |||
517 518 519 520 521 522 523 | 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 | - - - + - - + - - + - - - - - - - |
} // playseq()
// --- dom_loaded() main code ---
// load the abc2svg core if not done by <script>
src = document.body.innerHTML
if (!abc2svg.Abc) {
|
| ︙ |
Changes to util/chord.js.
| ︙ | |||
32 33 34 35 36 37 38 | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | - + | m7b5: ["C-b-e g ", "e-C g b ", "g-e b C+", "b-e g C+"], M7: ["C-B-E G ", "E-C G B ", "G-E B C+", "B-E G C+"], '6': ["C-A-E G ", "E-C A B ", "A-E B C+", "B-E A C+"], m6: ["C-A-e G ", "e-C A B ", "A-e B C+", "B-e A C+"], aug: ["C-E a C+", "E-C a C+", "a-C E a "], // plus: ["C-E a C+", "E-C a C+", "a-C E a "], aug7: ["C-b-E a ", "E-C a b ", "a-E b C+", "b-E a C+"], |
| ︙ | |||
238 239 240 241 242 243 244 245 246 247 248 249 250 251 | 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 | + + | instr: cfmt.chord.prog || 0, time: 0, ts_prev: first, ts_next: first.ts_next }, vol: cfmt.chord.vol || .6 // (external default 76.2) } vch.sym.p_v = vch vch.sym.v = vch.v vch.last_sym = vch.sym voice_tb.push(vch) first.ts_next = vch.sym // loop on the symbols and add the accompaniment chords gchon = cfmt.chord.gchon s = first |
| ︙ |
Changes to util/sndaud.js.
| ︙ | |||
299 300 301 302 303 304 305 | 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 | - + - - + + - - + + - + |
// scan from the beginning of the tune
s = s.p_v.sym
while (s.ts_prev)
s = s.ts_prev
for ( ; s; s = s.ts_next) {
|
| ︙ | |||
344 345 346 347 348 349 350 | 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 | - + |
i += bk[s.v] // bank number
if (!params[i]) {
params[i] = [] // instrument being loaded
f(i, sf2par, sf2pre) // sf2_create or load_instr
}
}
nv = (2 << nv) - 1
|
| ︙ | |||
367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 | 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 | + + + + + + + + + + + |
parser = new sf2.Parser(b64dcod(abc2svg.sf2))
parser.parse()
presets = parser.getPresets()
}
// load the soundfont if not done yet
} else if (!parser) {
w_instr++
if (conf.sfu.slice(-3) == ".js") {
abc2svg.loadjs(conf.sfu,
function() {
load_res(s) // load the instruments
if (--w_instr == 0)
play_start()
},
function() {
errmsg('could not load the sound file '
+ conf.sfu)
if (--w_instr == 0)
play_start()
})
return
}
var r = new XMLHttpRequest() // .sf2
r.open('GET', conf.sfu, true)
r.responseType = "arraybuffer"
r.onload = function() {
if (r.status === 200) {
parser = new sf2.Parser(
new Uint8Array(r.response))
parser.parse()
presets = parser.getPresets()
load_res(s) // load the instruments
if (--w_instr == 0)
play_start()
} else {
errmsg('could not load the sound file '
+ conf.sfu)
if (--w_instr == 0)
play_start()
}
}
r.onerror = function() {
errmsg('could not load the sound file '
+ conf.sfu)
if (--w_instr == 0)
play_start()
}
r.send()
return
}
// create the instruments and start playing
def_instr(s, sf2_create, parser, presets)
|
| ︙ | |||
563 564 565 566 567 568 569 | 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 | - + |
// This is needed for iPhone/iPad/...
function play_unlock() {
var buf = ac.createBuffer(1, 1, 22050),
src = ac.createBufferSource()
src.buffer = buf
src.connect(ac.destination)
|
| ︙ |
Changes to util/sndgen.js.
1 2 | 1 2 3 4 5 6 7 8 9 10 | - + | // sndgen.js - sound generation // |
| ︙ | |||
47 48 49 50 51 52 53 54 55 56 57 58 59 60 | 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + |
i, n, dt, d, v,
s = first,
rst = s, // left repeat (repeat restart)
rst_fac, // play factor on repeat restart
rsk = [], // repeat variant array (repeat skip)
b_tim, // time of last measure bar
b_typ // type of last measure bar
function get_beat() {
var s = first.p_v.meter
if (!s.a_meter[0])
return C.BLEN / 4
if (!s.a_meter[0].bot)
return (s.a_meter[1]
&& s.a_meter[1].top == '|') // (cut time)
? C.BLEN / 2 : C.BLEN / 4
if (s.a_meter[0].bot == "8"
&& s.a_meter[0].top % 3 == 0)
return C.BLEN / 8 * 3
return C.BLEN / s.a_meter[0].bot | 0
} // get_beat()
// create the starting beats
function def_beats() {
var i, s2, s3, tim,
beat = get_beat(), // time between two beats
d = first.p_v.meter.wmeasure, // duration of a measure
nb = d / beat | 0, // number of beats in a measure
v = voice_tb.length, // beat voice number
p_v = { // voice for the beats
id: "_beats",
v: v,
// time:
sym: {
type: C.BLOCK,
v: v,
// p_v: p_v,
subtype: "midiprog",
chn: 9, // percussion channel
instr: 16384, // percussion bank
// time:
// next:
ts_prev: first
// ts_next:
}
// vol:
},
s = {
type: C.NOTE,
v: v,
p_v: p_v,
// time:
dur: beat,
nhd: 0,
notes: [{
midi: 37 // Side Stick
}]
}
abc_time = -d // start time of the beat ticks
// check for an anacrusis
for (s2 = first; s2; s2 = s2.ts_next) {
if (s2.bar_type && s2.time) {
nb = (2 * d - s2.time) / beat | 0
abc_time -= d - s2.time
break
}
}
// add the tempo
s2 = p_v.sym // midiprog
for (s3 = first; s3 && !s3.time; s3 = s3.ts_next) {
if (s3.type == C.TEMPO) {
s3 = Object.create(s3) // new tempo
s3.v = v
s3.p_v = p_v
s3.prev =
s3.ts_prev = s2
s2.next =
s2.ts_next = s3
s2 = s3
play_fac = set_tempo(s2)
break
}
}
voice_tb[v] = p_v
p_v.sym.p_v = p_v
first.time = s2.time = tim = abc_time
if (s3)
p_v.sym.time = tim
for (i = 0; i < nb; i++) {
s3 = Object.create(s) // new beat tick
s3.time = tim
s3.prev = s2
s2.next = s3
s3.ts_prev = s2
s2.ts_next = s3
s2 = s3
tim += beat
}
s2.ts_next = first.ts_next
s2.ts_next.ts_prev = s2
first.ts_next = p_v.sym
rst = s2.ts_next
} // def_beats()
// build the information about the parts (P:)
function build_parts(first) {
var i, j, c, n, v,
s = first,
p = s.parts,
st = [],
|
| ︙ | |||
183 184 185 186 187 188 189 | 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 | - + + + + + | else if (d != ',') rsk.push(s) // last } } // set_variant() // add() main |
| ︙ | |||
252 253 254 255 256 257 258 | 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 | - - - - - - - - - + + + + + + + + + + + - - - + + | && rst.bar_type.slice(-1) != ':') rst.bar_type += ':' // restart confirmed set_variant(s) rst_fac = play_fac } // left repeat |
| ︙ | |||
395 396 397 398 399 400 401 | 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 | - + - |
// set the MIDI controls up to now
function set_ctrl(po, s2, t) {
var i,
p_v = s2.p_v,
s = {
subtype: "midictl",
p_v: p_v,
|
| ︙ | |||
549 550 551 552 553 554 555 | 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 | - + |
} else {
s = po.s_end
}
po.repv = 1
}
break
}
|
| ︙ |
Changes to util/sndmid.js.
| ︙ | |||
92 93 94 95 96 97 98 | 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | - + - - - - + + + - - - - + + + + + + + + |
}
po.op.send(new Uint8Array([0x90 + c, k, 127]), t) // note on
po.op.send(new Uint8Array([0x80 + c, k, 0]), t + d - 20) // note off
} // note_run()
// send a MIDI control
function midi_ctrl(po, s, t) {
|
| ︙ | |||
172 173 174 175 176 177 178 | 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | - + + |
)
}
)
}, // get_outputs()
// set the output port
set_output: function(name) {
|
| ︙ |