-
Notifications
You must be signed in to change notification settings - Fork 202
/
NotationSettings.ts
382 lines (325 loc) · 9.59 KB
/
NotationSettings.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
/**
* Lists the different modes on how rhythm notation is shown on the tab staff.
*/
export enum TabRhythmMode {
/**
* Rhythm notation is hidden.
*/
Hidden,
/**
* Rhythm notation is shown with individual beams per beat.
*/
ShowWithBeams,
/**
* Rhythm notation is shown and behaves like normal score notation with connected bars.
*/
ShowWithBars
}
/**
* Lists all modes on how fingerings should be displayed.
*/
export enum FingeringMode {
/**
* Fingerings will be shown in the standard notation staff.
*/
ScoreDefault,
/**
* Fingerings will be shown in the standard notation staff. Piano finger style is enforced, where
* fingers are rendered as 1-5 instead of p,i,m,a,c and T,1,2,3,4.
*/
ScoreForcePiano,
/**
* Fingerings will be shown in a effect band above the tabs in case
* they have only a single note on the beat.
*/
SingleNoteEffectBand,
/**
* Fingerings will be shown in a effect band above the tabs in case
* they have only a single note on the beat. Piano finger style is enforced, where
* fingers are rendered as 1-5 instead of p,i,m,a,c and T,1,2,3,4.
*/
SingleNoteEffectBandForcePiano
}
/**
* Lists all modes on how alphaTab can handle the display and playback of music notation.
*/
export enum NotationMode {
/**
* Music elements will be displayed and played as in Guitar Pro.
*/
GuitarPro,
/**
* Music elements will be displayed and played as in traditional songbooks.
* Changes:
* 1. Bends
* For bends additional grace beats are introduced.
* Bends are categorized into gradual and fast bends.
* - Gradual bends are indicated by beat text "grad" or "grad.". Bend will sound along the beat duration.
* - Fast bends are done right before the next note. If the next note is tied even on-beat of the next note.
* 2. Whammy Bars
* Dips are shown as simple annotation over the beats
* Whammy Bars are categorized into gradual and fast.
* - Gradual whammys are indicated by beat text "grad" or "grad.". Whammys will sound along the beat duration.
* - Fast whammys are done right the beat.
* 3. Let Ring
* Tied notes with let ring are not shown in standard notation
* Let ring does not cause a longer playback, duration is defined via tied notes.
*/
SongBook
}
/**
* Lists all major music notation elements that are part
* of the music sheet and can be dynamically controlled to be shown
* or hidden.
*/
export enum NotationElement {
/**
* The score title shown at the start of the music sheet.
*/
ScoreTitle,
/**
* The score subtitle shown at the start of the music sheet.
*/
ScoreSubTitle,
/**
* The score artist shown at the start of the music sheet.
*/
ScoreArtist,
/**
* The score album shown at the start of the music sheet.
*/
ScoreAlbum,
/**
* The score words author shown at the start of the music sheet.
*/
ScoreWords,
/**
* The score music author shown at the start of the music sheet.
*/
ScoreMusic,
/**
* The score words&music author shown at the start of the music sheet.
*/
ScoreWordsAndMusic,
/**
* The score copyright owner shown at the start of the music sheet.
*/
ScoreCopyright,
/**
* The tuning information of the guitar shown
* above the staves.
*/
GuitarTuning,
/**
* The track names which are shown in the accolade.
*/
TrackNames,
/**
* The chord diagrams for guitars. Usually shown
* below the score info.
*/
ChordDiagrams,
/**
* Parenthesis that are shown for tied bends
* if they are preceeded by bends.
*/
ParenthesisOnTiedBends,
/**
* The tab number for tied notes if the
* bend of a note is increased at that point.
*/
TabNotesOnTiedBends,
/**
* Zero tab numbers on "dive whammys".
*/
ZerosOnDiveWhammys,
/**
* The alternate endings information on repeats shown above the staff.
*/
EffectAlternateEndings,
/**
* The information about the fret on which the capo is placed shown above the staff.
*/
EffectCapo,
/**
* The chord names shown above beats shown above the staff.
*/
EffectChordNames,
/**
* The crescendo/decrescendo angle shown above the staff.
*/
EffectCrescendo,
/**
* The beat dynamics shown above the staff.
*/
EffectDynamics,
/**
* The curved angle for fade in/out effects shown above the staff.
*/
EffectFadeIn,
/**
* The fermata symbol shown above the staff.
*/
EffectFermata,
/**
* The fingering information.
*/
EffectFingering,
/**
* The harmonics names shown above the staff.
* (does not represent the harmonic note heads)
*/
EffectHarmonics,
/**
* The let ring name and line above the staff.
*/
EffectLetRing,
/**
* The lyrics of the track shown above the staff.
*/
EffectLyrics,
/**
* The section markers shown above the staff.
*/
EffectMarker,
/**
* The ottava symbol and lines shown above the staff.
*/
EffectOttavia,
/**
* The palm mute name and line shown above the staff.
*/
EffectPalmMute,
/**
* The pick slide information shown above the staff.
* (does not control the pick slide lines)
*/
EffectPickSlide,
/**
* The pick stroke symbols shown above the staff.
*/
EffectPickStroke,
/**
* The slight beat vibrato waves shown above the staff.
*/
EffectSlightBeatVibrato,
/**
* The slight note vibrato waves shown above the staff.
*/
EffectSlightNoteVibrato,
/**
* The tap/slap/pop effect names shown above the staff.
*/
EffectTap,
/**
* The tempo information shown above the staff.
*/
EffectTempo,
/**
* The additional beat text shown above the staff.
*/
EffectText,
/**
* The trill name and waves shown above the staff.
*/
EffectTrill,
/**
* The triplet feel symbol shown above the staff.
*/
EffectTripletFeel,
/**
* The whammy bar information shown above the staff.
* (does not control the whammy lines shown within the staff)
*/
EffectWhammyBar,
/**
* The wide beat vibrato waves shown above the staff.
*/
EffectWideBeatVibrato,
/**
* The wide note vibrato waves shown above the staff.
*/
EffectWideNoteVibrato,
/**
* The left hand tap symbol shown above the staff.
*/
EffectLeftHandTap
}
/**
* The notation settings control how various music notation elements are shown and behaving
* @json
*/
export class NotationSettings {
/**
* Gets or sets the mode to use for display and play music notation elements.
*/
public notationMode: NotationMode = NotationMode.GuitarPro;
/**
* Gets or sets the fingering mode to use.
*/
public fingeringMode: FingeringMode = FingeringMode.ScoreDefault;
/**
* Gets or sets the configuration on whether music notation elements are visible or not.
* If notation elements are not specified, the default configuration will be applied.
*/
public elements: Map<NotationElement, boolean> = new Map();
/**
* Gets the default configuration of the {@see notationElements} setting. Do not modify
* this map as it might not result in the expected side effects.
* If items are not listed explicitly in this list, they are considered visible.
*/
public static defaultElements: Map<NotationElement, boolean> = new Map([
[NotationElement.ZerosOnDiveWhammys, false]
]);
/**
* Whether to show rhythm notation in the guitar tablature.
*/
public rhythmMode: TabRhythmMode = TabRhythmMode.Hidden;
/**
* The height of the rythm bars.
*/
public rhythmHeight: number = 15;
/**
* The transposition pitch offsets for the individual tracks.
* They apply to rendering and playback.
*/
public transpositionPitches: number[] = [];
/**
* The transposition pitch offsets for the individual tracks.
* They apply to rendering only.
*/
public displayTranspositionPitches: number[] = [];
/**
* If set to true the guitar tabs on grace beats are rendered smaller.
*/
public smallGraceTabNotes: boolean = true;
/**
* If set to true bend arrows expand to the end of the last tied note
* of the string. Otherwise they end on the next beat.
*/
public extendBendArrowsOnTiedNotes: boolean = true;
/**
* If set to true, line effects (like w/bar, let-ring etc)
* are drawn until the end of the beat instead of the start.
*/
public extendLineEffectsToBeatEnd: boolean = false;
/**
* Gets or sets the height for slurs. The factor is multiplied with the a logarithmic distance
* between slur start and end.
*/
public slurHeight: number = 5.0;
/**
* Gets whether the given music notation element should be shown
* @param element the element to check
* @returns true if the element should be shown, otherwise false.
*/
public isNotationElementVisible(element: NotationElement): boolean {
if (this.elements.has(element)) {
return this.elements.get(element)!;
}
if (NotationSettings.defaultElements.has(element)) {
return NotationSettings.defaultElements.get(element)!;
}
return true;
}
}