abcjs 6.0.0-beta.8 → 6.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/tests.yml +29 -0
- package/CODE_OF_CONDUCT.md +76 -0
- package/CONTRIBUTING.md +1 -0
- package/LICENSE.md +1 -1
- package/README.md +92 -3
- package/RELEASE.md +959 -1
- package/abcjs-audio.css +14 -5
- package/dist/.gitignore +1 -2
- package/dist/abcjs-basic-min.js +3 -0
- package/dist/abcjs-basic-min.js.LICENSE +23 -0
- package/dist/abcjs-basic.js +28232 -0
- package/dist/abcjs-basic.js.map +1 -0
- package/dist/abcjs-plugin-min.js +3 -0
- package/dist/abcjs-plugin-min.js.LICENSE +23 -0
- package/dist/report-basic.html +37 -0
- package/dist/report-before-glyph-compress.html +37 -0
- package/dist/report-brown-ts-target-es5.html +37 -0
- package/dist/report-dev-orig-no-babel.html +37 -0
- package/dist/report-synth.html +37 -0
- package/docker-build.sh +1 -0
- package/glyphs.json +1 -0
- package/index.js +27 -2
- package/{static-wrappers/license.js → license.js} +1 -1
- package/package.json +26 -29
- package/{src/plugin/abc_plugin.js → plugin.js} +31 -19
- package/src/api/abc_animation.js +1 -17
- package/src/api/abc_tablatures.js +144 -0
- package/src/api/abc_timing_callbacks.js +239 -116
- package/src/api/abc_tunebook.js +18 -67
- package/src/api/abc_tunebook_svg.js +38 -46
- package/src/data/abc_tune.js +232 -972
- package/src/data/deline-tune.js +199 -0
- package/src/edit/abc_editarea.js +112 -0
- package/src/edit/abc_editor.js +95 -221
- package/src/midi/abc_midi_create.js +48 -50
- package/src/parse/abc_common.js +0 -14
- package/src/parse/abc_parse.js +167 -1321
- package/src/parse/abc_parse_book.js +62 -0
- package/src/parse/abc_parse_directive.js +164 -41
- package/src/parse/abc_parse_header.js +116 -145
- package/src/parse/abc_parse_key_voice.js +26 -20
- package/src/parse/abc_parse_music.js +1337 -0
- package/src/parse/abc_tokenizer.js +21 -15
- package/src/parse/abc_transpose.js +3 -15
- package/src/parse/tune-builder.js +896 -0
- package/src/parse/wrap_lines.js +205 -453
- package/src/synth/abc_midi_flattener.js +1292 -0
- package/src/{midi → synth}/abc_midi_renderer.js +44 -17
- package/src/synth/abc_midi_sequencer.js +648 -0
- package/src/synth/active-audio-context.js +3 -14
- package/src/synth/cents-to-factor.js +10 -0
- package/src/synth/create-note-map.js +21 -32
- package/src/synth/create-synth-control.js +20 -103
- package/src/synth/create-synth.js +185 -77
- package/src/synth/download-buffer.js +7 -21
- package/src/synth/get-midi-file.js +13 -20
- package/src/synth/images/{loading.svg → loading.svg.js} +4 -0
- package/src/synth/images/loop.svg.js +65 -0
- package/src/synth/images/pause.svg.js +10 -0
- package/src/synth/images/play.svg.js +9 -0
- package/src/synth/images/{reset.svg → reset.svg.js} +5 -1
- package/src/synth/instrument-index-to-name.js +1 -16
- package/src/synth/load-note.js +37 -76
- package/src/synth/pitch-to-note-name.js +0 -15
- package/src/synth/pitches-to-perc.js +64 -0
- package/src/synth/place-note.js +78 -68
- package/src/synth/play-event.js +17 -18
- package/src/synth/register-audio-context.js +11 -23
- package/src/synth/sounds-cache.js +0 -15
- package/src/synth/supports-audio.js +9 -23
- package/src/synth/synth-controller.js +80 -49
- package/src/synth/synth-sequence.js +20 -34
- package/src/tablatures/instruments/guitar/guitar-fonts.js +19 -0
- package/src/tablatures/instruments/guitar/guitar-patterns.js +23 -0
- package/src/tablatures/instruments/guitar/tab-guitar.js +50 -0
- package/src/tablatures/instruments/string-patterns.js +277 -0
- package/src/tablatures/instruments/string-tablature.js +56 -0
- package/src/tablatures/instruments/tab-note.js +282 -0
- package/src/tablatures/instruments/tab-notes.js +41 -0
- package/src/tablatures/instruments/violin/tab-violin.js +47 -0
- package/src/tablatures/instruments/violin/violin-fonts.js +19 -0
- package/src/tablatures/instruments/violin/violin-patterns.js +23 -0
- package/src/tablatures/tab-absolute-elements.js +310 -0
- package/src/tablatures/tab-common.js +29 -0
- package/src/tablatures/tab-renderer.js +243 -0
- package/src/tablatures/transposer.js +110 -0
- package/src/test/abc_midi_lint.js +5 -22
- package/src/test/abc_midi_sequencer_lint.js +11 -14
- package/src/test/abc_parser_lint.js +136 -32
- package/src/test/abc_vertical_lint.js +94 -32
- package/src/test/rendering-lint.js +38 -5
- package/src/write/abc_absolute_element.js +112 -120
- package/src/write/abc_abstract_engraver.js +102 -253
- package/src/write/abc_beam_element.js +30 -290
- package/src/write/abc_brace_element.js +12 -121
- package/src/write/abc_create_clef.js +21 -32
- package/src/write/abc_create_key_signature.js +8 -26
- package/src/write/abc_create_note_head.js +107 -0
- package/src/write/abc_create_time_signature.js +2 -21
- package/src/write/abc_crescendo_element.js +3 -50
- package/src/write/abc_decoration.js +7 -30
- package/src/write/abc_dynamic_decoration.js +3 -37
- package/src/write/abc_ending_element.js +1 -57
- package/src/write/abc_engraver_controller.js +111 -234
- package/src/write/abc_glyphs.js +8 -18
- package/src/write/abc_relative_element.js +57 -97
- package/src/write/abc_renderer.js +10 -832
- package/src/write/abc_spacing.js +0 -15
- package/src/write/abc_staff_group_element.js +14 -349
- package/src/write/abc_tempo_element.js +9 -117
- package/src/write/abc_tie_element.js +5 -68
- package/src/write/abc_triplet_element.js +6 -124
- package/src/write/abc_voice_element.js +7 -222
- package/src/write/add-chord.js +103 -0
- package/src/write/add-text-if.js +33 -0
- package/src/write/bottom-text.js +79 -0
- package/src/write/calcHeight.js +17 -0
- package/src/write/classes.js +100 -0
- package/src/write/draw/absolute.js +68 -0
- package/src/write/draw/beam.js +56 -0
- package/src/write/draw/brace.js +106 -0
- package/src/write/draw/crescendo.js +38 -0
- package/src/write/draw/debug-box.js +8 -0
- package/src/write/draw/draw.js +56 -0
- package/src/write/draw/dynamics.js +20 -0
- package/src/write/draw/ending.js +46 -0
- package/src/write/draw/group-elements.js +66 -0
- package/src/write/draw/horizontal-line.js +25 -0
- package/src/write/draw/non-music.js +50 -0
- package/src/write/draw/print-line.js +24 -0
- package/src/write/draw/print-path.js +7 -0
- package/src/write/draw/print-stem.js +30 -0
- package/src/write/draw/print-symbol.js +59 -0
- package/src/write/draw/print-vertical-line.js +18 -0
- package/src/write/draw/relative.js +77 -0
- package/src/write/draw/round-number.js +5 -0
- package/src/write/draw/selectables.js +59 -0
- package/src/write/draw/separator.js +16 -0
- package/src/write/draw/set-paper-size.js +45 -0
- package/src/write/{sprintf.js → draw/sprintf.js} +0 -0
- package/src/write/draw/staff-group.js +226 -0
- package/src/write/draw/staff-line.js +9 -0
- package/src/write/draw/staff.js +33 -0
- package/src/write/draw/tab-line.js +40 -0
- package/src/write/draw/tempo.js +45 -0
- package/src/write/draw/text.js +71 -0
- package/src/write/draw/tie.js +97 -0
- package/src/write/draw/triplet.js +46 -0
- package/src/write/draw/voice.js +102 -0
- package/src/write/format-jazz-chord.js +15 -0
- package/src/write/free-text.js +41 -0
- package/src/write/get-font-and-attr.js +37 -0
- package/src/write/get-text-size.js +56 -0
- package/src/write/highlight.js +11 -0
- package/src/write/layout/VoiceElements.js +121 -0
- package/src/write/layout/beam.js +213 -0
- package/src/write/layout/get-left-edge-of-staff.js +56 -0
- package/src/write/layout/getBarYAt.js +6 -0
- package/src/write/layout/layout.js +94 -0
- package/src/write/layout/setUpperAndLowerElements.js +232 -0
- package/src/write/layout/staffGroup.js +146 -0
- package/src/write/layout/triplet.js +75 -0
- package/src/write/layout/voice.js +137 -0
- package/src/write/selection.js +188 -70
- package/src/write/separator.js +10 -0
- package/src/write/set-class.js +21 -0
- package/src/write/subtitle.js +12 -0
- package/src/write/svg.js +95 -43
- package/src/write/top-text.js +54 -0
- package/src/write/unhighlight.js +11 -0
- package/temp.txt +15256 -0
- package/test.js +27 -64
- package/types/index.d.ts +1095 -0
- package/version.js +1 -1
- package/.babelrc +0 -5
- package/.eslintrc +0 -3
- package/.gitmodules +0 -3
- package/abcjs-midi.css +0 -166
- package/build-utils/loadPresets.js +0 -14
- package/build-utils/presets/webpack.analyze.js +0 -6
- package/build-utils/presets/webpack.optimize.js +0 -30
- package/build-utils/webpack.development.js +0 -14
- package/build-utils/webpack.production.js +0 -35
- package/deploy-docs.sh +0 -25
- package/docs/README.md +0 -33
- package/fix-versions.sh +0 -23
- package/mei.js +0 -43
- package/midi.js +0 -62
- package/src/api/abc_tunebook_midi.js +0 -116
- package/src/midi/abc_midi_controls.js +0 -701
- package/src/midi/abc_midi_flattener.js +0 -1119
- package/src/midi/abc_midi_js_preparer.js +0 -243
- package/src/midi/abc_midi_sequencer.js +0 -401
- package/src/midi/abc_midi_ui_generator.js +0 -86
- package/src/plugin/abc_plugin_midi.js +0 -220
- package/src/synth/images/loop.svg +0 -61
- package/src/synth/images/pause.svg +0 -6
- package/src/synth/images/play.svg +0 -5
- package/src/transform/abc2abc_write.js +0 -395
- package/static-wrappers/basic.js +0 -2
- package/static-wrappers/midi.js +0 -2
- package/static-wrappers/plugin-midi.js +0 -6
- package/static-wrappers/plugin.js +0 -6
- package/webpack.config.js +0 -29
|
@@ -1,22 +1,8 @@
|
|
|
1
1
|
// abc_vertical_lint.js: Analyzes the vertical position of the output object.
|
|
2
|
-
// Copyright (C) 2015-2020 Paul Rosen (paul at paulrosen dot net)
|
|
3
|
-
//
|
|
4
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
|
5
|
-
// documentation files (the "Software"), to deal in the Software without restriction, including without limitation
|
|
6
|
-
// the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
|
|
7
|
-
// to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
8
|
-
//
|
|
9
|
-
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
10
|
-
//
|
|
11
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
|
|
12
|
-
// BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
13
|
-
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
14
|
-
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
15
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
16
2
|
|
|
17
3
|
//This file takes as input the output structure of the writing routine and lists the vertical position of all the elements.
|
|
18
4
|
|
|
19
|
-
|
|
5
|
+
var pitchToNoteName = require('../synth/pitch-to-note-name');
|
|
20
6
|
|
|
21
7
|
var midiLint = function(tune) {
|
|
22
8
|
"use strict";
|
|
@@ -30,14 +16,11 @@ var midiLint = function(tune) {
|
|
|
30
16
|
case 'program':
|
|
31
17
|
ret += "\tProgram: ch=" + event.channel + " inst=" + event.instrument + "\n";
|
|
32
18
|
break;
|
|
33
|
-
case '
|
|
34
|
-
ret += "\
|
|
19
|
+
case 'note':
|
|
20
|
+
ret += "\tNote: pitch=" + pitchToNoteName[event.pitch] + " (" + event.pitch + ") start=" + event.start + " dur=" + event.duration + " gap=" + event.gap + " vol=" + event.volume + " inst=" + event.instrument + "\n";
|
|
35
21
|
break;
|
|
36
|
-
case '
|
|
37
|
-
ret += "\
|
|
38
|
-
break;
|
|
39
|
-
case 'move':
|
|
40
|
-
ret += "\tMove: " + event.duration + "\n";
|
|
22
|
+
case 'text':
|
|
23
|
+
ret += "\tText: " + event.type + '=' + event.text + "\n";
|
|
41
24
|
break;
|
|
42
25
|
default:
|
|
43
26
|
ret += "\tUnknown: " + event.cmd + "\n";
|
|
@@ -1,18 +1,4 @@
|
|
|
1
1
|
// abc_vertical_lint.js: Analyzes the vertical position of the output object.
|
|
2
|
-
// Copyright (C) 2015-2020 Paul Rosen (paul at paulrosen dot net)
|
|
3
|
-
//
|
|
4
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
|
5
|
-
// documentation files (the "Software"), to deal in the Software without restriction, including without limitation
|
|
6
|
-
// the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
|
|
7
|
-
// to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
8
|
-
//
|
|
9
|
-
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
10
|
-
//
|
|
11
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
|
|
12
|
-
// BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
13
|
-
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
14
|
-
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
15
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
16
2
|
|
|
17
3
|
//This file takes as input the output structure of the writing routine and lists the vertical position of all the elements.
|
|
18
4
|
|
|
@@ -33,6 +19,8 @@ var midiSequencerLint = function(tune) {
|
|
|
33
19
|
case "note":
|
|
34
20
|
ret += "\t\t";
|
|
35
21
|
ret += 'duration: ' + element.duration + '\n';
|
|
22
|
+
if (element.decoration && element.decoration.length > 0)
|
|
23
|
+
ret += '\t\tdecoration: ' + element.decoration.join(", ") + '\n';
|
|
36
24
|
ret += "\t\t";
|
|
37
25
|
if (element.chord) {
|
|
38
26
|
ret += 'chord: ';
|
|
@@ -73,6 +61,10 @@ var midiSequencerLint = function(tune) {
|
|
|
73
61
|
if (element.pitches[n].endTie)
|
|
74
62
|
ret += ' endTie';
|
|
75
63
|
}
|
|
64
|
+
if (element.style && element.style !== "normal")
|
|
65
|
+
ret += "\n\t\tstyle: " + element.style;
|
|
66
|
+
if (element.noChordVoice)
|
|
67
|
+
ret += "\n\t\tnoChordVoice";
|
|
76
68
|
}
|
|
77
69
|
ret += '\n';
|
|
78
70
|
break;
|
|
@@ -143,6 +135,11 @@ var midiSequencerLint = function(tune) {
|
|
|
143
135
|
ret += "[" + params.pattern.join(" ") + "] bars=" + params.bars + " intro=" + params.intro + " on=" + params.on;
|
|
144
136
|
ret += '\n';
|
|
145
137
|
break;
|
|
138
|
+
case "name":
|
|
139
|
+
ret += "\t\t";
|
|
140
|
+
ret += element.trackName;
|
|
141
|
+
ret += '\n';
|
|
142
|
+
break;
|
|
146
143
|
default:
|
|
147
144
|
ret += "Unknown el_type: " + element.el_type + "\n";
|
|
148
145
|
break;
|
|
@@ -1,18 +1,4 @@
|
|
|
1
1
|
// abc_parser_lint.js: Analyzes the output of abc_parse.
|
|
2
|
-
// Copyright (C) 2010-2020 Paul Rosen (paul at paulrosen dot net)
|
|
3
|
-
//
|
|
4
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
|
5
|
-
// documentation files (the "Software"), to deal in the Software without restriction, including without limitation
|
|
6
|
-
// the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
|
|
7
|
-
// to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
8
|
-
//
|
|
9
|
-
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
10
|
-
//
|
|
11
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
|
|
12
|
-
// BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
13
|
-
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
14
|
-
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
15
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
16
2
|
|
|
17
3
|
//This file takes as input the output of AbcParser and analyzes it to make sure there are no
|
|
18
4
|
//unexpected elements in it. It also returns a person-readable version of it that is suitable
|
|
@@ -74,15 +60,17 @@ var ParserLint = function() {
|
|
|
74
60
|
"segno", "coda", "D.S.", "D.C.", "fine", "crescendo(", "crescendo)", "diminuendo(", "diminuendo)",
|
|
75
61
|
"p", "pp", "f", "ff", "mf", "mp", "ppp", "pppp", "fff", "ffff", "sfz", "repeatbar", "repeatbar2", "slide",
|
|
76
62
|
"upbow", "downbow", "staccato", "trem1", "trem2", "trem3", "trem4",
|
|
77
|
-
"/", "//", "
|
|
63
|
+
"/", "//", "///", "////", "turnx", "invertedturn", "invertedturnx", "arpeggio", "trill(", "trill)", "xstem",
|
|
78
64
|
"mark", "marcato", "umarcato"
|
|
79
65
|
] } };
|
|
80
66
|
|
|
81
67
|
var tempoProperties = {
|
|
82
68
|
duration: { type: "array", optional: true, output: "join", requires: [ 'bpm'], items: { type: "number"} },
|
|
83
69
|
bpm: { type: "number", optional: true, requires: [ 'duration'] },
|
|
70
|
+
endChar: { type: 'number'},
|
|
84
71
|
preString: { type: 'string', optional: true},
|
|
85
72
|
postString: { type: 'string', optional: true},
|
|
73
|
+
startChar: { type: 'number'},
|
|
86
74
|
suppress: { type: 'boolean', Enum: [ true ], optional: true},
|
|
87
75
|
suppressBpm: { type: 'boolean', Enum: [ true ], optional: true}
|
|
88
76
|
};
|
|
@@ -112,9 +100,71 @@ var ParserLint = function() {
|
|
|
112
100
|
}
|
|
113
101
|
};
|
|
114
102
|
|
|
103
|
+
var percMapElement = {
|
|
104
|
+
type: 'object', optional: true, properties: {
|
|
105
|
+
sound: { type: 'number', minimum: 35, maximum: 81 },
|
|
106
|
+
noteHead: { type: 'string', Enum: ['normal', 'harmonic', 'rhythm', 'x', 'triangle'], optional: true },
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
var percMapProps = {
|
|
110
|
+
"C": percMapElement,
|
|
111
|
+
"_C": percMapElement,
|
|
112
|
+
"^C": percMapElement,
|
|
113
|
+
"=C": percMapElement,
|
|
114
|
+
"D": percMapElement,
|
|
115
|
+
"_D": percMapElement,
|
|
116
|
+
"^D": percMapElement,
|
|
117
|
+
"=D": percMapElement,
|
|
118
|
+
"E": percMapElement,
|
|
119
|
+
"_E": percMapElement,
|
|
120
|
+
"^E": percMapElement,
|
|
121
|
+
"=E": percMapElement,
|
|
122
|
+
"F": percMapElement,
|
|
123
|
+
"_F": percMapElement,
|
|
124
|
+
"^F": percMapElement,
|
|
125
|
+
"=F": percMapElement,
|
|
126
|
+
"G": percMapElement,
|
|
127
|
+
"_G": percMapElement,
|
|
128
|
+
"^G": percMapElement,
|
|
129
|
+
"=G": percMapElement,
|
|
130
|
+
"A": percMapElement,
|
|
131
|
+
"_A": percMapElement,
|
|
132
|
+
"^A": percMapElement,
|
|
133
|
+
"=A": percMapElement,
|
|
134
|
+
"B": percMapElement,
|
|
135
|
+
"_B": percMapElement,
|
|
136
|
+
"^B": percMapElement,
|
|
137
|
+
"=B": percMapElement,
|
|
138
|
+
"c": percMapElement,
|
|
139
|
+
"_c": percMapElement,
|
|
140
|
+
"^c": percMapElement,
|
|
141
|
+
"=c": percMapElement,
|
|
142
|
+
"d": percMapElement,
|
|
143
|
+
"_d": percMapElement,
|
|
144
|
+
"^d": percMapElement,
|
|
145
|
+
"=d": percMapElement,
|
|
146
|
+
"e": percMapElement,
|
|
147
|
+
"_e": percMapElement,
|
|
148
|
+
"^e": percMapElement,
|
|
149
|
+
"=e": percMapElement,
|
|
150
|
+
"f": percMapElement,
|
|
151
|
+
"_f": percMapElement,
|
|
152
|
+
"^f": percMapElement,
|
|
153
|
+
"=f": percMapElement,
|
|
154
|
+
"g": percMapElement,
|
|
155
|
+
"_g": percMapElement,
|
|
156
|
+
"^g": percMapElement,
|
|
157
|
+
"=g": percMapElement,
|
|
158
|
+
"a": percMapElement,
|
|
159
|
+
"_a": percMapElement,
|
|
160
|
+
"^a": percMapElement,
|
|
161
|
+
"=a": percMapElement,
|
|
162
|
+
};
|
|
163
|
+
|
|
115
164
|
var clefProperties = {
|
|
116
165
|
stafflines: { type: 'number', minimum: 0, maximum: 10, optional: true },
|
|
117
|
-
|
|
166
|
+
staffscale: { type: 'number', minimum: 0.1, maximum: 10, optional: true },
|
|
167
|
+
transpose: { type: 'number', minimum: -24, maximum: 24, optional: true },
|
|
118
168
|
type: { type: 'string', Enum: [ 'treble', 'tenor', 'bass', 'alto', 'treble+8', 'tenor+8', 'bass+8', 'alto+8', 'treble-8', 'tenor-8', 'bass-8', 'alto-8', 'none', 'perc' ] },
|
|
119
169
|
verticalPos: { type: 'number', minimum: -20, maximum: 10 }, // the pitch that goes in the middle of the staff C=0
|
|
120
170
|
clefPos: { type: 'number', minimum: 2, maximum: 10, optional: true } // this is needed if there is a clef, but should not be present if the clef is 'none'
|
|
@@ -181,12 +231,13 @@ var ParserLint = function() {
|
|
|
181
231
|
endSlur: { type: 'array', optional: true, output: "join", items: { type: 'number', minimum: 0 } },
|
|
182
232
|
endTie: { type: 'boolean', Enum: [ true ], optional: true },
|
|
183
233
|
midipitch: { type: 'number', optional: true },
|
|
234
|
+
name: { type: 'string' },
|
|
184
235
|
pitch: { type: 'number' },
|
|
185
236
|
verticalPos: { type: 'number' },
|
|
186
237
|
startBeam: { type: 'boolean', Enum: [ true ], prohibits: [ 'endBeam', 'beambr' ], optional: true },
|
|
187
238
|
startSlur: slurProperties,
|
|
188
|
-
startTie: tieProperties
|
|
189
|
-
|
|
239
|
+
startTie: tieProperties,
|
|
240
|
+
}
|
|
190
241
|
}},
|
|
191
242
|
lyric: { type: 'array', optional: true, output: "noindex", items: {
|
|
192
243
|
type: 'object', properties: {
|
|
@@ -200,11 +251,12 @@ var ParserLint = function() {
|
|
|
200
251
|
endSlur: { type: 'array', optional: true, output: "join", items: { type: 'number', minimum: 0 } },
|
|
201
252
|
endTie: { type: 'boolean', Enum: [ true ], optional: true },
|
|
202
253
|
midipitch: { type: 'number', optional: true },
|
|
254
|
+
name: { type: 'string' },
|
|
203
255
|
pitch: { type: 'number' },
|
|
204
256
|
verticalPos: { type: 'number' },
|
|
205
257
|
startSlur: slurProperties,
|
|
206
258
|
startTie: tieProperties,
|
|
207
|
-
style: { type: 'string', Enum: ['normal', 'harmonic', 'rhythm', 'x'], optional: true }
|
|
259
|
+
style: { type: 'string', Enum: ['normal', 'harmonic', 'rhythm', 'x', 'triangle'], optional: true },
|
|
208
260
|
}
|
|
209
261
|
}},
|
|
210
262
|
positioning: { type: 'object', optional: true, properties: {
|
|
@@ -215,7 +267,8 @@ var ParserLint = function() {
|
|
|
215
267
|
volumePosition: { type: 'string', Enum: [ 'above', 'below', 'hidden' ], optional: true}
|
|
216
268
|
}},
|
|
217
269
|
rest: { type: 'object', optional: true, prohibits: [ 'pitches', 'lyric' ], properties: {
|
|
218
|
-
type: { type: 'string', Enum: [ 'invisible', 'spacer', 'rest', 'multimeasure', 'whole' ] }, // multimeasure requires duration to be the number of measures.
|
|
270
|
+
type: { type: 'string', Enum: [ 'invisible', 'spacer', 'rest', 'multimeasure', 'invisible-multimeasure', 'whole' ] }, // multimeasure requires duration to be the number of measures.
|
|
271
|
+
text: { type: 'number', minimum: 1, maximum: 100, optional: true },
|
|
219
272
|
endTie: { type: 'boolean', Enum: [ true ], optional: true },
|
|
220
273
|
startTie: tieProperties
|
|
221
274
|
}},
|
|
@@ -223,8 +276,9 @@ var ParserLint = function() {
|
|
|
223
276
|
startSlur: slurProperties,
|
|
224
277
|
startTriplet: { type: 'number', minimum: 2, maximum: 9, optional: true },
|
|
225
278
|
tripletMultiplier: { type: 'number', minimum: .1, maximum: 9, optional: true },
|
|
279
|
+
tripletR: { type: 'number', minimum: .1, maximum: 9, optional: true },
|
|
226
280
|
stemConnectsToAbove: { type: 'boolean', Enum: [ true ], optional: true },
|
|
227
|
-
style: { type: 'string', Enum: ['normal', 'harmonic', 'rhythm', 'x'], optional: true }
|
|
281
|
+
style: { type: 'string', Enum: ['normal', 'harmonic', 'rhythm', 'x', 'triangle'], optional: true }
|
|
228
282
|
};
|
|
229
283
|
|
|
230
284
|
var keyProperties = { // change deepCopyKey (in parse_header) if there are changes around here
|
|
@@ -294,7 +348,7 @@ var ParserLint = function() {
|
|
|
294
348
|
direction: { type: 'string', Enum: [ 'up', 'down', 'auto', 'none' ] }
|
|
295
349
|
}},
|
|
296
350
|
{ value: 'style', properties: {
|
|
297
|
-
head: { type: 'string', Enum: [ 'normal', 'harmonic', 'rhythm', 'x' ] }
|
|
351
|
+
head: { type: 'string', Enum: [ 'normal', 'harmonic', 'rhythm', 'x', 'triangle' ] }
|
|
298
352
|
}},
|
|
299
353
|
{ value: 'tempo', properties: appendPositioning(tempoProperties) },
|
|
300
354
|
{ value: 'transpose', properties: { steps: { type: "number" } } },
|
|
@@ -305,9 +359,11 @@ var ParserLint = function() {
|
|
|
305
359
|
var textFieldProperties = { type: "stringorarray", optional: true, output: 'noindex',
|
|
306
360
|
items: {
|
|
307
361
|
type: 'object', properties: {
|
|
362
|
+
endChar: { type: 'number', optional: true},
|
|
308
363
|
font: fontType,
|
|
309
364
|
text: { type: 'string' },
|
|
310
|
-
center: { type: 'boolean', Enum: [ true ], optional: true }
|
|
365
|
+
center: { type: 'boolean', Enum: [ true ], optional: true },
|
|
366
|
+
startChar: { type: 'number', optional: true}
|
|
311
367
|
}
|
|
312
368
|
}
|
|
313
369
|
};
|
|
@@ -393,7 +449,7 @@ var ParserLint = function() {
|
|
|
393
449
|
freegchord: { type: "boolean", optional: true },
|
|
394
450
|
gchordbox: { type: "boolean", optional: true },
|
|
395
451
|
gchordfont: fontType,
|
|
396
|
-
|
|
452
|
+
graceSlurs: { type: "boolean", optional: true },
|
|
397
453
|
gracespacebefore: { type: "number", optional: true },
|
|
398
454
|
gracespaceinside: { type: "number", optional: true },
|
|
399
455
|
gracespaceafter: { type: "number", optional: true },
|
|
@@ -405,6 +461,7 @@ var ParserLint = function() {
|
|
|
405
461
|
infoline: { type: "boolean", optional: true },
|
|
406
462
|
infospace: { type: "number", optional: true },
|
|
407
463
|
// landscape: { type: "boolean", optional: true },
|
|
464
|
+
jazzchords: { type: "boolean", optional: true },
|
|
408
465
|
leftmargin: { type: "number", optional: true },
|
|
409
466
|
linesep: { type: "number", optional: true },
|
|
410
467
|
lineskipfac: { type: "number", optional: true },
|
|
@@ -476,13 +533,12 @@ var ParserLint = function() {
|
|
|
476
533
|
partsbox: { type: "boolean", optional: true },
|
|
477
534
|
partsfont: fontType,
|
|
478
535
|
partsspace: { type: "number", optional: true },
|
|
479
|
-
percmap: {
|
|
536
|
+
percmap: {type: 'object', optional: true, properties: percMapProps},
|
|
480
537
|
playtempo: { type: "string", optional: true },
|
|
481
538
|
repeatfont: fontType,
|
|
482
539
|
rightmargin: { type: "number", optional: true },
|
|
483
540
|
scale: { type: "number", optional: true },
|
|
484
541
|
score: { type: "string", optional: true },
|
|
485
|
-
slurgraces: { type: "boolean", optional: true },
|
|
486
542
|
slurheight: { type: "number", optional: true },
|
|
487
543
|
splittune: { type: "boolean", optional: true },
|
|
488
544
|
squarebreve: { type: "boolean", optional: true },
|
|
@@ -490,12 +546,15 @@ var ParserLint = function() {
|
|
|
490
546
|
staffwidth: { type: "number", optional: true },
|
|
491
547
|
stemheight: { type: "number", optional: true },
|
|
492
548
|
straightflags: { type: "boolean", optional: true },
|
|
493
|
-
stretchlast: {
|
|
549
|
+
stretchlast: {type: "number", optional: true, minimum: 0, maximum: 1 },
|
|
494
550
|
stretchstaff: { type: "boolean", optional: true },
|
|
495
551
|
subtitlefont: fontType,
|
|
496
552
|
subtitlespace: { type: "number", optional: true },
|
|
497
553
|
sysstaffsep: { type: "number", optional: true },
|
|
498
554
|
systemsep: { type: "number", optional: true },
|
|
555
|
+
tabgracefont: fontType,
|
|
556
|
+
tablabelfont: fontType,
|
|
557
|
+
tabnumberfont: fontType,
|
|
499
558
|
tempofont: fontType,
|
|
500
559
|
textfont: fontType,
|
|
501
560
|
textspace: { type: "number", optional: true },
|
|
@@ -539,13 +598,27 @@ var ParserLint = function() {
|
|
|
539
598
|
staffbreak: { type: 'number', optional: true },
|
|
540
599
|
separator: { type: 'object', optional: true, prohibits: [ 'staff', 'text', 'subtitle' ],
|
|
541
600
|
properties: {
|
|
601
|
+
endChar: { type: 'number'},
|
|
542
602
|
lineLength: { type: 'number', optional: true },
|
|
543
603
|
spaceAbove: { type: 'number', optional: true },
|
|
544
|
-
spaceBelow: { type: 'number', optional: true }
|
|
604
|
+
spaceBelow: { type: 'number', optional: true },
|
|
605
|
+
startChar: { type: 'number'}
|
|
606
|
+
}
|
|
607
|
+
},
|
|
608
|
+
subtitle: { type: "object", optional: true, prohibits: [ 'staff', 'text', 'separator' ],
|
|
609
|
+
properties: {
|
|
610
|
+
endChar: { type: 'number'},
|
|
611
|
+
startChar: { type: 'number'},
|
|
612
|
+
text: { type: 'string'}
|
|
613
|
+
}
|
|
614
|
+
},
|
|
615
|
+
text: { type: "object", optional: true, prohibits: [ 'staff', 'subtitle', 'separator' ],
|
|
616
|
+
properties: {
|
|
617
|
+
endChar: { type: 'number'},
|
|
618
|
+
startChar: { type: 'number'},
|
|
619
|
+
text: textFieldProperties
|
|
545
620
|
}
|
|
546
621
|
},
|
|
547
|
-
subtitle: { type: "string", optional: true, prohibits: [ 'staff', 'text', 'separator' ] },
|
|
548
|
-
text: addProhibits(textFieldProperties, [ 'staff', 'subtitle', 'separator' ]),
|
|
549
622
|
staff: { type: 'array', optional: true, prohibits: [ 'subtitle', 'text', 'separator' ],
|
|
550
623
|
items: { type: 'object',
|
|
551
624
|
properties: {
|
|
@@ -554,6 +627,7 @@ var ParserLint = function() {
|
|
|
554
627
|
bracket: { type: 'string', optional: true, Enum: [ "start", "continue", "end" ] },
|
|
555
628
|
clef: { type: 'object', optional: true, properties: clefProperties },
|
|
556
629
|
connectBarLines: { type: 'string', optional: true, Enum: [ "start", "continue", "end" ] },
|
|
630
|
+
gchordfont: fontType,
|
|
557
631
|
tripletfont: fontType,
|
|
558
632
|
vocalfont: fontType,
|
|
559
633
|
key: { type: 'object', optional: true, properties: keyProperties },
|
|
@@ -581,7 +655,7 @@ var ParserLint = function() {
|
|
|
581
655
|
description:"ABC Internal Music Representation",
|
|
582
656
|
type:"object",
|
|
583
657
|
properties: {
|
|
584
|
-
version: { type: "string", Enum: [ "1.0
|
|
658
|
+
version: { type: "string", Enum: [ "1.1.0" ] },
|
|
585
659
|
media: { type: "string", Enum: [ "screen", "print" ] },
|
|
586
660
|
|
|
587
661
|
formatting: formattingProperties,
|
|
@@ -630,7 +704,37 @@ var ParserLint = function() {
|
|
|
630
704
|
unalignedWords: { type: 'array', optional: true, items: textFieldProperties },
|
|
631
705
|
url: { type: "string", optional: true }
|
|
632
706
|
}
|
|
633
|
-
}
|
|
707
|
+
},
|
|
708
|
+
metaTextInfo: {type:"object",
|
|
709
|
+
description: "There can only be one of these per tune",
|
|
710
|
+
properties: {
|
|
711
|
+
"abc-copyright": { type: "object", optional: true, properties: { startChar: { type: "number"}, endChar: { type: "number"}, } },
|
|
712
|
+
"abc-creator": { type: "object", optional: true, properties: { startChar: { type: "number"}, endChar: { type: "number"}, } },
|
|
713
|
+
"abc-version": { type: "object", optional: true, properties: { startChar: { type: "number"}, endChar: { type: "number"}, } },
|
|
714
|
+
"abc-charset": { type: "object", optional: true, properties: { startChar: { type: "number"}, endChar: { type: "number"}, } },
|
|
715
|
+
"abc-edited-by": { type: "object", optional: true, properties: { startChar: { type: "number"}, endChar: { type: "number"}, } },
|
|
716
|
+
author: { type: "object", optional: true, properties: { startChar: { type: "number"}, endChar: { type: "number"}, } },
|
|
717
|
+
book: { type: "object", optional: true, properties: { startChar: { type: "number"}, endChar: { type: "number"}, } },
|
|
718
|
+
composer: { type: "object", optional: true, properties: { startChar: { type: "number"}, endChar: { type: "number"}, } },
|
|
719
|
+
discography: { type: "object", optional: true, properties: { startChar: { type: "number"}, endChar: { type: "number"}, } },
|
|
720
|
+
footer: { type: "object", optional: true, properties: { startChar: { type: "number"}, endChar: { type: "number"}, } },
|
|
721
|
+
group: { type: "object", optional: true, properties: { startChar: { type: "number"}, endChar: { type: "number"}, } },
|
|
722
|
+
header: { type: "object", optional: true, properties: { startChar: { type: "number"}, endChar: { type: "number"}, } },
|
|
723
|
+
history: { type: "object", optional: true, properties: { startChar: { type: "number"}, endChar: { type: "number"}, } },
|
|
724
|
+
instruction: { type: "object", optional: true, properties: { startChar: { type: "number"}, endChar: { type: "number"}, } },
|
|
725
|
+
notes: { type: "object", optional: true, properties: { startChar: { type: "number"}, endChar: { type: "number"}, } },
|
|
726
|
+
origin: { type: "object", optional: true, properties: { startChar: { type: "number"}, endChar: { type: "number"}, } },
|
|
727
|
+
partOrder: { type: "object", optional: true, properties: { startChar: { type: "number"}, endChar: { type: "number"}, } },
|
|
728
|
+
rhythm: { type: "object", optional: true, properties: { startChar: { type: "number"}, endChar: { type: "number"}, } },
|
|
729
|
+
source: { type: "object", optional: true, properties: { startChar: { type: "number"}, endChar: { type: "number"}, } },
|
|
730
|
+
tempo: { type: "object", optional: true, properties: { startChar: { type: "number"}, endChar: { type: "number"}, } },
|
|
731
|
+
textBlock: { type: "object", optional: true, properties: { startChar: { type: "number"}, endChar: { type: "number"}, } },
|
|
732
|
+
title: { type: "object", optional: true, properties: { startChar: { type: "number"}, endChar: { type: "number"}, } },
|
|
733
|
+
transcription: { type: "object", optional: true, properties: { startChar: { type: "number"}, endChar: { type: "number"}, } },
|
|
734
|
+
unalignedWords: { type: "object", optional: true, properties: { startChar: { type: "number"}, endChar: { type: "number"}, } },
|
|
735
|
+
url: { type: "object", optional: true, properties: { startChar: { type: "number"}, endChar: { type: "number"}, } },
|
|
736
|
+
}
|
|
737
|
+
},
|
|
634
738
|
}
|
|
635
739
|
};
|
|
636
740
|
|
|
@@ -1,18 +1,4 @@
|
|
|
1
1
|
// abc_vertical_lint.js: Analyzes the vertical position of the output object.
|
|
2
|
-
// Copyright (C) 2015-2020 Paul Rosen (paul at paulrosen dot net)
|
|
3
|
-
//
|
|
4
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
|
5
|
-
// documentation files (the "Software"), to deal in the Software without restriction, including without limitation
|
|
6
|
-
// the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
|
|
7
|
-
// to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
8
|
-
//
|
|
9
|
-
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
10
|
-
//
|
|
11
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
|
|
12
|
-
// BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
13
|
-
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
14
|
-
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
15
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
16
2
|
|
|
17
3
|
//This file takes as input the output structure of the writing routine and lists the vertical position of all the elements.
|
|
18
4
|
|
|
@@ -51,6 +37,23 @@ var verticalLint = function(tunes) {
|
|
|
51
37
|
function formatArrayStart(tabs, i) {
|
|
52
38
|
return tabs + i + ": ";
|
|
53
39
|
}
|
|
40
|
+
function collectBrace(brace) {
|
|
41
|
+
var ret;
|
|
42
|
+
if (brace) {
|
|
43
|
+
ret = [];
|
|
44
|
+
for (var b1 = 0; b1 < brace.length; b1++) {
|
|
45
|
+
var bracket = {
|
|
46
|
+
x: brace[b1].x,
|
|
47
|
+
top: fixed1(brace[b1].startY),
|
|
48
|
+
bottom: fixed1(brace[b1].endY)
|
|
49
|
+
};
|
|
50
|
+
if (brace[b1].header)
|
|
51
|
+
bracket.header = brace[b1].header;
|
|
52
|
+
ret.push(bracket);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return ret;
|
|
56
|
+
}
|
|
54
57
|
function getType(obj) {
|
|
55
58
|
if (obj.$type.indexOf('staff-extra') >= 0) {
|
|
56
59
|
if (obj.elem.length === 1) {
|
|
@@ -144,6 +147,12 @@ var verticalLint = function(tunes) {
|
|
|
144
147
|
return tabs + str;
|
|
145
148
|
}
|
|
146
149
|
|
|
150
|
+
function formatClasses(obj) {
|
|
151
|
+
if (obj.classes)
|
|
152
|
+
return " " + obj.classes;
|
|
153
|
+
return '';
|
|
154
|
+
}
|
|
155
|
+
|
|
147
156
|
function formatElements(arr, indent) {
|
|
148
157
|
var tabs = "";
|
|
149
158
|
for (var i = 0; i < indent; i++) tabs += "\t";
|
|
@@ -152,9 +161,9 @@ var verticalLint = function(tunes) {
|
|
|
152
161
|
var obj = arr[i];
|
|
153
162
|
var type = getType(obj);
|
|
154
163
|
if (type === "unknown")
|
|
155
|
-
str += formatArrayStart(tabs, i) + "\n" + formatObject(obj, indent) + "\n";
|
|
164
|
+
str += formatArrayStart(tabs, i) + "\n" + formatObject(obj, indent) + formatClasses(obj) + "\n";
|
|
156
165
|
else
|
|
157
|
-
str += formatArrayStart(tabs, i) + type + ' ' + formatY(obj) + formatX(obj) + "\n";
|
|
166
|
+
str += formatArrayStart(tabs, i) + type + ' ' + formatY(obj) + formatX(obj) + formatClasses(obj) + "\n";
|
|
158
167
|
}
|
|
159
168
|
return tabs + str;
|
|
160
169
|
}
|
|
@@ -170,7 +179,7 @@ var verticalLint = function(tunes) {
|
|
|
170
179
|
var params = "";
|
|
171
180
|
for (var j = 0; j < keys.length; j++)
|
|
172
181
|
params += keys[j] + ": " + arr[i].params[keys[j]] + " ";
|
|
173
|
-
str += arr[i].type + " (" + params + ")\n";
|
|
182
|
+
str += arr[i].type + " (" + params + ")" + formatClasses(arr[i].params) + "\n";
|
|
174
183
|
}
|
|
175
184
|
return str + "\n";
|
|
176
185
|
}
|
|
@@ -235,13 +244,23 @@ var verticalLint = function(tunes) {
|
|
|
235
244
|
return str.join("\n");
|
|
236
245
|
}
|
|
237
246
|
|
|
247
|
+
function addHeader(obj) {
|
|
248
|
+
if (obj.header)
|
|
249
|
+
return " " + obj.header;
|
|
250
|
+
return "";
|
|
251
|
+
}
|
|
252
|
+
|
|
238
253
|
function formatLine(line, lineNum) {
|
|
239
254
|
var str = "";
|
|
240
255
|
str += "Line: " + lineNum + ": (" + fixed1(line.height) + ")\n";
|
|
241
|
-
if (line.brace)
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
256
|
+
if (line.brace) {
|
|
257
|
+
for (var i = 0; i < line.brace.length; i++)
|
|
258
|
+
str += "brace: " + fixed1(line.brace[i].x) + " " + formatY(line.brace[i]) + addHeader(line.brace[i]) + "\n";
|
|
259
|
+
}
|
|
260
|
+
if (line.bracket) {
|
|
261
|
+
for (var i2 = 0; i2 < line.bracket.length; i2++)
|
|
262
|
+
str += "bracket: " + fixed1(line.bracket[i2].x) + " " + formatY(line.bracket[i2]) + addHeader(line.bracket[i2]) + "\n";
|
|
263
|
+
}
|
|
245
264
|
str += "staffs: " + formatStaffs(line.staffs, 1);
|
|
246
265
|
str += "voices: " + formatVoices(line.voices, 1);
|
|
247
266
|
return str;
|
|
@@ -260,12 +279,8 @@ var verticalLint = function(tunes) {
|
|
|
260
279
|
|
|
261
280
|
function extractPositioningInfo(staffGroup, lineNum) {
|
|
262
281
|
var ret = { height: staffGroup.height, minSpace: staffGroup.minspace, spacingUnits: staffGroup.spacingunits, width: staffGroup.w, startX: staffGroup.startX, staffs: [], voices: [] };
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
}
|
|
266
|
-
if (staffGroup.bracket) {
|
|
267
|
-
ret.bracket = { x: staffGroup.bracket.x, top: fixed1(staffGroup.bracket.startY), bottom: fixed1(staffGroup.bracket.endY) };
|
|
268
|
-
}
|
|
282
|
+
ret.brace = collectBrace(staffGroup.brace);
|
|
283
|
+
ret.bracket = collectBrace(staffGroup.bracket);
|
|
269
284
|
for (var i = 0; i < staffGroup.staffs.length; i++) {
|
|
270
285
|
var staff = staffGroup.staffs[i];
|
|
271
286
|
ret.staffs.push({bottom: fixed1(staff.bottom), top: fixed1(staff.top), specialY: setSpecialY(staff) });
|
|
@@ -276,16 +291,34 @@ var verticalLint = function(tunes) {
|
|
|
276
291
|
for (var j = 0; j < voice.children.length; j++) {
|
|
277
292
|
var child = voice.children[j];
|
|
278
293
|
var type = child.type;
|
|
294
|
+
var classes = [];
|
|
295
|
+
if (child.elemset) {
|
|
296
|
+
for (var jj = 0; jj < child.elemset.length; jj++) {
|
|
297
|
+
var cl = child.elemset[jj].classList;
|
|
298
|
+
if (cl && cl.length > 0) {
|
|
299
|
+
for (var jjj = 0; jjj < cl.length; jjj++)
|
|
300
|
+
classes.push(cl[jjj]);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
279
304
|
if (type === 'note' || type === 'rest') {
|
|
280
305
|
if (child.abcelem.pitches) {
|
|
281
306
|
var pitches = [];
|
|
282
307
|
for (var ii = 0; ii < child.abcelem.pitches.length; ii++) pitches.push(child.abcelem.pitches[ii].verticalPos);
|
|
283
308
|
type += "(" + pitches.join(',') + ")";
|
|
284
|
-
} else
|
|
285
|
-
|
|
309
|
+
} else {
|
|
310
|
+
var r = "rest";
|
|
311
|
+
switch (child.abcelem.rest.type) {
|
|
312
|
+
case "invisible": r += "/inv"; break;
|
|
313
|
+
case "spacer": r += "/sp"; break;
|
|
314
|
+
}
|
|
315
|
+
type = "note(" + r + ")";
|
|
316
|
+
}
|
|
286
317
|
if (child.abcelem.lyric && child.abcelem.lyric.length > 0) type += " " + child.abcelem.lyric[0].syllable;
|
|
287
318
|
}
|
|
288
319
|
var obj2 = { $type: type, bottom: fixed1(child.bottom), top: fixed1(child.top), specialY: setSpecialY(child), minSpacing: child.minspacing, duration: child.duration, width: child.w, x: child.x };
|
|
320
|
+
if (classes.length > 0)
|
|
321
|
+
obj2.classes = classes.join(" ");
|
|
289
322
|
obj2.elem = [];
|
|
290
323
|
if (type === 'tempo') {
|
|
291
324
|
var tempo = child.children[0].tempo;
|
|
@@ -327,6 +360,19 @@ var verticalLint = function(tunes) {
|
|
|
327
360
|
var value = otherChild[key];
|
|
328
361
|
if (value === null)
|
|
329
362
|
ch.params[key] = "null";
|
|
363
|
+
else if (value === className && key === 'type')
|
|
364
|
+
;
|
|
365
|
+
else if (key === "elemset") {
|
|
366
|
+
var cls = [];
|
|
367
|
+
for (var j2 = 0; j2 < otherChild.elemset.length; j2++) {
|
|
368
|
+
var c2 = otherChild.elemset[j2].classList;
|
|
369
|
+
if (c2 && c2.length > 0) {
|
|
370
|
+
for (var j3 = 0; j3 < c2.length; j3++)
|
|
371
|
+
cls.push(c2[j3]);
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
ch.params.classes = cls.join(" ");
|
|
375
|
+
}
|
|
330
376
|
else if (typeof value === "object") {
|
|
331
377
|
var obj3 = value.constructor.name + '[';
|
|
332
378
|
switch (value.constructor.name) {
|
|
@@ -379,16 +425,32 @@ var verticalLint = function(tunes) {
|
|
|
379
425
|
return formatLine(ret, lineNum);
|
|
380
426
|
}
|
|
381
427
|
|
|
428
|
+
function extractText(label, arr) {
|
|
429
|
+
var items = [];
|
|
430
|
+
items.push(label);
|
|
431
|
+
for (var i = 0; i < arr.length; i++) {
|
|
432
|
+
var item = arr[i];
|
|
433
|
+
items.push("\t" + JSON.stringify(item));
|
|
434
|
+
}
|
|
435
|
+
items.push("");
|
|
436
|
+
return items.join("\n");
|
|
437
|
+
}
|
|
438
|
+
|
|
382
439
|
var positioning = [];
|
|
383
440
|
for (var i = 0; i < tunes.length; i++) {
|
|
384
|
-
|
|
385
|
-
|
|
441
|
+
var tune = tunes[i];
|
|
442
|
+
if (tune.topText && tune.topText.rows.length > 0)
|
|
443
|
+
positioning.push(extractText("Top Text", tune.topText.rows));
|
|
444
|
+
for (var j = 0; j < tune.lines.length; j++) {
|
|
445
|
+
var line = tune.lines[j];
|
|
386
446
|
if (line.staffGroup)
|
|
387
|
-
positioning.push(extractPositioningInfo(
|
|
447
|
+
positioning.push(extractPositioningInfo(tune.lines[j].staffGroup, j));
|
|
388
448
|
else
|
|
389
449
|
positioning.push(JSON.stringify(line));
|
|
390
450
|
}
|
|
391
451
|
}
|
|
452
|
+
if (tune.bottomText && tune.bottomText.rows.length > 0)
|
|
453
|
+
positioning.push(extractText("Bottom Text", tune.bottomText.rows));
|
|
392
454
|
return positioning;
|
|
393
455
|
};
|
|
394
456
|
|