smoosic 1.0.24 → 1.0.26

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.
Files changed (189) hide show
  1. package/build/smoosic.js +1 -1
  2. package/package.json +1 -1
  3. package/release/smoosic.js +1 -1
  4. package/release/styles/ribbon.css +5 -10
  5. package/src/application/exports.ts +1 -0
  6. package/src/styles/ribbon.css +5 -10
  7. package/types/src/application/application.d.ts +102 -102
  8. package/types/src/application/common.d.ts +74 -74
  9. package/types/src/application/configuration.d.ts +74 -74
  10. package/types/src/application/dom.d.ts +8 -8
  11. package/types/src/application/dynamicInit.d.ts +1 -1
  12. package/types/src/application/eventHandler.d.ts +78 -78
  13. package/types/src/application/exports.d.ts +494 -493
  14. package/types/src/application/generateVexTests.d.ts +10 -10
  15. package/types/src/application/keyCommands.d.ts +90 -90
  16. package/types/src/common/bootstrap.bundle.d.ts +1138 -1138
  17. package/types/src/common/htmlHelpers.d.ts +105 -105
  18. package/types/src/common/jszip.d.ts +2 -2
  19. package/types/src/common/midi-parser.d.ts +38 -38
  20. package/types/src/common/promiseHelpers.d.ts +30 -30
  21. package/types/src/common/serializationHelpers.d.ts +29 -29
  22. package/types/src/common/textformatter.d.ts +140 -140
  23. package/types/src/common/vex.d.ts +222 -222
  24. package/types/src/render/audio/musicCursor.d.ts +25 -25
  25. package/types/src/render/audio/oscillator.d.ts +98 -98
  26. package/types/src/render/audio/player.d.ts +141 -141
  27. package/types/src/render/audio/samples.d.ts +56 -56
  28. package/types/src/render/sui/configuration.d.ts +12 -12
  29. package/types/src/render/sui/formatter.d.ts +151 -151
  30. package/types/src/render/sui/layoutDebug.d.ts +43 -43
  31. package/types/src/render/sui/mapper.d.ts +116 -116
  32. package/types/src/render/sui/piano.d.ts +46 -46
  33. package/types/src/render/sui/renderState.d.ts +88 -88
  34. package/types/src/render/sui/scoreRender.d.ts +93 -93
  35. package/types/src/render/sui/scoreView.d.ts +267 -267
  36. package/types/src/render/sui/scoreViewOperations.d.ts +594 -594
  37. package/types/src/render/sui/scroller.d.ts +34 -34
  38. package/types/src/render/sui/svgHelpers.d.ts +85 -85
  39. package/types/src/render/sui/svgPageMap.d.ts +318 -318
  40. package/types/src/render/sui/textEdit.d.ts +310 -310
  41. package/types/src/render/sui/textRender.d.ts +189 -189
  42. package/types/src/render/sui/tracker.d.ts +90 -90
  43. package/types/src/render/vex/glyphDimensions.d.ts +23 -23
  44. package/types/src/render/vex/smoAdapter.d.ts +46 -46
  45. package/types/src/render/vex/toVex.d.ts +13 -13
  46. package/types/src/render/vex/vxMeasure.d.ts +95 -95
  47. package/types/src/render/vex/vxNote.d.ts +55 -55
  48. package/types/src/render/vex/vxSystem.d.ts +64 -64
  49. package/types/src/smo/data/common.d.ts +220 -220
  50. package/types/src/smo/data/measure.d.ts +510 -510
  51. package/types/src/smo/data/measureModifiers.d.ts +506 -506
  52. package/types/src/smo/data/music.d.ts +438 -438
  53. package/types/src/smo/data/note.d.ts +485 -485
  54. package/types/src/smo/data/noteModifiers.d.ts +590 -590
  55. package/types/src/smo/data/partInfo.d.ts +162 -162
  56. package/types/src/smo/data/score.d.ts +395 -395
  57. package/types/src/smo/data/scoreModifiers.d.ts +433 -433
  58. package/types/src/smo/data/scoreText.d.ts +277 -277
  59. package/types/src/smo/data/staffModifiers.d.ts +767 -767
  60. package/types/src/smo/data/systemStaff.d.ts +238 -238
  61. package/types/src/smo/data/tuplet.d.ts +146 -146
  62. package/types/src/smo/midi/midiToSmo.d.ts +198 -198
  63. package/types/src/smo/midi/smoToMidi.d.ts +23 -23
  64. package/types/src/smo/mxml/smoToXml.d.ts +165 -165
  65. package/types/src/smo/mxml/xmlHelpers.d.ts +140 -140
  66. package/types/src/smo/mxml/xmlState.d.ts +257 -257
  67. package/types/src/smo/mxml/xmlToSmo.d.ts +92 -92
  68. package/types/src/smo/xform/beamers.d.ts +46 -46
  69. package/types/src/smo/xform/copypaste.d.ts +99 -99
  70. package/types/src/smo/xform/operations.d.ts +127 -127
  71. package/types/src/smo/xform/roadmap.d.ts +70 -70
  72. package/types/src/smo/xform/selections.d.ts +153 -153
  73. package/types/src/smo/xform/tickDuration.d.ts +155 -155
  74. package/types/src/smo/xform/tickMap.d.ts +34 -34
  75. package/types/src/smo/xform/undo.d.ts +142 -142
  76. package/types/src/smo/xform/updateAudio.d.ts +9 -9
  77. package/types/src/styles/font_metrics/Commissioner-Medium-Metrics.d.ts +871 -871
  78. package/types/src/styles/font_metrics/ConcertOne-Regular.d.ts +871 -871
  79. package/types/src/styles/font_metrics/Merriweather-Regular.d.ts +871 -871
  80. package/types/src/styles/font_metrics/arial_metrics.d.ts +870 -870
  81. package/types/src/styles/font_metrics/ssp-sans-metrics.d.ts +871 -871
  82. package/types/src/styles/font_metrics/ssp-serif-metrics.d.ts +871 -871
  83. package/types/src/styles/font_metrics/times_metrics.d.ts +870 -870
  84. package/types/src/ui/buttons/button.d.ts +95 -95
  85. package/types/src/ui/buttons/collapsable.d.ts +42 -42
  86. package/types/src/ui/buttons/display.d.ts +23 -23
  87. package/types/src/ui/buttons/ribbon.d.ts +76 -76
  88. package/types/src/ui/common.d.ts +45 -45
  89. package/types/src/ui/composable/draggable.d.ts +12 -12
  90. package/types/src/ui/configuration.d.ts +31 -31
  91. package/types/src/ui/dialogs/adapter.d.ts +107 -107
  92. package/types/src/ui/dialogs/addMeasure.d.ts +20 -20
  93. package/types/src/ui/dialogs/arpeggio.d.ts +2 -2
  94. package/types/src/ui/dialogs/articulation.d.ts +2 -2
  95. package/types/src/ui/dialogs/audioSettings.d.ts +32 -32
  96. package/types/src/ui/dialogs/chordChange.d.ts +35 -35
  97. package/types/src/ui/dialogs/clefChange.d.ts +2 -2
  98. package/types/src/ui/dialogs/components/baseComponent.d.ts +158 -158
  99. package/types/src/ui/dialogs/components/button.d.ts +54 -54
  100. package/types/src/ui/dialogs/components/buttonArray.d.ts +101 -101
  101. package/types/src/ui/dialogs/components/checkdrop.d.ts +27 -27
  102. package/types/src/ui/dialogs/components/dragText.d.ts +27 -27
  103. package/types/src/ui/dialogs/components/dropdown.d.ts +78 -78
  104. package/types/src/ui/dialogs/components/fileDownload.d.ts +28 -28
  105. package/types/src/ui/dialogs/components/fontComponent.d.ts +32 -32
  106. package/types/src/ui/dialogs/components/noteText.d.ts +98 -98
  107. package/types/src/ui/dialogs/components/pitch.d.ts +95 -95
  108. package/types/src/ui/dialogs/components/rocker.d.ts +66 -66
  109. package/types/src/ui/dialogs/components/staffComponents.d.ts +77 -77
  110. package/types/src/ui/dialogs/components/textCheck.d.ts +38 -38
  111. package/types/src/ui/dialogs/components/textInPlace.d.ts +90 -90
  112. package/types/src/ui/dialogs/components/textInput.d.ts +58 -58
  113. package/types/src/ui/dialogs/components/tie.d.ts +41 -41
  114. package/types/src/ui/dialogs/components/toggle.d.ts +53 -53
  115. package/types/src/ui/dialogs/components/tree.d.ts +46 -46
  116. package/types/src/ui/dialogs/customTuplets.d.ts +25 -25
  117. package/types/src/ui/dialogs/dialog.d.ts +201 -201
  118. package/types/src/ui/dialogs/durations.d.ts +2 -2
  119. package/types/src/ui/dialogs/dynamics.d.ts +37 -37
  120. package/types/src/ui/dialogs/endings.d.ts +61 -61
  121. package/types/src/ui/dialogs/factory.d.ts +15 -15
  122. package/types/src/ui/dialogs/fileDialogs.d.ts +4 -4
  123. package/types/src/ui/dialogs/fonts.d.ts +2 -2
  124. package/types/src/ui/dialogs/globalLayout.d.ts +2 -2
  125. package/types/src/ui/dialogs/gracenote.d.ts +2 -2
  126. package/types/src/ui/dialogs/hairpin.d.ts +35 -35
  127. package/types/src/ui/dialogs/instrument.d.ts +3 -3
  128. package/types/src/ui/dialogs/keySignature.d.ts +33 -33
  129. package/types/src/ui/dialogs/library.d.ts +70 -70
  130. package/types/src/ui/dialogs/lyric.d.ts +39 -39
  131. package/types/src/ui/dialogs/measureFormat.d.ts +52 -52
  132. package/types/src/ui/dialogs/microtones.d.ts +2 -2
  133. package/types/src/ui/dialogs/noteHead.d.ts +2 -2
  134. package/types/src/ui/dialogs/ornament.d.ts +2 -2
  135. package/types/src/ui/dialogs/pageLayout.d.ts +2 -2
  136. package/types/src/ui/dialogs/partInfo.d.ts +2 -2
  137. package/types/src/ui/dialogs/pedalMarking.d.ts +35 -35
  138. package/types/src/ui/dialogs/pitch.d.ts +2 -2
  139. package/types/src/ui/dialogs/preferences.d.ts +2 -2
  140. package/types/src/ui/dialogs/scoreId.d.ts +2 -2
  141. package/types/src/ui/dialogs/scoreView.d.ts +2 -2
  142. package/types/src/ui/dialogs/slur.d.ts +57 -57
  143. package/types/src/ui/dialogs/staffGroup.d.ts +2 -2
  144. package/types/src/ui/dialogs/tabNote.d.ts +32 -32
  145. package/types/src/ui/dialogs/tabStave.d.ts +43 -43
  146. package/types/src/ui/dialogs/tempo.d.ts +50 -50
  147. package/types/src/ui/dialogs/textBlock.d.ts +61 -61
  148. package/types/src/ui/dialogs/textBracket.d.ts +35 -35
  149. package/types/src/ui/dialogs/tie.d.ts +41 -41
  150. package/types/src/ui/dialogs/timeSignature.d.ts +34 -34
  151. package/types/src/ui/dialogs/transposeScore.d.ts +2 -2
  152. package/types/src/ui/dialogs/volta.d.ts +40 -40
  153. package/types/src/ui/eventSource.d.ts +63 -63
  154. package/types/src/ui/exceptions.d.ts +12 -12
  155. package/types/src/ui/fileio/fileInput.d.ts +12 -12
  156. package/types/src/ui/fileio/library.d.ts +40 -40
  157. package/types/src/ui/fileio/xhrLoader.d.ts +18 -18
  158. package/types/src/ui/help.d.ts +22 -22
  159. package/types/src/ui/i18n/language.d.ts +37 -37
  160. package/types/src/ui/i18n/language_ar.d.ts +5 -5
  161. package/types/src/ui/i18n/language_de.d.ts +1 -1
  162. package/types/src/ui/i18n/language_en.d.ts +18 -18
  163. package/types/src/ui/i18n/translationEditor.d.ts +14 -14
  164. package/types/src/ui/keyBindings/default/editorKeys.d.ts +7 -7
  165. package/types/src/ui/keyBindings/default/trackerKeys.d.ts +7 -7
  166. package/types/src/ui/menus/beams.d.ts +13 -13
  167. package/types/src/ui/menus/edit.d.ts +8 -8
  168. package/types/src/ui/menus/file.d.ts +26 -26
  169. package/types/src/ui/menus/help.d.ts +8 -8
  170. package/types/src/ui/menus/keySignature.d.ts +13 -13
  171. package/types/src/ui/menus/language.d.ts +12 -12
  172. package/types/src/ui/menus/manager.d.ts +57 -57
  173. package/types/src/ui/menus/measure.d.ts +8 -8
  174. package/types/src/ui/menus/menu.d.ts +136 -136
  175. package/types/src/ui/menus/note.d.ts +8 -8
  176. package/types/src/ui/menus/partSelection.d.ts +19 -19
  177. package/types/src/ui/menus/parts.d.ts +50 -50
  178. package/types/src/ui/menus/score.d.ts +20 -20
  179. package/types/src/ui/menus/staffModifier.d.ts +21 -21
  180. package/types/src/ui/menus/text.d.ts +8 -8
  181. package/types/src/ui/menus/timeSignature.d.ts +12 -12
  182. package/types/src/ui/menus/tuplets.d.ts +13 -13
  183. package/types/src/ui/menus/voices.d.ts +8 -8
  184. package/types/src/ui/modalDialogs.d.ts +1 -1
  185. package/types/src/ui/navigation.d.ts +15 -15
  186. package/types/src/ui/qwerty.d.ts +41 -41
  187. package/types/src/ui/ribbonLayout/default/defaultRibbon.d.ts +15 -15
  188. package/types/src/ui/ribbonLayout/default/tabletRibbon.d.ts +22 -22
  189. package/types/typedoc.d.ts +158 -158
@@ -1,485 +1,485 @@
1
- import { SmoNoteModifierBase, SmoArticulation, SmoLyric, SmoGraceNote, SmoMicrotone, SmoOrnament, SmoDynamicText, SmoArpeggio, SmoArticulationParametersSer, GraceNoteParamsSer, SmoOrnamentParamsSer, SmoMicrotoneParamsSer, SmoClefChangeParamsSer, SmoClefChange, SmoLyricParamsSer, SmoDynamicTextSer, SmoTabNote, SmoTabNoteParamsSer, SmoTabNoteParams } from './noteModifiers';
2
- import { Ticks, Pitch, SmoAttrs, Transposable, SvgBox } from './common';
3
- import { FontInfo } from '../../common/vex';
4
- export interface PlayedNote {
5
- pitches: Pitch[];
6
- duration: number;
7
- durationPct: number;
8
- }
9
- export interface SmoAudioData {
10
- volume: number[];
11
- playedNotes: PlayedNote[];
12
- }
13
- /**
14
- * @category SmoObject
15
- */
16
- export interface TupletInfo {
17
- id: string;
18
- }
19
- export type NoteType = 'n' | 'r' | '/';
20
- export type NoteStringParam = 'noteHead' | 'clef';
21
- export declare const NoteStringParams: NoteStringParam[];
22
- export type NoteNumberParam = 'beamBeats' | 'flagState' | 'beamState';
23
- export declare const NoteNumberParams: NoteNumberParam[];
24
- export type NoteBooleanParam = 'hidden' | 'isCue';
25
- export declare const NoteBooleanParams: NoteBooleanParam[];
26
- /**
27
- * Constructor parameters for a note. Usually you will call
28
- * {@link SmoNote.defaults}, and modify the parameters you need to change.
29
- * @param noteType
30
- * @param noteHead is non-empty, a Vex notehead code TODO make a record<>
31
- * @param clef determines how the pitch is placed on the staff
32
- * @param textModifiers are lyrics, chords, dynamics
33
- * @param articulations
34
- * @param graceNotes
35
- * @param ornaments
36
- * @param tones
37
- * @param tuplet tuplet info, if the note is part of a tuplet
38
- * @param endBeam true if this is the last note in a beam
39
- * @param fillStyle for special effects, for instance to highlight active voice
40
- * @param hidden indicates the note (usually a rest) is invisible (transparent)
41
- * @param beamBeats how many ticks to use before beaming a group
42
- * @param beamState the beaming configuration
43
- * @param flagState up down auto
44
- * @param ticks duration
45
- * @param stemTicks visible duration (todo update this comment)
46
- * @param pitches SmoPitch array
47
- * @param isCue tiny notes
48
- * @category SmoObject
49
- */
50
- export interface SmoNoteParams {
51
- /** note, rest, slash */
52
- noteType: NoteType;
53
- /**
54
- * custom note head, defaults to black or open (based on duration)
55
- */
56
- noteHead: string;
57
- /**
58
- * clef of this note, determines leger lines and sound
59
- */
60
- clef: string;
61
- /**
62
- * lyrics, annotations
63
- */
64
- textModifiers: SmoNoteModifierBase[];
65
- /**
66
- * articulations attached to the note
67
- */
68
- articulations: SmoArticulation[];
69
- /**
70
- * grace notes before the note
71
- */
72
- graceNotes: SmoGraceNote[];
73
- /**
74
- * ornaments attached to the note
75
- */
76
- ornaments: SmoOrnament[];
77
- /**
78
- * microtones attached to the note
79
- */
80
- tones: SmoMicrotone[];
81
- /**
82
- * arpeggio on the note
83
- */
84
- arpeggio?: SmoArpeggio;
85
- /**
86
- * if this note is part of a tuplet
87
- */
88
- tupletId: string | null;
89
- tabNote?: SmoTabNote;
90
- /**
91
- * fill, for the pretty
92
- */
93
- fillStyle: string | null;
94
- /**
95
- * indicates 'hidden' note. Useful for padding beginning/end of partial measures
96
- */
97
- hidden: boolean;
98
- /**
99
- * how many notes to beam before creating a new beam group
100
- */
101
- beamBeats: number;
102
- /**
103
- * auto-beam, force end or secondary
104
- */
105
- beamState: number;
106
- /**
107
- * up, down, auto
108
- */
109
- flagState: number;
110
- /**
111
- * note duration
112
- */
113
- ticks: Ticks;
114
- /**
115
- * visible duration
116
- */
117
- stemTicks: number;
118
- /**
119
- * pitch for leger lines and sounds
120
- */
121
- pitches: Pitch[];
122
- /**
123
- * draw cue sized
124
- */
125
- isCue: boolean;
126
- /**
127
- * indicates this note goes with a clef change
128
- */
129
- clefNote: SmoClefChangeParamsSer;
130
- }
131
- export type SmoNoteTextModifierSer = SmoLyricParamsSer | SmoDynamicTextSer;
132
- /**
133
- * The serializable bits of a Note. Notes will always
134
- * have a type, and if a sounded note, can contain pitches. It will always
135
- * contains ticks.
136
- * @category serialization
137
- */
138
- export interface SmoNoteParamsSer {
139
- /** constructor */
140
- ctor: string;
141
- /** attributes for identity */
142
- attrs: SmoAttrs;
143
- /** note, rest, slash */
144
- noteType: NoteType;
145
- /**
146
- * custom note head, defaults to black or open (based on duration)
147
- */
148
- noteHead: string;
149
- /**
150
- * clef of this note, determines leger lines and sound
151
- */
152
- clef: string;
153
- /**
154
- * lyrics, annotations
155
- */
156
- textModifiers: SmoNoteTextModifierSer[];
157
- /**
158
- * articulations attached to the note
159
- */
160
- articulations: SmoArticulationParametersSer;
161
- /**
162
- * grace notes before the note
163
- */
164
- graceNotes: GraceNoteParamsSer[];
165
- /**
166
- * ornaments attached to the note
167
- */
168
- ornaments: SmoOrnamentParamsSer[];
169
- /**
170
- * microtones attached to the note
171
- */
172
- tones: SmoMicrotoneParamsSer[];
173
- /**
174
- * arpeggio on the note
175
- */
176
- arpeggio?: SmoArticulationParametersSer;
177
- /**
178
- * if this note is part of a tuplet
179
- */
180
- tupletId?: string;
181
- /**
182
- * If a custom tab note is here, keep track of it
183
- */
184
- tabNote?: SmoTabNoteParamsSer;
185
- /**
186
- * does this note end the secondary beam group
187
- */
188
- endSecondaryBeam: boolean;
189
- /**
190
- * fill, for the pretty
191
- */
192
- fillStyle: string | null;
193
- /**
194
- * indicates 'hidden' note. Useful for padding beginning/end of partial measures
195
- */
196
- hidden: boolean;
197
- /**
198
- * how many notes to beam before creating a new beam group
199
- */
200
- beamBeats: number;
201
- /**
202
- * auto, end, secondary, continue
203
- */
204
- beamState: number;
205
- /**
206
- * up, down, auto
207
- */
208
- flagState: number;
209
- /**
210
- * note duration
211
- */
212
- ticks: Ticks;
213
- /**
214
- * visible duration (todo: update this comment)
215
- */
216
- stemTicks: number;
217
- /**
218
- * pitch for leger lines and sounds
219
- */
220
- pitches: Pitch[];
221
- /**
222
- * draw cue sized
223
- */
224
- isCue: boolean;
225
- /**
226
- * indicates this note goes with a clef change
227
- */
228
- clefNote?: SmoClefChangeParamsSer;
229
- }
230
- export declare function isSmoNote(transposable: Transposable): transposable is SmoNote;
231
- /**
232
- * SmoNote contains the pitch and duration of a note or chord.
233
- * It can also contain arrays of modifiers like lyrics, articulations etc.
234
- * Also information about the beaming, flag etc.
235
- * @category SmoObject
236
- * */
237
- export declare class SmoNote implements Transposable {
238
- constructor(params: SmoNoteParams);
239
- static get flagStates(): {
240
- auto: number;
241
- up: number;
242
- down: number;
243
- };
244
- static get beamStates(): {
245
- auto: number;
246
- continue: number;
247
- end: number;
248
- secondary: number;
249
- };
250
- static get beamStateMax(): number;
251
- static get defaultAudioData(): {
252
- volume: never[];
253
- };
254
- attrs: SmoAttrs;
255
- flagState: number;
256
- beamState: number;
257
- textModifiers: SmoNoteModifierBase[];
258
- articulations: SmoArticulation[];
259
- ornaments: SmoOrnament[];
260
- pitches: Pitch[];
261
- noteHead: string;
262
- arpeggio?: SmoArpeggio;
263
- tabNote?: SmoTabNote;
264
- clef: string;
265
- clefNote: SmoClefChange | null;
266
- graceNotes: SmoGraceNote[];
267
- noteType: NoteType;
268
- fillStyle: string;
269
- hidden: boolean;
270
- tupletId: string | null;
271
- tones: SmoMicrotone[];
272
- endBeam: boolean;
273
- endSecondaryBeam: boolean;
274
- ticks: Ticks;
275
- stemTicks: number;
276
- beamBeats: number;
277
- beam_group: SmoAttrs | null;
278
- renderId: string | null;
279
- keySignature: string;
280
- logicalBox: SvgBox | null;
281
- audioData: SmoAudioData;
282
- isCue: boolean;
283
- hasTabNote: boolean;
284
- accidentalsRendered: string[];
285
- /**
286
- * used in serialization
287
- * @internal
288
- */
289
- static get parameterArray(): string[];
290
- /**
291
- * Default constructor parameters. We always return a copy so the caller can modify it
292
- */
293
- static get defaults(): SmoNoteParams;
294
- /**
295
- * Up, down auto (tri-state)
296
- */
297
- toggleFlagState(): void;
298
- get dots(): number;
299
- private _addModifier;
300
- setArticulation(articulation: SmoArticulation, set: boolean): void;
301
- clearArticulations(): void;
302
- getArticulations(): SmoArticulation[];
303
- getArticulation(stringCode: string): SmoArticulation | undefined;
304
- getOrnament(stringCode: string): SmoOrnament | undefined;
305
- hasMordent(): boolean;
306
- hasTurn(): boolean;
307
- /**
308
- * Add a new dynamic to thisnote
309
- * @param dynamic
310
- */
311
- addDynamic(dynamic: SmoDynamicText): void;
312
- /**
313
- * Remove the dynamic from this note.
314
- * @param dynamic
315
- */
316
- removeDynamic(dynamic: SmoDynamicText): void;
317
- /**
318
- * Get all note modifiers of a type, either a lyric or a dynamic
319
- * @param type ctor
320
- * @returns
321
- */
322
- getModifiers(type: string): SmoNoteModifierBase[];
323
- setArpeggio(arp: SmoArpeggio): void;
324
- /**
325
- *
326
- * @returns the longest lyric, used for formatting
327
- */
328
- longestLyric(): SmoLyric | null;
329
- /** Add a lyric to this note, replacing another in the same verse */
330
- addLyric(lyric: SmoLyric): void;
331
- /**
332
- * @returns array of lyrics that are lyrics
333
- */
334
- getTrueLyrics(): SmoLyric[];
335
- /**
336
- *
337
- * @returns array of SmoLyric whose parsers are chord
338
- */
339
- getChords(): SmoLyric[];
340
- /**
341
- *
342
- * @param lyric lyric to remove, find the best match if there are multiples
343
- */
344
- removeLyric(lyric: SmoLyric): void;
345
- /**
346
- *
347
- * @param verse
348
- * @param parser
349
- * @returns
350
- */
351
- getLyricForVerse(verse: number, parser: number): SmoNoteModifierBase[];
352
- /**
353
- *
354
- * @param fontInfo
355
- */
356
- setLyricFont(fontInfo: FontInfo): void;
357
- /**
358
- * @param adjustNoteWidth if true, vex will consider the lyric width when formatting the measure
359
- */
360
- setLyricAdjustWidth(adjustNoteWidth: boolean): void;
361
- setChordAdjustWidth(adjustNoteWidth: boolean): void;
362
- setChordFont(fontInfo: FontInfo): void;
363
- getOrnaments(): SmoOrnament[];
364
- getJazzOrnaments(): SmoOrnament[];
365
- getTextOrnaments(): SmoOrnament[];
366
- /**
367
- * Toggle the ornament up/down/off
368
- * @param ornament
369
- */
370
- toggleOrnament(ornament: SmoOrnament): void;
371
- setOrnament(ornament: SmoOrnament, set: boolean): void;
372
- setTabNote(params: SmoTabNoteParams): void;
373
- clearTabNote(): void;
374
- /**
375
- * Toggle the ornament up/down/off
376
- * @param articulation
377
- */
378
- toggleArticulation(articulation: SmoArticulation): void;
379
- /**
380
- * Sort pitches in pitch order, Vex likes to receive pitches in order
381
- * @param note
382
- */
383
- static sortPitches(note: Transposable): void;
384
- setNoteHead(notehead: string): void;
385
- toggleNoteHead(noteHead: string): void;
386
- /**
387
- *
388
- * @param graceNote
389
- * @param offset the index from the first grace note
390
- */
391
- addGraceNote(graceNote: SmoGraceNote, offset: number): void;
392
- removeGraceNote(offset: number): void;
393
- getGraceNotes(): SmoGraceNote[];
394
- /**
395
- * Add another pitch to this note at `offset` 1/2 steps
396
- * @param note
397
- * @param offset
398
- */
399
- static addPitchOffset(note: Transposable, offset: number): void;
400
- /**
401
- * Add another pitch to this note at `offset` 1/2 steps
402
- * @param offset
403
- * @returns
404
- */
405
- addPitchOffset(offset: number): void;
406
- toggleRest(): void;
407
- toggleSlash(): void;
408
- makeSlash(): void;
409
- makeRest(): void;
410
- isRest(): boolean;
411
- isSlash(): boolean;
412
- isHidden(): boolean;
413
- makeNote(): void;
414
- /**
415
- * set note opacity on/off
416
- * @param val
417
- */
418
- makeHidden(val: boolean): void;
419
- /**
420
- * Return true if this note is part of a tuplet
421
- */
422
- get isTuplet(): boolean;
423
- /**
424
- * we only support a single microtone, not sure if vex supports multiple
425
- * @param tone
426
- */
427
- addMicrotone(tone: SmoMicrotone): void;
428
- removeMicrotone(): void;
429
- getMicrotone(toneIndex: number): SmoMicrotone | undefined;
430
- getMicrotones(): SmoMicrotone[];
431
- /**
432
- * cycle through the list of enharmonics for this note.
433
- * @param pitch
434
- * @returns
435
- */
436
- static toggleEnharmonic(pitch: Pitch): Pitch;
437
- /**
438
- * transpose a note or grace note to a key-friendly enharmonic
439
- * @param pitchArray
440
- * @param offset
441
- * @param originalKey - keySignature from original note
442
- * @param destinationKey - keySignature we are transposing into
443
- * @returns
444
- */
445
- transpose(pitchArray: number[], offset: number, originalKey: string, destinationKey: string): Transposable;
446
- /**
447
- * used to add chord and pitch by piano widget
448
- * @param pitch
449
- */
450
- toggleAddPitch(pitch: Pitch): void;
451
- /**
452
- * @param note note to transpose
453
- * @param pitchArray an array of indices (not pitches) that indicate which pitches get altered if a chord
454
- * @param offset in 1/2 step
455
- * @param originalKey original key for enharmonic-friendly key
456
- * @param destinationKey destination key signature
457
- * @returns
458
- */
459
- static transpose(note: Transposable, pitchArray: number[], offset: number, originalKey: string, destinationKey: string): Transposable;
460
- get tickCount(): number;
461
- /**
462
- * Copy the note, give it unique id
463
- * @param note
464
- * @returns
465
- */
466
- static clone(note: SmoNote): SmoNote;
467
- /**
468
- * @param note
469
- * @param ticks
470
- * @returns A note identical to `note` but with different duration
471
- */
472
- static cloneWithDuration(note: SmoNote, ticks: Ticks | number, stemTicks?: number | null): SmoNote;
473
- static serializeModifier(modifiers: SmoNoteModifierBase[]): object[];
474
- private _serializeModifiers;
475
- /**
476
- * @returns a JSON object that can be used to create this note
477
- */
478
- serialize(): SmoNoteParamsSer;
479
- /**
480
- * restore note modifiers and create a SmoNote object
481
- * @param jsonObj
482
- * @returns
483
- */
484
- static deserialize(jsonObj: any): SmoNote;
485
- }
1
+ import { SmoNoteModifierBase, SmoArticulation, SmoLyric, SmoGraceNote, SmoMicrotone, SmoOrnament, SmoDynamicText, SmoArpeggio, SmoArticulationParametersSer, GraceNoteParamsSer, SmoOrnamentParamsSer, SmoMicrotoneParamsSer, SmoClefChangeParamsSer, SmoClefChange, SmoLyricParamsSer, SmoDynamicTextSer, SmoTabNote, SmoTabNoteParamsSer, SmoTabNoteParams } from './noteModifiers';
2
+ import { Ticks, Pitch, SmoAttrs, Transposable, SvgBox } from './common';
3
+ import { FontInfo } from '../../common/vex';
4
+ export interface PlayedNote {
5
+ pitches: Pitch[];
6
+ duration: number;
7
+ durationPct: number;
8
+ }
9
+ export interface SmoAudioData {
10
+ volume: number[];
11
+ playedNotes: PlayedNote[];
12
+ }
13
+ /**
14
+ * @category SmoObject
15
+ */
16
+ export interface TupletInfo {
17
+ id: string;
18
+ }
19
+ export type NoteType = 'n' | 'r' | '/';
20
+ export type NoteStringParam = 'noteHead' | 'clef';
21
+ export declare const NoteStringParams: NoteStringParam[];
22
+ export type NoteNumberParam = 'beamBeats' | 'flagState' | 'beamState';
23
+ export declare const NoteNumberParams: NoteNumberParam[];
24
+ export type NoteBooleanParam = 'hidden' | 'isCue';
25
+ export declare const NoteBooleanParams: NoteBooleanParam[];
26
+ /**
27
+ * Constructor parameters for a note. Usually you will call
28
+ * {@link SmoNote.defaults}, and modify the parameters you need to change.
29
+ * @param noteType
30
+ * @param noteHead is non-empty, a Vex notehead code TODO make a record<>
31
+ * @param clef determines how the pitch is placed on the staff
32
+ * @param textModifiers are lyrics, chords, dynamics
33
+ * @param articulations
34
+ * @param graceNotes
35
+ * @param ornaments
36
+ * @param tones
37
+ * @param tuplet tuplet info, if the note is part of a tuplet
38
+ * @param endBeam true if this is the last note in a beam
39
+ * @param fillStyle for special effects, for instance to highlight active voice
40
+ * @param hidden indicates the note (usually a rest) is invisible (transparent)
41
+ * @param beamBeats how many ticks to use before beaming a group
42
+ * @param beamState the beaming configuration
43
+ * @param flagState up down auto
44
+ * @param ticks duration
45
+ * @param stemTicks visible duration (todo update this comment)
46
+ * @param pitches SmoPitch array
47
+ * @param isCue tiny notes
48
+ * @category SmoObject
49
+ */
50
+ export interface SmoNoteParams {
51
+ /** note, rest, slash */
52
+ noteType: NoteType;
53
+ /**
54
+ * custom note head, defaults to black or open (based on duration)
55
+ */
56
+ noteHead: string;
57
+ /**
58
+ * clef of this note, determines leger lines and sound
59
+ */
60
+ clef: string;
61
+ /**
62
+ * lyrics, annotations
63
+ */
64
+ textModifiers: SmoNoteModifierBase[];
65
+ /**
66
+ * articulations attached to the note
67
+ */
68
+ articulations: SmoArticulation[];
69
+ /**
70
+ * grace notes before the note
71
+ */
72
+ graceNotes: SmoGraceNote[];
73
+ /**
74
+ * ornaments attached to the note
75
+ */
76
+ ornaments: SmoOrnament[];
77
+ /**
78
+ * microtones attached to the note
79
+ */
80
+ tones: SmoMicrotone[];
81
+ /**
82
+ * arpeggio on the note
83
+ */
84
+ arpeggio?: SmoArpeggio;
85
+ /**
86
+ * if this note is part of a tuplet
87
+ */
88
+ tupletId: string | null;
89
+ tabNote?: SmoTabNote;
90
+ /**
91
+ * fill, for the pretty
92
+ */
93
+ fillStyle: string | null;
94
+ /**
95
+ * indicates 'hidden' note. Useful for padding beginning/end of partial measures
96
+ */
97
+ hidden: boolean;
98
+ /**
99
+ * how many notes to beam before creating a new beam group
100
+ */
101
+ beamBeats: number;
102
+ /**
103
+ * auto-beam, force end or secondary
104
+ */
105
+ beamState: number;
106
+ /**
107
+ * up, down, auto
108
+ */
109
+ flagState: number;
110
+ /**
111
+ * note duration
112
+ */
113
+ ticks: Ticks;
114
+ /**
115
+ * visible duration
116
+ */
117
+ stemTicks: number;
118
+ /**
119
+ * pitch for leger lines and sounds
120
+ */
121
+ pitches: Pitch[];
122
+ /**
123
+ * draw cue sized
124
+ */
125
+ isCue: boolean;
126
+ /**
127
+ * indicates this note goes with a clef change
128
+ */
129
+ clefNote: SmoClefChangeParamsSer;
130
+ }
131
+ export type SmoNoteTextModifierSer = SmoLyricParamsSer | SmoDynamicTextSer;
132
+ /**
133
+ * The serializable bits of a Note. Notes will always
134
+ * have a type, and if a sounded note, can contain pitches. It will always
135
+ * contains ticks.
136
+ * @category serialization
137
+ */
138
+ export interface SmoNoteParamsSer {
139
+ /** constructor */
140
+ ctor: string;
141
+ /** attributes for identity */
142
+ attrs: SmoAttrs;
143
+ /** note, rest, slash */
144
+ noteType: NoteType;
145
+ /**
146
+ * custom note head, defaults to black or open (based on duration)
147
+ */
148
+ noteHead: string;
149
+ /**
150
+ * clef of this note, determines leger lines and sound
151
+ */
152
+ clef: string;
153
+ /**
154
+ * lyrics, annotations
155
+ */
156
+ textModifiers: SmoNoteTextModifierSer[];
157
+ /**
158
+ * articulations attached to the note
159
+ */
160
+ articulations: SmoArticulationParametersSer;
161
+ /**
162
+ * grace notes before the note
163
+ */
164
+ graceNotes: GraceNoteParamsSer[];
165
+ /**
166
+ * ornaments attached to the note
167
+ */
168
+ ornaments: SmoOrnamentParamsSer[];
169
+ /**
170
+ * microtones attached to the note
171
+ */
172
+ tones: SmoMicrotoneParamsSer[];
173
+ /**
174
+ * arpeggio on the note
175
+ */
176
+ arpeggio?: SmoArticulationParametersSer;
177
+ /**
178
+ * if this note is part of a tuplet
179
+ */
180
+ tupletId?: string;
181
+ /**
182
+ * If a custom tab note is here, keep track of it
183
+ */
184
+ tabNote?: SmoTabNoteParamsSer;
185
+ /**
186
+ * does this note end the secondary beam group
187
+ */
188
+ endSecondaryBeam: boolean;
189
+ /**
190
+ * fill, for the pretty
191
+ */
192
+ fillStyle: string | null;
193
+ /**
194
+ * indicates 'hidden' note. Useful for padding beginning/end of partial measures
195
+ */
196
+ hidden: boolean;
197
+ /**
198
+ * how many notes to beam before creating a new beam group
199
+ */
200
+ beamBeats: number;
201
+ /**
202
+ * auto, end, secondary, continue
203
+ */
204
+ beamState: number;
205
+ /**
206
+ * up, down, auto
207
+ */
208
+ flagState: number;
209
+ /**
210
+ * note duration
211
+ */
212
+ ticks: Ticks;
213
+ /**
214
+ * visible duration (todo: update this comment)
215
+ */
216
+ stemTicks: number;
217
+ /**
218
+ * pitch for leger lines and sounds
219
+ */
220
+ pitches: Pitch[];
221
+ /**
222
+ * draw cue sized
223
+ */
224
+ isCue: boolean;
225
+ /**
226
+ * indicates this note goes with a clef change
227
+ */
228
+ clefNote?: SmoClefChangeParamsSer;
229
+ }
230
+ export declare function isSmoNote(transposable: Transposable): transposable is SmoNote;
231
+ /**
232
+ * SmoNote contains the pitch and duration of a note or chord.
233
+ * It can also contain arrays of modifiers like lyrics, articulations etc.
234
+ * Also information about the beaming, flag etc.
235
+ * @category SmoObject
236
+ * */
237
+ export declare class SmoNote implements Transposable {
238
+ constructor(params: SmoNoteParams);
239
+ static get flagStates(): {
240
+ auto: number;
241
+ up: number;
242
+ down: number;
243
+ };
244
+ static get beamStates(): {
245
+ auto: number;
246
+ continue: number;
247
+ end: number;
248
+ secondary: number;
249
+ };
250
+ static get beamStateMax(): number;
251
+ static get defaultAudioData(): {
252
+ volume: never[];
253
+ };
254
+ attrs: SmoAttrs;
255
+ flagState: number;
256
+ beamState: number;
257
+ textModifiers: SmoNoteModifierBase[];
258
+ articulations: SmoArticulation[];
259
+ ornaments: SmoOrnament[];
260
+ pitches: Pitch[];
261
+ noteHead: string;
262
+ arpeggio?: SmoArpeggio;
263
+ tabNote?: SmoTabNote;
264
+ clef: string;
265
+ clefNote: SmoClefChange | null;
266
+ graceNotes: SmoGraceNote[];
267
+ noteType: NoteType;
268
+ fillStyle: string;
269
+ hidden: boolean;
270
+ tupletId: string | null;
271
+ tones: SmoMicrotone[];
272
+ endBeam: boolean;
273
+ endSecondaryBeam: boolean;
274
+ ticks: Ticks;
275
+ stemTicks: number;
276
+ beamBeats: number;
277
+ beam_group: SmoAttrs | null;
278
+ renderId: string | null;
279
+ keySignature: string;
280
+ logicalBox: SvgBox | null;
281
+ audioData: SmoAudioData;
282
+ isCue: boolean;
283
+ hasTabNote: boolean;
284
+ accidentalsRendered: string[];
285
+ /**
286
+ * used in serialization
287
+ * @internal
288
+ */
289
+ static get parameterArray(): string[];
290
+ /**
291
+ * Default constructor parameters. We always return a copy so the caller can modify it
292
+ */
293
+ static get defaults(): SmoNoteParams;
294
+ /**
295
+ * Up, down auto (tri-state)
296
+ */
297
+ toggleFlagState(): void;
298
+ get dots(): number;
299
+ private _addModifier;
300
+ setArticulation(articulation: SmoArticulation, set: boolean): void;
301
+ clearArticulations(): void;
302
+ getArticulations(): SmoArticulation[];
303
+ getArticulation(stringCode: string): SmoArticulation | undefined;
304
+ getOrnament(stringCode: string): SmoOrnament | undefined;
305
+ hasMordent(): boolean;
306
+ hasTurn(): boolean;
307
+ /**
308
+ * Add a new dynamic to thisnote
309
+ * @param dynamic
310
+ */
311
+ addDynamic(dynamic: SmoDynamicText): void;
312
+ /**
313
+ * Remove the dynamic from this note.
314
+ * @param dynamic
315
+ */
316
+ removeDynamic(dynamic: SmoDynamicText): void;
317
+ /**
318
+ * Get all note modifiers of a type, either a lyric or a dynamic
319
+ * @param type ctor
320
+ * @returns
321
+ */
322
+ getModifiers(type: string): SmoNoteModifierBase[];
323
+ setArpeggio(arp: SmoArpeggio): void;
324
+ /**
325
+ *
326
+ * @returns the longest lyric, used for formatting
327
+ */
328
+ longestLyric(): SmoLyric | null;
329
+ /** Add a lyric to this note, replacing another in the same verse */
330
+ addLyric(lyric: SmoLyric): void;
331
+ /**
332
+ * @returns array of lyrics that are lyrics
333
+ */
334
+ getTrueLyrics(): SmoLyric[];
335
+ /**
336
+ *
337
+ * @returns array of SmoLyric whose parsers are chord
338
+ */
339
+ getChords(): SmoLyric[];
340
+ /**
341
+ *
342
+ * @param lyric lyric to remove, find the best match if there are multiples
343
+ */
344
+ removeLyric(lyric: SmoLyric): void;
345
+ /**
346
+ *
347
+ * @param verse
348
+ * @param parser
349
+ * @returns
350
+ */
351
+ getLyricForVerse(verse: number, parser: number): SmoNoteModifierBase[];
352
+ /**
353
+ *
354
+ * @param fontInfo
355
+ */
356
+ setLyricFont(fontInfo: FontInfo): void;
357
+ /**
358
+ * @param adjustNoteWidth if true, vex will consider the lyric width when formatting the measure
359
+ */
360
+ setLyricAdjustWidth(adjustNoteWidth: boolean): void;
361
+ setChordAdjustWidth(adjustNoteWidth: boolean): void;
362
+ setChordFont(fontInfo: FontInfo): void;
363
+ getOrnaments(): SmoOrnament[];
364
+ getJazzOrnaments(): SmoOrnament[];
365
+ getTextOrnaments(): SmoOrnament[];
366
+ /**
367
+ * Toggle the ornament up/down/off
368
+ * @param ornament
369
+ */
370
+ toggleOrnament(ornament: SmoOrnament): void;
371
+ setOrnament(ornament: SmoOrnament, set: boolean): void;
372
+ setTabNote(params: SmoTabNoteParams): void;
373
+ clearTabNote(): void;
374
+ /**
375
+ * Toggle the ornament up/down/off
376
+ * @param articulation
377
+ */
378
+ toggleArticulation(articulation: SmoArticulation): void;
379
+ /**
380
+ * Sort pitches in pitch order, Vex likes to receive pitches in order
381
+ * @param note
382
+ */
383
+ static sortPitches(note: Transposable): void;
384
+ setNoteHead(notehead: string): void;
385
+ toggleNoteHead(noteHead: string): void;
386
+ /**
387
+ *
388
+ * @param graceNote
389
+ * @param offset the index from the first grace note
390
+ */
391
+ addGraceNote(graceNote: SmoGraceNote, offset: number): void;
392
+ removeGraceNote(offset: number): void;
393
+ getGraceNotes(): SmoGraceNote[];
394
+ /**
395
+ * Add another pitch to this note at `offset` 1/2 steps
396
+ * @param note
397
+ * @param offset
398
+ */
399
+ static addPitchOffset(note: Transposable, offset: number): void;
400
+ /**
401
+ * Add another pitch to this note at `offset` 1/2 steps
402
+ * @param offset
403
+ * @returns
404
+ */
405
+ addPitchOffset(offset: number): void;
406
+ toggleRest(): void;
407
+ toggleSlash(): void;
408
+ makeSlash(): void;
409
+ makeRest(): void;
410
+ isRest(): boolean;
411
+ isSlash(): boolean;
412
+ isHidden(): boolean;
413
+ makeNote(): void;
414
+ /**
415
+ * set note opacity on/off
416
+ * @param val
417
+ */
418
+ makeHidden(val: boolean): void;
419
+ /**
420
+ * Return true if this note is part of a tuplet
421
+ */
422
+ get isTuplet(): boolean;
423
+ /**
424
+ * we only support a single microtone, not sure if vex supports multiple
425
+ * @param tone
426
+ */
427
+ addMicrotone(tone: SmoMicrotone): void;
428
+ removeMicrotone(): void;
429
+ getMicrotone(toneIndex: number): SmoMicrotone | undefined;
430
+ getMicrotones(): SmoMicrotone[];
431
+ /**
432
+ * cycle through the list of enharmonics for this note.
433
+ * @param pitch
434
+ * @returns
435
+ */
436
+ static toggleEnharmonic(pitch: Pitch): Pitch;
437
+ /**
438
+ * transpose a note or grace note to a key-friendly enharmonic
439
+ * @param pitchArray
440
+ * @param offset
441
+ * @param originalKey - keySignature from original note
442
+ * @param destinationKey - keySignature we are transposing into
443
+ * @returns
444
+ */
445
+ transpose(pitchArray: number[], offset: number, originalKey: string, destinationKey: string): Transposable;
446
+ /**
447
+ * used to add chord and pitch by piano widget
448
+ * @param pitch
449
+ */
450
+ toggleAddPitch(pitch: Pitch): void;
451
+ /**
452
+ * @param note note to transpose
453
+ * @param pitchArray an array of indices (not pitches) that indicate which pitches get altered if a chord
454
+ * @param offset in 1/2 step
455
+ * @param originalKey original key for enharmonic-friendly key
456
+ * @param destinationKey destination key signature
457
+ * @returns
458
+ */
459
+ static transpose(note: Transposable, pitchArray: number[], offset: number, originalKey: string, destinationKey: string): Transposable;
460
+ get tickCount(): number;
461
+ /**
462
+ * Copy the note, give it unique id
463
+ * @param note
464
+ * @returns
465
+ */
466
+ static clone(note: SmoNote): SmoNote;
467
+ /**
468
+ * @param note
469
+ * @param ticks
470
+ * @returns A note identical to `note` but with different duration
471
+ */
472
+ static cloneWithDuration(note: SmoNote, ticks: Ticks | number, stemTicks?: number | null): SmoNote;
473
+ static serializeModifier(modifiers: SmoNoteModifierBase[]): object[];
474
+ private _serializeModifiers;
475
+ /**
476
+ * @returns a JSON object that can be used to create this note
477
+ */
478
+ serialize(): SmoNoteParamsSer;
479
+ /**
480
+ * restore note modifiers and create a SmoNote object
481
+ * @param jsonObj
482
+ * @returns
483
+ */
484
+ static deserialize(jsonObj: any): SmoNote;
485
+ }