@tspro/web-music-score 4.1.0 → 4.2.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.
Files changed (34) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +64 -31
  3. package/dist/audio/index.js +1 -1
  4. package/dist/audio/index.mjs +2 -2
  5. package/dist/audio-cg/index.js +1 -1
  6. package/dist/audio-cg/index.mjs +2 -2
  7. package/dist/{chunk-MHNTJ6FU.mjs → chunk-5NWLGWHS.mjs} +2 -2
  8. package/dist/chunk-7MNV5JN6.mjs +264 -0
  9. package/dist/core/index.js +2 -2
  10. package/dist/core/index.mjs +3 -3
  11. package/dist/iife/index.global.js +11 -11
  12. package/dist/{music-objects-DIaqNPjs.d.mts → music-objects-3Hxlkxy6.d.mts} +105 -19
  13. package/dist/{music-objects-xJJNlFwK.d.ts → music-objects-CI7IjsjE.d.ts} +105 -19
  14. package/dist/pieces/index.d.mts +2 -2
  15. package/dist/pieces/index.d.ts +2 -2
  16. package/dist/pieces/index.js +2 -2
  17. package/dist/pieces/index.mjs +3 -3
  18. package/dist/react-ui/index.d.mts +3 -3
  19. package/dist/react-ui/index.d.ts +3 -3
  20. package/dist/react-ui/index.js +1 -1
  21. package/dist/react-ui/index.mjs +2 -2
  22. package/dist/{scale-DQNA-YLD.d.ts → scale-DGx3tJH4.d.ts} +1 -1
  23. package/dist/{scale-bnD0WnMV.d.mts → scale-DQP3b9Zx.d.mts} +1 -1
  24. package/dist/score/index.d.mts +43 -21
  25. package/dist/score/index.d.ts +43 -21
  26. package/dist/score/index.js +776 -249
  27. package/dist/score/index.mjs +495 -219
  28. package/dist/{tempo-Bp1UzsrZ.d.ts → tempo-GrstpD9G.d.ts} +2 -0
  29. package/dist/{tempo-S85Q7uJA.d.mts → tempo-dkctPkCS.d.mts} +2 -0
  30. package/dist/theory/index.d.mts +3 -3
  31. package/dist/theory/index.d.ts +3 -3
  32. package/dist/theory/index.js +4 -1
  33. package/dist/theory/index.mjs +28 -269
  34. package/package.json +6 -2
@@ -297,6 +297,8 @@ declare enum TimeSignatures {
297
297
  _3_4 = "3/4",
298
298
  /** 4/4 time signature. */
299
299
  _4_4 = "4/4",
300
+ /** 3/8 time signature. */
301
+ _3_8 = "3/8",
300
302
  /** 5/8 time signature. */
301
303
  _5_8 = "5/8",
302
304
  /** 6/8 time signature. */
@@ -297,6 +297,8 @@ declare enum TimeSignatures {
297
297
  _3_4 = "3/4",
298
298
  /** 4/4 time signature. */
299
299
  _4_4 = "4/4",
300
+ /** 3/8 time signature. */
301
+ _3_8 = "3/8",
300
302
  /** 5/8 time signature. */
301
303
  _5_8 = "5/8",
302
304
  /** 6/8 time signature. */
@@ -1,9 +1,9 @@
1
1
  import { N as Note } from '../note-eA2xPPiG.mjs';
2
2
  export { A as Accidental, d as DefaultGuitarNoteLabel, D as DefaultPitchNotation, G as GuitarNoteLabel, e as GuitarNoteLabelList, a as NoteLetter, P as ParsedNote, b as PitchNotation, c as PitchNotationList, S as SymbolSet, g as getPitchNotationName, f as validateGuitarNoteLabel, v as validatePitchNotation } from '../note-eA2xPPiG.mjs';
3
- import { D as Degree } from '../scale-bnD0WnMV.mjs';
4
- export { b as Interval, I as IntervalDirection, a as IntervalQuality, c as Scale, d as ScaleFactory, S as ScaleType, i as getDefaultScale, h as getScale, e as getScaleFactory, g as getScaleFactoryList, v as validateIntervalQuality, f as validateScaleType } from '../scale-bnD0WnMV.mjs';
3
+ import { D as Degree } from '../scale-DQP3b9Zx.mjs';
4
+ export { b as Interval, I as IntervalDirection, a as IntervalQuality, c as Scale, d as ScaleFactory, S as ScaleType, i as getDefaultScale, h as getScale, e as getScaleFactory, g as getScaleFactoryList, v as validateIntervalQuality, f as validateScaleType } from '../scale-DQP3b9Zx.mjs';
5
5
  export { D as DefaultHandedness, a as DefaultTuningName, H as Handedness, T as TuningNameList, g as getTuningStrings, v as validateHandedness, b as validateTuningName } from '../guitar-DdexKdN6.mjs';
6
- export { A as AccidentalType, B as BeamGrouping, K as KeySignature, M as Mode, N as NoteLength, j as NoteLengthProps, i as NoteLengthStr, R as RhythmProps, d as Tempo, b as TimeSignature, a as TimeSignatureString, T as TimeSignatures, m as Tuplet, k as TupletRatio, h as alterTempoSpeed, g as getDefaultKeySignature, e as getDefaultTempo, c as getDefaultTimeSignature, f as getTempoString, v as validateNoteLength, l as validateTupletRatio } from '../tempo-S85Q7uJA.mjs';
6
+ export { A as AccidentalType, B as BeamGrouping, K as KeySignature, M as Mode, N as NoteLength, j as NoteLengthProps, i as NoteLengthStr, R as RhythmProps, d as Tempo, b as TimeSignature, a as TimeSignatureString, T as TimeSignatures, m as Tuplet, k as TupletRatio, h as alterTempoSpeed, g as getDefaultKeySignature, e as getDefaultTempo, c as getDefaultTimeSignature, f as getTempoString, v as validateNoteLength, l as validateTupletRatio } from '../tempo-dkctPkCS.mjs';
7
7
 
8
8
  /** Chord info type. */
9
9
  type ChordInfo = {
@@ -1,9 +1,9 @@
1
1
  import { N as Note } from '../note-eA2xPPiG.js';
2
2
  export { A as Accidental, d as DefaultGuitarNoteLabel, D as DefaultPitchNotation, G as GuitarNoteLabel, e as GuitarNoteLabelList, a as NoteLetter, P as ParsedNote, b as PitchNotation, c as PitchNotationList, S as SymbolSet, g as getPitchNotationName, f as validateGuitarNoteLabel, v as validatePitchNotation } from '../note-eA2xPPiG.js';
3
- import { D as Degree } from '../scale-DQNA-YLD.js';
4
- export { b as Interval, I as IntervalDirection, a as IntervalQuality, c as Scale, d as ScaleFactory, S as ScaleType, i as getDefaultScale, h as getScale, e as getScaleFactory, g as getScaleFactoryList, v as validateIntervalQuality, f as validateScaleType } from '../scale-DQNA-YLD.js';
3
+ import { D as Degree } from '../scale-DGx3tJH4.js';
4
+ export { b as Interval, I as IntervalDirection, a as IntervalQuality, c as Scale, d as ScaleFactory, S as ScaleType, i as getDefaultScale, h as getScale, e as getScaleFactory, g as getScaleFactoryList, v as validateIntervalQuality, f as validateScaleType } from '../scale-DGx3tJH4.js';
5
5
  export { D as DefaultHandedness, a as DefaultTuningName, H as Handedness, T as TuningNameList, g as getTuningStrings, v as validateHandedness, b as validateTuningName } from '../guitar-CaZJDA05.js';
6
- export { A as AccidentalType, B as BeamGrouping, K as KeySignature, M as Mode, N as NoteLength, j as NoteLengthProps, i as NoteLengthStr, R as RhythmProps, d as Tempo, b as TimeSignature, a as TimeSignatureString, T as TimeSignatures, m as Tuplet, k as TupletRatio, h as alterTempoSpeed, g as getDefaultKeySignature, e as getDefaultTempo, c as getDefaultTimeSignature, f as getTempoString, v as validateNoteLength, l as validateTupletRatio } from '../tempo-Bp1UzsrZ.js';
6
+ export { A as AccidentalType, B as BeamGrouping, K as KeySignature, M as Mode, N as NoteLength, j as NoteLengthProps, i as NoteLengthStr, R as RhythmProps, d as Tempo, b as TimeSignature, a as TimeSignatureString, T as TimeSignatures, m as Tuplet, k as TupletRatio, h as alterTempoSpeed, g as getDefaultKeySignature, e as getDefaultTempo, c as getDefaultTimeSignature, f as getTempoString, v as validateNoteLength, l as validateTupletRatio } from '../tempo-GrstpD9G.js';
7
7
 
8
8
  /** Chord info type. */
9
9
  type ChordInfo = {
@@ -1,4 +1,4 @@
1
- /* WebMusicScore v4.1.0 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
1
+ /* WebMusicScore v4.2.0 | (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;
@@ -2135,6 +2135,7 @@ var TimeSignatures = /* @__PURE__ */ ((TimeSignatures2) => {
2135
2135
  TimeSignatures2["_2_4"] = "2/4";
2136
2136
  TimeSignatures2["_3_4"] = "3/4";
2137
2137
  TimeSignatures2["_4_4"] = "4/4";
2138
+ TimeSignatures2["_3_8"] = "3/8";
2138
2139
  TimeSignatures2["_5_8"] = "5/8";
2139
2140
  TimeSignatures2["_6_8"] = "6/8";
2140
2141
  TimeSignatures2["_7_8"] = "7/8";
@@ -2192,6 +2193,8 @@ var TimeSignature = class {
2192
2193
  this.beamGroupSizes = [[2], [2], [2]];
2193
2194
  } else if (this.is(4, 4)) {
2194
2195
  this.beamGroupSizes = [[2, 2], [2, 2]];
2196
+ } else if (this.is(3, 8)) {
2197
+ this.beamGroupSizes = [[3]];
2195
2198
  } else if (this.is(5, 8)) {
2196
2199
  if (!import_ts_utils_lib9.Utils.Is.isUndefined(beamGrouping) && beamGrouping !== "2-3" /* _2_3 */ && beamGrouping !== "3-2" /* _3_2 */) {
2197
2200
  throw new import_core9.MusicError(import_core9.MusicErrorType.Timesignature, `Invalid beam grouping "${beamGrouping}" for time signature "${this.toString()}".`);
@@ -1,7 +1,15 @@
1
- /* WebMusicScore v4.1.0 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
1
+ /* WebMusicScore v4.2.0 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
2
+ import {
3
+ NoteLength,
4
+ NoteLengthProps,
5
+ RhythmProps,
6
+ Tuplet,
7
+ validateNoteLength,
8
+ validateTupletRatio
9
+ } from "../chunk-7MNV5JN6.mjs";
2
10
  import {
3
11
  __publicField
4
- } from "../chunk-MHNTJ6FU.mjs";
12
+ } from "../chunk-5NWLGWHS.mjs";
5
13
 
6
14
  // src/theory/chord.ts
7
15
  import { Utils as Utils6 } from "@tspro/ts-utils-lib";
@@ -1808,264 +1816,13 @@ function getTuningStrings(tuningName) {
1808
1816
  }
1809
1817
 
1810
1818
  // src/theory/time-signature.ts
1811
- import { Utils as Utils9 } from "@tspro/ts-utils-lib";
1812
-
1813
- // src/theory/rhythm.ts
1814
1819
  import { Utils as Utils8 } from "@tspro/ts-utils-lib";
1815
1820
  import { MusicError as MusicError8, MusicErrorType as MusicErrorType8 } from "@tspro/web-music-score/core";
1816
- var cmp = (a, b) => a === b ? 0 : a < b ? -1 : 1;
1817
- var MaxTupletRatioValue = 12;
1818
- var TicksMultiplier = 12 * 11 * 9 * 7 * 5;
1819
- var NoteLength = /* @__PURE__ */ ((NoteLength3) => {
1820
- NoteLength3["Whole"] = "1n";
1821
- NoteLength3["WholeTriplet"] = "1t";
1822
- NoteLength3["WholeDot"] = "1.";
1823
- NoteLength3["Whole2Dots"] = "1..";
1824
- NoteLength3["Whole12Dots"] = "1..";
1825
- NoteLength3["Whole3Dots"] = "1...";
1826
- NoteLength3["Whole4Dots"] = "1....";
1827
- NoteLength3["Whole5Dots"] = "1.....";
1828
- NoteLength3["Whole6Dots"] = "1......";
1829
- NoteLength3["Half"] = "2n";
1830
- NoteLength3["HalfTriplet"] = "2t";
1831
- NoteLength3["HalfDot"] = "2.";
1832
- NoteLength3["Half2Dots"] = "2..";
1833
- NoteLength3["Half3Dots"] = "2...";
1834
- NoteLength3["Half4Dots"] = "2....";
1835
- NoteLength3["Half5Dots"] = "2.....";
1836
- NoteLength3["Quarter"] = "4n";
1837
- NoteLength3["QuarterTriplet"] = "4t";
1838
- NoteLength3["QuarterDot"] = "4.";
1839
- NoteLength3["Quarter2Dots"] = "4..";
1840
- NoteLength3["Quarter3Dots"] = "4...";
1841
- NoteLength3["Quarter4Dots"] = "4....";
1842
- NoteLength3["Eighth"] = "8n";
1843
- NoteLength3["EighthTriplet"] = "8t";
1844
- NoteLength3["EighthDot"] = "8.";
1845
- NoteLength3["Eighth2Dots"] = "8..";
1846
- NoteLength3["Eighth3Dots"] = "8...";
1847
- NoteLength3["Sixteenth"] = "16n";
1848
- NoteLength3["SixteenthTriplet"] = "16t";
1849
- NoteLength3["SixteenthDot"] = "16.";
1850
- NoteLength3["Sixteenth2Dots"] = "16..";
1851
- NoteLength3["ThirtySecond"] = "32n";
1852
- NoteLength3["ThirtySecondTriplet"] = "32t";
1853
- NoteLength3["ThirtySecondDot"] = "32.";
1854
- NoteLength3["SixtyFourth"] = "64n";
1855
- NoteLength3["SixtyFourthTriplet"] = "64t";
1856
- return NoteLength3;
1857
- })(NoteLength || {});
1858
- function validateNoteLength(noteLength) {
1859
- if (Utils8.Is.isEnumValue(noteLength, NoteLength)) {
1860
- return noteLength;
1861
- } else {
1862
- throw new MusicError8(MusicErrorType8.InvalidArg, `Invalid noteLength: ${noteLength}`);
1863
- }
1864
- }
1865
- var _NoteLengthProps = class _NoteLengthProps {
1866
- constructor(noteLength) {
1867
- /** Note length. */
1868
- __publicField(this, "noteLength");
1869
- /** Note size (whole=1, half=2, quarter=4, ...). */
1870
- __publicField(this, "noteSize");
1871
- /** Number of ticks (not altered by isTriplet). */
1872
- __publicField(this, "ticks");
1873
- /** Flag count. */
1874
- __publicField(this, "flagCount");
1875
- /** Dot count. */
1876
- __publicField(this, "dotCount");
1877
- /** Max dot count. */
1878
- __publicField(this, "maxDotCount");
1879
- /** Is triplet? */
1880
- __publicField(this, "isTriplet");
1881
- /** Has note stem. */
1882
- __publicField(this, "hasStem");
1883
- /** Is note head solid (black)? */
1884
- __publicField(this, "isSolid");
1885
- this.noteLength = validateNoteLength(noteLength);
1886
- this.noteSize = parseInt(noteLength);
1887
- this.isTriplet = noteLength.endsWith("t");
1888
- this.maxDotCount = this.isTriplet ? 0 : Math.floor(Math.log2(_NoteLengthProps.ShortestNoteSize / this.noteSize));
1889
- this.dotCount = Utils8.Str.charCount(noteLength, ".");
1890
- this.flagCount = this.noteSize > 4 ? Math.floor(Math.log2(this.noteSize / 4)) : 0;
1891
- this.ticks = TicksMultiplier * _NoteLengthProps.ShortestNoteSize / this.noteSize;
1892
- this.hasStem = this.noteSize > 1;
1893
- this.isSolid = this.noteSize > 2;
1894
- if (this.dotCount > this.maxDotCount) {
1895
- throw new MusicError8(MusicErrorType8.Note, `dotCount ${this.dotCount} > maxDotCount ${this.maxDotCount}, for noteLength "${this.noteLength}".`);
1896
- } else if (this.isTriplet && this.dotCount > 0) {
1897
- throw new MusicError8(MusicErrorType8.Note, `noteLength "${this.noteLength}" is both triplet and dotted!`);
1898
- }
1899
- }
1900
- /**
1901
- * Get note length props.
1902
- * @param noteLength - Note length.
1903
- * @returns - Note length props.
1904
- */
1905
- static get(noteLength) {
1906
- let p = this.cache.get(noteLength);
1907
- if (!p) {
1908
- this.cache.set(noteLength, p = new _NoteLengthProps(noteLength));
1909
- }
1910
- return p;
1911
- }
1912
- /**
1913
- * Create note length props.
1914
- * @param noteLength - Note length or note size.
1915
- * @param dotCount - Dot count.
1916
- * @returns - Note length props.
1917
- */
1918
- static create(noteLength, dotCount = 0) {
1919
- let noteSize = typeof noteLength === "number" ? noteLength : this.get(noteLength).noteSize;
1920
- return this.get(noteSize + (Utils8.Is.isIntegerGte(dotCount, 1) ? ".".repeat(dotCount) : "n"));
1921
- }
1922
- /**
1923
- * Compare note lengths/sizes. Whole (1) > half (2) > quarter (4), etc.
1924
- * Ignores possible triplet property of note length.
1925
- * @param a - NoteLengthProps, NoteLength/Str or noteSize
1926
- * @param b - NoteLengthProps, NoteLength/Str or noteSize
1927
- * @returns - -1: a < b, 0: a === b, +1: a > b (note length/size comparisons)
1928
- */
1929
- static cmp(a, b) {
1930
- let aNoteSize = a instanceof _NoteLengthProps ? a.noteSize : typeof a === "number" ? a : _NoteLengthProps.get(a).noteSize;
1931
- let bNoteSize = b instanceof _NoteLengthProps ? b.noteSize : typeof b === "number" ? b : _NoteLengthProps.get(b).noteSize;
1932
- return cmp(bNoteSize, aNoteSize);
1933
- }
1934
- /**
1935
- * Compare note lengths/sizes for equality.
1936
- * Ignores possible triplet property of note length.
1937
- * @param a - NoteLengthProps, NoteLength/Str or noteSize
1938
- * @param b - NoteLengthProps, NoteLength/Str or noteSize
1939
- * @returns - true: a === b, false: a !== b (note length/size comparisons)
1940
- */
1941
- static equals(a, b) {
1942
- let aNoteSize = a instanceof _NoteLengthProps ? a.noteSize : typeof a === "number" ? a : _NoteLengthProps.get(a).noteSize;
1943
- let bNoteSize = b instanceof _NoteLengthProps ? b.noteSize : typeof b === "number" ? b : _NoteLengthProps.get(b).noteSize;
1944
- return aNoteSize === bNoteSize;
1945
- }
1946
- };
1947
- /** Longest note size (e.g. 1 = whole note). */
1948
- __publicField(_NoteLengthProps, "LongestNoteSize", Math.min(...Utils8.Enum.getEnumValues(NoteLength).map((noteLength) => parseInt(noteLength))));
1949
- /** Shortest note size (e.g. 64 = sixtyfourth note). */
1950
- __publicField(_NoteLengthProps, "ShortestNoteSize", Math.max(...Utils8.Enum.getEnumValues(NoteLength).map((noteLength) => parseInt(noteLength))));
1951
- __publicField(_NoteLengthProps, "cache", /* @__PURE__ */ new Map());
1952
- var NoteLengthProps = _NoteLengthProps;
1953
- function validateTupletRatio(tupletRatio) {
1954
- if (Utils8.Is.isObject(tupletRatio) && Utils8.Is.isIntegerBetween(tupletRatio.parts, 2, MaxTupletRatioValue) && Utils8.Is.isIntegerBetween(tupletRatio.inTimeOf, 2, MaxTupletRatioValue)) {
1955
- return tupletRatio;
1956
- } else {
1957
- throw new MusicError8(MusicErrorType8.Note, `Invalid tupletRatio ${JSON.stringify(tupletRatio)}`);
1958
- }
1959
- }
1960
- var Tuplet = {
1961
- /** Duplet: 2 in the time of 3 */
1962
- Duplet: { parts: 2, inTimeOf: 3 },
1963
- /** Triplet: 3 in the time of 2 */
1964
- Triplet: { parts: 3, inTimeOf: 2 },
1965
- /** Quadruplet: 4 in the time of 3 */
1966
- Quadruplet: { parts: 4, inTimeOf: 3 }
1967
- };
1968
- var _RhythmProps = class _RhythmProps {
1969
- constructor(noteLength, dotCount, tupletRatio) {
1970
- /** Note length. */
1971
- __publicField(this, "noteLength");
1972
- /** Note size (whole=1, half=2, quarter=4, ...). */
1973
- __publicField(this, "noteSize");
1974
- /** Dot count. */
1975
- __publicField(this, "dotCount");
1976
- /** Tuplet ratio. */
1977
- __publicField(this, "tupletRatio");
1978
- /** Number of ticks. */
1979
- __publicField(this, "ticks");
1980
- /** Flag count. */
1981
- __publicField(this, "flagCount");
1982
- /** Has note stem. */
1983
- __publicField(this, "hasStem");
1984
- /** Is note head solid (black)? */
1985
- __publicField(this, "isSolidNoteHead");
1986
- this.noteLength = validateNoteLength(noteLength);
1987
- let p = NoteLengthProps.get(noteLength);
1988
- this.noteSize = p.noteSize;
1989
- this.ticks = p.ticks;
1990
- this.flagCount = p.flagCount;
1991
- this.dotCount = dotCount != null ? dotCount : p.dotCount;
1992
- this.hasStem = p.hasStem;
1993
- this.isSolidNoteHead = p.isSolid;
1994
- if (Utils8.Is.isObject(tupletRatio)) {
1995
- this.tupletRatio = validateTupletRatio(tupletRatio);
1996
- } else if (p.isTriplet) {
1997
- this.tupletRatio = Tuplet.Triplet;
1998
- } else {
1999
- this.tupletRatio = void 0;
2000
- }
2001
- if (this.dotCount > 0 && this.tupletRatio !== void 0) {
2002
- throw new MusicError8(MusicErrorType8.Note, `Note cannot be both dotted and tuplet!`);
2003
- } else if (this.dotCount > p.maxDotCount) {
2004
- throw new MusicError8(MusicErrorType8.Note, `Too big dot count ${this.dotCount} for note length ${this.noteLength}.`);
2005
- }
2006
- for (let add = this.ticks / 2, i = 1; i <= this.dotCount; i++, add /= 2) {
2007
- this.ticks += add;
2008
- }
2009
- if (this.tupletRatio) {
2010
- this.ticks *= this.tupletRatio.inTimeOf / this.tupletRatio.parts;
2011
- }
2012
- }
2013
- /**
2014
- * Get string presentation of rhythm props.
2015
- * @returns - String presentation.
2016
- */
2017
- toString() {
2018
- let sym = _RhythmProps.NoteSymbolMap.get(this.noteSize);
2019
- let dots = ".".repeat(this.dotCount);
2020
- return sym ? sym + dots : "" + this.noteSize + (dots.length > 0 ? dots : "n");
2021
- }
2022
- /**
2023
- * Get rhythm props with given arguments.
2024
- * @param noteLength - Note length.
2025
- * @param dotCount - Dot count.
2026
- * @param tupletRatio - Tuplet ratio.
2027
- * @returns - Rhythm props.
2028
- */
2029
- static get(noteLength, dotCount, tupletRatio) {
2030
- if (dotCount !== void 0 || tupletRatio !== void 0) {
2031
- return new _RhythmProps(noteLength, dotCount, tupletRatio);
2032
- } else {
2033
- let rhythmProps = this.cache.get(noteLength);
2034
- if (!rhythmProps) {
2035
- this.cache.set(noteLength, rhythmProps = new _RhythmProps(noteLength));
2036
- }
2037
- return rhythmProps;
2038
- }
2039
- }
2040
- /**
2041
- * Compare duration of rhythm props.
2042
- * @param a - RhythmProps
2043
- * @param b - RhythmProps
2044
- * @returns - -1: a < b, 0: a === b, +1: a > b (duration comparisons)
2045
- */
2046
- static cmp(a, b) {
2047
- return cmp(a.ticks, b.ticks);
2048
- }
2049
- /**
2050
- * Compare duration equality of rhythm props.
2051
- * @param a - RhythmProps
2052
- * @param b - RhythmProps
2053
- * @returns - true: a === b, false: a !== b (duration comparisons)
2054
- */
2055
- static equals(a, b) {
2056
- return a.ticks === b.ticks;
2057
- }
2058
- };
2059
- __publicField(_RhythmProps, "NoteSymbolMap", /* @__PURE__ */ new Map([[1, "\u{1D15D}"], [2, "\u{1D15E}"], [4, "\u{1D15F}"], [8, "\u{1D160}"], [16, "\u{1D161}"], [32, "\u{1D162}"], [64, "\u{1D163}"], [128, "\u{1D164}"]]));
2060
- __publicField(_RhythmProps, "cache", /* @__PURE__ */ new Map());
2061
- var RhythmProps = _RhythmProps;
2062
-
2063
- // src/theory/time-signature.ts
2064
- import { MusicError as MusicError9, MusicErrorType as MusicErrorType9 } from "@tspro/web-music-score/core";
2065
1821
  var TimeSignatures = /* @__PURE__ */ ((TimeSignatures2) => {
2066
1822
  TimeSignatures2["_2_4"] = "2/4";
2067
1823
  TimeSignatures2["_3_4"] = "3/4";
2068
1824
  TimeSignatures2["_4_4"] = "4/4";
1825
+ TimeSignatures2["_3_8"] = "3/8";
2069
1826
  TimeSignatures2["_5_8"] = "5/8";
2070
1827
  TimeSignatures2["_6_8"] = "6/8";
2071
1828
  TimeSignatures2["_7_8"] = "7/8";
@@ -2093,26 +1850,26 @@ var TimeSignature = class {
2093
1850
  /** Beam groups (e.g. [[2], [2]] or [[2, 2], [2, 2]] (first try as [[4], [4]])). */
2094
1851
  __publicField(this, "beamGroupSizes", []);
2095
1852
  let beamGrouping;
2096
- if (Utils9.Is.isEnumValue(args[0], TimeSignatures)) {
1853
+ if (Utils8.Is.isEnumValue(args[0], TimeSignatures)) {
2097
1854
  let parts = args[0].split("/");
2098
1855
  this.beatCount = +parts[0];
2099
1856
  this.beatSize = +parts[1];
2100
- if (Utils9.Is.isEnumValue(args[1], BeamGrouping)) {
1857
+ if (Utils8.Is.isEnumValue(args[1], BeamGrouping)) {
2101
1858
  beamGrouping = args[1];
2102
1859
  }
2103
- } else if (Utils9.Is.isIntegerGte(args[0], 2) && Utils9.Is.isIntegerGte(args[1], 2)) {
1860
+ } else if (Utils8.Is.isIntegerGte(args[0], 2) && Utils8.Is.isIntegerGte(args[1], 2)) {
2104
1861
  this.beatCount = args[0];
2105
1862
  this.beatSize = args[1];
2106
- if (Utils9.Is.isEnumValue(args[2], BeamGrouping)) {
1863
+ if (Utils8.Is.isEnumValue(args[2], BeamGrouping)) {
2107
1864
  beamGrouping = args[2];
2108
1865
  }
2109
1866
  } else {
2110
- throw new MusicError9(MusicErrorType9.Timesignature, `Invalid args: ${args}`);
1867
+ throw new MusicError8(MusicErrorType8.Timesignature, `Invalid args: ${args}`);
2111
1868
  }
2112
- if (!Utils9.Is.isIntegerGte(this.beatCount, 1)) {
2113
- throw new MusicError9(MusicErrorType9.Timesignature, `Invalid beatCount: ${this.beatCount}`);
2114
- } else if (!Utils9.Is.isIntegerGte(this.beatSize, 1)) {
2115
- throw new MusicError9(MusicErrorType9.Timesignature, `Invalid beatSize: ${this.beatSize}`);
1869
+ if (!Utils8.Is.isIntegerGte(this.beatCount, 1)) {
1870
+ throw new MusicError8(MusicErrorType8.Timesignature, `Invalid beatCount: ${this.beatCount}`);
1871
+ } else if (!Utils8.Is.isIntegerGte(this.beatSize, 1)) {
1872
+ throw new MusicError8(MusicErrorType8.Timesignature, `Invalid beatSize: ${this.beatSize}`);
2116
1873
  }
2117
1874
  let { noteLength, ticks } = NoteLengthProps.create(this.beatSize);
2118
1875
  this.beatLength = noteLength;
@@ -2123,9 +1880,11 @@ var TimeSignature = class {
2123
1880
  this.beamGroupSizes = [[2], [2], [2]];
2124
1881
  } else if (this.is(4, 4)) {
2125
1882
  this.beamGroupSizes = [[2, 2], [2, 2]];
1883
+ } else if (this.is(3, 8)) {
1884
+ this.beamGroupSizes = [[3]];
2126
1885
  } else if (this.is(5, 8)) {
2127
- if (!Utils9.Is.isUndefined(beamGrouping) && beamGrouping !== "2-3" /* _2_3 */ && beamGrouping !== "3-2" /* _3_2 */) {
2128
- throw new MusicError9(MusicErrorType9.Timesignature, `Invalid beam grouping "${beamGrouping}" for time signature "${this.toString()}".`);
1886
+ if (!Utils8.Is.isUndefined(beamGrouping) && beamGrouping !== "2-3" /* _2_3 */ && beamGrouping !== "3-2" /* _3_2 */) {
1887
+ throw new MusicError8(MusicErrorType8.Timesignature, `Invalid beam grouping "${beamGrouping}" for time signature "${this.toString()}".`);
2129
1888
  } else {
2130
1889
  this.beamGroupSizes = beamGrouping === "3-2" /* _3_2 */ ? [[3], [2]] : [[2], [3]];
2131
1890
  beamGrouping = void 0;
@@ -2133,8 +1892,8 @@ var TimeSignature = class {
2133
1892
  } else if (this.is(6, 8)) {
2134
1893
  this.beamGroupSizes = [[3], [3]];
2135
1894
  } else if (this.is(7, 8)) {
2136
- if (!Utils9.Is.isUndefined(beamGrouping) && beamGrouping !== "2-2-3" /* _2_2_3 */ && beamGrouping !== "3-2-2" /* _3_2_2 */) {
2137
- throw new MusicError9(MusicErrorType9.Timesignature, `Invalid beam grouping "${beamGrouping}" for time signature "${this.toString()}".`);
1895
+ if (!Utils8.Is.isUndefined(beamGrouping) && beamGrouping !== "2-2-3" /* _2_2_3 */ && beamGrouping !== "3-2-2" /* _3_2_2 */) {
1896
+ throw new MusicError8(MusicErrorType8.Timesignature, `Invalid beam grouping "${beamGrouping}" for time signature "${this.toString()}".`);
2138
1897
  } else {
2139
1898
  this.beamGroupSizes = beamGrouping === "3-2-2" /* _3_2_2 */ ? [[3], [2], [2]] : [[2], [2], [3]];
2140
1899
  beamGrouping = void 0;
@@ -2145,9 +1904,9 @@ var TimeSignature = class {
2145
1904
  this.beamGroupSizes = [[3], [3], [3], [3]];
2146
1905
  }
2147
1906
  if (this.beamGroupSizes.length === 0) {
2148
- throw new MusicError9(MusicErrorType9.Timesignature, `Unimplemented time signature "${this.toString()}".`);
1907
+ throw new MusicError8(MusicErrorType8.Timesignature, `Unimplemented time signature "${this.toString()}".`);
2149
1908
  } else if (beamGrouping !== void 0) {
2150
- throw new MusicError9(MusicErrorType9.Timesignature, `Invalid beam grouping "${beamGrouping}" for time signature "${this.toString()}".`);
1909
+ throw new MusicError8(MusicErrorType8.Timesignature, `Invalid beam grouping "${beamGrouping}" for time signature "${this.toString()}".`);
2151
1910
  }
2152
1911
  }
2153
1912
  /**
package/package.json CHANGED
@@ -1,11 +1,15 @@
1
1
  {
2
2
  "name": "@tspro/web-music-score",
3
- "version": "4.1.0",
3
+ "version": "4.2.0",
4
4
  "author": "PahkaSoft",
5
5
  "license": "MIT",
6
6
  "private": false,
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/pahkasoft/web-music-score.git"
10
+ },
7
11
  "bugs": {
8
- "url": "https://github.com/pahkasoft/issues/issues/new"
12
+ "url": "https://github.com/pahkasoft/web-music-score/issues/new/choose"
9
13
  },
10
14
  "description": "TS/JS component for rendering and playing music scores in the browser.",
11
15
  "exports": {