add synonyms for scaleTranspose
This commit is contained in:
parent
cdbbe079db
commit
efc2333360
1 changed files with 20 additions and 16 deletions
|
|
@ -142,6 +142,7 @@ export const transpose = register('transpose', function (intervalOrSemitones, pa
|
||||||
* @name scaleTranspose
|
* @name scaleTranspose
|
||||||
* @param {offset} offset number of steps inside the scale
|
* @param {offset} offset number of steps inside the scale
|
||||||
* @returns Pattern
|
* @returns Pattern
|
||||||
|
* @synonyms scaleTrans
|
||||||
* @example
|
* @example
|
||||||
* "-8 [2,4,6]"
|
* "-8 [2,4,6]"
|
||||||
* .scale('C4 bebop major')
|
* .scale('C4 bebop major')
|
||||||
|
|
@ -149,22 +150,25 @@ export const transpose = register('transpose', function (intervalOrSemitones, pa
|
||||||
* .note()
|
* .note()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export const scaleTranspose = register('scaleTranspose', function (offset /* : number | string */, pat) {
|
export const scaleTranspose = register(
|
||||||
return pat.withHap((hap) => {
|
['scaleTranspose', 'scaleTrans', 'strans'],
|
||||||
if (!hap.context.scale) {
|
function (offset /* : number | string */, pat) {
|
||||||
throw new Error('can only use scaleTranspose after .scale');
|
return pat.withHap((hap) => {
|
||||||
}
|
if (!hap.context.scale) {
|
||||||
if (typeof hap.value === 'object')
|
throw new Error('can only use scaleTranspose after .scale');
|
||||||
return hap.withValue(() => ({
|
}
|
||||||
...hap.value,
|
if (typeof hap.value === 'object')
|
||||||
note: scaleOffset(hap.context.scale, Number(offset), hap.value.note),
|
return hap.withValue(() => ({
|
||||||
}));
|
...hap.value,
|
||||||
if (typeof hap.value !== 'string') {
|
note: scaleOffset(hap.context.scale, Number(offset), hap.value.note),
|
||||||
throw new Error('can only use scaleTranspose with notes');
|
}));
|
||||||
}
|
if (typeof hap.value !== 'string') {
|
||||||
return hap.withValue(() => scaleOffset(hap.context.scale, Number(offset), hap.value));
|
throw new Error('can only use scaleTranspose with notes');
|
||||||
});
|
}
|
||||||
});
|
return hap.withValue(() => scaleOffset(hap.context.scale, Number(offset), hap.value));
|
||||||
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Turns numbers into notes in the scale (zero indexed). Also sets scale for other scale operations, like {@link Pattern#scaleTranspose}.
|
* Turns numbers into notes in the scale (zero indexed). Also sets scale for other scale operations, like {@link Pattern#scaleTranspose}.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue