abcjs 6.0.0-beta.9 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.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 +88 -7
- package/RELEASE.md +939 -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 +28231 -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 +216 -117
- 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 +17 -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/Dockerfile +0 -8
- 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/docker-compose.yml +0 -13
- package/docs/README.md +0 -33
- package/fix-versions.sh +0 -23
- 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
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,1095 @@
|
|
|
1
|
+
declare module 'abcjs' {
|
|
2
|
+
//
|
|
3
|
+
// Enumerations
|
|
4
|
+
//
|
|
5
|
+
|
|
6
|
+
export type Clef = 'treble' | 'tenor' | 'bass' | 'alto' | 'treble+8' | 'tenor+8' | 'bass+8' | 'alto+8' | 'treble-8' | 'tenor-8' | 'bass-8' | 'alto-8' | 'none' | 'perc';
|
|
7
|
+
|
|
8
|
+
export type Bar = 'bar_dbl_repeat' | 'bar_right_repeat' | 'bar_left_repeat' | 'bar_invisible' | 'bar_thick_thin' | 'bar_thin_thin' | 'bar_thin' | 'bar_thin_thick';
|
|
9
|
+
|
|
10
|
+
export type MeterType = 'common_time' | 'cut_time' | 'specified' | 'tempus_perfectum' | 'tempus_imperfectum' | 'tempus_perfectum_prolatio' | 'tempus_imperfectum_prolatio';
|
|
11
|
+
|
|
12
|
+
export type NoteLetter = 'A' | 'B' | 'C' | 'D' | 'E' | 'F' | 'G' | 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g';
|
|
13
|
+
|
|
14
|
+
export type AccidentalName = 'flat' | 'natural' | 'sharp' | 'dblsharp' | 'dblflat' | 'quarterflat' | 'quartersharp';
|
|
15
|
+
|
|
16
|
+
export type ChordRoot = 'A' | 'B' | 'C' | 'D' | 'E' | 'F' | 'G';
|
|
17
|
+
|
|
18
|
+
export type KeyRoot = 'A' | 'B' | 'C' | 'D' | 'E' | 'F' | 'G' | 'HP' | 'Hp' | 'none';
|
|
19
|
+
|
|
20
|
+
export type KeyAccidentalName = '' | '#' | 'b';
|
|
21
|
+
|
|
22
|
+
export type Mode = '' | 'm' | 'Dor' | 'Mix' | 'Loc' | 'Phr' | 'Lyd';
|
|
23
|
+
|
|
24
|
+
export type ChordType = '' | 'm' | '7' | 'm7' | 'maj7' | 'M7' | '6' | 'm6' | 'aug' | '+' | 'aug7' | 'dim' | 'dim7' | '9' |
|
|
25
|
+
'm9' | 'maj9' | 'M9' | '11' | 'dim9' | 'sus' | 'sus9' | '7sus4' | '7sus9' | '5';
|
|
26
|
+
|
|
27
|
+
export type Placement = 'above' | 'below';
|
|
28
|
+
|
|
29
|
+
export type ChordPlacement = 'above' | 'below' | 'left' | 'right' | 'default';
|
|
30
|
+
|
|
31
|
+
export type BracePosition = "start" | "continue" | "end";
|
|
32
|
+
|
|
33
|
+
export type Alignment = 'left' | 'center' |'right';
|
|
34
|
+
|
|
35
|
+
export type Media = 'screen' | 'print';
|
|
36
|
+
|
|
37
|
+
export type ProgressUnit = "seconds" | "beats" | "percent";
|
|
38
|
+
|
|
39
|
+
export type NoteTimingEventType = "end" | "event";
|
|
40
|
+
|
|
41
|
+
export type MidiOutputType = 'encoded' | 'binary' | 'link';
|
|
42
|
+
|
|
43
|
+
export type Responsive = 'resize';
|
|
44
|
+
|
|
45
|
+
export type DragTypes = "author" | "bar" | "brace" | "clef" | "composer" | "dynamicDecoration" | "ending" | "extraText" |
|
|
46
|
+
"freeText" | "keySignature" | "note" | "part" | "partOrder" | "rhythm" | "slur" | "subtitle" | "tempo" | "timeSignature" | "title" |
|
|
47
|
+
"unalignedWords" | "voiceName";
|
|
48
|
+
|
|
49
|
+
export type FormatAttributes = "titlefont" | "gchordfont" | "composerfont" | "footerfont" | "headerfont" | "historyfont" | "infofont" |
|
|
50
|
+
"measurefont" | "partsfont" | "repeatfont" | "subtitlefont" | "tempofont" | "textfont" | "voicefont" | "tripletfont" | "vocalfont" |
|
|
51
|
+
"wordsfont" | "annotationfont" | "scale" | "partsbox" | "freegchord" | "fontboxpadding" | "stretchlast" | "tablabelfont" | "tabnumberfont" | "tabgracefont";
|
|
52
|
+
|
|
53
|
+
export type MidiCommands = "nobarlines" | "barlines" | "beataccents" | "nobeataccents" | "droneon" | "droneoff" | "noportamento" | "channel" | "c" |
|
|
54
|
+
"drumon" | "drumoff" | "fermatafixed" | "fermataproportional" | "gchordon" | "gchordoff" | "bassvol" | "chordvol" |
|
|
55
|
+
"controlcombo" | "temperamentnormal" | "gchord" | "ptstress" | "beatmod" | "deltaloudness" | "drumbars" | "pitchbend" |
|
|
56
|
+
"gracedivider" | "makechordchannels" | "randomchordattack" | "chordattack" | "stressmodel" | "transpose" |
|
|
57
|
+
"rtranspose" | "volinc" | "program" | "ratio" | "snt" | "bendvelocity" | "control" | "temperamentlinear" | "beat" | "beatstring" |
|
|
58
|
+
"drone" | "bassprog" | "chordprog" | "drummap" | "portamento" | "expand" | "grace" | "trim" | "drum" | "chordname";
|
|
59
|
+
|
|
60
|
+
export type StemDirection = 'up' | 'down' | 'auto' | 'none';
|
|
61
|
+
|
|
62
|
+
export type NoteHeadType = 'normal' | 'harmonic' | 'rhythm' | 'x' | 'triangle';
|
|
63
|
+
|
|
64
|
+
export type Decorations = "trill" | "lowermordent" | "uppermordent" | "mordent" | "pralltriller" | "accent" |
|
|
65
|
+
"fermata" | "invertedfermata" | "tenuto" | "0" | "1" | "2" | "3" | "4" | "5" | "+" | "wedge" |
|
|
66
|
+
"open" | "thumb" | "snap" | "turn" | "roll" | "irishroll" | "breath" | "shortphrase" | "mediumphrase" | "longphrase" |
|
|
67
|
+
"segno" | "coda" | "D.S." | "D.C." | "fine" | "crescendo(" | "crescendo)" | "diminuendo(" | "diminuendo)" |
|
|
68
|
+
"p" | "pp" | "f" | "ff" | "mf" | "mp" | "ppp" | "pppp" | "fff" | "ffff" | "sfz" | "repeatbar" | "repeatbar2" | "slide" |
|
|
69
|
+
"upbow" | "downbow" | "staccato" | "trem1" | "trem2" | "trem3" | "trem4" |
|
|
70
|
+
"/" | "//" | "///" | "////" | "turnx" | "invertedturn" | "invertedturnx" | "arpeggio" | "trill(" | "trill)" | "xstem" |
|
|
71
|
+
"mark" | "marcato" | "umarcato"
|
|
72
|
+
|
|
73
|
+
//
|
|
74
|
+
// Basic types
|
|
75
|
+
//
|
|
76
|
+
export type Selector = String | HTMLElement
|
|
77
|
+
|
|
78
|
+
type NumberFunction = () => number;
|
|
79
|
+
|
|
80
|
+
export interface MeterFraction {
|
|
81
|
+
num: string;
|
|
82
|
+
den?: string;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export interface ClefProperties {
|
|
86
|
+
stafflines?: number;
|
|
87
|
+
staffscale?: number;
|
|
88
|
+
transpose?: number;
|
|
89
|
+
type: Clef;
|
|
90
|
+
verticalPos: number;
|
|
91
|
+
clefPos?: number;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export interface Meter {
|
|
95
|
+
type: MeterType;
|
|
96
|
+
value?: Array<MeterFraction>;
|
|
97
|
+
beat_division?: Array<MeterFraction>;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export interface Accidental {
|
|
101
|
+
acc: AccidentalName;
|
|
102
|
+
note: NoteLetter;
|
|
103
|
+
verticalPos: number;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export interface KeySignature {
|
|
107
|
+
accidentals?: Array<Accidental>;
|
|
108
|
+
root: KeyRoot;
|
|
109
|
+
acc: KeyAccidentalName;
|
|
110
|
+
mode: Mode;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export interface Font {
|
|
114
|
+
face: string;
|
|
115
|
+
size: number;
|
|
116
|
+
weight: 'normal' | 'bold';
|
|
117
|
+
style: 'normal' | 'italic';
|
|
118
|
+
decoration: 'none' | 'underline';
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export interface TempoProperties {
|
|
122
|
+
duration?: Array<number>;
|
|
123
|
+
bpm?: number;
|
|
124
|
+
endChar: number;
|
|
125
|
+
preString?: string;
|
|
126
|
+
postString?: string;
|
|
127
|
+
startChar: number;
|
|
128
|
+
suppress?: boolean;
|
|
129
|
+
suppressBpm?: boolean;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export interface TextFieldProperties {
|
|
133
|
+
endChar?: number;
|
|
134
|
+
font: Font;
|
|
135
|
+
text: string;
|
|
136
|
+
center?: boolean;
|
|
137
|
+
startChar?: number;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export interface ChordProperties {
|
|
141
|
+
name: string;
|
|
142
|
+
chord: {
|
|
143
|
+
root: ChordRoot;
|
|
144
|
+
type: ChordType;
|
|
145
|
+
},
|
|
146
|
+
position?: ChordPlacement
|
|
147
|
+
rel_position?: {
|
|
148
|
+
x: number;
|
|
149
|
+
y: number;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export interface CharRange {
|
|
154
|
+
startChar: number;
|
|
155
|
+
endChar: number;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export type MidiParam = Array<string|number>;
|
|
159
|
+
|
|
160
|
+
export type MidiGracePitches = Array<{instrument: string; pitch: number; volume: number; cents?: number}>;
|
|
161
|
+
|
|
162
|
+
export interface MidiPitch {
|
|
163
|
+
instrument: string;
|
|
164
|
+
pitch: number;
|
|
165
|
+
duration: number;
|
|
166
|
+
volume: number;
|
|
167
|
+
cents?: number
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export type MidiPitches = Array<MidiPitch>;
|
|
171
|
+
|
|
172
|
+
export type AbsoluteElement = any; // TODO
|
|
173
|
+
|
|
174
|
+
export type NoteProperties = any; // TODO
|
|
175
|
+
|
|
176
|
+
export type AudioTrackCommand = 'program' | 'text' | 'note';
|
|
177
|
+
//
|
|
178
|
+
// Input Types
|
|
179
|
+
//
|
|
180
|
+
|
|
181
|
+
// renderAbc
|
|
182
|
+
export interface Wrap {
|
|
183
|
+
preferredMeasuresPerLine: number;
|
|
184
|
+
minSpacing: number;
|
|
185
|
+
maxSpacing: number;
|
|
186
|
+
lastLineLimit?: number;
|
|
187
|
+
minSpacingLimit?: number;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
export interface AbcVisualParams {
|
|
191
|
+
add_classes?: boolean;
|
|
192
|
+
afterParsing?: AfterParsing;
|
|
193
|
+
ariaLabel?: string;
|
|
194
|
+
clickListener?: ClickListener;
|
|
195
|
+
dragColor?: string;
|
|
196
|
+
dragging?: boolean;
|
|
197
|
+
foregroundColor?: string;
|
|
198
|
+
format?: { [attr: FormatAttributes]: any };
|
|
199
|
+
header_only?: boolean;
|
|
200
|
+
initialClef?: boolean;
|
|
201
|
+
jazzchords?: boolean;
|
|
202
|
+
lineBreaks?: Array<number>;
|
|
203
|
+
minPadding?: number;
|
|
204
|
+
oneSvgPerLine?: boolean;
|
|
205
|
+
paddingbottom?: number;
|
|
206
|
+
paddingleft?: number;
|
|
207
|
+
paddingright?: number;
|
|
208
|
+
paddingtop?: number;
|
|
209
|
+
print?: boolean;
|
|
210
|
+
responsive?: Responsive;
|
|
211
|
+
scale?: number;
|
|
212
|
+
scrollHorizontal?: boolean;
|
|
213
|
+
selectionColor?: string;
|
|
214
|
+
selectTypes?: boolean | Array<DragTypes>;
|
|
215
|
+
showDebug?: Array<"grid" | "box">;
|
|
216
|
+
staffwidth?: number;
|
|
217
|
+
startingTune?: number;
|
|
218
|
+
stop_on_warning?: boolean;
|
|
219
|
+
textboxpadding?: number;
|
|
220
|
+
viewportHorizontal?: boolean;
|
|
221
|
+
viewportVertical?: boolean;
|
|
222
|
+
visualTranspose?: number;
|
|
223
|
+
wrap?: Wrap;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
// TimingCallbacks
|
|
227
|
+
export interface AnimationOptions {
|
|
228
|
+
qpm?: number;
|
|
229
|
+
extraMeasuresAtBeginning?: number;
|
|
230
|
+
lineEndAnticipation?: number;
|
|
231
|
+
beatSubdivisions?: number;
|
|
232
|
+
beatCallback?: BeatCallback;
|
|
233
|
+
eventCallback?: EventCallback;
|
|
234
|
+
lineEndCallback?: LineEndCallback;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
// Editor
|
|
238
|
+
|
|
239
|
+
export interface EditorSynth {
|
|
240
|
+
synthControl?: SynthObjectController;
|
|
241
|
+
el: Selector;
|
|
242
|
+
cursorControl: CursorControl;
|
|
243
|
+
options: SynthOptions;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
export interface EditorOptions {
|
|
247
|
+
canvas_id?: Selector;
|
|
248
|
+
paper_id?: Selector;
|
|
249
|
+
generate_warnings?: boolean;
|
|
250
|
+
warnings_id?: Selector;
|
|
251
|
+
onchange?: OnChange;
|
|
252
|
+
selectionChangeCallback?: SelectionChangeCallback;
|
|
253
|
+
abcjsParams?: AbcVisualParams;
|
|
254
|
+
indicate_changed?: boolean;
|
|
255
|
+
synth?: EditorSynth;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
// Audio
|
|
259
|
+
export interface NoteMapTrackItem {
|
|
260
|
+
pitch: number;
|
|
261
|
+
instrument: number;
|
|
262
|
+
start: number;
|
|
263
|
+
end: number;
|
|
264
|
+
volume: number;
|
|
265
|
+
style?: string;
|
|
266
|
+
cents?: number;
|
|
267
|
+
}
|
|
268
|
+
export type NoteMapTrack = Array<NoteMapTrackItem>
|
|
269
|
+
|
|
270
|
+
export interface SynthOptions {
|
|
271
|
+
soundFontUrl?: string;
|
|
272
|
+
soundFontVolumeMultiplier?: number;
|
|
273
|
+
programOffsets?: {[instrument: string]: number}
|
|
274
|
+
fadeLength?: number;
|
|
275
|
+
sequenceCallback?: (sequence: Array<NoteMapTrack>, context: any) => Array<NoteMapTrack>;
|
|
276
|
+
callbackContext?: any; // Anything is ok. It is just passed back in the callback
|
|
277
|
+
onEnded?: (context: any) => void;
|
|
278
|
+
pan?: Array<number>;
|
|
279
|
+
voicesOff?: boolean | Array<number>;
|
|
280
|
+
drum?: string;
|
|
281
|
+
drumBars?: number;
|
|
282
|
+
drumIntro?: number;
|
|
283
|
+
program?: number;
|
|
284
|
+
midiTranspose?: number;
|
|
285
|
+
visualTranspose?: number;
|
|
286
|
+
channel?: number;
|
|
287
|
+
qpm?: number;
|
|
288
|
+
defaultQpm?: number;
|
|
289
|
+
chordsOff?: boolean;
|
|
290
|
+
detuneOctave?: boolean;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
export interface SynthVisualOptions {
|
|
294
|
+
displayLoop?: boolean;
|
|
295
|
+
displayRestart?: boolean;
|
|
296
|
+
displayPlay?: boolean;
|
|
297
|
+
displayProgress?: boolean;
|
|
298
|
+
displayWarp?: boolean;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
export type DownloadLabelFn = (visualObj: TuneObject, index: number) => string;
|
|
302
|
+
|
|
303
|
+
export interface MidiFileOptions extends SynthOptions {
|
|
304
|
+
midiOutputType?: MidiOutputType
|
|
305
|
+
downloadClass?: string
|
|
306
|
+
preTextDownload?: string
|
|
307
|
+
downloadLabel?: string | DownloadLabelFn
|
|
308
|
+
postTextDownload?: string
|
|
309
|
+
fileName?: string
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
export interface MidiBufferOptions {
|
|
313
|
+
audioContext? : AudioContext;
|
|
314
|
+
visualObj?: TuneObject;
|
|
315
|
+
sequence?: AudioSequence;
|
|
316
|
+
millisecondsPerMeasure?: number;
|
|
317
|
+
debugCallback? : (message: string) => void;
|
|
318
|
+
options?: SynthOptions;
|
|
319
|
+
onEnded?: (context: any) => void;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
// Glyph
|
|
323
|
+
export interface GlyphDef {
|
|
324
|
+
d: Array<[string, ...number[]]>;
|
|
325
|
+
w: number;
|
|
326
|
+
h: number;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
//
|
|
330
|
+
// Return Types
|
|
331
|
+
//
|
|
332
|
+
|
|
333
|
+
// renderAbc
|
|
334
|
+
interface NoteTimingEvent {
|
|
335
|
+
milliseconds: number;
|
|
336
|
+
millisecondsPerMeasure: number;
|
|
337
|
+
type: NoteTimingEventType;
|
|
338
|
+
|
|
339
|
+
elements?: Array<HTMLElement>;
|
|
340
|
+
endChar?: number;
|
|
341
|
+
endCharArray?: Array<number>;
|
|
342
|
+
endX?: number;
|
|
343
|
+
height?: number;
|
|
344
|
+
left?: number;
|
|
345
|
+
line?: number;
|
|
346
|
+
measureNumber?: number;
|
|
347
|
+
midiPitches?: MidiPitches;
|
|
348
|
+
startChar?: number;
|
|
349
|
+
startCharArray?: Array<number>;
|
|
350
|
+
top?: number;
|
|
351
|
+
width?: number;
|
|
352
|
+
measureStart?: boolean;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
export interface PercMapElement {
|
|
356
|
+
sound: number;
|
|
357
|
+
noteHead: NoteHeadType;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
export interface Formatting {
|
|
361
|
+
alignbars?: number;
|
|
362
|
+
aligncomposer?: Alignment;
|
|
363
|
+
auquality?: string;
|
|
364
|
+
bagpipes?: boolean;
|
|
365
|
+
botmargin?: number;
|
|
366
|
+
botspace?: number;
|
|
367
|
+
bstemdown?: boolean;
|
|
368
|
+
composerspace?: number;
|
|
369
|
+
continueall?: boolean;
|
|
370
|
+
continuous?: string;
|
|
371
|
+
dynalign?: boolean;
|
|
372
|
+
exprabove?: boolean;
|
|
373
|
+
exprbelow?: boolean;
|
|
374
|
+
flatbeams?: boolean;
|
|
375
|
+
footer?: string;
|
|
376
|
+
freegchord?: boolean;
|
|
377
|
+
gchordbox?: boolean;
|
|
378
|
+
graceSlurs?: boolean;
|
|
379
|
+
gracespacebefore?: number;
|
|
380
|
+
gracespaceinside?: number;
|
|
381
|
+
gracespaceafter?: number;
|
|
382
|
+
header?: string;
|
|
383
|
+
indent?: number;
|
|
384
|
+
infoline?: boolean;
|
|
385
|
+
infospace?: number;
|
|
386
|
+
leftmargin?: number;
|
|
387
|
+
linesep?: number;
|
|
388
|
+
lineskipfac?: number;
|
|
389
|
+
map?: string;
|
|
390
|
+
maxshrink?: number;
|
|
391
|
+
maxstaffsep?: number;
|
|
392
|
+
maxsysstaffsep?: number;
|
|
393
|
+
measurebox?: boolean;
|
|
394
|
+
midi?: {
|
|
395
|
+
barlines?: MidiParam;
|
|
396
|
+
bassprog?: MidiParam;
|
|
397
|
+
bassvol?: MidiParam;
|
|
398
|
+
beat?: MidiParam;
|
|
399
|
+
beataccents?: MidiParam;
|
|
400
|
+
beatmod?: MidiParam;
|
|
401
|
+
beatstring?: MidiParam;
|
|
402
|
+
bendvelocity?: MidiParam;
|
|
403
|
+
c?: MidiParam;
|
|
404
|
+
channel?: MidiParam;
|
|
405
|
+
chordattack?: MidiParam;
|
|
406
|
+
chordname?: MidiParam;
|
|
407
|
+
chordprog?: MidiParam;
|
|
408
|
+
chordvol?: MidiParam;
|
|
409
|
+
control?: MidiParam;
|
|
410
|
+
controlcombo?: MidiParam;
|
|
411
|
+
deltaloudness?: MidiParam;
|
|
412
|
+
drone?: MidiParam;
|
|
413
|
+
droneoff?: MidiParam;
|
|
414
|
+
droneon?: MidiParam;
|
|
415
|
+
drum?: MidiParam;
|
|
416
|
+
drumbars?: MidiParam;
|
|
417
|
+
drummap: MidiParam;
|
|
418
|
+
drumoff?: MidiParam;
|
|
419
|
+
drumon?: MidiParam;
|
|
420
|
+
expand?: MidiParam;
|
|
421
|
+
fermatafixed?: MidiParam;
|
|
422
|
+
fermataproportional?: MidiParam;
|
|
423
|
+
gchord?: MidiParam;
|
|
424
|
+
gchordon?: MidiParam;
|
|
425
|
+
gchordoff?: MidiParam;
|
|
426
|
+
grace?: MidiParam;
|
|
427
|
+
gracedivider?: MidiParam;
|
|
428
|
+
makechordchannels?: MidiParam;
|
|
429
|
+
nobarlines?: MidiParam;
|
|
430
|
+
nobeataccents?: MidiParam;
|
|
431
|
+
noportamento?: MidiParam;
|
|
432
|
+
pitchbend?: MidiParam;
|
|
433
|
+
program?: MidiParam;
|
|
434
|
+
portamento?: MidiParam;
|
|
435
|
+
ptstress?: MidiParam;
|
|
436
|
+
randomchordattack?: MidiParam;
|
|
437
|
+
ratio?: MidiParam;
|
|
438
|
+
rtranspose?: MidiParam;
|
|
439
|
+
snt?: MidiParam;
|
|
440
|
+
stressmodel?: MidiParam;
|
|
441
|
+
temperamentlinear?: MidiParam;
|
|
442
|
+
temperamentnormal?: MidiParam;
|
|
443
|
+
transpose?: MidiParam;
|
|
444
|
+
trim?: MidiParam;
|
|
445
|
+
volinc: MidiParam;
|
|
446
|
+
}
|
|
447
|
+
musicspace?: number;
|
|
448
|
+
nobarcheck?: string;
|
|
449
|
+
notespacingfactor?: number;
|
|
450
|
+
parskipfac?: number;
|
|
451
|
+
partsbox?: boolean;
|
|
452
|
+
partsspace?: number;
|
|
453
|
+
percmap?: Array<PercMapElement>;
|
|
454
|
+
playtempo?: string;
|
|
455
|
+
rightmargin?: number;
|
|
456
|
+
scale?: number;
|
|
457
|
+
score?: string;
|
|
458
|
+
slurheight?: number;
|
|
459
|
+
splittune?: boolean;
|
|
460
|
+
squarebreve?: boolean;
|
|
461
|
+
staffsep?: number;
|
|
462
|
+
staffwidth?: number;
|
|
463
|
+
stemheight?: number;
|
|
464
|
+
straightflags?: boolean;
|
|
465
|
+
stretchlast?: number;
|
|
466
|
+
stretchstaff?: boolean;
|
|
467
|
+
subtitlespace?: number;
|
|
468
|
+
sysstaffsep?: number;
|
|
469
|
+
systemsep?: number;
|
|
470
|
+
textspace?: number;
|
|
471
|
+
titleformat?: string;
|
|
472
|
+
titleleft?: boolean;
|
|
473
|
+
titlespace?: number;
|
|
474
|
+
topmargin?: number;
|
|
475
|
+
topspace?: number;
|
|
476
|
+
vocalabove?: boolean;
|
|
477
|
+
vocalspace?: number;
|
|
478
|
+
wordsspace?: number;
|
|
479
|
+
|
|
480
|
+
annotationfont: Font;
|
|
481
|
+
composerfont: Font;
|
|
482
|
+
footerfont: Font;
|
|
483
|
+
gchordfont: Font;
|
|
484
|
+
headerfont: Font;
|
|
485
|
+
historyfont: Font;
|
|
486
|
+
infofont: Font;
|
|
487
|
+
measurefont: Font;
|
|
488
|
+
pageheight: number;
|
|
489
|
+
pagewidth: number;
|
|
490
|
+
partsfont: Font;
|
|
491
|
+
repeatfont: Font;
|
|
492
|
+
subtitlefont: Font;
|
|
493
|
+
tabgracefont: Font;
|
|
494
|
+
tablabelfont: Font;
|
|
495
|
+
tabnumberfont: Font;
|
|
496
|
+
tempofont: Font;
|
|
497
|
+
textfont: Font;
|
|
498
|
+
titlefont: Font;
|
|
499
|
+
tripletfont: Font;
|
|
500
|
+
vocalfont: Font;
|
|
501
|
+
voicefont: Font;
|
|
502
|
+
wordsfont: Font;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
export interface MetaText {
|
|
506
|
+
"abc-copyright"?: string;
|
|
507
|
+
"abc-creator"?: string;
|
|
508
|
+
"abc-version"?: string;
|
|
509
|
+
"abc-charset"?: string;
|
|
510
|
+
"abc-edited-by"?: string;
|
|
511
|
+
author?: string;
|
|
512
|
+
book?: string;
|
|
513
|
+
composer?: string;
|
|
514
|
+
decorationPlacement?: Placement;
|
|
515
|
+
discography?: string;
|
|
516
|
+
footer?: {
|
|
517
|
+
left: string;
|
|
518
|
+
center: string;
|
|
519
|
+
right: string;
|
|
520
|
+
};
|
|
521
|
+
group?: string;
|
|
522
|
+
header?: {
|
|
523
|
+
left: string;
|
|
524
|
+
center: string;
|
|
525
|
+
right: string;
|
|
526
|
+
}
|
|
527
|
+
history?: string;
|
|
528
|
+
instruction?: string;
|
|
529
|
+
measurebox?: boolean;
|
|
530
|
+
notes?: string;
|
|
531
|
+
origin?: string;
|
|
532
|
+
partOrder?: string;
|
|
533
|
+
rhythm?: string;
|
|
534
|
+
source?: string;
|
|
535
|
+
tempo?: TempoProperties;
|
|
536
|
+
textBlock?: string;
|
|
537
|
+
title?: string;
|
|
538
|
+
transcription?: string;
|
|
539
|
+
unalignedWords?: Array<TextFieldProperties|string>;
|
|
540
|
+
url?: string;
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
export interface MetaTextInfo {
|
|
544
|
+
"abc-copyright": CharRange;
|
|
545
|
+
"abc-creator": CharRange;
|
|
546
|
+
"abc-version": CharRange;
|
|
547
|
+
"abc-charset": CharRange;
|
|
548
|
+
"abc-edited-by": CharRange;
|
|
549
|
+
author: CharRange;
|
|
550
|
+
book: CharRange;
|
|
551
|
+
composer: CharRange;
|
|
552
|
+
discography: CharRange;
|
|
553
|
+
footer: CharRange;
|
|
554
|
+
group: CharRange;
|
|
555
|
+
header: CharRange;
|
|
556
|
+
history: CharRange;
|
|
557
|
+
instruction: CharRange;
|
|
558
|
+
notes: CharRange;
|
|
559
|
+
origin: CharRange;
|
|
560
|
+
partOrder: CharRange;
|
|
561
|
+
rhythm: CharRange;
|
|
562
|
+
source: CharRange;
|
|
563
|
+
tempo: CharRange;
|
|
564
|
+
textBlock: CharRange;
|
|
565
|
+
title: CharRange;
|
|
566
|
+
transcription: CharRange;
|
|
567
|
+
unalignedWords: CharRange;
|
|
568
|
+
url: CharRange;
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
export interface VoiceItemClef {
|
|
572
|
+
el_type: "clef";
|
|
573
|
+
stafflines?: number;
|
|
574
|
+
staffscale?: number;
|
|
575
|
+
transpose?: number;
|
|
576
|
+
type: Clef;
|
|
577
|
+
verticalPos: number;
|
|
578
|
+
clefPos?: number;
|
|
579
|
+
startChar: number;
|
|
580
|
+
endChar: number;
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
export interface VoiceItemBar {
|
|
584
|
+
el_type: "bar";
|
|
585
|
+
barNumber?: number;
|
|
586
|
+
chord?: Array<ChordProperties>;
|
|
587
|
+
decoration: Array<Decorations>;
|
|
588
|
+
endEnding?: boolean;
|
|
589
|
+
startEnding?: string;
|
|
590
|
+
startChar: number;
|
|
591
|
+
endChar: number;
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
export interface VoiceItemGap {
|
|
595
|
+
el_type: "gap";
|
|
596
|
+
gap: number;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
export interface VoiceItemKey extends KeySignature {
|
|
600
|
+
el_type: "key";
|
|
601
|
+
startChar: number;
|
|
602
|
+
endChar: number;
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
export interface VoiceItemMeter extends Meter {
|
|
606
|
+
el_type: "meter";
|
|
607
|
+
startChar: number;
|
|
608
|
+
endChar: number;
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
export interface VoiceItemMidi {
|
|
612
|
+
el_type: "midi";
|
|
613
|
+
cmd: MidiCommands;
|
|
614
|
+
params: Array<string|number>;
|
|
615
|
+
startChar: number;
|
|
616
|
+
endChar: number;
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
export interface VoiceItemOverlay {
|
|
620
|
+
el_type: "overlay";
|
|
621
|
+
startChar: number;
|
|
622
|
+
endChar: number;
|
|
623
|
+
overlay: Array<NoteProperties>;
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
export interface VoiceItemPart {
|
|
627
|
+
el_type: "part";
|
|
628
|
+
startChar: number;
|
|
629
|
+
endChar: number;
|
|
630
|
+
title: string;
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
export interface VoiceItemScale {
|
|
634
|
+
el_type: "scale";
|
|
635
|
+
size: number;
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
export interface VoiceItemStem {
|
|
639
|
+
el_type: "stem";
|
|
640
|
+
direction: StemDirection;
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
export interface VoiceItemStyle {
|
|
644
|
+
el_type: "style";
|
|
645
|
+
head: NoteHeadType;
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
export interface VoiceItemTempo extends TempoProperties {
|
|
649
|
+
el_type: "tempo";
|
|
650
|
+
startChar: number;
|
|
651
|
+
endChar: number;
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
export interface VoiceItemTranspose {
|
|
655
|
+
el_type: "transpose";
|
|
656
|
+
steps: number;
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
export interface VoiceItemNote extends NoteProperties {
|
|
660
|
+
el_type: "note";
|
|
661
|
+
startChar: number;
|
|
662
|
+
endChar: number;
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
export type VoiceItem = VoiceItemClef | VoiceItemBar | VoiceItemGap | VoiceItemKey | VoiceItemMeter | VoiceItemMidi | VoiceItemOverlay | VoiceItemPart | VoiceItemScale | VoiceItemStem | VoiceItemStyle | VoiceItemTempo | VoiceItemTranspose | VoiceItemNote;
|
|
666
|
+
|
|
667
|
+
export interface TuneLine {
|
|
668
|
+
columns?: { formatting: any, lines: any };
|
|
669
|
+
image?: string;
|
|
670
|
+
newpage?: number;
|
|
671
|
+
staffbreak?: number;
|
|
672
|
+
// Only one of separator, subtitle, text, or staff will be present
|
|
673
|
+
separator?: {
|
|
674
|
+
endChar: number;
|
|
675
|
+
lineLength?: number;
|
|
676
|
+
spaceAbove?: number;
|
|
677
|
+
spaceBelow?: number;
|
|
678
|
+
startChar: number;
|
|
679
|
+
};
|
|
680
|
+
subtitle?: {
|
|
681
|
+
endChar: number;
|
|
682
|
+
startChar: number;
|
|
683
|
+
text: string;
|
|
684
|
+
};
|
|
685
|
+
text?: {
|
|
686
|
+
endChar: number;
|
|
687
|
+
startChar: number;
|
|
688
|
+
text: TextFieldProperties;
|
|
689
|
+
};
|
|
690
|
+
staff?: Array<{
|
|
691
|
+
barNumber?: number;
|
|
692
|
+
brace: BracePosition;
|
|
693
|
+
bracket: BracePosition;
|
|
694
|
+
clef?: ClefProperties;
|
|
695
|
+
connectBarLines: BracePosition;
|
|
696
|
+
gchordfont: Font;
|
|
697
|
+
tripletfont: Font;
|
|
698
|
+
vocalfont: Font;
|
|
699
|
+
key?: KeySignature;
|
|
700
|
+
meter?: Meter;
|
|
701
|
+
spacingAbove?: number;
|
|
702
|
+
spacingBelow?: number;
|
|
703
|
+
stafflines?: number;
|
|
704
|
+
staffscale?: number;
|
|
705
|
+
title?: Array<string>;
|
|
706
|
+
voices?: Array<Array<VoiceItem>>;
|
|
707
|
+
}>
|
|
708
|
+
vskip?: number;
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
export interface TuneObject {
|
|
712
|
+
formatting: Formatting;
|
|
713
|
+
lines: Array<TuneLine>;
|
|
714
|
+
media: Media;
|
|
715
|
+
metaText: MetaText;
|
|
716
|
+
metaTextInfo: MetaTextInfo;
|
|
717
|
+
version: string;
|
|
718
|
+
|
|
719
|
+
getTotalTime: NumberFunction;
|
|
720
|
+
getTotalBeats: NumberFunction;
|
|
721
|
+
getBarLength: NumberFunction;
|
|
722
|
+
getBeatLength: NumberFunction;
|
|
723
|
+
getBeatsPerMeasure: NumberFunction;
|
|
724
|
+
getBpm: NumberFunction;
|
|
725
|
+
getMeter: () => Meter;
|
|
726
|
+
getMeterFraction: () => MeterFraction;
|
|
727
|
+
getPickupLength: NumberFunction;
|
|
728
|
+
getKeySignature: () => KeySignature;
|
|
729
|
+
getElementFromChar: (charPos: number) => VoiceItem | null;
|
|
730
|
+
millisecondsPerMeasure: NumberFunction;
|
|
731
|
+
setTiming: (bpm?: number, measuresOfDelay? : number) => void;
|
|
732
|
+
setUpAudio: (options: SynthOptions) => AudioTracks;
|
|
733
|
+
lineBreaks?: Array<number>;
|
|
734
|
+
visualTranspose?: number;
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
export type TuneObjectArray = [TuneObject]
|
|
738
|
+
|
|
739
|
+
export interface AbcElem {
|
|
740
|
+
el_type: string //TODO enumerate these
|
|
741
|
+
abselem: any;
|
|
742
|
+
beambr?: number;
|
|
743
|
+
chord?: Array<any>
|
|
744
|
+
decoration: Array<any>
|
|
745
|
+
duration: number
|
|
746
|
+
endBeam?: boolean
|
|
747
|
+
endSlur?: number
|
|
748
|
+
endTriplet?: true
|
|
749
|
+
gracenotes?: Array<any>
|
|
750
|
+
lyric?: Array<any>
|
|
751
|
+
noStem?: boolean
|
|
752
|
+
pitches?: Array<any>
|
|
753
|
+
positioning?: any
|
|
754
|
+
rest?: any
|
|
755
|
+
startBeam?: boolean
|
|
756
|
+
startTriplet?: number
|
|
757
|
+
tripletMultiplier?: number
|
|
758
|
+
tripletR?: number
|
|
759
|
+
stemConnectsToAbove?: true
|
|
760
|
+
style?: NoteHeadType
|
|
761
|
+
startChar: number
|
|
762
|
+
endChar: number
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
export interface ClickListenerDrag {
|
|
766
|
+
step: number;
|
|
767
|
+
max: number;
|
|
768
|
+
index: number;
|
|
769
|
+
setSelection: (index: number) => void;
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
export interface ClickListenerAnalysis {
|
|
773
|
+
staffPos: number;
|
|
774
|
+
name: string;
|
|
775
|
+
clickedName: string;
|
|
776
|
+
parentClasses: Array<string>;
|
|
777
|
+
clickedClasses: Array<string>;
|
|
778
|
+
voice: number;
|
|
779
|
+
line: number;
|
|
780
|
+
measure: number;
|
|
781
|
+
selectableElement: HTMLElement;
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
// TimingCallbacks
|
|
785
|
+
export interface LineEndInfo {
|
|
786
|
+
milliseconds: number;
|
|
787
|
+
top: number;
|
|
788
|
+
bottom: number;
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
export interface LineEndDetails {
|
|
792
|
+
line: number;
|
|
793
|
+
endTimings: Array<LineEndInfo>;
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
export interface TimingEvent {
|
|
797
|
+
type: "event";
|
|
798
|
+
milliseconds: number;
|
|
799
|
+
millisecondsPerMeasure: number;
|
|
800
|
+
line: number;
|
|
801
|
+
measureNumber: number;
|
|
802
|
+
top: number;
|
|
803
|
+
height: number;
|
|
804
|
+
left: number;
|
|
805
|
+
width: number;
|
|
806
|
+
elements: Array< HTMLElement>;
|
|
807
|
+
startCharArray: Array<number>;
|
|
808
|
+
endCharArray: Array<number>;
|
|
809
|
+
midiPitches: MidiPitches
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
export interface TimingCallbacksPosition {
|
|
813
|
+
top: number;
|
|
814
|
+
left: number;
|
|
815
|
+
height: number
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
export interface TimingCallbacksDebug {
|
|
819
|
+
timestamp: number;
|
|
820
|
+
startTime: number;
|
|
821
|
+
ev: NoteTimingEvent;
|
|
822
|
+
endMs: number;
|
|
823
|
+
offMs: number;
|
|
824
|
+
offPs: number;
|
|
825
|
+
gapMs: number;
|
|
826
|
+
gapPx: number;
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
// Audio
|
|
830
|
+
export interface SequenceInstrument {
|
|
831
|
+
el_type: "instrument";
|
|
832
|
+
program: number;
|
|
833
|
+
pickupLength: number;
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
export interface SequenceChannel {
|
|
837
|
+
el_type: "channel";
|
|
838
|
+
channel: number;
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
export interface SequenceTranspose {
|
|
842
|
+
el_type: "transpose";
|
|
843
|
+
transpose: number;
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
export interface SequenceName {
|
|
847
|
+
el_type: "name";
|
|
848
|
+
trackName: string;
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
export interface SequenceDrum {
|
|
852
|
+
el_type: "drum";
|
|
853
|
+
pattern: string;
|
|
854
|
+
on: boolean;
|
|
855
|
+
bars?: number;
|
|
856
|
+
intro?: number;
|
|
857
|
+
}
|
|
858
|
+
|
|
859
|
+
export interface SequenceTempo {
|
|
860
|
+
el_type: "tempo";
|
|
861
|
+
qpm: number;
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
export interface SequenceKey {
|
|
865
|
+
el_type: "key";
|
|
866
|
+
accidentals: Array<Accidental>;
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
export interface SequenceBeat {
|
|
870
|
+
el_type: "beat";
|
|
871
|
+
beats: [number,number,number];
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
export interface SequenceBeatAccents {
|
|
875
|
+
el_type: "beataccents";
|
|
876
|
+
value: boolean;
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
export interface SequenceBagpipes {
|
|
880
|
+
el_type: "bagpipes";
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
export interface SequenceNote {
|
|
884
|
+
el_type: "note";
|
|
885
|
+
duration: number;
|
|
886
|
+
elem: AbsoluteElement;
|
|
887
|
+
pitches: {pitch: number; name: NoteLetter};
|
|
888
|
+
timing: number;
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
export type AudioSequenceElement = SequenceInstrument | SequenceChannel | SequenceTranspose | SequenceName | SequenceDrum | SequenceTempo | SequenceKey | SequenceBeat | SequenceBeatAccents | SequenceBagpipes | SequenceNote;
|
|
892
|
+
|
|
893
|
+
export type AudioSequenceVoice = Array<AudioSequenceElement>;
|
|
894
|
+
|
|
895
|
+
export type AudioSequence = Array<AudioSequenceVoice>;
|
|
896
|
+
|
|
897
|
+
export type MidiFile = any // This is a standard midi file format
|
|
898
|
+
|
|
899
|
+
export interface MidiBufferPromise {
|
|
900
|
+
cached: Array<string>;
|
|
901
|
+
error: Array<string>;
|
|
902
|
+
loaded: Array<string>;
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
export interface AudioTrack {
|
|
906
|
+
cmd: AudioTrackCommand;
|
|
907
|
+
[param: any]; // TODO - make this a union
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
export interface AudioTracks {
|
|
911
|
+
tempo: number;
|
|
912
|
+
instrument: number;
|
|
913
|
+
tracks: Array<AudioTrack>;
|
|
914
|
+
totalDuration: number;
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
// Analysis
|
|
918
|
+
export interface AnalyzedTune {
|
|
919
|
+
abc: string;
|
|
920
|
+
id: string;
|
|
921
|
+
pure: string;
|
|
922
|
+
startPos: number;
|
|
923
|
+
title: string;
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
export interface MeasureDef {
|
|
927
|
+
abc: string;
|
|
928
|
+
startEnding?: string;
|
|
929
|
+
endEnding?: true;
|
|
930
|
+
}
|
|
931
|
+
|
|
932
|
+
export interface MeasureList {
|
|
933
|
+
header: string;
|
|
934
|
+
measures: Array<MeasureDef>;
|
|
935
|
+
hasPickup: boolean
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
|
|
939
|
+
//
|
|
940
|
+
// Callbacks
|
|
941
|
+
//
|
|
942
|
+
|
|
943
|
+
// renderAbc
|
|
944
|
+
export type ClickListener = (abcElem: AbcElem, tuneNumber: number, classes: string, analysis: ClickListenerAnalysis, drag: ClickListenerDrag) => void;
|
|
945
|
+
|
|
946
|
+
export type AfterParsing = (tune: TuneObject, tuneNumber: number, abcString: string) => TuneObject;
|
|
947
|
+
|
|
948
|
+
// TimingCallbacks
|
|
949
|
+
export type BeatCallback = (beatNumber: number, totalBeats: number, totalTime: number, position: TimingCallbacksPosition, debugInfo: TimingCallbacksDebug) => void;
|
|
950
|
+
|
|
951
|
+
export type EventCallback = (event: TimingEvent) => void;
|
|
952
|
+
|
|
953
|
+
export type LineEndCallback = (info : LineEndInfo, event: TimingEvent, details: LineEndDetails) => void;
|
|
954
|
+
|
|
955
|
+
// Editor
|
|
956
|
+
export type OnChange = (editor: Editor) => void;
|
|
957
|
+
|
|
958
|
+
export type SelectionChangeCallback = (startChar: number, endChar: number) => void;
|
|
959
|
+
|
|
960
|
+
// Audio
|
|
961
|
+
export interface CursorControl {
|
|
962
|
+
beatSubDivision?: number
|
|
963
|
+
|
|
964
|
+
onReady?(): void
|
|
965
|
+
onStart?(): void
|
|
966
|
+
onFinished?(): void
|
|
967
|
+
onBeat?(beatNumber: number, totalBeats: number, totalTime: number): void
|
|
968
|
+
onEvent?(event: NoteTimingEvent): void
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
//
|
|
972
|
+
// Visual
|
|
973
|
+
//
|
|
974
|
+
let signature: string;
|
|
975
|
+
|
|
976
|
+
export function renderAbc(target: Selector, code: string, params?: AbcVisualParams): TuneObjectArray
|
|
977
|
+
|
|
978
|
+
export function parseOnly(abc: string, params?: AbcVisualParams) : TuneObjectArray
|
|
979
|
+
|
|
980
|
+
//
|
|
981
|
+
// Animation
|
|
982
|
+
//
|
|
983
|
+
export class TimingCallbacks {
|
|
984
|
+
constructor(visualObj: TuneObject, options?: AnimationOptions) ;
|
|
985
|
+
replaceTarget(visualObj: TuneObject): void;
|
|
986
|
+
start(position?: number, units?: ProgressUnit) : void;
|
|
987
|
+
pause() : void;
|
|
988
|
+
reset() : void;
|
|
989
|
+
stop() : void;
|
|
990
|
+
setProgress(position: number, units?: ProgressUnit ) : void;
|
|
991
|
+
currentMillisecond(): number;
|
|
992
|
+
|
|
993
|
+
noteTimings: Array<NoteTimingEvent>;
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
//
|
|
997
|
+
// Editor
|
|
998
|
+
//
|
|
999
|
+
export class Editor {
|
|
1000
|
+
constructor(target: Selector, options: EditorOptions);
|
|
1001
|
+
paramChanged(options: AbcVisualParams): void;
|
|
1002
|
+
synthParamChanged(options: SynthOptions): void;
|
|
1003
|
+
setNotDirty(): void;
|
|
1004
|
+
isDirty(): boolean;
|
|
1005
|
+
pause(shouldPause: boolean): void;
|
|
1006
|
+
millisecondsPerMeasure(): number;
|
|
1007
|
+
pauseMidi(shouldPause: boolean): void;
|
|
1008
|
+
}
|
|
1009
|
+
|
|
1010
|
+
//
|
|
1011
|
+
// Audio
|
|
1012
|
+
//
|
|
1013
|
+
export interface AudioControl {
|
|
1014
|
+
disable: (isDisabled: boolean) => void;
|
|
1015
|
+
setWarp: (tempo: number, warp: number) => void;
|
|
1016
|
+
setTempo: (tempo: number) => void;
|
|
1017
|
+
resetAll: () => void;
|
|
1018
|
+
pushPlay: (push: boolean) => void;
|
|
1019
|
+
pushLoop: (push: boolean) => void;
|
|
1020
|
+
setProgress: (percent: number, totalTime: number) => void;
|
|
1021
|
+
}
|
|
1022
|
+
|
|
1023
|
+
export interface MidiBuffer {
|
|
1024
|
+
init(params?: MidiBufferOptions): Promise<MidiBufferPromise>
|
|
1025
|
+
prime(): Promise<void>
|
|
1026
|
+
start(): void
|
|
1027
|
+
pause(): number
|
|
1028
|
+
resume(): void
|
|
1029
|
+
seek(position: number, units?: ProgressUnit): void
|
|
1030
|
+
stop(): number
|
|
1031
|
+
download(): string // returns audio buffer in wav format as a reference to a blob
|
|
1032
|
+
}
|
|
1033
|
+
|
|
1034
|
+
export interface SynthInitResponse {
|
|
1035
|
+
status: "no-audio-context" | "created";
|
|
1036
|
+
loadingResponse?: {
|
|
1037
|
+
cached: Array<string>
|
|
1038
|
+
error: Array<string>
|
|
1039
|
+
loaded: Array<string>
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
export interface SynthObjectController {
|
|
1044
|
+
disable(isDisabled: boolean): void
|
|
1045
|
+
setTune(visualObj: TuneObject, userAction: Boolean, audioParams?: AbcVisualParams): Promise<SynthInitResponse>
|
|
1046
|
+
load(selector: string, cursorControl?: any, visualOptions?: SynthVisualOptions): void
|
|
1047
|
+
play(): void
|
|
1048
|
+
pause(): void
|
|
1049
|
+
toggleLoop(): void
|
|
1050
|
+
restart(): void
|
|
1051
|
+
setProgress(ev: number): void
|
|
1052
|
+
setWarp(percent: number): void
|
|
1053
|
+
download(fName: string): void
|
|
1054
|
+
}
|
|
1055
|
+
|
|
1056
|
+
export interface SynthSequenceClass {
|
|
1057
|
+
// TODO
|
|
1058
|
+
}
|
|
1059
|
+
|
|
1060
|
+
export namespace synth {
|
|
1061
|
+
let instrumentIndexToName: [string]
|
|
1062
|
+
let pitchToNoteName: [string]
|
|
1063
|
+
let SynthController: { new (): SynthObjectController }
|
|
1064
|
+
let CreateSynth: { new (): MidiBuffer }
|
|
1065
|
+
let SynthSequence: { new (): SynthSequenceClass }
|
|
1066
|
+
|
|
1067
|
+
export function supportsAudio(): boolean
|
|
1068
|
+
export function registerAudioContext(ac?: AudioContext): boolean
|
|
1069
|
+
export function activeAudioContext(): AudioContext
|
|
1070
|
+
export function CreateSynthControl(element: Selector, options: AbcVisualParams): AudioControl
|
|
1071
|
+
export function getMidiFile(source: String | TuneObject, options?: MidiFileOptions): MidiFile;
|
|
1072
|
+
export function playEvent(pitches: MidiPitches, graceNotes: MidiGracePitches, milliSecondsPerMeasure: number): Promise<void>;
|
|
1073
|
+
export function sequence(visualObj: TuneObject, options: AbcVisualParams): AudioSequence
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1076
|
+
//
|
|
1077
|
+
// Analysis
|
|
1078
|
+
//
|
|
1079
|
+
export class TuneBook {
|
|
1080
|
+
constructor(tunebookString: string) ;
|
|
1081
|
+
getTuneById(id: string | number): AnalyzedTune;
|
|
1082
|
+
getTuneByTitle(id: string): AnalyzedTune;
|
|
1083
|
+
|
|
1084
|
+
header: string;
|
|
1085
|
+
tunes: Array<AnalyzedTune>;
|
|
1086
|
+
}
|
|
1087
|
+
|
|
1088
|
+
export function numberOfTunes(abc: string) : number;
|
|
1089
|
+
export function extractMeasures(abc: string) : Array<MeasureList>;
|
|
1090
|
+
|
|
1091
|
+
//
|
|
1092
|
+
// Glyph
|
|
1093
|
+
//
|
|
1094
|
+
export function setGlyph(glyphName: string, glyph: GlyphDef) : void;
|
|
1095
|
+
}
|