@tspro/web-music-score 5.4.2 → 5.5.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 +11 -0
- package/LICENSE +24 -0
- package/README.md +13 -6
- package/dist/audio/index.d.ts +1 -1
- package/dist/audio/index.js +1637 -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-MMWSQGVR.mjs → chunk-2DCCUAGC.mjs} +3 -3
- package/dist/{chunk-CVYTUTL6.mjs → chunk-2PEB4HWS.mjs} +2 -2
- package/dist/{chunk-42IBAVOC.mjs → chunk-33HIE3HR.mjs} +18 -13
- package/dist/chunk-BMKUAUSJ.mjs +101 -0
- package/dist/chunk-PCQGQM63.mjs +18381 -0
- package/dist/chunk-T6TYLAJE.mjs +3766 -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 +11 -11
- 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 +2163 -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 +4828 -872
- package/dist/score/index.mjs +1280 -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 +2576 -136
- package/dist/theory/index.mjs +41 -49
- package/package.json +4 -5
- package/dist/chunk-ROBXPR34.mjs +0 -9
|
@@ -1,20 +1,25 @@
|
|
|
1
|
-
/* WebMusicScore v5.
|
|
1
|
+
/* WebMusicScore v5.5.0 | (c) 2023-2025 PahkaSoft | MIT License | Includes: Tone.js (MIT License), Color Name to Code (MIT License) */
|
|
2
|
+
import {
|
|
3
|
+
Filter,
|
|
4
|
+
PolySynth,
|
|
5
|
+
Reverb,
|
|
6
|
+
Synth
|
|
7
|
+
} from "../chunk-PCQGQM63.mjs";
|
|
2
8
|
import {
|
|
3
9
|
linearToDecibels
|
|
4
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-2PEB4HWS.mjs";
|
|
5
11
|
import {
|
|
6
12
|
__publicField
|
|
7
|
-
} from "../chunk-
|
|
13
|
+
} from "../chunk-BMKUAUSJ.mjs";
|
|
8
14
|
|
|
9
15
|
// src/audio-instruments/audio-synth/index.ts
|
|
10
|
-
import * as Tone from "tone";
|
|
11
16
|
var SynthesizerInstr = class {
|
|
12
17
|
constructor() {
|
|
13
18
|
__publicField(this, "audioSource");
|
|
14
19
|
try {
|
|
15
|
-
const reverb = new
|
|
16
|
-
const filter = new
|
|
17
|
-
this.audioSource = new
|
|
20
|
+
const reverb = new Reverb({ decay: 3, wet: 0.4 }).toDestination();
|
|
21
|
+
const filter = new Filter(800, "lowpass").connect(reverb);
|
|
22
|
+
this.audioSource = new PolySynth(Synth, {
|
|
18
23
|
oscillator: {
|
|
19
24
|
type: "triangle"
|
|
20
25
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/* WebMusicScore v5.
|
|
1
|
+
/* WebMusicScore v5.5.0 | (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-BMKUAUSJ.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-2DCCUAGC.mjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* WebMusicScore v5.
|
|
1
|
+
/* WebMusicScore v5.5.0 | (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-2PEB4HWS.mjs.map
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
/* WebMusicScore v5.
|
|
1
|
+
/* WebMusicScore v5.5.0 | (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-T6TYLAJE.mjs";
|
|
2
8
|
import {
|
|
3
9
|
__publicField
|
|
4
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-BMKUAUSJ.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-33HIE3HR.mjs.map
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/* WebMusicScore v5.5.0 | (c) 2023-2025 PahkaSoft | MIT License | Includes: Tone.js (MIT License), Color Name to Code (MIT License) */
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
4
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
+
var __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name);
|
|
9
|
+
var __typeError = (msg) => {
|
|
10
|
+
throw TypeError(msg);
|
|
11
|
+
};
|
|
12
|
+
var __pow = Math.pow;
|
|
13
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
14
|
+
var __spreadValues = (a, b) => {
|
|
15
|
+
for (var prop in b || (b = {}))
|
|
16
|
+
if (__hasOwnProp.call(b, prop))
|
|
17
|
+
__defNormalProp(a, prop, b[prop]);
|
|
18
|
+
if (__getOwnPropSymbols)
|
|
19
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
20
|
+
if (__propIsEnum.call(b, prop))
|
|
21
|
+
__defNormalProp(a, prop, b[prop]);
|
|
22
|
+
}
|
|
23
|
+
return a;
|
|
24
|
+
};
|
|
25
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
26
|
+
var __objRest = (source, exclude) => {
|
|
27
|
+
var target = {};
|
|
28
|
+
for (var prop in source)
|
|
29
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
30
|
+
target[prop] = source[prop];
|
|
31
|
+
if (source != null && __getOwnPropSymbols)
|
|
32
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
33
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
34
|
+
target[prop] = source[prop];
|
|
35
|
+
}
|
|
36
|
+
return target;
|
|
37
|
+
};
|
|
38
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
39
|
+
var __async = (__this, __arguments, generator) => {
|
|
40
|
+
return new Promise((resolve, reject) => {
|
|
41
|
+
var fulfilled = (value) => {
|
|
42
|
+
try {
|
|
43
|
+
step(generator.next(value));
|
|
44
|
+
} catch (e) {
|
|
45
|
+
reject(e);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
var rejected = (value) => {
|
|
49
|
+
try {
|
|
50
|
+
step(generator.throw(value));
|
|
51
|
+
} catch (e) {
|
|
52
|
+
reject(e);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
56
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
var __await = function(promise, isYieldStar) {
|
|
60
|
+
this[0] = promise;
|
|
61
|
+
this[1] = isYieldStar;
|
|
62
|
+
};
|
|
63
|
+
var __yieldStar = (value) => {
|
|
64
|
+
var obj = value[__knownSymbol("asyncIterator")], isAwait = false, method, it = {};
|
|
65
|
+
if (obj == null) {
|
|
66
|
+
obj = value[__knownSymbol("iterator")]();
|
|
67
|
+
method = (k) => it[k] = (x) => obj[k](x);
|
|
68
|
+
} else {
|
|
69
|
+
obj = obj.call(value);
|
|
70
|
+
method = (k) => it[k] = (v) => {
|
|
71
|
+
if (isAwait) {
|
|
72
|
+
isAwait = false;
|
|
73
|
+
if (k === "throw") throw v;
|
|
74
|
+
return v;
|
|
75
|
+
}
|
|
76
|
+
isAwait = true;
|
|
77
|
+
return {
|
|
78
|
+
done: false,
|
|
79
|
+
value: new __await(new Promise((resolve) => {
|
|
80
|
+
var x = obj[k](v);
|
|
81
|
+
if (!(x instanceof Object)) __typeError("Object expected");
|
|
82
|
+
resolve(x);
|
|
83
|
+
}), 1)
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
return it[__knownSymbol("iterator")] = () => it, method("next"), "throw" in obj ? method("throw") : it.throw = (x) => {
|
|
88
|
+
throw x;
|
|
89
|
+
}, "return" in obj && method("return"), it;
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
export {
|
|
93
|
+
__pow,
|
|
94
|
+
__spreadValues,
|
|
95
|
+
__spreadProps,
|
|
96
|
+
__objRest,
|
|
97
|
+
__publicField,
|
|
98
|
+
__async,
|
|
99
|
+
__yieldStar
|
|
100
|
+
};
|
|
101
|
+
//# sourceMappingURL=chunk-BMKUAUSJ.mjs.map
|