abcjs 6.2.3 → 6.4.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/README.md +8 -0
- package/RELEASE.md +84 -1
- package/dist/abcjs-basic-min.js +2 -2
- package/dist/abcjs-basic.js +1775 -1034
- package/dist/abcjs-basic.js.map +1 -1
- package/dist/abcjs-plugin-min.js +2 -2
- package/index.js +3 -0
- package/package.json +1 -1
- package/plugin.js +1 -1
- package/src/api/abc_tablatures.js +48 -13
- package/src/api/tune-metrics.js +18 -0
- package/src/data/abc_tune.js +13 -2
- package/src/edit/abc_editarea.js +4 -1
- package/src/parse/abc_parse.js +2 -0
- package/src/parse/abc_parse_directive.js +23 -16
- package/src/parse/abc_parse_header.js +22 -19
- package/src/parse/abc_tokenizer.js +72 -7
- package/src/parse/tune-builder.js +60 -1
- package/src/synth/abc_midi_flattener.js +40 -462
- package/src/synth/abc_midi_sequencer.js +25 -10
- package/src/synth/chord-track.js +562 -0
- package/src/synth/create-note-map.js +2 -1
- package/src/synth/create-synth.js +91 -42
- package/src/synth/synth-controller.js +6 -2
- package/src/tablatures/instruments/string-patterns.js +11 -0
- package/src/tablatures/instruments/{violin/violin-patterns.js → tab-string-patterns.js} +6 -6
- package/src/tablatures/instruments/{violin/tab-violin.js → tab-string.js} +13 -11
- package/src/tablatures/tab-absolute-elements.js +16 -7
- package/src/tablatures/tab-renderer.js +22 -9
- package/src/test/abc_parser_lint.js +14 -12
- package/src/write/creation/abstract-engraver.js +6 -2
- package/src/write/creation/add-chord.js +102 -82
- package/src/write/creation/add-text-if.js +2 -2
- package/src/write/creation/decoration.js +16 -9
- package/src/write/creation/elements/bottom-text.js +62 -47
- package/src/write/creation/elements/rich-text.js +51 -0
- package/src/write/creation/elements/tie-element.js +23 -0
- package/src/write/creation/elements/top-text.js +37 -11
- package/src/write/creation/glyphs.js +1 -1
- package/src/write/draw/absolute.js +4 -1
- package/src/write/draw/draw.js +13 -4
- package/src/write/draw/non-music.js +3 -1
- package/src/write/draw/relative.js +1 -1
- package/src/write/draw/tempo.js +1 -1
- package/src/write/draw/text.js +10 -0
- package/src/write/engraver-controller.js +62 -17
- package/src/write/helpers/classes.js +1 -1
- package/src/write/helpers/get-font-and-attr.js +8 -1
- package/src/write/helpers/get-text-size.js +8 -1
- package/src/write/interactive/create-analysis.js +50 -0
- package/src/write/interactive/find-selectable-element.js +24 -0
- package/src/write/interactive/selection.js +5 -45
- package/src/write/layout/layout-in-grid.js +83 -0
- package/src/write/layout/layout.js +29 -24
- package/src/write/layout/set-upper-and-lower-elements.js +2 -0
- package/src/write/layout/staff-group.js +2 -2
- package/src/write/layout/voice-elements.js +1 -1
- package/src/write/layout/voice.js +1 -1
- package/src/write/renderer.js +3 -0
- package/src/write/svg.js +30 -0
- package/temp.txt +3 -0
- package/types/index.d.ts +142 -38
- package/version.js +1 -1
- package/.github/workflows/tests.yml +0 -29
- package/abc2xml_239/abc2xml.html +0 -769
- package/abc2xml_239/abc2xml.py +0 -2248
- package/abc2xml_239/abc2xml_changelog.html +0 -124
- package/abc2xml_239/lazy-river.abc +0 -26
- package/abc2xml_239/lazy-river.xml +0 -3698
- package/abc2xml_239/mean-to-me.abc +0 -22
- package/abc2xml_239/mean-to-me.xml +0 -2954
- package/abc2xml_239/pyparsing.py +0 -3672
- package/abc2xml_239/pyparsing.pyc +0 -0
- package/src/tablatures/instruments/guitar/guitar-patterns.js +0 -23
- package/src/tablatures/instruments/guitar/tab-guitar.js +0 -48
|
@@ -19,7 +19,7 @@ function checkLastBarX(voices) {
|
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
var layoutStaffGroup = function (spacing,
|
|
22
|
+
var layoutStaffGroup = function (spacing, minPadding, debug, staffGroup, leftEdge) {
|
|
23
23
|
var epsilon = 0.0000001; // Fudging for inexactness of floating point math.
|
|
24
24
|
var spacingunits = 0; // number of times we will have ended up using the spacing distance (as opposed to fixed width distances)
|
|
25
25
|
var minspace = 1000; // a big number to start off with - used to find out what the smallest space between two notes is -- GD 2014.1.7
|
|
@@ -82,7 +82,7 @@ var layoutStaffGroup = function (spacing, renderer, debug, staffGroup, leftEdge)
|
|
|
82
82
|
var topVoice = (lastTopVoice !== undefined && currentvoices[lastTopVoice].voicenumber !== v.voicenumber) ? currentvoices[lastTopVoice] : undefined;
|
|
83
83
|
if (!isSameStaff(v, topVoice))
|
|
84
84
|
topVoice = undefined;
|
|
85
|
-
var voicechildx = layoutVoiceElements.layoutOneItem(x, spacing, v,
|
|
85
|
+
var voicechildx = layoutVoiceElements.layoutOneItem(x, spacing, v, minPadding, topVoice);
|
|
86
86
|
var dx = voicechildx - x;
|
|
87
87
|
if (dx > 0) {
|
|
88
88
|
x = voicechildx; //update x
|
|
@@ -96,7 +96,7 @@ VoiceElement.shiftRight = function (dx, voice) {
|
|
|
96
96
|
|
|
97
97
|
// call when spacingduration has been updated
|
|
98
98
|
VoiceElement.updateNextX = function (x, spacing, voice) {
|
|
99
|
-
voice.nextx = x + (spacing *
|
|
99
|
+
voice.nextx = x + (spacing * this.getSpacingUnits(voice));
|
|
100
100
|
};
|
|
101
101
|
|
|
102
102
|
VoiceElement.updateIndices = function (voice) {
|
|
@@ -36,7 +36,7 @@ function moveDecorations(beam) {
|
|
|
36
36
|
var top = yAtNote(child, beam);
|
|
37
37
|
for (var i = 0; i < child.children.length; i++) {
|
|
38
38
|
var el = child.children[i];
|
|
39
|
-
if (el.klass === 'ornament') {
|
|
39
|
+
if (el.klass === 'ornament' && el.position !== 'below') {
|
|
40
40
|
if (el.bottom - padding < top) {
|
|
41
41
|
var distance = top - el.bottom + padding; // Find the distance that it needs to move and add a little margin so the element doesn't touch the beam.
|
|
42
42
|
el.bottom += distance;
|
package/src/write/renderer.js
CHANGED
|
@@ -103,6 +103,7 @@ Renderer.prototype.initVerticalSpace = function () {
|
|
|
103
103
|
parts: 11.33, // Set the vertical space above a new part.
|
|
104
104
|
slurHeight: 1.0, // Set the slur height factor.
|
|
105
105
|
staffSeparation: 61.33, // Do not put a staff system closer than <unit> from the previous system.
|
|
106
|
+
staffTopMargin: 0,
|
|
106
107
|
stemHeight: 26.67 + 10, // Set the stem height.
|
|
107
108
|
subtitle: 3.78, // Set the vertical space above the subtitle.
|
|
108
109
|
systemStaffSeparation: 48, // Do not place the staves closer than <unit> inside a system. * This values applies to all staves when in the tune header. Otherwise, it applies to the next staff
|
|
@@ -157,6 +158,8 @@ Renderer.prototype.setVerticalSpace = function (formatting) {
|
|
|
157
158
|
this.spacing.title = formatting.titlespace * 4 / 3;
|
|
158
159
|
if (formatting.sysstaffsep !== undefined)
|
|
159
160
|
this.spacing.systemStaffSeparation = formatting.sysstaffsep * 4 / 3;
|
|
161
|
+
if (formatting.stafftopmargin !== undefined)
|
|
162
|
+
this.spacing.staffTopMargin = formatting.stafftopmargin * 4 / 3;
|
|
160
163
|
if (formatting.subtitlespace !== undefined)
|
|
161
164
|
this.spacing.subtitle = formatting.subtitlespace * 4 / 3;
|
|
162
165
|
if (formatting.topspace !== undefined)
|
package/src/write/svg.js
CHANGED
|
@@ -211,6 +211,36 @@ Svg.prototype.text = function (text, attr, target) {
|
|
|
211
211
|
return el;
|
|
212
212
|
};
|
|
213
213
|
|
|
214
|
+
Svg.prototype.richTextLine = function (phrases, x, y, klass, anchor, target) {
|
|
215
|
+
var el = document.createElementNS(svgNS, 'text');
|
|
216
|
+
el.setAttribute("stroke", "none");
|
|
217
|
+
el.setAttribute("class", klass);
|
|
218
|
+
el.setAttribute("x", x);
|
|
219
|
+
el.setAttribute("y", y);
|
|
220
|
+
el.setAttribute("text-anchor", anchor);
|
|
221
|
+
el.setAttribute("dominant-baseline", "middle");
|
|
222
|
+
|
|
223
|
+
for (var i = 0; i < phrases.length; i++) {
|
|
224
|
+
var phrase = phrases[i]
|
|
225
|
+
var tspan = document.createElementNS(svgNS, 'tspan');
|
|
226
|
+
var attrs = Object.keys(phrase.attrs)
|
|
227
|
+
for (var j = 0; j < attrs.length; j++) {
|
|
228
|
+
var value = phrase.attrs[attrs[j]]
|
|
229
|
+
if (value !== '')
|
|
230
|
+
tspan.setAttribute(attrs[j], value)
|
|
231
|
+
}
|
|
232
|
+
tspan.textContent = phrase.content;
|
|
233
|
+
|
|
234
|
+
el.appendChild(tspan);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
if (target)
|
|
238
|
+
target.appendChild(el);
|
|
239
|
+
else
|
|
240
|
+
this.append(el);
|
|
241
|
+
return el;
|
|
242
|
+
}
|
|
243
|
+
|
|
214
244
|
Svg.prototype.guessWidth = function (text, attr) {
|
|
215
245
|
var svg = this.createDummySvg();
|
|
216
246
|
var el = this.text(text, attr, svg);
|
package/temp.txt
ADDED
package/types/index.d.ts
CHANGED
|
@@ -48,14 +48,14 @@ declare module 'abcjs' {
|
|
|
48
48
|
|
|
49
49
|
export type FormatAttributes = "titlefont" | "gchordfont" | "composerfont" | "footerfont" | "headerfont" | "historyfont" | "infofont" |
|
|
50
50
|
"measurefont" | "partsfont" | "repeatfont" | "subtitlefont" | "tempofont" | "textfont" | "voicefont" | "tripletfont" | "vocalfont" |
|
|
51
|
-
"wordsfont" | "annotationfont" | "scale" | "partsbox" | "freegchord" | "fontboxpadding" | "stretchlast" | "tablabelfont" | "tabnumberfont" | "tabgracefont";
|
|
51
|
+
"wordsfont" | "annotationfont" | "scale" | "partsbox" | "freegchord" | "fontboxpadding" | "stretchlast" | "tablabelfont" | "tabnumberfont" | "tabgracefont" | 'stafftopmargin';
|
|
52
52
|
|
|
53
53
|
export type MidiCommands = "nobarlines" | "barlines" | "beataccents" | "nobeataccents" | "droneon" | "droneoff" | "noportamento" | "channel" | "c" |
|
|
54
54
|
"drumon" | "drumoff" | "fermatafixed" | "fermataproportional" | "gchordon" | "gchordoff" | "bassvol" | "chordvol" | "bassprog" | "chordprog" |
|
|
55
55
|
"controlcombo" | "temperamentnormal" | "gchord" | "ptstress" | "beatmod" | "deltaloudness" | "drumbars" | "pitchbend" |
|
|
56
56
|
"gracedivider" | "makechordchannels" | "randomchordattack" | "chordattack" | "stressmodel" | "transpose" |
|
|
57
57
|
"rtranspose" | "volinc" | "program" | "ratio" | "snt" | "bendvelocity" | "control" | "temperamentlinear" | "beat" | "beatstring" |
|
|
58
|
-
"drone" | "
|
|
58
|
+
"drone" | "drummap" | "portamento" | "expand" | "grace" | "trim" | "drum" | "chordname";
|
|
59
59
|
|
|
60
60
|
export type StemDirection = 'up' | 'down' | 'auto' | 'none';
|
|
61
61
|
|
|
@@ -262,6 +262,7 @@ declare module 'abcjs' {
|
|
|
262
262
|
}
|
|
263
263
|
|
|
264
264
|
export interface AbcVisualParams {
|
|
265
|
+
accentAbove?: boolean;
|
|
265
266
|
add_classes?: boolean;
|
|
266
267
|
afterParsing?: AfterParsing;
|
|
267
268
|
ariaLabel?: string;
|
|
@@ -291,10 +292,12 @@ declare module 'abcjs' {
|
|
|
291
292
|
selectTypes?: boolean | Array<DragTypes>;
|
|
292
293
|
showDebug?: Array<"grid" | "box">;
|
|
293
294
|
staffwidth?: number;
|
|
295
|
+
stafftopmargin?: number;
|
|
294
296
|
startingTune?: number;
|
|
295
297
|
stop_on_warning?: boolean;
|
|
296
298
|
tablature?: Array<Tablature>;
|
|
297
299
|
textboxpadding?: number;
|
|
300
|
+
timeBasedLayout?: { minPadding?:number, minWidth?:number, align?: 'left'|'center'};
|
|
298
301
|
viewportHorizontal?: boolean;
|
|
299
302
|
viewportVertical?: boolean;
|
|
300
303
|
visualTranspose?: number;
|
|
@@ -317,8 +320,8 @@ declare module 'abcjs' {
|
|
|
317
320
|
export interface EditorSynth {
|
|
318
321
|
synthControl?: SynthObjectController;
|
|
319
322
|
el: Selector;
|
|
320
|
-
cursorControl
|
|
321
|
-
options
|
|
323
|
+
cursorControl?: CursorControl;
|
|
324
|
+
options?: SynthOptions;
|
|
322
325
|
}
|
|
323
326
|
|
|
324
327
|
export interface EditorOptions {
|
|
@@ -336,7 +339,7 @@ declare module 'abcjs' {
|
|
|
336
339
|
// Audio
|
|
337
340
|
export interface NoteMapTrackItem {
|
|
338
341
|
pitch: number;
|
|
339
|
-
instrument:
|
|
342
|
+
instrument: string;
|
|
340
343
|
start: number;
|
|
341
344
|
end: number;
|
|
342
345
|
startChar: number;
|
|
@@ -360,6 +363,7 @@ declare module 'abcjs' {
|
|
|
360
363
|
drum?: string;
|
|
361
364
|
drumBars?: number;
|
|
362
365
|
drumIntro?: number;
|
|
366
|
+
drumOff?: boolean;
|
|
363
367
|
program?: number;
|
|
364
368
|
midiTranspose?: number;
|
|
365
369
|
visualTranspose?: number;
|
|
@@ -368,6 +372,13 @@ declare module 'abcjs' {
|
|
|
368
372
|
defaultQpm?: number;
|
|
369
373
|
chordsOff?: boolean;
|
|
370
374
|
detuneOctave?: boolean;
|
|
375
|
+
|
|
376
|
+
swing?: number;
|
|
377
|
+
bassprog?: number;
|
|
378
|
+
bassvol?: number;
|
|
379
|
+
chordprog?: number;
|
|
380
|
+
chordvol?: number;
|
|
381
|
+
gchord?: string;
|
|
371
382
|
}
|
|
372
383
|
|
|
373
384
|
export interface SynthVisualOptions {
|
|
@@ -553,6 +564,7 @@ declare module 'abcjs' {
|
|
|
553
564
|
subtitlespace?: number;
|
|
554
565
|
sysstaffsep?: number;
|
|
555
566
|
systemsep?: number;
|
|
567
|
+
stafftopmargin?: number;
|
|
556
568
|
textspace?: number;
|
|
557
569
|
titleformat?: string;
|
|
558
570
|
titleleft?: boolean;
|
|
@@ -776,8 +788,10 @@ declare module 'abcjs' {
|
|
|
776
788
|
el_type: "note";
|
|
777
789
|
startChar: number;
|
|
778
790
|
endChar: number;
|
|
791
|
+
duration: number;
|
|
792
|
+
pitches?: Array<any>; // TODO-PER
|
|
793
|
+
rest?: { type: 'rest' | 'spacer' | 'invisible' | 'invisible-multimeasure' | 'multimeasure', text? : number};
|
|
779
794
|
}
|
|
780
|
-
|
|
781
795
|
export type VoiceItem = VoiceItemClef | VoiceItemBar | VoiceItemGap | VoiceItemKey | VoiceItemMeter | VoiceItemMidi | VoiceItemOverlay | VoiceItemPart | VoiceItemScale | VoiceItemStem | VoiceItemStyle | VoiceItemTempo | VoiceItemTranspose | VoiceItemNote;
|
|
782
796
|
|
|
783
797
|
export interface TuneLine {
|
|
@@ -804,26 +818,59 @@ declare module 'abcjs' {
|
|
|
804
818
|
text: TextFieldProperties;
|
|
805
819
|
};
|
|
806
820
|
staff?: Array<{
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
821
|
+
clef?: ClefProperties;
|
|
822
|
+
key?: KeySignature;
|
|
823
|
+
meter?: Meter;
|
|
824
|
+
voices?: Array<Array<VoiceItem>>;
|
|
825
|
+
}>;
|
|
826
|
+
staffGroup?: {
|
|
827
|
+
barNumber?: number;
|
|
828
|
+
brace?: BracePosition;
|
|
829
|
+
bracket?: BracePosition;
|
|
830
|
+
connectBarLines?: BracePosition;
|
|
831
|
+
gchordfont?: Font;
|
|
832
|
+
tripletfont?: Font;
|
|
833
|
+
vocalfont?: Font;
|
|
834
|
+
spacingAbove?: number;
|
|
835
|
+
spacingBelow?: number;
|
|
836
|
+
stafflines?: number;
|
|
837
|
+
staffscale?: number;
|
|
838
|
+
title?: Array<string>;
|
|
839
|
+
height?:number;
|
|
840
|
+
line?: number;
|
|
841
|
+
startx?:number;
|
|
842
|
+
w?:number;
|
|
843
|
+
gridStart?:number;
|
|
844
|
+
gridEnd?:number;
|
|
845
|
+
};
|
|
824
846
|
vskip?: number;
|
|
825
847
|
}
|
|
826
848
|
|
|
849
|
+
export interface Selectable {
|
|
850
|
+
absEl: AbsoluteElement;
|
|
851
|
+
isDraggable: boolean;
|
|
852
|
+
staffPos: {
|
|
853
|
+
height: number;
|
|
854
|
+
top: number;
|
|
855
|
+
zero: number;
|
|
856
|
+
}
|
|
857
|
+
svgEl: SVGElement;
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
export interface SelectableReturn {
|
|
861
|
+
index: number;
|
|
862
|
+
classes: Array<string>;
|
|
863
|
+
element: Selectable;
|
|
864
|
+
analysis: {
|
|
865
|
+
staffPos: number;
|
|
866
|
+
name: string;
|
|
867
|
+
voice: number;
|
|
868
|
+
line: number;
|
|
869
|
+
measure: number;
|
|
870
|
+
selectableElement: HTMLElement;
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
|
|
827
874
|
export interface TuneObject {
|
|
828
875
|
formatting: Formatting;
|
|
829
876
|
engraver?: EngraverController;
|
|
@@ -832,6 +879,7 @@ declare module 'abcjs' {
|
|
|
832
879
|
metaText: MetaText;
|
|
833
880
|
metaTextInfo: MetaTextInfo;
|
|
834
881
|
version: string;
|
|
882
|
+
warnings?: Array<string>;
|
|
835
883
|
|
|
836
884
|
getTotalTime: NumberFunction;
|
|
837
885
|
getTotalBeats: NumberFunction;
|
|
@@ -846,25 +894,18 @@ declare module 'abcjs' {
|
|
|
846
894
|
getElementFromChar: (charPos: number) => VoiceItem | null;
|
|
847
895
|
millisecondsPerMeasure: (bpm?: number) => number;
|
|
848
896
|
setTiming: (bpm?: number, measuresOfDelay? : number) => void;
|
|
897
|
+
setupEvents: (startingDelay: number, timeDivider:number, startingBpm: number, warp?: number) => Array<NoteTimingEvent>;
|
|
849
898
|
setUpAudio: (options: SynthOptions) => AudioTracks;
|
|
850
899
|
makeVoicesArray: () => Array<Selectable[]>
|
|
851
900
|
deline: () => Array<TuneLine>;
|
|
901
|
+
findSelectableElement: (target: HTMLElement) => SelectableReturn | null;
|
|
902
|
+
getSelectableArray: () => Array<Selectable>
|
|
852
903
|
lineBreaks?: Array<number>;
|
|
853
904
|
visualTranspose?: number;
|
|
854
905
|
}
|
|
855
906
|
|
|
856
907
|
export type TuneObjectArray = [TuneObject]
|
|
857
908
|
|
|
858
|
-
export interface Selectable {
|
|
859
|
-
absEl: AbsoluteElement;
|
|
860
|
-
isDraggable: boolean;
|
|
861
|
-
staffPos: {
|
|
862
|
-
height: number;
|
|
863
|
-
top: number;
|
|
864
|
-
zero: number;
|
|
865
|
-
}
|
|
866
|
-
}
|
|
867
|
-
|
|
868
909
|
export interface AbcElem {
|
|
869
910
|
el_type: string; //TODO enumerate these
|
|
870
911
|
abselem: AbsoluteElement;
|
|
@@ -1026,10 +1067,30 @@ declare module 'abcjs' {
|
|
|
1026
1067
|
loaded: Array<string>;
|
|
1027
1068
|
}
|
|
1028
1069
|
|
|
1029
|
-
export interface
|
|
1030
|
-
cmd:
|
|
1031
|
-
|
|
1070
|
+
export interface AudioTrackProgramItem {
|
|
1071
|
+
cmd: 'program';
|
|
1072
|
+
channel: number;
|
|
1073
|
+
instrument: number;
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1076
|
+
export interface AudioTrackNoteItem {
|
|
1077
|
+
cmd: 'note';
|
|
1078
|
+
duration: number;
|
|
1079
|
+
endChar: number;
|
|
1080
|
+
endType?: "staccato"|"tenuto";
|
|
1081
|
+
gap: number;
|
|
1082
|
+
instrument: number;
|
|
1083
|
+
pitch: number;
|
|
1084
|
+
start: number;
|
|
1085
|
+
startChar: number;
|
|
1086
|
+
volume: number;
|
|
1032
1087
|
}
|
|
1088
|
+
export interface AudioTrackTextItem {
|
|
1089
|
+
cmd: 'text';
|
|
1090
|
+
type: 'name';
|
|
1091
|
+
text: string;
|
|
1092
|
+
}
|
|
1093
|
+
export type AudioTrack = Array<AudioTrackProgramItem|AudioTrackNoteItem|AudioTrackTextItem>
|
|
1033
1094
|
|
|
1034
1095
|
export interface AudioTracks {
|
|
1035
1096
|
tempo: number;
|
|
@@ -1101,6 +1162,8 @@ declare module 'abcjs' {
|
|
|
1101
1162
|
|
|
1102
1163
|
export function renderAbc(target: Selector, code: string, params?: AbcVisualParams): TuneObjectArray
|
|
1103
1164
|
|
|
1165
|
+
export function tuneMetrics(code: string, params?: AbcVisualParams): Array<{sections: Array<{left: number, measureWidths:Array<number>, total: number}>}>
|
|
1166
|
+
|
|
1104
1167
|
export function parseOnly(abc: string, params?: AbcVisualParams) : TuneObjectArray
|
|
1105
1168
|
|
|
1106
1169
|
//
|
|
@@ -1157,6 +1220,7 @@ declare module 'abcjs' {
|
|
|
1157
1220
|
stop(): number
|
|
1158
1221
|
download(): string // returns audio buffer in wav format as a reference to a blob
|
|
1159
1222
|
getIsRunning(): boolean
|
|
1223
|
+
getAudioBuffer(): AudioBuffer | undefined
|
|
1160
1224
|
}
|
|
1161
1225
|
|
|
1162
1226
|
export interface SynthInitResponse {
|
|
@@ -1188,6 +1252,45 @@ declare module 'abcjs' {
|
|
|
1188
1252
|
appendNote(trackNumber: number, pitch: number, durationInMeasures: number, volume: number, cents: number): void
|
|
1189
1253
|
}
|
|
1190
1254
|
|
|
1255
|
+
export interface MidiRenderer {
|
|
1256
|
+
setTempo(bpm: number): void
|
|
1257
|
+
setGlobalInfo(bpm: number, name: string, key:KeySignature, time:MeterFraction): void
|
|
1258
|
+
startTrack(): void
|
|
1259
|
+
endTrack(): void
|
|
1260
|
+
setText(type: string, text: string):void
|
|
1261
|
+
setInstrument(instrument: number):void
|
|
1262
|
+
setChannel(channel:number, pan?: number):void
|
|
1263
|
+
startNote(pitch:number, loudness:number, cents?:number):void
|
|
1264
|
+
endNote(pitch:number):void
|
|
1265
|
+
addRest(length:number):void
|
|
1266
|
+
|
|
1267
|
+
getData():string
|
|
1268
|
+
embed(parent:Element, noplayer:boolean):void
|
|
1269
|
+
}
|
|
1270
|
+
|
|
1271
|
+
export interface SynthControlOptions {
|
|
1272
|
+
ac?: AudioContext;
|
|
1273
|
+
afterResume?: () => void;
|
|
1274
|
+
loopHandler?: (ev: any) => Promise<void>;
|
|
1275
|
+
restartHandler?: (ev: any) => Promise<void>;
|
|
1276
|
+
playHandler?: (ev: any) => Promise<void>;
|
|
1277
|
+
playPromiseHandler?: (ev: any) => Promise<void>;
|
|
1278
|
+
progressHandler?: (ev: any) => Promise<void>;
|
|
1279
|
+
warpHandler?: (ev: any) => Promise<void>;
|
|
1280
|
+
hasClock?: boolean;
|
|
1281
|
+
repeatTitle?: string;
|
|
1282
|
+
repeatAria?: string;
|
|
1283
|
+
restartTitle?: string;
|
|
1284
|
+
restartAria?: string;
|
|
1285
|
+
playTitle?: string;
|
|
1286
|
+
playAria?: string;
|
|
1287
|
+
randomTitle?: string;
|
|
1288
|
+
randomAria?: string;
|
|
1289
|
+
warpTitle?: string;
|
|
1290
|
+
warpAria?: string;
|
|
1291
|
+
bpm?: string;
|
|
1292
|
+
}
|
|
1293
|
+
|
|
1191
1294
|
export namespace synth {
|
|
1192
1295
|
let instrumentIndexToName: [string]
|
|
1193
1296
|
let pitchToNoteName: [string]
|
|
@@ -1198,10 +1301,11 @@ declare module 'abcjs' {
|
|
|
1198
1301
|
export function supportsAudio(): boolean
|
|
1199
1302
|
export function registerAudioContext(ac?: AudioContext): boolean
|
|
1200
1303
|
export function activeAudioContext(): AudioContext
|
|
1201
|
-
export function CreateSynthControl(element: Selector, options
|
|
1304
|
+
export function CreateSynthControl(element: Selector, options?: SynthControlOptions): AudioControl
|
|
1202
1305
|
export function getMidiFile(source: string | TuneObject, options?: MidiFileOptions): MidiFile;
|
|
1203
1306
|
export function playEvent(pitches: MidiPitches, graceNotes: MidiGracePitches | undefined, milliSecondsPerMeasure: number, soundFontUrl? : string, debugCallback?: (message: string) => void): Promise<void>;
|
|
1204
1307
|
export function sequence(visualObj: TuneObject, options: AbcVisualParams): AudioSequence
|
|
1308
|
+
export function midiRenderer(): MidiRenderer
|
|
1205
1309
|
}
|
|
1206
1310
|
|
|
1207
1311
|
//
|
|
@@ -1219,7 +1323,7 @@ declare module 'abcjs' {
|
|
|
1219
1323
|
export function numberOfTunes(abc: string) : number;
|
|
1220
1324
|
export function extractMeasures(abc: string) : Array<MeasureList>;
|
|
1221
1325
|
|
|
1222
|
-
export function strTranspose(originalAbc: string, visualObj:
|
|
1326
|
+
export function strTranspose(originalAbc: string, visualObj: TuneObjectArray, steps: number): string;
|
|
1223
1327
|
|
|
1224
1328
|
//
|
|
1225
1329
|
// Glyph
|
package/version.js
CHANGED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
name: Tests
|
|
2
|
-
|
|
3
|
-
on: [push, pull_request]
|
|
4
|
-
|
|
5
|
-
jobs:
|
|
6
|
-
Jest:
|
|
7
|
-
runs-on: ubuntu-latest
|
|
8
|
-
steps:
|
|
9
|
-
- uses: actions/checkout@v2
|
|
10
|
-
|
|
11
|
-
- name: Cache node modules
|
|
12
|
-
uses: actions/cache@v2
|
|
13
|
-
env:
|
|
14
|
-
cache-name: cache-node-modules
|
|
15
|
-
with:
|
|
16
|
-
path: ~/.npm
|
|
17
|
-
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
|
18
|
-
restore-keys: |
|
|
19
|
-
${{ runner.os }}-build-${{ env.cache-name }}-
|
|
20
|
-
${{ runner.os }}-build-
|
|
21
|
-
${{ runner.os }}-
|
|
22
|
-
|
|
23
|
-
- name: Install Dependencies
|
|
24
|
-
run: npm install --color="always"
|
|
25
|
-
|
|
26
|
-
- name: Install Dependencies
|
|
27
|
-
run: npm test -- --colors
|
|
28
|
-
|
|
29
|
-
|