@tspro/web-music-score 3.2.0 → 4.0.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 +38 -10
- package/README.md +189 -331
- 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-LCTM7BID.mjs → chunk-YFPLOHP2.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-Bn5HFt_U.d.mts → music-objects-DJQ4d2OA.d.mts} +640 -136
- package/dist/{interface-BlNl69uT.d.ts → music-objects-Dc3kR-XF.d.ts} +640 -136
- 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 +7 -7
- package/dist/pieces/index.mjs +11 -11
- 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-B2Icbetz.d.ts +230 -0
- package/dist/scale-BbDJTbrG.d.mts +230 -0
- package/dist/score/index.d.mts +359 -39
- package/dist/score/index.d.ts +359 -39
- package/dist/score/index.js +1252 -594
- package/dist/score/index.mjs +1255 -599
- package/dist/tempo-CtUhvJbr.d.mts +369 -0
- package/dist/tempo-Dt8aHpol.d.ts +369 -0
- package/dist/theory/index.d.mts +29 -13
- package/dist/theory/index.d.ts +29 -13
- package/dist/theory/index.js +583 -96
- package/dist/theory/index.mjs +580 -94
- package/package.json +2 -2
- package/dist/guitar-C2Cp71NZ.d.ts +0 -17
- package/dist/guitar-DggbM2UL.d.mts +0 -17
- package/dist/note-BFa43I86.d.mts +0 -85
- package/dist/note-BFa43I86.d.ts +0 -85
- package/dist/scale-DRR-t4Kr.d.mts +0 -74
- package/dist/scale-ebJm37q1.d.ts +0 -74
- package/dist/tempo-B4h5Ktob.d.mts +0 -104
- package/dist/tempo-DgqDEsn0.d.ts +0 -104
package/dist/audio/index.d.mts
CHANGED
|
@@ -1,15 +1,54 @@
|
|
|
1
|
-
import { N as Note } from '../note-
|
|
1
|
+
import { N as Note } from '../note-eA2xPPiG.mjs';
|
|
2
2
|
|
|
3
|
+
/** Instrument interface. */
|
|
3
4
|
interface Instrument {
|
|
5
|
+
/**
|
|
6
|
+
* Get instrument name.
|
|
7
|
+
* @return - Instrument name.
|
|
8
|
+
*/
|
|
4
9
|
getName(): string;
|
|
10
|
+
/**
|
|
11
|
+
* Play a note.
|
|
12
|
+
* @param note - Note to play (e.g. "C4").
|
|
13
|
+
* @param duration - Play duration in seconds.
|
|
14
|
+
* @param volume - Linear volume in range [0, 1].
|
|
15
|
+
*/
|
|
5
16
|
playNote(note: string, duration?: number, volume?: number): void;
|
|
17
|
+
/**
|
|
18
|
+
* Stop playback.
|
|
19
|
+
*/
|
|
6
20
|
stop(): void;
|
|
7
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* Get instrument name list.
|
|
24
|
+
* @returns - Array of available instrument names.
|
|
25
|
+
*/
|
|
8
26
|
declare function getInstrumentList(): ReadonlyArray<string>;
|
|
27
|
+
/**
|
|
28
|
+
* Get current instrument name.
|
|
29
|
+
* @returns - Name of current instrument.
|
|
30
|
+
*/
|
|
9
31
|
declare function getCurrentInstrument(): string;
|
|
32
|
+
/**
|
|
33
|
+
* Register new instrument.
|
|
34
|
+
* @param instr - Instrument object implementing Instrument interface.
|
|
35
|
+
*/
|
|
10
36
|
declare function registerInstrument(instr: Instrument): void;
|
|
37
|
+
/**
|
|
38
|
+
* Set current instrument to use in playback.
|
|
39
|
+
* @param instrName - Instrument name.
|
|
40
|
+
*/
|
|
11
41
|
declare function setInstrument(instrName: string): void;
|
|
42
|
+
/**
|
|
43
|
+
* Play a note using current instrument.
|
|
44
|
+
* @param note - Note instance of Note object, note name (e.g. "C4"), or midiNumber.
|
|
45
|
+
* @param duration - Play duration in seconds.
|
|
46
|
+
* @param linearVolume - Linear volume in range [0, 1].
|
|
47
|
+
*/
|
|
12
48
|
declare function playNote(note: Note | string | number, duration?: number, linearVolume?: number): void;
|
|
49
|
+
/**
|
|
50
|
+
* Stop playing on current instrument.
|
|
51
|
+
*/
|
|
13
52
|
declare function stop(): void;
|
|
14
53
|
|
|
15
54
|
export { type Instrument, getCurrentInstrument, getInstrumentList, playNote, registerInstrument, setInstrument, stop };
|
package/dist/audio/index.d.ts
CHANGED
|
@@ -1,15 +1,54 @@
|
|
|
1
|
-
import { N as Note } from '../note-
|
|
1
|
+
import { N as Note } from '../note-eA2xPPiG.js';
|
|
2
2
|
|
|
3
|
+
/** Instrument interface. */
|
|
3
4
|
interface Instrument {
|
|
5
|
+
/**
|
|
6
|
+
* Get instrument name.
|
|
7
|
+
* @return - Instrument name.
|
|
8
|
+
*/
|
|
4
9
|
getName(): string;
|
|
10
|
+
/**
|
|
11
|
+
* Play a note.
|
|
12
|
+
* @param note - Note to play (e.g. "C4").
|
|
13
|
+
* @param duration - Play duration in seconds.
|
|
14
|
+
* @param volume - Linear volume in range [0, 1].
|
|
15
|
+
*/
|
|
5
16
|
playNote(note: string, duration?: number, volume?: number): void;
|
|
17
|
+
/**
|
|
18
|
+
* Stop playback.
|
|
19
|
+
*/
|
|
6
20
|
stop(): void;
|
|
7
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* Get instrument name list.
|
|
24
|
+
* @returns - Array of available instrument names.
|
|
25
|
+
*/
|
|
8
26
|
declare function getInstrumentList(): ReadonlyArray<string>;
|
|
27
|
+
/**
|
|
28
|
+
* Get current instrument name.
|
|
29
|
+
* @returns - Name of current instrument.
|
|
30
|
+
*/
|
|
9
31
|
declare function getCurrentInstrument(): string;
|
|
32
|
+
/**
|
|
33
|
+
* Register new instrument.
|
|
34
|
+
* @param instr - Instrument object implementing Instrument interface.
|
|
35
|
+
*/
|
|
10
36
|
declare function registerInstrument(instr: Instrument): void;
|
|
37
|
+
/**
|
|
38
|
+
* Set current instrument to use in playback.
|
|
39
|
+
* @param instrName - Instrument name.
|
|
40
|
+
*/
|
|
11
41
|
declare function setInstrument(instrName: string): void;
|
|
42
|
+
/**
|
|
43
|
+
* Play a note using current instrument.
|
|
44
|
+
* @param note - Note instance of Note object, note name (e.g. "C4"), or midiNumber.
|
|
45
|
+
* @param duration - Play duration in seconds.
|
|
46
|
+
* @param linearVolume - Linear volume in range [0, 1].
|
|
47
|
+
*/
|
|
12
48
|
declare function playNote(note: Note | string | number, duration?: number, linearVolume?: number): void;
|
|
49
|
+
/**
|
|
50
|
+
* Stop playing on current instrument.
|
|
51
|
+
*/
|
|
13
52
|
declare function stop(): void;
|
|
14
53
|
|
|
15
54
|
export { type Instrument, getCurrentInstrument, getInstrumentList, playNote, registerInstrument, setInstrument, stop };
|
package/dist/audio/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* WebMusicScore
|
|
1
|
+
/* WebMusicScore v4.0.1 | (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;
|
package/dist/audio/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/* WebMusicScore
|
|
1
|
+
/* WebMusicScore v4.0.1 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
|
|
2
2
|
import {
|
|
3
3
|
__publicField
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-YFPLOHP2.mjs";
|
|
5
5
|
|
|
6
6
|
// src/audio/index.ts
|
|
7
7
|
import { Note, PitchNotation, SymbolSet } from "@tspro/web-music-score/theory";
|
package/dist/audio-cg/index.d.ts
CHANGED
package/dist/audio-cg/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* WebMusicScore
|
|
1
|
+
/* WebMusicScore v4.0.1 | (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;
|
package/dist/audio-cg/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/* WebMusicScore
|
|
1
|
+
/* WebMusicScore v4.0.1 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
|
|
2
2
|
import {
|
|
3
3
|
__publicField
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-YFPLOHP2.mjs";
|
|
5
5
|
|
|
6
6
|
// src/audio-cg/index.ts
|
|
7
7
|
import * as Tone from "tone";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* WebMusicScore
|
|
1
|
+
/* WebMusicScore v4.0.1 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4
4
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
@@ -6,4 +6,4 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
6
6
|
export {
|
|
7
7
|
__publicField
|
|
8
8
|
};
|
|
9
|
-
//# sourceMappingURL=chunk-
|
|
9
|
+
//# sourceMappingURL=chunk-YFPLOHP2.mjs.map
|
package/dist/core/index.d.mts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/** Enum of music error types. */
|
|
1
2
|
declare enum MusicErrorType {
|
|
2
3
|
Unknown = 0,
|
|
3
4
|
InvalidArg = 1,
|
|
@@ -7,9 +8,20 @@ declare enum MusicErrorType {
|
|
|
7
8
|
Timesignature = 5,
|
|
8
9
|
Score = 6
|
|
9
10
|
}
|
|
11
|
+
/** Music error class. */
|
|
10
12
|
declare class MusicError extends Error {
|
|
13
|
+
/** Music error type. */
|
|
11
14
|
readonly type: MusicErrorType;
|
|
15
|
+
/**
|
|
16
|
+
* Create new music error instance.
|
|
17
|
+
* @param message - Error message.
|
|
18
|
+
*/
|
|
12
19
|
constructor(message: string);
|
|
20
|
+
/**
|
|
21
|
+
* Create new musicerror instance.
|
|
22
|
+
* @param type - Music error type.
|
|
23
|
+
* @param message - Error message.
|
|
24
|
+
*/
|
|
13
25
|
constructor(type: MusicErrorType, message: string);
|
|
14
26
|
}
|
|
15
27
|
|
package/dist/core/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/** Enum of music error types. */
|
|
1
2
|
declare enum MusicErrorType {
|
|
2
3
|
Unknown = 0,
|
|
3
4
|
InvalidArg = 1,
|
|
@@ -7,9 +8,20 @@ declare enum MusicErrorType {
|
|
|
7
8
|
Timesignature = 5,
|
|
8
9
|
Score = 6
|
|
9
10
|
}
|
|
11
|
+
/** Music error class. */
|
|
10
12
|
declare class MusicError extends Error {
|
|
13
|
+
/** Music error type. */
|
|
11
14
|
readonly type: MusicErrorType;
|
|
15
|
+
/**
|
|
16
|
+
* Create new music error instance.
|
|
17
|
+
* @param message - Error message.
|
|
18
|
+
*/
|
|
12
19
|
constructor(message: string);
|
|
20
|
+
/**
|
|
21
|
+
* Create new musicerror instance.
|
|
22
|
+
* @param type - Music error type.
|
|
23
|
+
* @param message - Error message.
|
|
24
|
+
*/
|
|
13
25
|
constructor(type: MusicErrorType, message: string);
|
|
14
26
|
}
|
|
15
27
|
|
package/dist/core/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* WebMusicScore
|
|
1
|
+
/* WebMusicScore v4.0.1 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
|
|
2
2
|
"use strict";
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -47,6 +47,7 @@ var MusicError = class extends Error {
|
|
|
47
47
|
constructor(...args) {
|
|
48
48
|
const [type, msg] = args.length === 1 ? [0 /* Unknown */, args[0]] : args;
|
|
49
49
|
super(formatType(type) + msg);
|
|
50
|
+
/** Music error type. */
|
|
50
51
|
__publicField(this, "type");
|
|
51
52
|
Object.setPrototypeOf(this, new.target.prototype);
|
|
52
53
|
this.name = "MusicError";
|
|
@@ -61,7 +62,7 @@ function init() {
|
|
|
61
62
|
return;
|
|
62
63
|
}
|
|
63
64
|
initialized = true;
|
|
64
|
-
console.log("%cWebMusicScore
|
|
65
|
+
console.log("%cWebMusicScore v4.0.1 (cjs) initialized.", "background: black; color: white; padding: 2px;");
|
|
65
66
|
}
|
|
66
67
|
// Annotate the CommonJS export names for ESM import in node:
|
|
67
68
|
0 && (module.exports = {
|
package/dist/core/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/* WebMusicScore
|
|
1
|
+
/* WebMusicScore v4.0.1 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
|
|
2
2
|
import {
|
|
3
3
|
__publicField
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-YFPLOHP2.mjs";
|
|
5
5
|
|
|
6
6
|
// src/core/error.ts
|
|
7
7
|
var MusicErrorType = /* @__PURE__ */ ((MusicErrorType2) => {
|
|
@@ -21,6 +21,7 @@ var MusicError = class extends Error {
|
|
|
21
21
|
constructor(...args) {
|
|
22
22
|
const [type, msg] = args.length === 1 ? [0 /* Unknown */, args[0]] : args;
|
|
23
23
|
super(formatType(type) + msg);
|
|
24
|
+
/** Music error type. */
|
|
24
25
|
__publicField(this, "type");
|
|
25
26
|
Object.setPrototypeOf(this, new.target.prototype);
|
|
26
27
|
this.name = "MusicError";
|
|
@@ -35,7 +36,7 @@ function init() {
|
|
|
35
36
|
return;
|
|
36
37
|
}
|
|
37
38
|
initialized = true;
|
|
38
|
-
console.log("%cWebMusicScore
|
|
39
|
+
console.log("%cWebMusicScore v4.0.1 (esm) initialized.", "background: black; color: white; padding: 2px;");
|
|
39
40
|
}
|
|
40
41
|
export {
|
|
41
42
|
MusicError,
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { N as Note } from './note-eA2xPPiG.js';
|
|
2
|
+
|
|
3
|
+
/** Guitar handedness enum. */
|
|
4
|
+
declare enum Handedness {
|
|
5
|
+
/** Right handed guitar. */
|
|
6
|
+
RightHanded = 0,
|
|
7
|
+
/** Left handed guitar. */
|
|
8
|
+
LeftHanded = 1
|
|
9
|
+
}
|
|
10
|
+
/** Default guitar handedness (Handedness.RightHanded). */
|
|
11
|
+
declare const DefaultHandedness = Handedness.RightHanded;
|
|
12
|
+
/**
|
|
13
|
+
* Validate if given argument is guitar handedness.
|
|
14
|
+
* @param h - Guitar handedness to validate.
|
|
15
|
+
* @returns - Guitar handedness if valid, else throws.
|
|
16
|
+
*/
|
|
17
|
+
declare function validateHandedness(h: unknown): Handedness;
|
|
18
|
+
/** Guitar tuning name list. */
|
|
19
|
+
declare const TuningNameList: ReadonlyArray<string>;
|
|
20
|
+
/** DEfault tuning name (Standard). */
|
|
21
|
+
declare const DefaultTuningName: string;
|
|
22
|
+
/**
|
|
23
|
+
* Validate if given argument is available tuning name.
|
|
24
|
+
* @param tuningName - Tuning name to validate.
|
|
25
|
+
* @returns - Tuning name if valid, or throws.
|
|
26
|
+
*/
|
|
27
|
+
declare function validateTuningName(tuningName: string): string;
|
|
28
|
+
/**
|
|
29
|
+
* Get guitar tuning, note for each open string.
|
|
30
|
+
* @param tuningName - Tuning name.
|
|
31
|
+
* @returns Array of open string notes.
|
|
32
|
+
*/
|
|
33
|
+
declare function getTuningStrings(tuningName: string): ReadonlyArray<Note>;
|
|
34
|
+
|
|
35
|
+
export { DefaultHandedness as D, Handedness as H, TuningNameList as T, DefaultTuningName as a, validateTuningName as b, getTuningStrings as g, validateHandedness as v };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { N as Note } from './note-eA2xPPiG.mjs';
|
|
2
|
+
|
|
3
|
+
/** Guitar handedness enum. */
|
|
4
|
+
declare enum Handedness {
|
|
5
|
+
/** Right handed guitar. */
|
|
6
|
+
RightHanded = 0,
|
|
7
|
+
/** Left handed guitar. */
|
|
8
|
+
LeftHanded = 1
|
|
9
|
+
}
|
|
10
|
+
/** Default guitar handedness (Handedness.RightHanded). */
|
|
11
|
+
declare const DefaultHandedness = Handedness.RightHanded;
|
|
12
|
+
/**
|
|
13
|
+
* Validate if given argument is guitar handedness.
|
|
14
|
+
* @param h - Guitar handedness to validate.
|
|
15
|
+
* @returns - Guitar handedness if valid, else throws.
|
|
16
|
+
*/
|
|
17
|
+
declare function validateHandedness(h: unknown): Handedness;
|
|
18
|
+
/** Guitar tuning name list. */
|
|
19
|
+
declare const TuningNameList: ReadonlyArray<string>;
|
|
20
|
+
/** DEfault tuning name (Standard). */
|
|
21
|
+
declare const DefaultTuningName: string;
|
|
22
|
+
/**
|
|
23
|
+
* Validate if given argument is available tuning name.
|
|
24
|
+
* @param tuningName - Tuning name to validate.
|
|
25
|
+
* @returns - Tuning name if valid, or throws.
|
|
26
|
+
*/
|
|
27
|
+
declare function validateTuningName(tuningName: string): string;
|
|
28
|
+
/**
|
|
29
|
+
* Get guitar tuning, note for each open string.
|
|
30
|
+
* @param tuningName - Tuning name.
|
|
31
|
+
* @returns Array of open string notes.
|
|
32
|
+
*/
|
|
33
|
+
declare function getTuningStrings(tuningName: string): ReadonlyArray<Note>;
|
|
34
|
+
|
|
35
|
+
export { DefaultHandedness as D, Handedness as H, TuningNameList as T, DefaultTuningName as a, validateTuningName as b, getTuningStrings as g, validateHandedness as v };
|