@tspro/web-music-score 4.0.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.
Files changed (49) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +1 -1
  3. package/dist/audio/index.d.mts +40 -1
  4. package/dist/audio/index.d.ts +40 -1
  5. package/dist/audio/index.js +1 -1
  6. package/dist/audio/index.mjs +2 -2
  7. package/dist/audio-cg/index.d.mts +3 -0
  8. package/dist/audio-cg/index.d.ts +3 -0
  9. package/dist/audio-cg/index.js +1 -1
  10. package/dist/audio-cg/index.mjs +2 -2
  11. package/dist/{chunk-D643HZHM.mjs → chunk-YFPLOHP2.mjs} +2 -2
  12. package/dist/core/index.d.mts +12 -0
  13. package/dist/core/index.d.ts +12 -0
  14. package/dist/core/index.js +3 -2
  15. package/dist/core/index.mjs +4 -3
  16. package/dist/guitar-CaZJDA05.d.ts +35 -0
  17. package/dist/guitar-DdexKdN6.d.mts +35 -0
  18. package/dist/iife/index.global.js +11 -11
  19. package/dist/{interface-XoKiryoV.d.mts → music-objects-DJQ4d2OA.d.mts} +549 -53
  20. package/dist/{interface-7k8qGG44.d.ts → music-objects-Dc3kR-XF.d.ts} +549 -53
  21. package/dist/note-eA2xPPiG.d.mts +294 -0
  22. package/dist/note-eA2xPPiG.d.ts +294 -0
  23. package/dist/pieces/index.d.mts +22 -3
  24. package/dist/pieces/index.d.ts +22 -3
  25. package/dist/pieces/index.js +5 -2
  26. package/dist/pieces/index.mjs +6 -3
  27. package/dist/react-ui/index.d.mts +166 -17
  28. package/dist/react-ui/index.d.ts +166 -17
  29. package/dist/react-ui/index.js +78 -1
  30. package/dist/react-ui/index.mjs +79 -2
  31. package/dist/scale-B2Icbetz.d.ts +230 -0
  32. package/dist/scale-BbDJTbrG.d.mts +230 -0
  33. package/dist/score/index.d.mts +299 -46
  34. package/dist/score/index.d.ts +299 -46
  35. package/dist/score/index.js +553 -76
  36. package/dist/score/index.mjs +550 -75
  37. package/dist/{tempo-BAYoZ_Li.d.mts → tempo-CtUhvJbr.d.mts} +187 -5
  38. package/dist/{tempo-r2sb6Ku2.d.ts → tempo-Dt8aHpol.d.ts} +187 -5
  39. package/dist/theory/index.d.mts +29 -13
  40. package/dist/theory/index.d.ts +29 -13
  41. package/dist/theory/index.js +369 -25
  42. package/dist/theory/index.mjs +370 -26
  43. package/package.json +1 -1
  44. package/dist/guitar-DggbM2UL.d.mts +0 -17
  45. package/dist/guitar-cNmE-EvH.d.ts +0 -17
  46. package/dist/note-BFa43I86.d.mts +0 -85
  47. package/dist/note-CcVdUFqS.d.ts +0 -85
  48. package/dist/scale-C2pCNxdE.d.mts +0 -75
  49. package/dist/scale-CvPbJvfN.d.ts +0 -75
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.0.1] - 2025-09-28
4
+ ## Fixed
5
+ - Invalid typedoc @params.
6
+ - AnotationType was not referenced for typedoc.
7
+ - Deprecated misspelled NoteLength.Whole12Dots.
8
+
9
+ ## Changed
10
+ - Improved Frere Jacques demo piece.
11
+
12
+ ## Added
13
+ - Typedoc comments for all public exports.
14
+
3
15
  ## [4.0.0] - 2025-09-24
4
16
  Another major update was required by new features.
5
17
 
package/README.md CHANGED
@@ -13,7 +13,7 @@ This is a work in progress project. Lately there has been improvements that requ
13
13
  version update. As the project matures there might be less major updates, and more minor
14
14
  updates and patches.
15
15
 
16
- This version (4.0.0) added support for string arguments in addition to typescript enums (e.g. NoteLength.Quarter => "4n", just to name one).
16
+ Version 4.0.0 added support for string arguments in addition to typescript enums (e.g. NoteLength.Quarter => "4n", just to name one).
17
17
 
18
18
  ## Installation
19
19
 
@@ -1,15 +1,54 @@
1
- import { N as Note } from '../note-BFa43I86.mjs';
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 };
@@ -1,15 +1,54 @@
1
- import { N as Note } from '../note-CcVdUFqS.js';
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 };
@@ -1,4 +1,4 @@
1
- /* WebMusicScore v4.0.0 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
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;
@@ -1,7 +1,7 @@
1
- /* WebMusicScore v4.0.0 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
1
+ /* WebMusicScore v4.0.1 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
2
2
  import {
3
3
  __publicField
4
- } from "../chunk-D643HZHM.mjs";
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";
@@ -1,3 +1,6 @@
1
+ /**
2
+ * Register classical guitar audio instrument, and set is as current instrument.
3
+ */
1
4
  declare function registerClassicalGuitar(): void;
2
5
 
3
6
  export { registerClassicalGuitar };
@@ -1,3 +1,6 @@
1
+ /**
2
+ * Register classical guitar audio instrument, and set is as current instrument.
3
+ */
1
4
  declare function registerClassicalGuitar(): void;
2
5
 
3
6
  export { registerClassicalGuitar };
@@ -1,4 +1,4 @@
1
- /* WebMusicScore v4.0.0 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
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;
@@ -1,7 +1,7 @@
1
- /* WebMusicScore v4.0.0 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
1
+ /* WebMusicScore v4.0.1 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
2
2
  import {
3
3
  __publicField
4
- } from "../chunk-D643HZHM.mjs";
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 v4.0.0 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
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-D643HZHM.mjs.map
9
+ //# sourceMappingURL=chunk-YFPLOHP2.mjs.map
@@ -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
 
@@ -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
 
@@ -1,4 +1,4 @@
1
- /* WebMusicScore v4.0.0 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
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 v4.0.0 (cjs) initialized.", "background: black; color: white; padding: 2px;");
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 = {
@@ -1,7 +1,7 @@
1
- /* WebMusicScore v4.0.0 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
1
+ /* WebMusicScore v4.0.1 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
2
2
  import {
3
3
  __publicField
4
- } from "../chunk-D643HZHM.mjs";
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 v4.0.0 (esm) initialized.", "background: black; color: white; padding: 2px;");
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 };