@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
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
/** Symbol set enum. */
|
|
2
|
+
declare enum SymbolSet {
|
|
3
|
+
/** Ascii symbols. */
|
|
4
|
+
Ascii = 0,
|
|
5
|
+
/** Unicode symbols. */
|
|
6
|
+
Unicode = 1
|
|
7
|
+
}
|
|
8
|
+
/** Pitch notation enum. */
|
|
9
|
+
declare enum PitchNotation {
|
|
10
|
+
/** Scientific pitch notation (e.g. "C4"). */
|
|
11
|
+
Scientific = 0,
|
|
12
|
+
/** Helmholz pitch notation (the older system often used in Europe, e.g. "c′"). */
|
|
13
|
+
Helmholtz = 1
|
|
14
|
+
}
|
|
15
|
+
/** Array of available pitch notations. */
|
|
16
|
+
declare const PitchNotationList: ReadonlyArray<PitchNotation>;
|
|
17
|
+
/** Default pitch notation (PitchNotation.Scientific). */
|
|
18
|
+
declare const DefaultPitchNotation = PitchNotation.Scientific;
|
|
19
|
+
/**
|
|
20
|
+
* Validate pitch notation of unknown value.
|
|
21
|
+
* @param pn - Pitch notation value to validate.
|
|
22
|
+
* @returns - Valid pitch notation or throws.
|
|
23
|
+
*/
|
|
24
|
+
declare function validatePitchNotation(pn: unknown): PitchNotation;
|
|
25
|
+
/**
|
|
26
|
+
* Get name of given pitch notation.
|
|
27
|
+
* @param pn - Pitch notation.
|
|
28
|
+
* @returns - Name of given pitch notation.
|
|
29
|
+
*/
|
|
30
|
+
declare function getPitchNotationName(pn: PitchNotation): string;
|
|
31
|
+
/** Guitar note label enum. */
|
|
32
|
+
declare enum GuitarNoteLabel {
|
|
33
|
+
/** Default (e.g. "C4"). */
|
|
34
|
+
Default = "Default",
|
|
35
|
+
/** Omit octave (e.g. "C"). */
|
|
36
|
+
OmitOctave = "Omit Octave",
|
|
37
|
+
/** Interval (e.g. "R" for root note). */
|
|
38
|
+
Interval = "Interval"
|
|
39
|
+
}
|
|
40
|
+
/** Default guitar note label (GuitarNoteLabel.Default). */
|
|
41
|
+
declare const DefaultGuitarNoteLabel = GuitarNoteLabel.Default;
|
|
42
|
+
/** Array of available guitar note labels. */
|
|
43
|
+
declare const GuitarNoteLabelList: ReadonlyArray<GuitarNoteLabel>;
|
|
44
|
+
/**
|
|
45
|
+
* Validate guitar note label of unknown value.
|
|
46
|
+
* @param label - Guitar note label value to validate.
|
|
47
|
+
* @returns - Valid guitar note label or throws.
|
|
48
|
+
*/
|
|
49
|
+
declare function validateGuitarNoteLabel(label: unknown): GuitarNoteLabel;
|
|
50
|
+
|
|
51
|
+
/** Accidental type. */
|
|
52
|
+
type Accidental = -2 | -1 | 0 | 1 | 2;
|
|
53
|
+
/** Note letter type. */
|
|
54
|
+
type NoteLetter = "C" | "D" | "E" | "F" | "G" | "A" | "B";
|
|
55
|
+
/** Parsed note props. */
|
|
56
|
+
type ParsedNote = {
|
|
57
|
+
/** Note letter (e.g. "C" in "C#4"). */
|
|
58
|
+
noteLetter: NoteLetter;
|
|
59
|
+
/** Accidental (e.g. "1" (#=1) in "C#4"). */
|
|
60
|
+
accidental: Accidental;
|
|
61
|
+
/** Octave if available(e.g. "4" in "C#4"). */
|
|
62
|
+
octave?: number;
|
|
63
|
+
};
|
|
64
|
+
/** Note class. */
|
|
65
|
+
declare class Note {
|
|
66
|
+
private static noteByNameCache;
|
|
67
|
+
private static chromaticNoteCache;
|
|
68
|
+
/** Diatonic class */
|
|
69
|
+
readonly diatonicClass: number;
|
|
70
|
+
/** Accidental. */
|
|
71
|
+
readonly accidental: Accidental;
|
|
72
|
+
/** Octave. */
|
|
73
|
+
readonly octave: number;
|
|
74
|
+
/**
|
|
75
|
+
* Create new Note object instance.
|
|
76
|
+
* @param diatonicId - Diatonic id.
|
|
77
|
+
* @param accidental - Accidental (-2, -1, 0, 1 or 2).
|
|
78
|
+
*/
|
|
79
|
+
constructor(diatonicId: number, accidental: number);
|
|
80
|
+
/**
|
|
81
|
+
* Create new Note object instance.
|
|
82
|
+
* @param diatonicClass - Diatonic class [0, 11].
|
|
83
|
+
* @param accidental - Accidental (-2, -1, 0, 1 or 2).
|
|
84
|
+
* @param octave - Octave.
|
|
85
|
+
*/
|
|
86
|
+
constructor(diatonicClass: number, accidental: number, octave: number);
|
|
87
|
+
/**
|
|
88
|
+
* Create new Note object instance.
|
|
89
|
+
* @param noteLetter - Note letter (e.g. "C").
|
|
90
|
+
* @param accidental Accidental (-2, -1, 0, 1 or 2).
|
|
91
|
+
* @param octave - Octave.
|
|
92
|
+
*/
|
|
93
|
+
constructor(noteLetter: string, accidental: number, octave: number);
|
|
94
|
+
/** Diatonic id getter. */
|
|
95
|
+
get diatonicId(): number;
|
|
96
|
+
/** Chromatic id getter. */
|
|
97
|
+
get chromaticId(): number;
|
|
98
|
+
/** Midi number getter (implemented same as chromatic id). */
|
|
99
|
+
get midiNumber(): number;
|
|
100
|
+
/** Chromatic class getter. */
|
|
101
|
+
get chromaticClass(): number;
|
|
102
|
+
/** Note letter getter. */
|
|
103
|
+
get noteLetter(): NoteLetter;
|
|
104
|
+
/**
|
|
105
|
+
* Format note to string presentation.
|
|
106
|
+
* @param pitchNotation - Pitchy notation.
|
|
107
|
+
* @param symbolSet - Symbol set.
|
|
108
|
+
* @returns - String presentation of note.
|
|
109
|
+
*/
|
|
110
|
+
format(pitchNotation: PitchNotation, symbolSet: SymbolSet): string;
|
|
111
|
+
/**
|
|
112
|
+
* Format note to string presentation without octave number.
|
|
113
|
+
* @param symbolSet - Symbol set.
|
|
114
|
+
* @returns - String presentation of note without octave number.
|
|
115
|
+
*/
|
|
116
|
+
formatOmitOctave(symbolSet: SymbolSet): string;
|
|
117
|
+
/**
|
|
118
|
+
* Get note.
|
|
119
|
+
* @param noteName - Note name (e.g. "C4").
|
|
120
|
+
* @returns - Note.
|
|
121
|
+
*/
|
|
122
|
+
static getNote(noteName: string): Note;
|
|
123
|
+
/**
|
|
124
|
+
* Get chromatic note. There are number of alternatives, this function uses simple logic to choose one.
|
|
125
|
+
* @param chromaticId - Chromatic id.
|
|
126
|
+
* @returns - Note.
|
|
127
|
+
*/
|
|
128
|
+
static getChromaticNote(chromaticId: number): Note;
|
|
129
|
+
/**
|
|
130
|
+
* GEt diatoni class from diatonic id.
|
|
131
|
+
* @param diatonicId - Diatonicid.
|
|
132
|
+
*/
|
|
133
|
+
static getDiatonicClass(diatonicId: number): number;
|
|
134
|
+
/**
|
|
135
|
+
* Getdiatonic class from note name.
|
|
136
|
+
* @param noteName - Note name.
|
|
137
|
+
*/
|
|
138
|
+
static getDiatonicClass(noteName: string): number;
|
|
139
|
+
/**
|
|
140
|
+
* Get octave from diatonic id.
|
|
141
|
+
* @param diatonicId - Diatonic id.
|
|
142
|
+
* @returns - Octave.
|
|
143
|
+
*/
|
|
144
|
+
static getOctaveFromDiatonicId(diatonicId: number): number;
|
|
145
|
+
/**
|
|
146
|
+
* Get diatonic id in given octave (transposes diatonic id to given octave).
|
|
147
|
+
* @param diatonicId - Original diatonic id.
|
|
148
|
+
* @param octave - Octave.
|
|
149
|
+
* @returns - Transposed diatonic id.
|
|
150
|
+
*/
|
|
151
|
+
static getDiatonicIdInOctave(diatonicId: number, octave: number): number;
|
|
152
|
+
/**
|
|
153
|
+
* Get chromatic class from chromatic id.
|
|
154
|
+
* @param chromaticId - Chromatic id.
|
|
155
|
+
* @returns - Chromatic class.
|
|
156
|
+
*/
|
|
157
|
+
static getChromaticClass(chromaticId: number): number;
|
|
158
|
+
/**
|
|
159
|
+
* Get octave from chromatic id.
|
|
160
|
+
* @param chromaticId - Chromatic id.
|
|
161
|
+
* @returns - Octave.
|
|
162
|
+
*/
|
|
163
|
+
static getOctaveFromChromaticId(chromaticId: number): number;
|
|
164
|
+
/**
|
|
165
|
+
* Get chromatic id in given octave (transposes chromatic id to given octave).
|
|
166
|
+
* @param chromaticId - Original chromatic id.
|
|
167
|
+
* @param octave - Octave.
|
|
168
|
+
* @returns - Transpose chromatic id.
|
|
169
|
+
*/
|
|
170
|
+
static getChromaticIdInOctave(chromaticId: number, octave: number): number;
|
|
171
|
+
/**
|
|
172
|
+
* Test if given two notes are equal.
|
|
173
|
+
* @param a - Note a.
|
|
174
|
+
* @param b - Note b.
|
|
175
|
+
* @returns - True/false.
|
|
176
|
+
*/
|
|
177
|
+
static equals(a: Note | null | undefined, b: Note | null | undefined): boolean;
|
|
178
|
+
/**
|
|
179
|
+
* Replace accidental symbols in given string to givn symbol set (ascii/unicode).
|
|
180
|
+
* @param str - String to replace.
|
|
181
|
+
* @param symbolSet - Symbol set.
|
|
182
|
+
* @returns - String with updated accidental symbols.
|
|
183
|
+
*/
|
|
184
|
+
static replaceAccidentalSymbols(str: string, symbolSet: SymbolSet): string;
|
|
185
|
+
/**
|
|
186
|
+
* Test if given string is valid note name.
|
|
187
|
+
* @param noteName - Note name to validate.
|
|
188
|
+
* @returns - True/false.
|
|
189
|
+
*/
|
|
190
|
+
static isValidNoteName(noteName: string): boolean;
|
|
191
|
+
/**
|
|
192
|
+
* Parse note name string to note props.
|
|
193
|
+
* @param noteName - Note name to parse.
|
|
194
|
+
* @returns - Parsed note props or undefined if parsing error.
|
|
195
|
+
*/
|
|
196
|
+
static parseNote(noteName: string): Readonly<ParsedNote> | undefined;
|
|
197
|
+
/**
|
|
198
|
+
* Get scientific note name from given note name.
|
|
199
|
+
* @param noteName - Note name.
|
|
200
|
+
* @param symbolSet - Symbol set (ascii/unicode) for scientific note name.
|
|
201
|
+
* @returns - Scientific note name.
|
|
202
|
+
*/
|
|
203
|
+
static getScientificNoteName(noteName: string, symbolSet: SymbolSet): string;
|
|
204
|
+
/**
|
|
205
|
+
* Get symbol of given accidental in given symbol set (ascii/unicide).
|
|
206
|
+
* @param accidental - Accidental.
|
|
207
|
+
* @param symbolsSet - Symbol set.
|
|
208
|
+
* @returns - Accidental symbol or undefined (invalid accidental).
|
|
209
|
+
*/
|
|
210
|
+
static getAccidentalSymbol(accidental: Accidental, symbolsSet: SymbolSet): string | undefined;
|
|
211
|
+
/**
|
|
212
|
+
* Get accidental value from given accidental symbol.
|
|
213
|
+
* @param accidentalSymbol - Accidental symbol (e.g. "#").
|
|
214
|
+
* @returns - Accidental vlaue.
|
|
215
|
+
*/
|
|
216
|
+
static getAccidental(accidentalSymbol: string): Accidental;
|
|
217
|
+
/**
|
|
218
|
+
* Get note letter from given diatonic id.
|
|
219
|
+
* @param diatonicId - Diatonic id.
|
|
220
|
+
* @returns - Note letter.
|
|
221
|
+
*/
|
|
222
|
+
static getNoteLetter(diatonicId: number): NoteLetter;
|
|
223
|
+
/**
|
|
224
|
+
* Find next lowest possible diatonic id that is above given bottom level.
|
|
225
|
+
* @param diatonicId - Diatonic id to begin with.
|
|
226
|
+
* @param bottomDiatonicId - Bottom diatonic id.
|
|
227
|
+
* @param addOctaveIfEqual - If true then add one octave if diatonic id would equal to bottom diatonic id.
|
|
228
|
+
* @returns - Diatonic id.
|
|
229
|
+
*/
|
|
230
|
+
static findNextDiatonicIdAbove(diatonicId: number, bottomDiatonicId: number, addOctaveIfEqual: boolean): number;
|
|
231
|
+
/**
|
|
232
|
+
* Validate if given argument is diatonic id.
|
|
233
|
+
* @param diatonicId - Diatonic id to validate.
|
|
234
|
+
* @returns - Valid diatonic id or throws.
|
|
235
|
+
*/
|
|
236
|
+
static validateDiatonicId(diatonicId: unknown): number;
|
|
237
|
+
/**
|
|
238
|
+
* Validate if given argument is diatonic class.
|
|
239
|
+
* @param diatonicClass - Diatonic class to validate.
|
|
240
|
+
* @returns - Valid diatonic class or throws.
|
|
241
|
+
*/
|
|
242
|
+
static validateDiatonicClass(diatonicClass: unknown): number;
|
|
243
|
+
/**
|
|
244
|
+
* Validate if given argument is chromatic id.
|
|
245
|
+
* @param chromaticId - Chromatic id to validate.
|
|
246
|
+
* @returns - Valid chromatic id, or throws.
|
|
247
|
+
*/
|
|
248
|
+
static validateChromaticId(chromaticId: unknown): number;
|
|
249
|
+
/**
|
|
250
|
+
* Validate if given argument is chromatic class.
|
|
251
|
+
* @param chromaticClass - Chromatic class to validate.
|
|
252
|
+
* @returns - Valid chromatic class, or throws.
|
|
253
|
+
*/
|
|
254
|
+
static validatechromaticClass(chromaticClass: unknown): number;
|
|
255
|
+
/**
|
|
256
|
+
* Validate if given argument if note letter.
|
|
257
|
+
* @param noteLetter - Note letter to validate.
|
|
258
|
+
* @returns - Valid note letter or throws.
|
|
259
|
+
*/
|
|
260
|
+
static validateNoteLetter(noteLetter: unknown): NoteLetter;
|
|
261
|
+
/**
|
|
262
|
+
* Validate if given argument is octave.
|
|
263
|
+
* @param octave - Octave to validate.
|
|
264
|
+
* @returns - Valid octave or throws.
|
|
265
|
+
*/
|
|
266
|
+
static validateOctave(octave: number): number;
|
|
267
|
+
/**
|
|
268
|
+
* Validate if given argument is valid accidental.
|
|
269
|
+
* @param acc - Accidental to validate.
|
|
270
|
+
* @returns - Valid accidental or thorws.
|
|
271
|
+
*/
|
|
272
|
+
static validateAccidental(acc: unknown): Accidental;
|
|
273
|
+
/**
|
|
274
|
+
* Sort notes by diatonicId in ascending order.
|
|
275
|
+
* @param notes - Array of notes.
|
|
276
|
+
* @returns Sorted array of notes.
|
|
277
|
+
*/
|
|
278
|
+
static sort(notes: ReadonlyArray<Note>): Note[];
|
|
279
|
+
/**
|
|
280
|
+
* Remove duplicate notes.
|
|
281
|
+
* @param notes - Array of notes.
|
|
282
|
+
* @returns Sorted set of notes.
|
|
283
|
+
*/
|
|
284
|
+
static removeDuplicates(notes: ReadonlyArray<Note>): Note[];
|
|
285
|
+
/**
|
|
286
|
+
* Function to compare two notes using diatonic id and accidental properties of notes.
|
|
287
|
+
* @param a - Note a.
|
|
288
|
+
* @param b - Note b.
|
|
289
|
+
* @returns - -1, 0 or 1.
|
|
290
|
+
*/
|
|
291
|
+
static compareFunc(a: Note, b: Note): 1 | 0 | -1;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
export { type Accidental as A, DefaultPitchNotation as D, GuitarNoteLabel as G, Note as N, type ParsedNote as P, SymbolSet as S, type NoteLetter as a, PitchNotation as b, PitchNotationList as c, DefaultGuitarNoteLabel as d, GuitarNoteLabelList as e, validateGuitarNoteLabel as f, getPitchNotationName as g, validatePitchNotation as v };
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
/** Symbol set enum. */
|
|
2
|
+
declare enum SymbolSet {
|
|
3
|
+
/** Ascii symbols. */
|
|
4
|
+
Ascii = 0,
|
|
5
|
+
/** Unicode symbols. */
|
|
6
|
+
Unicode = 1
|
|
7
|
+
}
|
|
8
|
+
/** Pitch notation enum. */
|
|
9
|
+
declare enum PitchNotation {
|
|
10
|
+
/** Scientific pitch notation (e.g. "C4"). */
|
|
11
|
+
Scientific = 0,
|
|
12
|
+
/** Helmholz pitch notation (the older system often used in Europe, e.g. "c′"). */
|
|
13
|
+
Helmholtz = 1
|
|
14
|
+
}
|
|
15
|
+
/** Array of available pitch notations. */
|
|
16
|
+
declare const PitchNotationList: ReadonlyArray<PitchNotation>;
|
|
17
|
+
/** Default pitch notation (PitchNotation.Scientific). */
|
|
18
|
+
declare const DefaultPitchNotation = PitchNotation.Scientific;
|
|
19
|
+
/**
|
|
20
|
+
* Validate pitch notation of unknown value.
|
|
21
|
+
* @param pn - Pitch notation value to validate.
|
|
22
|
+
* @returns - Valid pitch notation or throws.
|
|
23
|
+
*/
|
|
24
|
+
declare function validatePitchNotation(pn: unknown): PitchNotation;
|
|
25
|
+
/**
|
|
26
|
+
* Get name of given pitch notation.
|
|
27
|
+
* @param pn - Pitch notation.
|
|
28
|
+
* @returns - Name of given pitch notation.
|
|
29
|
+
*/
|
|
30
|
+
declare function getPitchNotationName(pn: PitchNotation): string;
|
|
31
|
+
/** Guitar note label enum. */
|
|
32
|
+
declare enum GuitarNoteLabel {
|
|
33
|
+
/** Default (e.g. "C4"). */
|
|
34
|
+
Default = "Default",
|
|
35
|
+
/** Omit octave (e.g. "C"). */
|
|
36
|
+
OmitOctave = "Omit Octave",
|
|
37
|
+
/** Interval (e.g. "R" for root note). */
|
|
38
|
+
Interval = "Interval"
|
|
39
|
+
}
|
|
40
|
+
/** Default guitar note label (GuitarNoteLabel.Default). */
|
|
41
|
+
declare const DefaultGuitarNoteLabel = GuitarNoteLabel.Default;
|
|
42
|
+
/** Array of available guitar note labels. */
|
|
43
|
+
declare const GuitarNoteLabelList: ReadonlyArray<GuitarNoteLabel>;
|
|
44
|
+
/**
|
|
45
|
+
* Validate guitar note label of unknown value.
|
|
46
|
+
* @param label - Guitar note label value to validate.
|
|
47
|
+
* @returns - Valid guitar note label or throws.
|
|
48
|
+
*/
|
|
49
|
+
declare function validateGuitarNoteLabel(label: unknown): GuitarNoteLabel;
|
|
50
|
+
|
|
51
|
+
/** Accidental type. */
|
|
52
|
+
type Accidental = -2 | -1 | 0 | 1 | 2;
|
|
53
|
+
/** Note letter type. */
|
|
54
|
+
type NoteLetter = "C" | "D" | "E" | "F" | "G" | "A" | "B";
|
|
55
|
+
/** Parsed note props. */
|
|
56
|
+
type ParsedNote = {
|
|
57
|
+
/** Note letter (e.g. "C" in "C#4"). */
|
|
58
|
+
noteLetter: NoteLetter;
|
|
59
|
+
/** Accidental (e.g. "1" (#=1) in "C#4"). */
|
|
60
|
+
accidental: Accidental;
|
|
61
|
+
/** Octave if available(e.g. "4" in "C#4"). */
|
|
62
|
+
octave?: number;
|
|
63
|
+
};
|
|
64
|
+
/** Note class. */
|
|
65
|
+
declare class Note {
|
|
66
|
+
private static noteByNameCache;
|
|
67
|
+
private static chromaticNoteCache;
|
|
68
|
+
/** Diatonic class */
|
|
69
|
+
readonly diatonicClass: number;
|
|
70
|
+
/** Accidental. */
|
|
71
|
+
readonly accidental: Accidental;
|
|
72
|
+
/** Octave. */
|
|
73
|
+
readonly octave: number;
|
|
74
|
+
/**
|
|
75
|
+
* Create new Note object instance.
|
|
76
|
+
* @param diatonicId - Diatonic id.
|
|
77
|
+
* @param accidental - Accidental (-2, -1, 0, 1 or 2).
|
|
78
|
+
*/
|
|
79
|
+
constructor(diatonicId: number, accidental: number);
|
|
80
|
+
/**
|
|
81
|
+
* Create new Note object instance.
|
|
82
|
+
* @param diatonicClass - Diatonic class [0, 11].
|
|
83
|
+
* @param accidental - Accidental (-2, -1, 0, 1 or 2).
|
|
84
|
+
* @param octave - Octave.
|
|
85
|
+
*/
|
|
86
|
+
constructor(diatonicClass: number, accidental: number, octave: number);
|
|
87
|
+
/**
|
|
88
|
+
* Create new Note object instance.
|
|
89
|
+
* @param noteLetter - Note letter (e.g. "C").
|
|
90
|
+
* @param accidental Accidental (-2, -1, 0, 1 or 2).
|
|
91
|
+
* @param octave - Octave.
|
|
92
|
+
*/
|
|
93
|
+
constructor(noteLetter: string, accidental: number, octave: number);
|
|
94
|
+
/** Diatonic id getter. */
|
|
95
|
+
get diatonicId(): number;
|
|
96
|
+
/** Chromatic id getter. */
|
|
97
|
+
get chromaticId(): number;
|
|
98
|
+
/** Midi number getter (implemented same as chromatic id). */
|
|
99
|
+
get midiNumber(): number;
|
|
100
|
+
/** Chromatic class getter. */
|
|
101
|
+
get chromaticClass(): number;
|
|
102
|
+
/** Note letter getter. */
|
|
103
|
+
get noteLetter(): NoteLetter;
|
|
104
|
+
/**
|
|
105
|
+
* Format note to string presentation.
|
|
106
|
+
* @param pitchNotation - Pitchy notation.
|
|
107
|
+
* @param symbolSet - Symbol set.
|
|
108
|
+
* @returns - String presentation of note.
|
|
109
|
+
*/
|
|
110
|
+
format(pitchNotation: PitchNotation, symbolSet: SymbolSet): string;
|
|
111
|
+
/**
|
|
112
|
+
* Format note to string presentation without octave number.
|
|
113
|
+
* @param symbolSet - Symbol set.
|
|
114
|
+
* @returns - String presentation of note without octave number.
|
|
115
|
+
*/
|
|
116
|
+
formatOmitOctave(symbolSet: SymbolSet): string;
|
|
117
|
+
/**
|
|
118
|
+
* Get note.
|
|
119
|
+
* @param noteName - Note name (e.g. "C4").
|
|
120
|
+
* @returns - Note.
|
|
121
|
+
*/
|
|
122
|
+
static getNote(noteName: string): Note;
|
|
123
|
+
/**
|
|
124
|
+
* Get chromatic note. There are number of alternatives, this function uses simple logic to choose one.
|
|
125
|
+
* @param chromaticId - Chromatic id.
|
|
126
|
+
* @returns - Note.
|
|
127
|
+
*/
|
|
128
|
+
static getChromaticNote(chromaticId: number): Note;
|
|
129
|
+
/**
|
|
130
|
+
* GEt diatoni class from diatonic id.
|
|
131
|
+
* @param diatonicId - Diatonicid.
|
|
132
|
+
*/
|
|
133
|
+
static getDiatonicClass(diatonicId: number): number;
|
|
134
|
+
/**
|
|
135
|
+
* Getdiatonic class from note name.
|
|
136
|
+
* @param noteName - Note name.
|
|
137
|
+
*/
|
|
138
|
+
static getDiatonicClass(noteName: string): number;
|
|
139
|
+
/**
|
|
140
|
+
* Get octave from diatonic id.
|
|
141
|
+
* @param diatonicId - Diatonic id.
|
|
142
|
+
* @returns - Octave.
|
|
143
|
+
*/
|
|
144
|
+
static getOctaveFromDiatonicId(diatonicId: number): number;
|
|
145
|
+
/**
|
|
146
|
+
* Get diatonic id in given octave (transposes diatonic id to given octave).
|
|
147
|
+
* @param diatonicId - Original diatonic id.
|
|
148
|
+
* @param octave - Octave.
|
|
149
|
+
* @returns - Transposed diatonic id.
|
|
150
|
+
*/
|
|
151
|
+
static getDiatonicIdInOctave(diatonicId: number, octave: number): number;
|
|
152
|
+
/**
|
|
153
|
+
* Get chromatic class from chromatic id.
|
|
154
|
+
* @param chromaticId - Chromatic id.
|
|
155
|
+
* @returns - Chromatic class.
|
|
156
|
+
*/
|
|
157
|
+
static getChromaticClass(chromaticId: number): number;
|
|
158
|
+
/**
|
|
159
|
+
* Get octave from chromatic id.
|
|
160
|
+
* @param chromaticId - Chromatic id.
|
|
161
|
+
* @returns - Octave.
|
|
162
|
+
*/
|
|
163
|
+
static getOctaveFromChromaticId(chromaticId: number): number;
|
|
164
|
+
/**
|
|
165
|
+
* Get chromatic id in given octave (transposes chromatic id to given octave).
|
|
166
|
+
* @param chromaticId - Original chromatic id.
|
|
167
|
+
* @param octave - Octave.
|
|
168
|
+
* @returns - Transpose chromatic id.
|
|
169
|
+
*/
|
|
170
|
+
static getChromaticIdInOctave(chromaticId: number, octave: number): number;
|
|
171
|
+
/**
|
|
172
|
+
* Test if given two notes are equal.
|
|
173
|
+
* @param a - Note a.
|
|
174
|
+
* @param b - Note b.
|
|
175
|
+
* @returns - True/false.
|
|
176
|
+
*/
|
|
177
|
+
static equals(a: Note | null | undefined, b: Note | null | undefined): boolean;
|
|
178
|
+
/**
|
|
179
|
+
* Replace accidental symbols in given string to givn symbol set (ascii/unicode).
|
|
180
|
+
* @param str - String to replace.
|
|
181
|
+
* @param symbolSet - Symbol set.
|
|
182
|
+
* @returns - String with updated accidental symbols.
|
|
183
|
+
*/
|
|
184
|
+
static replaceAccidentalSymbols(str: string, symbolSet: SymbolSet): string;
|
|
185
|
+
/**
|
|
186
|
+
* Test if given string is valid note name.
|
|
187
|
+
* @param noteName - Note name to validate.
|
|
188
|
+
* @returns - True/false.
|
|
189
|
+
*/
|
|
190
|
+
static isValidNoteName(noteName: string): boolean;
|
|
191
|
+
/**
|
|
192
|
+
* Parse note name string to note props.
|
|
193
|
+
* @param noteName - Note name to parse.
|
|
194
|
+
* @returns - Parsed note props or undefined if parsing error.
|
|
195
|
+
*/
|
|
196
|
+
static parseNote(noteName: string): Readonly<ParsedNote> | undefined;
|
|
197
|
+
/**
|
|
198
|
+
* Get scientific note name from given note name.
|
|
199
|
+
* @param noteName - Note name.
|
|
200
|
+
* @param symbolSet - Symbol set (ascii/unicode) for scientific note name.
|
|
201
|
+
* @returns - Scientific note name.
|
|
202
|
+
*/
|
|
203
|
+
static getScientificNoteName(noteName: string, symbolSet: SymbolSet): string;
|
|
204
|
+
/**
|
|
205
|
+
* Get symbol of given accidental in given symbol set (ascii/unicide).
|
|
206
|
+
* @param accidental - Accidental.
|
|
207
|
+
* @param symbolsSet - Symbol set.
|
|
208
|
+
* @returns - Accidental symbol or undefined (invalid accidental).
|
|
209
|
+
*/
|
|
210
|
+
static getAccidentalSymbol(accidental: Accidental, symbolsSet: SymbolSet): string | undefined;
|
|
211
|
+
/**
|
|
212
|
+
* Get accidental value from given accidental symbol.
|
|
213
|
+
* @param accidentalSymbol - Accidental symbol (e.g. "#").
|
|
214
|
+
* @returns - Accidental vlaue.
|
|
215
|
+
*/
|
|
216
|
+
static getAccidental(accidentalSymbol: string): Accidental;
|
|
217
|
+
/**
|
|
218
|
+
* Get note letter from given diatonic id.
|
|
219
|
+
* @param diatonicId - Diatonic id.
|
|
220
|
+
* @returns - Note letter.
|
|
221
|
+
*/
|
|
222
|
+
static getNoteLetter(diatonicId: number): NoteLetter;
|
|
223
|
+
/**
|
|
224
|
+
* Find next lowest possible diatonic id that is above given bottom level.
|
|
225
|
+
* @param diatonicId - Diatonic id to begin with.
|
|
226
|
+
* @param bottomDiatonicId - Bottom diatonic id.
|
|
227
|
+
* @param addOctaveIfEqual - If true then add one octave if diatonic id would equal to bottom diatonic id.
|
|
228
|
+
* @returns - Diatonic id.
|
|
229
|
+
*/
|
|
230
|
+
static findNextDiatonicIdAbove(diatonicId: number, bottomDiatonicId: number, addOctaveIfEqual: boolean): number;
|
|
231
|
+
/**
|
|
232
|
+
* Validate if given argument is diatonic id.
|
|
233
|
+
* @param diatonicId - Diatonic id to validate.
|
|
234
|
+
* @returns - Valid diatonic id or throws.
|
|
235
|
+
*/
|
|
236
|
+
static validateDiatonicId(diatonicId: unknown): number;
|
|
237
|
+
/**
|
|
238
|
+
* Validate if given argument is diatonic class.
|
|
239
|
+
* @param diatonicClass - Diatonic class to validate.
|
|
240
|
+
* @returns - Valid diatonic class or throws.
|
|
241
|
+
*/
|
|
242
|
+
static validateDiatonicClass(diatonicClass: unknown): number;
|
|
243
|
+
/**
|
|
244
|
+
* Validate if given argument is chromatic id.
|
|
245
|
+
* @param chromaticId - Chromatic id to validate.
|
|
246
|
+
* @returns - Valid chromatic id, or throws.
|
|
247
|
+
*/
|
|
248
|
+
static validateChromaticId(chromaticId: unknown): number;
|
|
249
|
+
/**
|
|
250
|
+
* Validate if given argument is chromatic class.
|
|
251
|
+
* @param chromaticClass - Chromatic class to validate.
|
|
252
|
+
* @returns - Valid chromatic class, or throws.
|
|
253
|
+
*/
|
|
254
|
+
static validatechromaticClass(chromaticClass: unknown): number;
|
|
255
|
+
/**
|
|
256
|
+
* Validate if given argument if note letter.
|
|
257
|
+
* @param noteLetter - Note letter to validate.
|
|
258
|
+
* @returns - Valid note letter or throws.
|
|
259
|
+
*/
|
|
260
|
+
static validateNoteLetter(noteLetter: unknown): NoteLetter;
|
|
261
|
+
/**
|
|
262
|
+
* Validate if given argument is octave.
|
|
263
|
+
* @param octave - Octave to validate.
|
|
264
|
+
* @returns - Valid octave or throws.
|
|
265
|
+
*/
|
|
266
|
+
static validateOctave(octave: number): number;
|
|
267
|
+
/**
|
|
268
|
+
* Validate if given argument is valid accidental.
|
|
269
|
+
* @param acc - Accidental to validate.
|
|
270
|
+
* @returns - Valid accidental or thorws.
|
|
271
|
+
*/
|
|
272
|
+
static validateAccidental(acc: unknown): Accidental;
|
|
273
|
+
/**
|
|
274
|
+
* Sort notes by diatonicId in ascending order.
|
|
275
|
+
* @param notes - Array of notes.
|
|
276
|
+
* @returns Sorted array of notes.
|
|
277
|
+
*/
|
|
278
|
+
static sort(notes: ReadonlyArray<Note>): Note[];
|
|
279
|
+
/**
|
|
280
|
+
* Remove duplicate notes.
|
|
281
|
+
* @param notes - Array of notes.
|
|
282
|
+
* @returns Sorted set of notes.
|
|
283
|
+
*/
|
|
284
|
+
static removeDuplicates(notes: ReadonlyArray<Note>): Note[];
|
|
285
|
+
/**
|
|
286
|
+
* Function to compare two notes using diatonic id and accidental properties of notes.
|
|
287
|
+
* @param a - Note a.
|
|
288
|
+
* @param b - Note b.
|
|
289
|
+
* @returns - -1, 0 or 1.
|
|
290
|
+
*/
|
|
291
|
+
static compareFunc(a: Note, b: Note): 1 | 0 | -1;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
export { type Accidental as A, DefaultPitchNotation as D, GuitarNoteLabel as G, Note as N, type ParsedNote as P, SymbolSet as S, type NoteLetter as a, PitchNotation as b, PitchNotationList as c, DefaultGuitarNoteLabel as d, GuitarNoteLabelList as e, validateGuitarNoteLabel as f, getPitchNotationName as g, validatePitchNotation as v };
|
package/dist/pieces/index.d.mts
CHANGED
|
@@ -1,12 +1,31 @@
|
|
|
1
|
-
import { M as MDocument } from '../
|
|
2
|
-
import '../note-
|
|
3
|
-
import '../tempo-
|
|
1
|
+
import { M as MDocument } from '../music-objects-DJQ4d2OA.mjs';
|
|
2
|
+
import '../note-eA2xPPiG.mjs';
|
|
3
|
+
import '../tempo-CtUhvJbr.mjs';
|
|
4
4
|
import '@tspro/ts-utils-lib';
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Create Frere Jacques (round) music piece.<br />
|
|
8
|
+
* <br />
|
|
9
|
+
* Source: https://musescore.com/user/17324226/scores/7296137
|
|
10
|
+
*
|
|
11
|
+
* @returns - Music document.
|
|
12
|
+
*/
|
|
6
13
|
declare function createFrereJacques(): MDocument;
|
|
7
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Create Greensleeves music piece.<br />
|
|
17
|
+
* <br />
|
|
18
|
+
* Source: https://musescore.com/aaron_dc/scores/6167495
|
|
19
|
+
*
|
|
20
|
+
* @returns - Music document.
|
|
21
|
+
*/
|
|
8
22
|
declare function createGreensleeves(): MDocument;
|
|
9
23
|
|
|
24
|
+
/**
|
|
25
|
+
* Create Andante by A. Diabelli music piece.
|
|
26
|
+
*
|
|
27
|
+
* @returns - Music document.
|
|
28
|
+
*/
|
|
10
29
|
declare function createAndanteByDiabelli(): MDocument;
|
|
11
30
|
|
|
12
31
|
export { createAndanteByDiabelli, createFrereJacques, createGreensleeves };
|
package/dist/pieces/index.d.ts
CHANGED
|
@@ -1,12 +1,31 @@
|
|
|
1
|
-
import { M as MDocument } from '../
|
|
2
|
-
import '../note-
|
|
3
|
-
import '../tempo-
|
|
1
|
+
import { M as MDocument } from '../music-objects-Dc3kR-XF.js';
|
|
2
|
+
import '../note-eA2xPPiG.js';
|
|
3
|
+
import '../tempo-Dt8aHpol.js';
|
|
4
4
|
import '@tspro/ts-utils-lib';
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Create Frere Jacques (round) music piece.<br />
|
|
8
|
+
* <br />
|
|
9
|
+
* Source: https://musescore.com/user/17324226/scores/7296137
|
|
10
|
+
*
|
|
11
|
+
* @returns - Music document.
|
|
12
|
+
*/
|
|
6
13
|
declare function createFrereJacques(): MDocument;
|
|
7
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Create Greensleeves music piece.<br />
|
|
17
|
+
* <br />
|
|
18
|
+
* Source: https://musescore.com/aaron_dc/scores/6167495
|
|
19
|
+
*
|
|
20
|
+
* @returns - Music document.
|
|
21
|
+
*/
|
|
8
22
|
declare function createGreensleeves(): MDocument;
|
|
9
23
|
|
|
24
|
+
/**
|
|
25
|
+
* Create Andante by A. Diabelli music piece.
|
|
26
|
+
*
|
|
27
|
+
* @returns - Music document.
|
|
28
|
+
*/
|
|
10
29
|
declare function createAndanteByDiabelli(): MDocument;
|
|
11
30
|
|
|
12
31
|
export { createAndanteByDiabelli, createFrereJacques, createGreensleeves };
|