@tspro/web-music-score 4.0.0 → 4.1.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/CHANGELOG.md +19 -0
- package/README.md +18 -9
- package/dist/audio/index.d.mts +40 -1
- package/dist/audio/index.d.ts +40 -1
- package/dist/audio/index.js +1 -1
- package/dist/audio/index.mjs +2 -2
- package/dist/audio-cg/index.d.mts +3 -0
- package/dist/audio-cg/index.d.ts +3 -0
- package/dist/audio-cg/index.js +1 -1
- package/dist/audio-cg/index.mjs +2 -2
- package/dist/{chunk-D643HZHM.mjs → chunk-MHNTJ6FU.mjs} +2 -2
- package/dist/core/index.d.mts +12 -0
- package/dist/core/index.d.ts +12 -0
- package/dist/core/index.js +3 -2
- package/dist/core/index.mjs +4 -3
- package/dist/guitar-CaZJDA05.d.ts +35 -0
- package/dist/guitar-DdexKdN6.d.mts +35 -0
- package/dist/iife/index.global.js +11 -11
- package/dist/{interface-XoKiryoV.d.mts → music-objects-DIaqNPjs.d.mts} +616 -114
- package/dist/{interface-7k8qGG44.d.ts → music-objects-xJJNlFwK.d.ts} +616 -114
- package/dist/note-eA2xPPiG.d.mts +294 -0
- package/dist/note-eA2xPPiG.d.ts +294 -0
- package/dist/pieces/index.d.mts +22 -3
- package/dist/pieces/index.d.ts +22 -3
- package/dist/pieces/index.js +5 -2
- package/dist/pieces/index.mjs +6 -3
- package/dist/react-ui/index.d.mts +166 -17
- package/dist/react-ui/index.d.ts +166 -17
- package/dist/react-ui/index.js +78 -1
- package/dist/react-ui/index.mjs +79 -2
- package/dist/scale-DQNA-YLD.d.ts +230 -0
- package/dist/scale-bnD0WnMV.d.mts +230 -0
- package/dist/score/index.d.mts +315 -47
- package/dist/score/index.d.ts +315 -47
- package/dist/score/index.js +684 -173
- package/dist/score/index.mjs +683 -174
- package/dist/tempo-Bp1UzsrZ.d.ts +399 -0
- package/dist/tempo-S85Q7uJA.d.mts +399 -0
- package/dist/theory/index.d.mts +29 -13
- package/dist/theory/index.d.ts +29 -13
- package/dist/theory/index.js +433 -42
- package/dist/theory/index.mjs +432 -43
- package/package.json +3 -2
- package/dist/guitar-DggbM2UL.d.mts +0 -17
- package/dist/guitar-cNmE-EvH.d.ts +0 -17
- package/dist/note-BFa43I86.d.mts +0 -85
- package/dist/note-CcVdUFqS.d.ts +0 -85
- package/dist/scale-C2pCNxdE.d.mts +0 -75
- package/dist/scale-CvPbJvfN.d.ts +0 -75
- package/dist/tempo-BAYoZ_Li.d.mts +0 -187
- package/dist/tempo-r2sb6Ku2.d.ts +0 -187
package/dist/react-ui/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* WebMusicScore v4.
|
|
1
|
+
/* WebMusicScore v4.1.0 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
|
|
2
2
|
"use strict";
|
|
3
3
|
var __create = Object.create;
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -200,34 +200,54 @@ var DefaultColors = {
|
|
|
200
200
|
TextColor: "white"
|
|
201
201
|
};
|
|
202
202
|
var FretPosition = class {
|
|
203
|
+
/**
|
|
204
|
+
* Create new fret position object instance.
|
|
205
|
+
* @param guitarCtx - Guitar context.
|
|
206
|
+
* @param stringId - String index in range [0, 5].
|
|
207
|
+
* @param fretId - Fret index, 0 = open string fret position.
|
|
208
|
+
* @param chromaticId - Chromatic id.
|
|
209
|
+
*/
|
|
203
210
|
constructor(guitarCtx, stringId, fretId, chromaticId) {
|
|
204
211
|
this.guitarCtx = guitarCtx;
|
|
205
212
|
this.stringId = stringId;
|
|
206
213
|
this.fretId = fretId;
|
|
207
214
|
this.chromaticId = chromaticId;
|
|
215
|
+
/** Note of this fret position. */
|
|
208
216
|
__publicField(this, "note");
|
|
217
|
+
/** Is note of this fret position a scale note? */
|
|
209
218
|
__publicField(this, "isScaleNote");
|
|
219
|
+
/** Is note of this fret position a scale root note? */
|
|
210
220
|
__publicField(this, "isScaleRootNote");
|
|
221
|
+
/** Is note circle/text of this fret position visible? */
|
|
211
222
|
__publicField(this, "isVisible", false);
|
|
223
|
+
/** Text (e.g. note name) of this fret position. */
|
|
212
224
|
__publicField(this, "text", "");
|
|
225
|
+
/** Text color. */
|
|
213
226
|
__publicField(this, "textColor", DefaultColors.TextColor);
|
|
227
|
+
/** Fill color of note circle. */
|
|
214
228
|
__publicField(this, "fillColor");
|
|
229
|
+
/** Border color of note circle. */
|
|
215
230
|
__publicField(this, "borderColor");
|
|
231
|
+
/** Is barre? (Reserved for future) */
|
|
216
232
|
__publicField(this, "isBarre", false);
|
|
217
233
|
let { scale } = guitarCtx;
|
|
218
234
|
this.note = scale.getPreferredChromaticNote(chromaticId);
|
|
219
235
|
this.isScaleNote = scale.isScaleNote(this.note);
|
|
220
236
|
this.isScaleRootNote = scale.isScaleRootNote(this.note);
|
|
221
237
|
}
|
|
238
|
+
/** Chromatic class getter. */
|
|
222
239
|
get chromaticClass() {
|
|
223
240
|
return import_theory3.Note.getChromaticClass(this.chromaticId);
|
|
224
241
|
}
|
|
242
|
+
/** Show note circle/text of this fret position. */
|
|
225
243
|
show() {
|
|
226
244
|
this.isVisible = true;
|
|
227
245
|
}
|
|
246
|
+
/** Hide note circle/text of this fret position. */
|
|
228
247
|
hide() {
|
|
229
248
|
this.isVisible = false;
|
|
230
249
|
}
|
|
250
|
+
/** Set default note name. */
|
|
231
251
|
setDefaultText() {
|
|
232
252
|
let { pitchNotation, scale, guitarNoteLabel } = this.guitarCtx;
|
|
233
253
|
switch (guitarNoteLabel) {
|
|
@@ -242,20 +262,31 @@ var FretPosition = class {
|
|
|
242
262
|
break;
|
|
243
263
|
}
|
|
244
264
|
}
|
|
265
|
+
/** Set default fill color of note circle. */
|
|
245
266
|
setDefaultFillColor() {
|
|
246
267
|
this.fillColor = this.isScaleRootNote ? DefaultColors.ScaleRootNoteColor : this.isScaleNote ? DefaultColors.ScaleNoteColor : DefaultColors.NonScaleNoteColor;
|
|
247
268
|
}
|
|
269
|
+
/** Set default border color of note circle. */
|
|
248
270
|
setDefaultBorderColor(showBorder = false) {
|
|
249
271
|
this.borderColor = showBorder ? DefaultColors.DefaultBorderColor : void 0;
|
|
250
272
|
}
|
|
251
273
|
};
|
|
252
274
|
var GuitarContext = class _GuitarContext {
|
|
275
|
+
/**
|
|
276
|
+
* Create new guitar context object instance.
|
|
277
|
+
* @param tuningName - Tuning name (e.g. "Standard").
|
|
278
|
+
* @param scale - Scale.
|
|
279
|
+
* @param handedness - Handedness.
|
|
280
|
+
* @param pitchNotation - Pitch notation.
|
|
281
|
+
* @param guitarNoteLabel - Guitar note label type.
|
|
282
|
+
*/
|
|
253
283
|
constructor(tuningName, scale, handedness, pitchNotation, guitarNoteLabel) {
|
|
254
284
|
this.tuningName = tuningName;
|
|
255
285
|
this.scale = scale;
|
|
256
286
|
this.handedness = handedness;
|
|
257
287
|
this.pitchNotation = pitchNotation;
|
|
258
288
|
this.guitarNoteLabel = guitarNoteLabel;
|
|
289
|
+
/** Maximum fret index value. */
|
|
259
290
|
__publicField(this, "maxFretId");
|
|
260
291
|
__publicField(this, "fretPositionTable");
|
|
261
292
|
__publicField(this, "tuningStrings");
|
|
@@ -270,6 +301,12 @@ var GuitarContext = class _GuitarContext {
|
|
|
270
301
|
}
|
|
271
302
|
}
|
|
272
303
|
}
|
|
304
|
+
/**
|
|
305
|
+
* Get fret position object.
|
|
306
|
+
* @param stringId - String index in range [0,5].
|
|
307
|
+
* @param fretId - Fret index, 0 = open string fret position.
|
|
308
|
+
* @returns - Fret position object.
|
|
309
|
+
*/
|
|
273
310
|
getFretPosition(stringId, fretId) {
|
|
274
311
|
if (!import_ts_utils_lib2.Utils.Is.isInteger(stringId) || stringId < 0 || stringId > 5) {
|
|
275
312
|
throw new import_core.MusicError(import_core.MusicErrorType.InvalidArg, `Invalid stringId: + ${stringId}`);
|
|
@@ -279,24 +316,58 @@ var GuitarContext = class _GuitarContext {
|
|
|
279
316
|
return this.fretPositionTable[stringId][fretId];
|
|
280
317
|
}
|
|
281
318
|
}
|
|
319
|
+
/**
|
|
320
|
+
* Get tuning value (Note) of given string.
|
|
321
|
+
* @param stringId - STring index in range [0, 5].
|
|
322
|
+
* @returns - Note of given string played unfretted.
|
|
323
|
+
*/
|
|
282
324
|
getStringTuning(stringId) {
|
|
283
325
|
return this.tuningStrings[stringId];
|
|
284
326
|
}
|
|
327
|
+
/**
|
|
328
|
+
* Get tuning overview (e.g. "E2 - A2 - D3 - G3 - B3 - E4").
|
|
329
|
+
* @returns - Tuning overview string.
|
|
330
|
+
*/
|
|
285
331
|
getTuningOverview() {
|
|
286
332
|
return this.tuningStrings.slice().reverse().map((note) => note.format(this.pitchNotation, import_theory2.SymbolSet.Unicode)).join(" - ");
|
|
287
333
|
}
|
|
334
|
+
/**
|
|
335
|
+
* Create copy of this guitar context with new tuning name.
|
|
336
|
+
* @param tuningName - New tuning name.
|
|
337
|
+
* @returns - Guitar context.
|
|
338
|
+
*/
|
|
288
339
|
alterTuningName(tuningName) {
|
|
289
340
|
return tuningName === this.tuningName ? this : new _GuitarContext(tuningName, this.scale, this.handedness, this.pitchNotation, this.guitarNoteLabel);
|
|
290
341
|
}
|
|
342
|
+
/**
|
|
343
|
+
* Create copy of this guitar context with new scale.
|
|
344
|
+
* @param scale - New scale.
|
|
345
|
+
* @returns - Guitar context.
|
|
346
|
+
*/
|
|
291
347
|
alterScale(scale) {
|
|
292
348
|
return import_theory3.Scale.equals(scale, this.scale) ? this : new _GuitarContext(this.tuningName, scale, this.handedness, this.pitchNotation, this.guitarNoteLabel);
|
|
293
349
|
}
|
|
350
|
+
/**
|
|
351
|
+
* Create copy of this guitar context with handedness.
|
|
352
|
+
* @param handedness - New handedness.
|
|
353
|
+
* @returns - Guitar context.
|
|
354
|
+
*/
|
|
294
355
|
alterHandedness(handedness) {
|
|
295
356
|
return handedness === this.handedness ? this : new _GuitarContext(this.tuningName, this.scale, handedness, this.pitchNotation, this.guitarNoteLabel);
|
|
296
357
|
}
|
|
358
|
+
/**
|
|
359
|
+
* Create copy of this guitar context with new pitch notation.
|
|
360
|
+
* @param pitchNotation - New pitch notation.
|
|
361
|
+
* @returns - Guitar context.
|
|
362
|
+
*/
|
|
297
363
|
alterPitchNotation(pitchNotation) {
|
|
298
364
|
return pitchNotation === this.pitchNotation ? this : new _GuitarContext(this.tuningName, this.scale, this.handedness, pitchNotation, this.guitarNoteLabel);
|
|
299
365
|
}
|
|
366
|
+
/**
|
|
367
|
+
* Create copy of this guitar context with new guitar note label type.
|
|
368
|
+
* @param guitarNoteLabel - New guitar note label type.
|
|
369
|
+
* @returns - Guitar context.
|
|
370
|
+
*/
|
|
300
371
|
alterGuitarNoteLabel(guitarNoteLabel) {
|
|
301
372
|
return guitarNoteLabel === this.guitarNoteLabel ? this : new _GuitarContext(this.tuningName, this.scale, this.handedness, this.pitchNotation, guitarNoteLabel);
|
|
302
373
|
}
|
|
@@ -370,6 +441,12 @@ var Fret = class _Fret {
|
|
|
370
441
|
}
|
|
371
442
|
};
|
|
372
443
|
var FretPositionData = class {
|
|
444
|
+
/**
|
|
445
|
+
* Create new fret position data instance.
|
|
446
|
+
* @param fretPosition - Fret position.
|
|
447
|
+
* @param cellRect - Rect of fret position cell (space around string and between fret and next fret).
|
|
448
|
+
* @param noteRect - Rect to display note name in circle.
|
|
449
|
+
*/
|
|
373
450
|
constructor(fretPosition, cellRect, noteRect) {
|
|
374
451
|
this.fretPosition = fretPosition;
|
|
375
452
|
this.cellRect = cellRect;
|
package/dist/react-ui/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/* WebMusicScore v4.
|
|
1
|
+
/* WebMusicScore v4.1.0 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
|
|
2
2
|
import {
|
|
3
3
|
__publicField
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-MHNTJ6FU.mjs";
|
|
5
5
|
|
|
6
6
|
// src/react-ui/circle-of-fifths.tsx
|
|
7
7
|
import * as React from "react";
|
|
@@ -159,34 +159,54 @@ var DefaultColors = {
|
|
|
159
159
|
TextColor: "white"
|
|
160
160
|
};
|
|
161
161
|
var FretPosition = class {
|
|
162
|
+
/**
|
|
163
|
+
* Create new fret position object instance.
|
|
164
|
+
* @param guitarCtx - Guitar context.
|
|
165
|
+
* @param stringId - String index in range [0, 5].
|
|
166
|
+
* @param fretId - Fret index, 0 = open string fret position.
|
|
167
|
+
* @param chromaticId - Chromatic id.
|
|
168
|
+
*/
|
|
162
169
|
constructor(guitarCtx, stringId, fretId, chromaticId) {
|
|
163
170
|
this.guitarCtx = guitarCtx;
|
|
164
171
|
this.stringId = stringId;
|
|
165
172
|
this.fretId = fretId;
|
|
166
173
|
this.chromaticId = chromaticId;
|
|
174
|
+
/** Note of this fret position. */
|
|
167
175
|
__publicField(this, "note");
|
|
176
|
+
/** Is note of this fret position a scale note? */
|
|
168
177
|
__publicField(this, "isScaleNote");
|
|
178
|
+
/** Is note of this fret position a scale root note? */
|
|
169
179
|
__publicField(this, "isScaleRootNote");
|
|
180
|
+
/** Is note circle/text of this fret position visible? */
|
|
170
181
|
__publicField(this, "isVisible", false);
|
|
182
|
+
/** Text (e.g. note name) of this fret position. */
|
|
171
183
|
__publicField(this, "text", "");
|
|
184
|
+
/** Text color. */
|
|
172
185
|
__publicField(this, "textColor", DefaultColors.TextColor);
|
|
186
|
+
/** Fill color of note circle. */
|
|
173
187
|
__publicField(this, "fillColor");
|
|
188
|
+
/** Border color of note circle. */
|
|
174
189
|
__publicField(this, "borderColor");
|
|
190
|
+
/** Is barre? (Reserved for future) */
|
|
175
191
|
__publicField(this, "isBarre", false);
|
|
176
192
|
let { scale } = guitarCtx;
|
|
177
193
|
this.note = scale.getPreferredChromaticNote(chromaticId);
|
|
178
194
|
this.isScaleNote = scale.isScaleNote(this.note);
|
|
179
195
|
this.isScaleRootNote = scale.isScaleRootNote(this.note);
|
|
180
196
|
}
|
|
197
|
+
/** Chromatic class getter. */
|
|
181
198
|
get chromaticClass() {
|
|
182
199
|
return Note2.getChromaticClass(this.chromaticId);
|
|
183
200
|
}
|
|
201
|
+
/** Show note circle/text of this fret position. */
|
|
184
202
|
show() {
|
|
185
203
|
this.isVisible = true;
|
|
186
204
|
}
|
|
205
|
+
/** Hide note circle/text of this fret position. */
|
|
187
206
|
hide() {
|
|
188
207
|
this.isVisible = false;
|
|
189
208
|
}
|
|
209
|
+
/** Set default note name. */
|
|
190
210
|
setDefaultText() {
|
|
191
211
|
let { pitchNotation, scale, guitarNoteLabel } = this.guitarCtx;
|
|
192
212
|
switch (guitarNoteLabel) {
|
|
@@ -201,20 +221,31 @@ var FretPosition = class {
|
|
|
201
221
|
break;
|
|
202
222
|
}
|
|
203
223
|
}
|
|
224
|
+
/** Set default fill color of note circle. */
|
|
204
225
|
setDefaultFillColor() {
|
|
205
226
|
this.fillColor = this.isScaleRootNote ? DefaultColors.ScaleRootNoteColor : this.isScaleNote ? DefaultColors.ScaleNoteColor : DefaultColors.NonScaleNoteColor;
|
|
206
227
|
}
|
|
228
|
+
/** Set default border color of note circle. */
|
|
207
229
|
setDefaultBorderColor(showBorder = false) {
|
|
208
230
|
this.borderColor = showBorder ? DefaultColors.DefaultBorderColor : void 0;
|
|
209
231
|
}
|
|
210
232
|
};
|
|
211
233
|
var GuitarContext = class _GuitarContext {
|
|
234
|
+
/**
|
|
235
|
+
* Create new guitar context object instance.
|
|
236
|
+
* @param tuningName - Tuning name (e.g. "Standard").
|
|
237
|
+
* @param scale - Scale.
|
|
238
|
+
* @param handedness - Handedness.
|
|
239
|
+
* @param pitchNotation - Pitch notation.
|
|
240
|
+
* @param guitarNoteLabel - Guitar note label type.
|
|
241
|
+
*/
|
|
212
242
|
constructor(tuningName, scale, handedness, pitchNotation, guitarNoteLabel) {
|
|
213
243
|
this.tuningName = tuningName;
|
|
214
244
|
this.scale = scale;
|
|
215
245
|
this.handedness = handedness;
|
|
216
246
|
this.pitchNotation = pitchNotation;
|
|
217
247
|
this.guitarNoteLabel = guitarNoteLabel;
|
|
248
|
+
/** Maximum fret index value. */
|
|
218
249
|
__publicField(this, "maxFretId");
|
|
219
250
|
__publicField(this, "fretPositionTable");
|
|
220
251
|
__publicField(this, "tuningStrings");
|
|
@@ -229,6 +260,12 @@ var GuitarContext = class _GuitarContext {
|
|
|
229
260
|
}
|
|
230
261
|
}
|
|
231
262
|
}
|
|
263
|
+
/**
|
|
264
|
+
* Get fret position object.
|
|
265
|
+
* @param stringId - String index in range [0,5].
|
|
266
|
+
* @param fretId - Fret index, 0 = open string fret position.
|
|
267
|
+
* @returns - Fret position object.
|
|
268
|
+
*/
|
|
232
269
|
getFretPosition(stringId, fretId) {
|
|
233
270
|
if (!Utils2.Is.isInteger(stringId) || stringId < 0 || stringId > 5) {
|
|
234
271
|
throw new MusicError(MusicErrorType.InvalidArg, `Invalid stringId: + ${stringId}`);
|
|
@@ -238,24 +275,58 @@ var GuitarContext = class _GuitarContext {
|
|
|
238
275
|
return this.fretPositionTable[stringId][fretId];
|
|
239
276
|
}
|
|
240
277
|
}
|
|
278
|
+
/**
|
|
279
|
+
* Get tuning value (Note) of given string.
|
|
280
|
+
* @param stringId - STring index in range [0, 5].
|
|
281
|
+
* @returns - Note of given string played unfretted.
|
|
282
|
+
*/
|
|
241
283
|
getStringTuning(stringId) {
|
|
242
284
|
return this.tuningStrings[stringId];
|
|
243
285
|
}
|
|
286
|
+
/**
|
|
287
|
+
* Get tuning overview (e.g. "E2 - A2 - D3 - G3 - B3 - E4").
|
|
288
|
+
* @returns - Tuning overview string.
|
|
289
|
+
*/
|
|
244
290
|
getTuningOverview() {
|
|
245
291
|
return this.tuningStrings.slice().reverse().map((note) => note.format(this.pitchNotation, SymbolSet2.Unicode)).join(" - ");
|
|
246
292
|
}
|
|
293
|
+
/**
|
|
294
|
+
* Create copy of this guitar context with new tuning name.
|
|
295
|
+
* @param tuningName - New tuning name.
|
|
296
|
+
* @returns - Guitar context.
|
|
297
|
+
*/
|
|
247
298
|
alterTuningName(tuningName) {
|
|
248
299
|
return tuningName === this.tuningName ? this : new _GuitarContext(tuningName, this.scale, this.handedness, this.pitchNotation, this.guitarNoteLabel);
|
|
249
300
|
}
|
|
301
|
+
/**
|
|
302
|
+
* Create copy of this guitar context with new scale.
|
|
303
|
+
* @param scale - New scale.
|
|
304
|
+
* @returns - Guitar context.
|
|
305
|
+
*/
|
|
250
306
|
alterScale(scale) {
|
|
251
307
|
return Scale2.equals(scale, this.scale) ? this : new _GuitarContext(this.tuningName, scale, this.handedness, this.pitchNotation, this.guitarNoteLabel);
|
|
252
308
|
}
|
|
309
|
+
/**
|
|
310
|
+
* Create copy of this guitar context with handedness.
|
|
311
|
+
* @param handedness - New handedness.
|
|
312
|
+
* @returns - Guitar context.
|
|
313
|
+
*/
|
|
253
314
|
alterHandedness(handedness) {
|
|
254
315
|
return handedness === this.handedness ? this : new _GuitarContext(this.tuningName, this.scale, handedness, this.pitchNotation, this.guitarNoteLabel);
|
|
255
316
|
}
|
|
317
|
+
/**
|
|
318
|
+
* Create copy of this guitar context with new pitch notation.
|
|
319
|
+
* @param pitchNotation - New pitch notation.
|
|
320
|
+
* @returns - Guitar context.
|
|
321
|
+
*/
|
|
256
322
|
alterPitchNotation(pitchNotation) {
|
|
257
323
|
return pitchNotation === this.pitchNotation ? this : new _GuitarContext(this.tuningName, this.scale, this.handedness, pitchNotation, this.guitarNoteLabel);
|
|
258
324
|
}
|
|
325
|
+
/**
|
|
326
|
+
* Create copy of this guitar context with new guitar note label type.
|
|
327
|
+
* @param guitarNoteLabel - New guitar note label type.
|
|
328
|
+
* @returns - Guitar context.
|
|
329
|
+
*/
|
|
259
330
|
alterGuitarNoteLabel(guitarNoteLabel) {
|
|
260
331
|
return guitarNoteLabel === this.guitarNoteLabel ? this : new _GuitarContext(this.tuningName, this.scale, this.handedness, this.pitchNotation, guitarNoteLabel);
|
|
261
332
|
}
|
|
@@ -329,6 +400,12 @@ var Fret = class _Fret {
|
|
|
329
400
|
}
|
|
330
401
|
};
|
|
331
402
|
var FretPositionData = class {
|
|
403
|
+
/**
|
|
404
|
+
* Create new fret position data instance.
|
|
405
|
+
* @param fretPosition - Fret position.
|
|
406
|
+
* @param cellRect - Rect of fret position cell (space around string and between fret and next fret).
|
|
407
|
+
* @param noteRect - Rect to display note name in circle.
|
|
408
|
+
*/
|
|
332
409
|
constructor(fretPosition, cellRect, noteRect) {
|
|
333
410
|
this.fretPosition = fretPosition;
|
|
334
411
|
this.cellRect = cellRect;
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import { N as Note, S as SymbolSet } from './note-eA2xPPiG.js';
|
|
2
|
+
import { K as KeySignature } from './tempo-Bp1UzsrZ.js';
|
|
3
|
+
|
|
4
|
+
/** Interval direction type. */
|
|
5
|
+
type IntervalDirection = "Unison" | "Ascending" | "Descending";
|
|
6
|
+
/** Interval quality type. */
|
|
7
|
+
type IntervalQuality = "Perfect" | "Major" | "minor" | "Augmented" | "Doubly Augmented" | "diminished" | "doubly diminished";
|
|
8
|
+
/**
|
|
9
|
+
* Validate interval quality of unkown value.
|
|
10
|
+
* @param q - Interval quality to validate.
|
|
11
|
+
* @returns - Interval quality if valid, else throws.
|
|
12
|
+
*/
|
|
13
|
+
declare function validateIntervalQuality(q: unknown): IntervalQuality;
|
|
14
|
+
/** Interval class. */
|
|
15
|
+
declare class Interval {
|
|
16
|
+
readonly note1: Note;
|
|
17
|
+
readonly note2: Note;
|
|
18
|
+
/** Interval direction. */
|
|
19
|
+
readonly direction: IntervalDirection;
|
|
20
|
+
/** Number of semitones. */
|
|
21
|
+
readonly semitones: number;
|
|
22
|
+
/** Interval quantity. */
|
|
23
|
+
readonly quantity: number;
|
|
24
|
+
/** Interval quality. */
|
|
25
|
+
readonly quality: IntervalQuality;
|
|
26
|
+
private constructor();
|
|
27
|
+
/**
|
|
28
|
+
* Get interval between given two notes.
|
|
29
|
+
* @param note1 - First note.
|
|
30
|
+
* @param note2 - Second note.
|
|
31
|
+
* @returns - Interval if valid, or undefined.
|
|
32
|
+
*/
|
|
33
|
+
static get(note1: Note, note2: Note): Interval | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Get string presentation of interval (e.g. "Descending Major 2").
|
|
36
|
+
* @returns - Interval string.
|
|
37
|
+
*/
|
|
38
|
+
toString(): string;
|
|
39
|
+
/**
|
|
40
|
+
* Get abbrevated string presentation of interval (e.g. "↓M2").
|
|
41
|
+
* @returns - Interval abbrevated string.
|
|
42
|
+
*/
|
|
43
|
+
toAbbrString(): string;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** Degree type. */
|
|
47
|
+
type Degree = 1 | 2 | "b3" | 3 | 4 | "b5" | 5 | "#5" | 6 | "bb7" | "b7" | 7 | "#7" | "b9" | 9 | "#9" | 11 | 13;
|
|
48
|
+
/** Scale type enum. */
|
|
49
|
+
declare enum ScaleType {
|
|
50
|
+
/** Major scale. */
|
|
51
|
+
Major = "Major",
|
|
52
|
+
/** Natural minor scale. */
|
|
53
|
+
NaturalMinor = "Natural Minor",
|
|
54
|
+
/** Harmonic minor scale. */
|
|
55
|
+
HarmonicMinor = "Harmonic Minor",
|
|
56
|
+
/** Mode: Ionian. */
|
|
57
|
+
Ionian = "Ionian",
|
|
58
|
+
/** Mode: Dorian. */
|
|
59
|
+
Dorian = "Dorian",
|
|
60
|
+
/** Mode: Phrygian. */
|
|
61
|
+
Phrygian = "Phrygian",
|
|
62
|
+
/** Mode: Lydian. */
|
|
63
|
+
Lydian = "Lydian",
|
|
64
|
+
/** Mode: Mixolydian. */
|
|
65
|
+
Mixolydian = "Mixolydian",
|
|
66
|
+
/** Mode: Aeolian (minor). */
|
|
67
|
+
Aeolian = "Aeolian",
|
|
68
|
+
/** Mode: Locrian (rare). */
|
|
69
|
+
Locrian = "Locrian",
|
|
70
|
+
/** Major pentatonic scale. */
|
|
71
|
+
MajorPentatonic = "Major Pentatonic",
|
|
72
|
+
/** Minor pentatoni scale. */
|
|
73
|
+
MinorPentatonic = "Minor Pentatonic",
|
|
74
|
+
/** Major hexatonic blues scale. */
|
|
75
|
+
MajorHexatonicBlues = "Major Hexatonic Blues",
|
|
76
|
+
/** Minor hexatonic blues scale. */
|
|
77
|
+
MinorHexatonicBlues = "Minor Hexatonic Blues",
|
|
78
|
+
/** Heptatonic blues scale. */
|
|
79
|
+
HeptatonicBlues = "Heptatonic Blues"
|
|
80
|
+
}
|
|
81
|
+
/** Scale class. */
|
|
82
|
+
declare class Scale extends KeySignature {
|
|
83
|
+
readonly tonic: string;
|
|
84
|
+
readonly scaleType: ScaleType;
|
|
85
|
+
/** Degrees of scale notes. */
|
|
86
|
+
private readonly scaleDegrees;
|
|
87
|
+
/** Scale notes. */
|
|
88
|
+
private readonly scaleNotes;
|
|
89
|
+
/** Degrees (or undefined) of chromatic classes. */
|
|
90
|
+
private readonly chromaticClassDegree;
|
|
91
|
+
/**
|
|
92
|
+
* Create nev scale object instance.
|
|
93
|
+
* @param tonic - Tonic (e.g. "C" in "C Major").
|
|
94
|
+
* @param scaleType - Scale typo ("e.g. "Major" in "C Major").
|
|
95
|
+
*/
|
|
96
|
+
constructor(tonic: string, scaleType: ScaleType);
|
|
97
|
+
/**
|
|
98
|
+
* Compare if two scales equals.
|
|
99
|
+
* @param a - Scale a.
|
|
100
|
+
* @param b - Scale b.
|
|
101
|
+
* @returns - Boolean equality of given scales.
|
|
102
|
+
*/
|
|
103
|
+
static equals(a: Scale | null | undefined, b: Scale | null | undefined): boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Get scale name.
|
|
106
|
+
* @param symbolSet - Symbol set to format scale name in ascii or unicode.
|
|
107
|
+
* @returns - Scale name string.
|
|
108
|
+
*/
|
|
109
|
+
getScaleName(symbolSet?: SymbolSet): string;
|
|
110
|
+
/**
|
|
111
|
+
* Get scale notes.
|
|
112
|
+
* @param bottomNote - Computed scale notes begin no lower than this note.
|
|
113
|
+
* @param numOctaves - How many octaves?
|
|
114
|
+
* @returns - Array of scale notes.
|
|
115
|
+
*/
|
|
116
|
+
getScaleNotes(bottomNote: string, numOctaves: number): ReadonlyArray<Note>;
|
|
117
|
+
/**
|
|
118
|
+
* Get scale overview (e.g. "C - D - E - F - G - A - B" for "C Major" scale).
|
|
119
|
+
* @returns - Scale overview string.
|
|
120
|
+
*/
|
|
121
|
+
getScaleOverview(): string;
|
|
122
|
+
/**
|
|
123
|
+
* Get scale steps, array of 1 (half step) and 2 (whole step), (e.g. [2, 2, 1, 2, 2, 2, 1] for Major scale).
|
|
124
|
+
* @returns - Array of scale steps.
|
|
125
|
+
*/
|
|
126
|
+
getScaleSteps(): number[];
|
|
127
|
+
/**
|
|
128
|
+
* Get scale steps string presentation, array of "H" (half step) and "W" (whole step), (e.g. ["W", "W", "H", "W", "W", "W", "H"] for Major scale).
|
|
129
|
+
* @returns - Array of scale steps string presentation.
|
|
130
|
+
*/
|
|
131
|
+
getScaleStringSteps(): string[];
|
|
132
|
+
/**
|
|
133
|
+
* Test if given note is scale note.
|
|
134
|
+
* @param note - Note to test.
|
|
135
|
+
* @returns - True/false.
|
|
136
|
+
*/
|
|
137
|
+
isScaleNote(note: Note): boolean;
|
|
138
|
+
/**
|
|
139
|
+
* Test if given note is scale root note.
|
|
140
|
+
* @param note - Note to test.
|
|
141
|
+
* @returns - True/false.
|
|
142
|
+
*/
|
|
143
|
+
isScaleRootNote(note: Note): boolean;
|
|
144
|
+
/**
|
|
145
|
+
* Get interval value between scale root note and given note.
|
|
146
|
+
* @param note - Note.
|
|
147
|
+
* @returns - Interval.
|
|
148
|
+
*/
|
|
149
|
+
getIntervalFromRootNote(note: Note): Interval;
|
|
150
|
+
private preferredChromaticNoteCache;
|
|
151
|
+
/**
|
|
152
|
+
* Get preferred chromatic note from given chromatic id.
|
|
153
|
+
* @param chromaticId - Chromatic id.
|
|
154
|
+
* @returns - Note.
|
|
155
|
+
*/
|
|
156
|
+
getPreferredChromaticNote(chromaticId: number): Note;
|
|
157
|
+
}
|
|
158
|
+
/** Scale factory class. */
|
|
159
|
+
declare class ScaleFactory {
|
|
160
|
+
readonly type: ScaleType;
|
|
161
|
+
private tonicList;
|
|
162
|
+
private scaleMap;
|
|
163
|
+
/**
|
|
164
|
+
* Create new scale factory object instance.
|
|
165
|
+
* @param type - Scale type.
|
|
166
|
+
*/
|
|
167
|
+
constructor(type: ScaleType);
|
|
168
|
+
/**
|
|
169
|
+
* Get list of tonics (e.g. "C", "C#", ... for Major scale type).
|
|
170
|
+
* @returns - Array of tonics.
|
|
171
|
+
*/
|
|
172
|
+
getTonicList(): ReadonlyArray<string>;
|
|
173
|
+
/**
|
|
174
|
+
* Get default tonic.
|
|
175
|
+
* @returns - Default tonic.
|
|
176
|
+
*/
|
|
177
|
+
getDefaultTonic(): string;
|
|
178
|
+
/**
|
|
179
|
+
* Get scale type.
|
|
180
|
+
* @returns - SCale type.
|
|
181
|
+
*/
|
|
182
|
+
getType(): ScaleType;
|
|
183
|
+
/**
|
|
184
|
+
* Get scale by given tonic.
|
|
185
|
+
* @param tonic - Tonic (e.g. "C").
|
|
186
|
+
* @returns - Scale.
|
|
187
|
+
*/
|
|
188
|
+
getScale(tonic: string): Scale;
|
|
189
|
+
/**
|
|
190
|
+
* Test if this scale factory has scale for given tonic value.
|
|
191
|
+
* @param tonic - Tonic.
|
|
192
|
+
* @returns - True/false.
|
|
193
|
+
*/
|
|
194
|
+
hasScale(tonic: string): boolean;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Get array of scale factories, has some title string between to category.
|
|
198
|
+
* @returns - Array of scale factories.
|
|
199
|
+
*/
|
|
200
|
+
declare function getScaleFactoryList(): ReadonlyArray<ScaleFactory | string>;
|
|
201
|
+
/**
|
|
202
|
+
* Get scale factory for given scale type.
|
|
203
|
+
* @param scaleType - Scale type.
|
|
204
|
+
* @returns - Scale factory.
|
|
205
|
+
*/
|
|
206
|
+
declare function getScaleFactory(scaleType: ScaleType | `${ScaleType}`): ScaleFactory;
|
|
207
|
+
/**
|
|
208
|
+
* Validate scale type.
|
|
209
|
+
* @param scaleType - Scale type of unknown value.
|
|
210
|
+
* @returns - Scale type if given argument was valid scale type, or throws.
|
|
211
|
+
*/
|
|
212
|
+
declare function validateScaleType(scaleType: unknown): ScaleType;
|
|
213
|
+
/**
|
|
214
|
+
* Get scale.
|
|
215
|
+
* @param tonic - Tonic (e.g. "C").
|
|
216
|
+
* @param scaleType - Scale type (e.g. "Major").
|
|
217
|
+
*/
|
|
218
|
+
declare function getScale(tonic: string, scaleType: ScaleType | `${ScaleType}`): Scale;
|
|
219
|
+
/**
|
|
220
|
+
* Get scale.
|
|
221
|
+
* @param scale - Scale name (e.g. "C Major").
|
|
222
|
+
*/
|
|
223
|
+
declare function getScale(scale: string): Scale;
|
|
224
|
+
/**
|
|
225
|
+
* Get default scale ("C Major").
|
|
226
|
+
* @returns - Default scale.
|
|
227
|
+
*/
|
|
228
|
+
declare function getDefaultScale(): Scale;
|
|
229
|
+
|
|
230
|
+
export { type Degree as D, type IntervalDirection as I, ScaleType as S, type IntervalQuality as a, Interval as b, Scale as c, ScaleFactory as d, getScaleFactory as e, validateScaleType as f, getScaleFactoryList as g, getScale as h, getDefaultScale as i, validateIntervalQuality as v };
|