chordsheetjs 7.3.1 → 7.4.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/README.md +34 -12
- package/lib/bundle.js +35 -17
- package/lib/index.js +35 -17
- package/lib/index.js.map +1 -1
- package/lib/main.d.ts +26 -7
- package/lib/main.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -639,9 +639,9 @@ If not, it returns [INDETERMINATE](#INDETERMINATE)</p>
|
|
|
639
639
|
* [.clone()](#Song+clone) ⇒ [<code>Song</code>](#Song)
|
|
640
640
|
* [.setKey(key)](#Song+setKey) ⇒ [<code>Song</code>](#Song)
|
|
641
641
|
* [.setCapo(capo)](#Song+setCapo) ⇒ [<code>Song</code>](#Song)
|
|
642
|
-
* [.transpose(delta)](#Song+transpose) ⇒ [<code>Song</code>](#Song)
|
|
643
|
-
* [.transposeUp()](#Song+transposeUp) ⇒ [<code>Song</code>](#Song)
|
|
644
|
-
* [.transposeDown()](#Song+transposeDown) ⇒ [<code>Song</code>](#Song)
|
|
642
|
+
* [.transpose(delta, [options])](#Song+transpose) ⇒ [<code>Song</code>](#Song)
|
|
643
|
+
* [.transposeUp([options])](#Song+transposeUp) ⇒ [<code>Song</code>](#Song)
|
|
644
|
+
* [.transposeDown([options])](#Song+transposeDown) ⇒ [<code>Song</code>](#Song)
|
|
645
645
|
* [.changeKey(newKey)](#Song+changeKey) ⇒ [<code>Song</code>](#Song)
|
|
646
646
|
* [.changeMetadata(name, value)](#Song+changeMetadata)
|
|
647
647
|
* [.mapItems(func)](#Song+mapItems) ⇒ [<code>Song</code>](#Song)
|
|
@@ -729,7 +729,7 @@ if you want to skip the "header lines": the lines that only contain me
|
|
|
729
729
|
|
|
730
730
|
<a name="Song+transpose"></a>
|
|
731
731
|
|
|
732
|
-
### song.transpose(delta) ⇒ [<code>Song</code>](#Song)
|
|
732
|
+
### song.transpose(delta, [options]) ⇒ [<code>Song</code>](#Song)
|
|
733
733
|
<p>Transposes the song by the specified delta. It will:</p>
|
|
734
734
|
<ul>
|
|
735
735
|
<li>transpose all chords, see: [transpose](#Chord+transpose)</li>
|
|
@@ -740,13 +740,15 @@ if you want to skip the "header lines": the lines that only contain me
|
|
|
740
740
|
**Kind**: instance method of [<code>Song</code>](#Song)
|
|
741
741
|
**Returns**: [<code>Song</code>](#Song) - <p>The transposed song</p>
|
|
742
742
|
|
|
743
|
-
| Param | Type | Description |
|
|
744
|
-
| --- | --- | --- |
|
|
745
|
-
| delta | <code>number</code> | <p>The number of semitones (positive or negative) to transpose with</p> |
|
|
743
|
+
| Param | Type | Default | Description |
|
|
744
|
+
| --- | --- | --- | --- |
|
|
745
|
+
| delta | <code>number</code> | | <p>The number of semitones (positive or negative) to transpose with</p> |
|
|
746
|
+
| [options] | <code>Object</code> | <code>{}</code> | <p>options</p> |
|
|
747
|
+
| [options.normalizeChordSuffix] | <code>boolean</code> | <code>false</code> | <p>whether to normalize the chord suffixes after transposing</p> |
|
|
746
748
|
|
|
747
749
|
<a name="Song+transposeUp"></a>
|
|
748
750
|
|
|
749
|
-
### song.transposeUp() ⇒ [<code>Song</code>](#Song)
|
|
751
|
+
### song.transposeUp([options]) ⇒ [<code>Song</code>](#Song)
|
|
750
752
|
<p>Transposes the song up by one semitone. It will:</p>
|
|
751
753
|
<ul>
|
|
752
754
|
<li>transpose all chords, see: [transpose](#Chord+transpose)</li>
|
|
@@ -756,9 +758,15 @@ if you want to skip the "header lines": the lines that only contain me
|
|
|
756
758
|
|
|
757
759
|
**Kind**: instance method of [<code>Song</code>](#Song)
|
|
758
760
|
**Returns**: [<code>Song</code>](#Song) - <p>The transposed song</p>
|
|
761
|
+
|
|
762
|
+
| Param | Type | Default | Description |
|
|
763
|
+
| --- | --- | --- | --- |
|
|
764
|
+
| [options] | <code>Object</code> | <code>{}</code> | <p>options</p> |
|
|
765
|
+
| [options.normalizeChordSuffix] | <code>boolean</code> | <code>false</code> | <p>whether to normalize the chord suffixes after transposing</p> |
|
|
766
|
+
|
|
759
767
|
<a name="Song+transposeDown"></a>
|
|
760
768
|
|
|
761
|
-
### song.transposeDown() ⇒ [<code>Song</code>](#Song)
|
|
769
|
+
### song.transposeDown([options]) ⇒ [<code>Song</code>](#Song)
|
|
762
770
|
<p>Transposes the song down by one semitone. It will:</p>
|
|
763
771
|
<ul>
|
|
764
772
|
<li>transpose all chords, see: [transpose](#Chord+transpose)</li>
|
|
@@ -768,6 +776,12 @@ if you want to skip the "header lines": the lines that only contain me
|
|
|
768
776
|
|
|
769
777
|
**Kind**: instance method of [<code>Song</code>](#Song)
|
|
770
778
|
**Returns**: [<code>Song</code>](#Song) - <p>The transposed song</p>
|
|
779
|
+
|
|
780
|
+
| Param | Type | Default | Description |
|
|
781
|
+
| --- | --- | --- | --- |
|
|
782
|
+
| [options] | <code>Object</code> | <code>{}</code> | <p>options</p> |
|
|
783
|
+
| [options.normalizeChordSuffix] | <code>boolean</code> | <code>false</code> | <p>whether to normalize the chord suffixes after transposing</p> |
|
|
784
|
+
|
|
771
785
|
<a name="Song+changeKey"></a>
|
|
772
786
|
|
|
773
787
|
### song.changeKey(newKey) ⇒ [<code>Song</code>](#Song)
|
|
@@ -1188,7 +1202,7 @@ Inherits from [ChordSheetParser](#ChordSheetParser)</p>
|
|
|
1188
1202
|
* [.toNumericString([key])](#Chord+toNumericString) ⇒ <code>string</code>
|
|
1189
1203
|
* [.isNumeral()](#Chord+isNumeral) ⇒ <code>boolean</code>
|
|
1190
1204
|
* [.toString()](#Chord+toString) ⇒ <code>string</code>
|
|
1191
|
-
* [.normalize()](#Chord+normalize) ⇒ [<code>Chord</code>](#Chord)
|
|
1205
|
+
* [.normalize([key], [options])](#Chord+normalize) ⇒ [<code>Chord</code>](#Chord)
|
|
1192
1206
|
* [.useModifier(newModifier)](#Chord+useModifier) ⇒ [<code>Chord</code>](#Chord)
|
|
1193
1207
|
* [.transposeUp()](#Chord+transposeUp) ⇒ [<code>Chord</code>](#Chord)
|
|
1194
1208
|
* [.transposeDown()](#Chord+transposeDown) ⇒ [<code>Chord</code>](#Chord)
|
|
@@ -1312,7 +1326,7 @@ For example, a chord symbol A# with reference key E will return the numeric chor
|
|
|
1312
1326
|
**Returns**: <code>string</code> - <p>the chord string</p>
|
|
1313
1327
|
<a name="Chord+normalize"></a>
|
|
1314
1328
|
|
|
1315
|
-
### chord.normalize() ⇒ [<code>Chord</code>](#Chord)
|
|
1329
|
+
### chord.normalize([key], [options]) ⇒ [<code>Chord</code>](#Chord)
|
|
1316
1330
|
<p>Normalizes the chord root and bass notes:</p>
|
|
1317
1331
|
<ul>
|
|
1318
1332
|
<li>Fb becomes E</li>
|
|
@@ -1324,11 +1338,19 @@ For example, a chord symbol A# with reference key E will return the numeric chor
|
|
|
1324
1338
|
<li>7# becomes 1</li>
|
|
1325
1339
|
<li>3# becomes 4</li>
|
|
1326
1340
|
</ul>
|
|
1327
|
-
<p>Besides that it normalizes the suffix
|
|
1341
|
+
<p>Besides that it normalizes the suffix if <code>normalizeSuffix</code> is <code>true</code>.
|
|
1342
|
+
For example, <code>sus2</code> becomes <code>2</code>, <code>sus4</code> becomes <code>sus</code>.
|
|
1328
1343
|
All suffix normalizations can be found in <code>src/normalize_mappings/suffix-mapping.txt</code>.</p>
|
|
1329
1344
|
|
|
1330
1345
|
**Kind**: instance method of [<code>Chord</code>](#Chord)
|
|
1331
1346
|
**Returns**: [<code>Chord</code>](#Chord) - <p>the normalized chord</p>
|
|
1347
|
+
|
|
1348
|
+
| Param | Type | Default | Description |
|
|
1349
|
+
| --- | --- | --- | --- |
|
|
1350
|
+
| [key] | <code>Key</code> \| <code>string</code> | <code></code> | <p>the key to normalize to</p> |
|
|
1351
|
+
| [options] | <code>Object</code> | <code>{}</code> | <p>options</p> |
|
|
1352
|
+
| [options.normalizeSuffix] | <code>boolean</code> | <code>true</code> | <p>whether to normalize the chord suffix after transposing</p> |
|
|
1353
|
+
|
|
1332
1354
|
<a name="Chord+useModifier"></a>
|
|
1333
1355
|
|
|
1334
1356
|
### chord.useModifier(newModifier) ⇒ [<code>Chord</code>](#Chord)
|
package/lib/bundle.js
CHANGED
|
@@ -3088,7 +3088,7 @@ var $e12151f977ef7bf6$export$2e2bcd8739ae039 = $e12151f977ef7bf6$var$mapping;
|
|
|
3088
3088
|
|
|
3089
3089
|
|
|
3090
3090
|
|
|
3091
|
-
function $26f57998457eb2d4$var$
|
|
3091
|
+
function $26f57998457eb2d4$var$normalizeChordSuffix(suffix) {
|
|
3092
3092
|
if ((0, $e12151f977ef7bf6$export$2e2bcd8739ae039)[suffix] === "[blank]") return null;
|
|
3093
3093
|
return (0, $e12151f977ef7bf6$export$2e2bcd8739ae039)[suffix] || suffix;
|
|
3094
3094
|
}
|
|
@@ -3135,7 +3135,7 @@ const $26f57998457eb2d4$var$regexes = [
|
|
|
3135
3135
|
const keyObj = (0, $bff5407e03fdc8ee$export$2e2bcd8739ae039).wrap(key);
|
|
3136
3136
|
const rootKey = this.root.toChordSymbol(keyObj).normalizeEnharmonics(keyObj);
|
|
3137
3137
|
let chordSymbolChord = new $26f57998457eb2d4$var$Chord({
|
|
3138
|
-
suffix: $26f57998457eb2d4$var$
|
|
3138
|
+
suffix: $26f57998457eb2d4$var$normalizeChordSuffix(this.suffix),
|
|
3139
3139
|
root: rootKey,
|
|
3140
3140
|
bass: this.bass?.toChordSymbol(keyObj).normalizeEnharmonics(rootKey)
|
|
3141
3141
|
});
|
|
@@ -3171,7 +3171,7 @@ const $26f57998457eb2d4$var$regexes = [
|
|
|
3171
3171
|
});
|
|
3172
3172
|
const keyObj = (0, $bff5407e03fdc8ee$export$2e2bcd8739ae039).wrap(key);
|
|
3173
3173
|
return new $26f57998457eb2d4$var$Chord({
|
|
3174
|
-
suffix: $26f57998457eb2d4$var$
|
|
3174
|
+
suffix: $26f57998457eb2d4$var$normalizeChordSuffix(this.suffix),
|
|
3175
3175
|
root: this.root.toNumeric(keyObj),
|
|
3176
3176
|
bass: this.bass?.toNumeric(keyObj)
|
|
3177
3177
|
});
|
|
@@ -3189,7 +3189,7 @@ const $26f57998457eb2d4$var$regexes = [
|
|
|
3189
3189
|
});
|
|
3190
3190
|
const keyObj = (0, $bff5407e03fdc8ee$export$2e2bcd8739ae039).wrap(key);
|
|
3191
3191
|
return new $26f57998457eb2d4$var$Chord({
|
|
3192
|
-
suffix: $26f57998457eb2d4$var$
|
|
3192
|
+
suffix: $26f57998457eb2d4$var$normalizeChordSuffix(this.suffix),
|
|
3193
3193
|
root: this.root.toNumeral(keyObj),
|
|
3194
3194
|
bass: this.bass?.toNumeral(keyObj)
|
|
3195
3195
|
});
|
|
@@ -3243,17 +3243,21 @@ const $26f57998457eb2d4$var$regexes = [
|
|
|
3243
3243
|
* - 7# becomes 1
|
|
3244
3244
|
* - 3# becomes 4
|
|
3245
3245
|
*
|
|
3246
|
-
* Besides that it normalizes the suffix
|
|
3246
|
+
* Besides that it normalizes the suffix if `normalizeSuffix` is `true`.
|
|
3247
|
+
* For example, `sus2` becomes `2`, `sus4` becomes `sus`.
|
|
3247
3248
|
* All suffix normalizations can be found in `src/normalize_mappings/suffix-mapping.txt`.
|
|
3248
|
-
*
|
|
3249
|
+
* @param {Key|string} [key=null] the key to normalize to
|
|
3250
|
+
* @param {Object} [options={}] options
|
|
3251
|
+
* @param {boolean} [options.normalizeSuffix=true] whether to normalize the chord suffix after transposing
|
|
3249
3252
|
* @returns {Chord} the normalized chord
|
|
3250
|
-
*/ normalize(key = null) {
|
|
3253
|
+
*/ normalize(key = null, { normalizeSuffix: normalizeSuffix = true } = {}) {
|
|
3254
|
+
const suffix = normalizeSuffix ? $26f57998457eb2d4$var$normalizeChordSuffix(this.suffix) : this.suffix;
|
|
3251
3255
|
if ((0, $21a34a464e7bc609$export$7ee701e290d9865)(key)) return this.process("normalize").set({
|
|
3252
|
-
suffix:
|
|
3256
|
+
suffix: suffix
|
|
3253
3257
|
});
|
|
3254
3258
|
return this.set({
|
|
3259
|
+
suffix: suffix,
|
|
3255
3260
|
root: this.root.normalizeEnharmonics(key),
|
|
3256
|
-
suffix: (0, $21a34a464e7bc609$export$ed9b06b5ee264ad3)($26f57998457eb2d4$var$normalizeSuffix(this.suffix)),
|
|
3257
3261
|
bass: this.bass ? this.bass.normalizeEnharmonics(this.root.toString()) : null
|
|
3258
3262
|
});
|
|
3259
3263
|
}
|
|
@@ -3374,11 +3378,13 @@ var $26f57998457eb2d4$export$2e2bcd8739ae039 = $26f57998457eb2d4$var$Chord;
|
|
|
3374
3378
|
lyrics: lyrics
|
|
3375
3379
|
});
|
|
3376
3380
|
}
|
|
3377
|
-
transpose(delta, key = null) {
|
|
3381
|
+
transpose(delta, key = null, { normalizeChordSuffix: normalizeChordSuffix = false } = {}) {
|
|
3378
3382
|
const chordObj = (0, $26f57998457eb2d4$export$2e2bcd8739ae039).parse(this.chords);
|
|
3379
3383
|
if (chordObj) {
|
|
3380
3384
|
let transposedChord = chordObj.transpose(delta);
|
|
3381
|
-
if (key) transposedChord = transposedChord.normalize(key
|
|
3385
|
+
if (key) transposedChord = transposedChord.normalize(key, {
|
|
3386
|
+
normalizeSuffix: normalizeChordSuffix
|
|
3387
|
+
});
|
|
3382
3388
|
return this.set({
|
|
3383
3389
|
chords: transposedChord.toString()
|
|
3384
3390
|
});
|
|
@@ -4141,8 +4147,10 @@ var $ce1dd7d0f2cd2369$export$2e2bcd8739ae039 = $ce1dd7d0f2cd2369$var$ParserWarni
|
|
|
4141
4147
|
* - transpose the song key in {@link metadata}
|
|
4142
4148
|
* - update any existing `key` directive
|
|
4143
4149
|
* @param {number} delta The number of semitones (positive or negative) to transpose with
|
|
4150
|
+
* @param {Object} [options={}] options
|
|
4151
|
+
* @param {boolean} [options.normalizeChordSuffix=false] whether to normalize the chord suffixes after transposing
|
|
4144
4152
|
* @returns {Song} The transposed song
|
|
4145
|
-
*/ transpose(delta) {
|
|
4153
|
+
*/ transpose(delta, { normalizeChordSuffix: normalizeChordSuffix = false } = {}) {
|
|
4146
4154
|
const wrappedKey = (0, $bff5407e03fdc8ee$export$2e2bcd8739ae039).wrap(this.key);
|
|
4147
4155
|
let transposedKey = null;
|
|
4148
4156
|
let song = this;
|
|
@@ -4151,7 +4159,9 @@ var $ce1dd7d0f2cd2369$export$2e2bcd8739ae039 = $ce1dd7d0f2cd2369$var$ParserWarni
|
|
|
4151
4159
|
song = song.setKey(transposedKey);
|
|
4152
4160
|
}
|
|
4153
4161
|
return song.mapItems((item)=>{
|
|
4154
|
-
if (item instanceof (0, $d454f4215ba01af2$export$2e2bcd8739ae039)) return item.transpose(delta, transposedKey
|
|
4162
|
+
if (item instanceof (0, $d454f4215ba01af2$export$2e2bcd8739ae039)) return item.transpose(delta, transposedKey, {
|
|
4163
|
+
normalizeChordSuffix: normalizeChordSuffix
|
|
4164
|
+
});
|
|
4155
4165
|
return item;
|
|
4156
4166
|
});
|
|
4157
4167
|
}
|
|
@@ -4160,18 +4170,26 @@ var $ce1dd7d0f2cd2369$export$2e2bcd8739ae039 = $ce1dd7d0f2cd2369$var$ParserWarni
|
|
|
4160
4170
|
* - transpose all chords, see: {@link Chord#transpose}
|
|
4161
4171
|
* - transpose the song key in {@link metadata}
|
|
4162
4172
|
* - update any existing `key` directive
|
|
4173
|
+
* @param {Object} [options={}] options
|
|
4174
|
+
* @param {boolean} [options.normalizeChordSuffix=false] whether to normalize the chord suffixes after transposing
|
|
4163
4175
|
* @returns {Song} The transposed song
|
|
4164
|
-
*/ transposeUp() {
|
|
4165
|
-
return this.transpose(1
|
|
4176
|
+
*/ transposeUp({ normalizeChordSuffix: normalizeChordSuffix = false } = {}) {
|
|
4177
|
+
return this.transpose(1, {
|
|
4178
|
+
normalizeChordSuffix: normalizeChordSuffix
|
|
4179
|
+
});
|
|
4166
4180
|
}
|
|
4167
4181
|
/**
|
|
4168
4182
|
* Transposes the song down by one semitone. It will:
|
|
4169
4183
|
* - transpose all chords, see: {@link Chord#transpose}
|
|
4170
4184
|
* - transpose the song key in {@link metadata}
|
|
4171
4185
|
* - update any existing `key` directive
|
|
4186
|
+
* @param {Object} [options={}] options
|
|
4187
|
+
* @param {boolean} [options.normalizeChordSuffix=false] whether to normalize the chord suffixes after transposing
|
|
4172
4188
|
* @returns {Song} The transposed song
|
|
4173
|
-
*/ transposeDown() {
|
|
4174
|
-
return this.transpose(-1
|
|
4189
|
+
*/ transposeDown({ normalizeChordSuffix: normalizeChordSuffix = false } = {}) {
|
|
4190
|
+
return this.transpose(-1, {
|
|
4191
|
+
normalizeChordSuffix: normalizeChordSuffix
|
|
4192
|
+
});
|
|
4175
4193
|
}
|
|
4176
4194
|
/**
|
|
4177
4195
|
* Returns a copy of the song with the key set to the specified key. It changes:
|
package/lib/index.js
CHANGED
|
@@ -3087,7 +3087,7 @@ var $e12151f977ef7bf6$export$2e2bcd8739ae039 = $e12151f977ef7bf6$var$mapping;
|
|
|
3087
3087
|
|
|
3088
3088
|
|
|
3089
3089
|
|
|
3090
|
-
function $26f57998457eb2d4$var$
|
|
3090
|
+
function $26f57998457eb2d4$var$normalizeChordSuffix(suffix) {
|
|
3091
3091
|
if ((0, $e12151f977ef7bf6$export$2e2bcd8739ae039)[suffix] === "[blank]") return null;
|
|
3092
3092
|
return (0, $e12151f977ef7bf6$export$2e2bcd8739ae039)[suffix] || suffix;
|
|
3093
3093
|
}
|
|
@@ -3134,7 +3134,7 @@ const $26f57998457eb2d4$var$regexes = [
|
|
|
3134
3134
|
const keyObj = (0, $bff5407e03fdc8ee$export$2e2bcd8739ae039).wrap(key);
|
|
3135
3135
|
const rootKey = this.root.toChordSymbol(keyObj).normalizeEnharmonics(keyObj);
|
|
3136
3136
|
let chordSymbolChord = new $26f57998457eb2d4$var$Chord({
|
|
3137
|
-
suffix: $26f57998457eb2d4$var$
|
|
3137
|
+
suffix: $26f57998457eb2d4$var$normalizeChordSuffix(this.suffix),
|
|
3138
3138
|
root: rootKey,
|
|
3139
3139
|
bass: this.bass?.toChordSymbol(keyObj).normalizeEnharmonics(rootKey)
|
|
3140
3140
|
});
|
|
@@ -3170,7 +3170,7 @@ const $26f57998457eb2d4$var$regexes = [
|
|
|
3170
3170
|
});
|
|
3171
3171
|
const keyObj = (0, $bff5407e03fdc8ee$export$2e2bcd8739ae039).wrap(key);
|
|
3172
3172
|
return new $26f57998457eb2d4$var$Chord({
|
|
3173
|
-
suffix: $26f57998457eb2d4$var$
|
|
3173
|
+
suffix: $26f57998457eb2d4$var$normalizeChordSuffix(this.suffix),
|
|
3174
3174
|
root: this.root.toNumeric(keyObj),
|
|
3175
3175
|
bass: this.bass?.toNumeric(keyObj)
|
|
3176
3176
|
});
|
|
@@ -3188,7 +3188,7 @@ const $26f57998457eb2d4$var$regexes = [
|
|
|
3188
3188
|
});
|
|
3189
3189
|
const keyObj = (0, $bff5407e03fdc8ee$export$2e2bcd8739ae039).wrap(key);
|
|
3190
3190
|
return new $26f57998457eb2d4$var$Chord({
|
|
3191
|
-
suffix: $26f57998457eb2d4$var$
|
|
3191
|
+
suffix: $26f57998457eb2d4$var$normalizeChordSuffix(this.suffix),
|
|
3192
3192
|
root: this.root.toNumeral(keyObj),
|
|
3193
3193
|
bass: this.bass?.toNumeral(keyObj)
|
|
3194
3194
|
});
|
|
@@ -3242,17 +3242,21 @@ const $26f57998457eb2d4$var$regexes = [
|
|
|
3242
3242
|
* - 7# becomes 1
|
|
3243
3243
|
* - 3# becomes 4
|
|
3244
3244
|
*
|
|
3245
|
-
* Besides that it normalizes the suffix
|
|
3245
|
+
* Besides that it normalizes the suffix if `normalizeSuffix` is `true`.
|
|
3246
|
+
* For example, `sus2` becomes `2`, `sus4` becomes `sus`.
|
|
3246
3247
|
* All suffix normalizations can be found in `src/normalize_mappings/suffix-mapping.txt`.
|
|
3247
|
-
*
|
|
3248
|
+
* @param {Key|string} [key=null] the key to normalize to
|
|
3249
|
+
* @param {Object} [options={}] options
|
|
3250
|
+
* @param {boolean} [options.normalizeSuffix=true] whether to normalize the chord suffix after transposing
|
|
3248
3251
|
* @returns {Chord} the normalized chord
|
|
3249
|
-
*/ normalize(key = null) {
|
|
3252
|
+
*/ normalize(key = null, { normalizeSuffix: normalizeSuffix = true } = {}) {
|
|
3253
|
+
const suffix = normalizeSuffix ? $26f57998457eb2d4$var$normalizeChordSuffix(this.suffix) : this.suffix;
|
|
3250
3254
|
if ((0, $21a34a464e7bc609$export$7ee701e290d9865)(key)) return this.process("normalize").set({
|
|
3251
|
-
suffix:
|
|
3255
|
+
suffix: suffix
|
|
3252
3256
|
});
|
|
3253
3257
|
return this.set({
|
|
3258
|
+
suffix: suffix,
|
|
3254
3259
|
root: this.root.normalizeEnharmonics(key),
|
|
3255
|
-
suffix: (0, $21a34a464e7bc609$export$ed9b06b5ee264ad3)($26f57998457eb2d4$var$normalizeSuffix(this.suffix)),
|
|
3256
3260
|
bass: this.bass ? this.bass.normalizeEnharmonics(this.root.toString()) : null
|
|
3257
3261
|
});
|
|
3258
3262
|
}
|
|
@@ -3373,11 +3377,13 @@ var $26f57998457eb2d4$export$2e2bcd8739ae039 = $26f57998457eb2d4$var$Chord;
|
|
|
3373
3377
|
lyrics: lyrics
|
|
3374
3378
|
});
|
|
3375
3379
|
}
|
|
3376
|
-
transpose(delta, key = null) {
|
|
3380
|
+
transpose(delta, key = null, { normalizeChordSuffix: normalizeChordSuffix = false } = {}) {
|
|
3377
3381
|
const chordObj = (0, $26f57998457eb2d4$export$2e2bcd8739ae039).parse(this.chords);
|
|
3378
3382
|
if (chordObj) {
|
|
3379
3383
|
let transposedChord = chordObj.transpose(delta);
|
|
3380
|
-
if (key) transposedChord = transposedChord.normalize(key
|
|
3384
|
+
if (key) transposedChord = transposedChord.normalize(key, {
|
|
3385
|
+
normalizeSuffix: normalizeChordSuffix
|
|
3386
|
+
});
|
|
3381
3387
|
return this.set({
|
|
3382
3388
|
chords: transposedChord.toString()
|
|
3383
3389
|
});
|
|
@@ -4140,8 +4146,10 @@ var $ce1dd7d0f2cd2369$export$2e2bcd8739ae039 = $ce1dd7d0f2cd2369$var$ParserWarni
|
|
|
4140
4146
|
* - transpose the song key in {@link metadata}
|
|
4141
4147
|
* - update any existing `key` directive
|
|
4142
4148
|
* @param {number} delta The number of semitones (positive or negative) to transpose with
|
|
4149
|
+
* @param {Object} [options={}] options
|
|
4150
|
+
* @param {boolean} [options.normalizeChordSuffix=false] whether to normalize the chord suffixes after transposing
|
|
4143
4151
|
* @returns {Song} The transposed song
|
|
4144
|
-
*/ transpose(delta) {
|
|
4152
|
+
*/ transpose(delta, { normalizeChordSuffix: normalizeChordSuffix = false } = {}) {
|
|
4145
4153
|
const wrappedKey = (0, $bff5407e03fdc8ee$export$2e2bcd8739ae039).wrap(this.key);
|
|
4146
4154
|
let transposedKey = null;
|
|
4147
4155
|
let song = this;
|
|
@@ -4150,7 +4158,9 @@ var $ce1dd7d0f2cd2369$export$2e2bcd8739ae039 = $ce1dd7d0f2cd2369$var$ParserWarni
|
|
|
4150
4158
|
song = song.setKey(transposedKey);
|
|
4151
4159
|
}
|
|
4152
4160
|
return song.mapItems((item)=>{
|
|
4153
|
-
if (item instanceof (0, $d454f4215ba01af2$export$2e2bcd8739ae039)) return item.transpose(delta, transposedKey
|
|
4161
|
+
if (item instanceof (0, $d454f4215ba01af2$export$2e2bcd8739ae039)) return item.transpose(delta, transposedKey, {
|
|
4162
|
+
normalizeChordSuffix: normalizeChordSuffix
|
|
4163
|
+
});
|
|
4154
4164
|
return item;
|
|
4155
4165
|
});
|
|
4156
4166
|
}
|
|
@@ -4159,18 +4169,26 @@ var $ce1dd7d0f2cd2369$export$2e2bcd8739ae039 = $ce1dd7d0f2cd2369$var$ParserWarni
|
|
|
4159
4169
|
* - transpose all chords, see: {@link Chord#transpose}
|
|
4160
4170
|
* - transpose the song key in {@link metadata}
|
|
4161
4171
|
* - update any existing `key` directive
|
|
4172
|
+
* @param {Object} [options={}] options
|
|
4173
|
+
* @param {boolean} [options.normalizeChordSuffix=false] whether to normalize the chord suffixes after transposing
|
|
4162
4174
|
* @returns {Song} The transposed song
|
|
4163
|
-
*/ transposeUp() {
|
|
4164
|
-
return this.transpose(1
|
|
4175
|
+
*/ transposeUp({ normalizeChordSuffix: normalizeChordSuffix = false } = {}) {
|
|
4176
|
+
return this.transpose(1, {
|
|
4177
|
+
normalizeChordSuffix: normalizeChordSuffix
|
|
4178
|
+
});
|
|
4165
4179
|
}
|
|
4166
4180
|
/**
|
|
4167
4181
|
* Transposes the song down by one semitone. It will:
|
|
4168
4182
|
* - transpose all chords, see: {@link Chord#transpose}
|
|
4169
4183
|
* - transpose the song key in {@link metadata}
|
|
4170
4184
|
* - update any existing `key` directive
|
|
4185
|
+
* @param {Object} [options={}] options
|
|
4186
|
+
* @param {boolean} [options.normalizeChordSuffix=false] whether to normalize the chord suffixes after transposing
|
|
4171
4187
|
* @returns {Song} The transposed song
|
|
4172
|
-
*/ transposeDown() {
|
|
4173
|
-
return this.transpose(-1
|
|
4188
|
+
*/ transposeDown({ normalizeChordSuffix: normalizeChordSuffix = false } = {}) {
|
|
4189
|
+
return this.transpose(-1, {
|
|
4190
|
+
normalizeChordSuffix: normalizeChordSuffix
|
|
4191
|
+
});
|
|
4174
4192
|
}
|
|
4175
4193
|
/**
|
|
4176
4194
|
* Returns a copy of the song with the key set to the specified key. It changes:
|