@tspro/web-music-score 5.4.2 → 5.5.1
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 +15 -0
- package/LICENSE +24 -0
- package/README.md +8 -546
- package/dist/audio/index.d.ts +1 -1
- package/dist/audio/index.js +1748 -5
- package/dist/audio/index.mjs +9 -6
- package/dist/audio-cg/index.js +17487 -46
- package/dist/audio-cg/index.mjs +7 -5
- package/dist/audio-synth/index.js +18434 -32
- package/dist/audio-synth/index.mjs +12 -7
- package/dist/chunk-7GVRGM3N.mjs +101 -0
- package/dist/chunk-AUOH7S2E.mjs +3877 -0
- package/dist/{chunk-MMWSQGVR.mjs → chunk-BZE5UGTJ.mjs} +3 -3
- package/dist/{chunk-CVYTUTL6.mjs → chunk-FLBNOYUN.mjs} +2 -2
- package/dist/{chunk-42IBAVOC.mjs → chunk-KKIFSIFK.mjs} +18 -13
- package/dist/chunk-L7VPSGMT.mjs +18381 -0
- package/dist/core/index.js +2 -2
- package/dist/core/index.mjs +4 -4
- package/dist/{guitar-CNOxM4ZK.d.ts → guitar-CarHGDAt.d.ts} +1 -1
- package/dist/iife/audio-cg.global.js +1 -1
- package/dist/iife/index.global.js +13 -13
- package/dist/{music-objects-DqoO-Sfv.d.mts → music-objects-CcJvZxS6.d.mts} +123 -96
- package/dist/{music-objects-T8u8bnNP.d.ts → music-objects-l5Ai97QA.d.ts} +125 -98
- package/dist/{note-RVXvpfyV.d.ts → note-CJuq5aBy.d.ts} +1 -1
- package/dist/pieces/index.d.mts +12 -6
- package/dist/pieces/index.d.ts +14 -8
- package/dist/pieces/index.js +25 -13
- package/dist/pieces/index.mjs +25 -14
- package/dist/react-ui/index.d.mts +1 -1
- package/dist/react-ui/index.d.ts +5 -5
- package/dist/react-ui/index.js +2274 -22
- package/dist/react-ui/index.mjs +18 -15
- package/dist/{scale-CUYFBo-8.d.ts → scale-DulPFco_.d.ts} +2 -2
- package/dist/score/index.d.mts +51 -3
- package/dist/score/index.d.ts +54 -6
- package/dist/score/index.js +4941 -872
- package/dist/score/index.mjs +1282 -729
- package/dist/{tempo-DwuZsv2T.d.ts → tempo-BnUjm25M.d.ts} +1 -1
- package/dist/theory/index.d.ts +6 -6
- package/dist/theory/index.js +2687 -136
- package/dist/theory/index.mjs +41 -49
- package/package.json +4 -5
- package/dist/chunk-ROBXPR34.mjs +0 -9
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/* WebMusicScore v5.
|
|
1
|
+
/* WebMusicScore v5.5.1 | (c) 2023-2025 PahkaSoft | MIT License | Includes: Tone.js (MIT License), Color Name to Code (MIT License) */
|
|
2
2
|
import {
|
|
3
3
|
__publicField
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-7GVRGM3N.mjs";
|
|
5
5
|
|
|
6
6
|
// src/core/error.ts
|
|
7
7
|
var MusicErrorType = /* @__PURE__ */ ((MusicErrorType2) => {
|
|
@@ -34,4 +34,4 @@ export {
|
|
|
34
34
|
MusicErrorType,
|
|
35
35
|
MusicError
|
|
36
36
|
};
|
|
37
|
-
//# sourceMappingURL=chunk-
|
|
37
|
+
//# sourceMappingURL=chunk-BZE5UGTJ.mjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* WebMusicScore v5.
|
|
1
|
+
/* WebMusicScore v5.5.1 | (c) 2023-2025 PahkaSoft | MIT License | Includes: Tone.js (MIT License), Color Name to Code (MIT License) */
|
|
2
2
|
|
|
3
3
|
// src/audio/instrument.ts
|
|
4
4
|
function linearToDecibels(linearVolume) {
|
|
@@ -8,4 +8,4 @@ function linearToDecibels(linearVolume) {
|
|
|
8
8
|
export {
|
|
9
9
|
linearToDecibels
|
|
10
10
|
};
|
|
11
|
-
//# sourceMappingURL=chunk-
|
|
11
|
+
//# sourceMappingURL=chunk-FLBNOYUN.mjs.map
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
/* WebMusicScore v5.
|
|
1
|
+
/* WebMusicScore v5.5.1 | (c) 2023-2025 PahkaSoft | MIT License | Includes: Tone.js (MIT License), Color Name to Code (MIT License) */
|
|
2
|
+
import {
|
|
3
|
+
IndexArray,
|
|
4
|
+
UniMap,
|
|
5
|
+
guard_exports,
|
|
6
|
+
utils_exports
|
|
7
|
+
} from "./chunk-AUOH7S2E.mjs";
|
|
2
8
|
import {
|
|
3
9
|
__publicField
|
|
4
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-7GVRGM3N.mjs";
|
|
5
11
|
|
|
6
12
|
// src/theory/rhythm.ts
|
|
7
|
-
import { Guard, IndexArray, UniMap, Utils } from "@tspro/ts-utils-lib";
|
|
8
13
|
import { MusicError, MusicErrorType } from "@tspro/web-music-score/core";
|
|
9
14
|
var MaxTupletRatioValue = 12;
|
|
10
15
|
var TicksMultiplier = 12 * 11 * 9 * 7 * 5;
|
|
@@ -48,7 +53,7 @@ var NoteLength = /* @__PURE__ */ ((NoteLength2) => {
|
|
|
48
53
|
return NoteLength2;
|
|
49
54
|
})(NoteLength || {});
|
|
50
55
|
function isNoteLength(noteLength) {
|
|
51
|
-
return
|
|
56
|
+
return guard_exports.isEnumValue(noteLength, NoteLength);
|
|
52
57
|
}
|
|
53
58
|
function validateNoteLength(noteLength) {
|
|
54
59
|
if (isNoteLength(noteLength)) {
|
|
@@ -81,7 +86,7 @@ var _NoteLengthProps = class _NoteLengthProps {
|
|
|
81
86
|
this.noteSize = parseInt(noteLength);
|
|
82
87
|
this.isTriplet = noteLength.endsWith("t");
|
|
83
88
|
this.maxDotCount = this.isTriplet ? 0 : Math.floor(Math.log2(_NoteLengthProps.ShortestNoteSize / this.noteSize));
|
|
84
|
-
this.dotCount =
|
|
89
|
+
this.dotCount = utils_exports.Str.charCount(noteLength, ".");
|
|
85
90
|
this.flagCount = this.noteSize > 4 ? Math.floor(Math.log2(this.noteSize / 4)) : 0;
|
|
86
91
|
this.ticks = TicksMultiplier * _NoteLengthProps.ShortestNoteSize / this.noteSize;
|
|
87
92
|
this.hasStem = this.noteSize > 1;
|
|
@@ -108,7 +113,7 @@ var _NoteLengthProps = class _NoteLengthProps {
|
|
|
108
113
|
*/
|
|
109
114
|
static create(noteLength, dotCount = 0) {
|
|
110
115
|
let noteSize = typeof noteLength === "number" ? noteLength : this.get(noteLength).noteSize;
|
|
111
|
-
return this.get(noteSize + (
|
|
116
|
+
return this.get(noteSize + (guard_exports.isIntegerGte(dotCount, 1) ? ".".repeat(dotCount) : "n"));
|
|
112
117
|
}
|
|
113
118
|
/**
|
|
114
119
|
* Compare note lengths/sizes. Whole (1) > half (2) > quarter (4), etc.
|
|
@@ -120,7 +125,7 @@ var _NoteLengthProps = class _NoteLengthProps {
|
|
|
120
125
|
static cmp(a, b) {
|
|
121
126
|
let aNoteSize = a instanceof _NoteLengthProps ? a.noteSize : typeof a === "number" ? a : _NoteLengthProps.get(a).noteSize;
|
|
122
127
|
let bNoteSize = b instanceof _NoteLengthProps ? b.noteSize : typeof b === "number" ? b : _NoteLengthProps.get(b).noteSize;
|
|
123
|
-
return
|
|
128
|
+
return utils_exports.Math.cmp(bNoteSize, aNoteSize);
|
|
124
129
|
}
|
|
125
130
|
/**
|
|
126
131
|
* Compare note lengths/sizes for equality.
|
|
@@ -136,13 +141,13 @@ var _NoteLengthProps = class _NoteLengthProps {
|
|
|
136
141
|
}
|
|
137
142
|
};
|
|
138
143
|
/** Longest note size (e.g. 1 = whole note). */
|
|
139
|
-
__publicField(_NoteLengthProps, "LongestNoteSize", Math.min(...
|
|
144
|
+
__publicField(_NoteLengthProps, "LongestNoteSize", Math.min(...utils_exports.Enum.getEnumValues(NoteLength).map((noteLength) => parseInt(noteLength))));
|
|
140
145
|
/** Shortest note size (e.g. 64 = sixtyfourth note). */
|
|
141
|
-
__publicField(_NoteLengthProps, "ShortestNoteSize", Math.max(...
|
|
146
|
+
__publicField(_NoteLengthProps, "ShortestNoteSize", Math.max(...utils_exports.Enum.getEnumValues(NoteLength).map((noteLength) => parseInt(noteLength))));
|
|
142
147
|
__publicField(_NoteLengthProps, "cache", new UniMap());
|
|
143
148
|
var NoteLengthProps = _NoteLengthProps;
|
|
144
149
|
function isTupletRatio(tupletRatio) {
|
|
145
|
-
return
|
|
150
|
+
return guard_exports.isObject(tupletRatio) && guard_exports.isIntegerBetween(tupletRatio.parts, 2, MaxTupletRatioValue) && guard_exports.isIntegerBetween(tupletRatio.inTimeOf, 2, MaxTupletRatioValue);
|
|
146
151
|
}
|
|
147
152
|
function validateTupletRatio(tupletRatio) {
|
|
148
153
|
if (isTupletRatio(tupletRatio)) {
|
|
@@ -185,7 +190,7 @@ var _RhythmProps = class _RhythmProps {
|
|
|
185
190
|
this.dotCount = dotCount != null ? dotCount : p.dotCount;
|
|
186
191
|
this.hasStem = p.hasStem;
|
|
187
192
|
this.isSolidNoteHead = p.isSolid;
|
|
188
|
-
if (
|
|
193
|
+
if (guard_exports.isObject(tupletRatio)) {
|
|
189
194
|
this.tupletRatio = validateTupletRatio(tupletRatio);
|
|
190
195
|
} else if (p.isTriplet) {
|
|
191
196
|
this.tupletRatio = Tuplet.Triplet;
|
|
@@ -234,7 +239,7 @@ var _RhythmProps = class _RhythmProps {
|
|
|
234
239
|
* @returns - -1: a < b, 0: a === b, +1: a > b (duration comparisons)
|
|
235
240
|
*/
|
|
236
241
|
static cmp(a, b) {
|
|
237
|
-
return
|
|
242
|
+
return utils_exports.Math.cmp(a.ticks, b.ticks);
|
|
238
243
|
}
|
|
239
244
|
/**
|
|
240
245
|
* Compare duration equality of rhythm props.
|
|
@@ -260,4 +265,4 @@ export {
|
|
|
260
265
|
Tuplet,
|
|
261
266
|
RhythmProps
|
|
262
267
|
};
|
|
263
|
-
//# sourceMappingURL=chunk-
|
|
268
|
+
//# sourceMappingURL=chunk-KKIFSIFK.mjs.map
|