wtf is happening
This commit is contained in:
@ -346,26 +346,6 @@ export const makeArrayExtensions = (api: UserAPI) => {
|
|||||||
Array.prototype.rand = Array.prototype.random;
|
Array.prototype.rand = Array.prototype.random;
|
||||||
};
|
};
|
||||||
|
|
||||||
Array.prototype.scale = function (
|
|
||||||
scale: string = "major",
|
|
||||||
base_note: number = 0
|
|
||||||
) {
|
|
||||||
/**
|
|
||||||
* @param scale - the scale name
|
|
||||||
* @param base_note - the base note to start at (MIDI note number)
|
|
||||||
*/
|
|
||||||
const selected_scale = SCALES[scale];
|
|
||||||
return this.map((value) => {
|
|
||||||
const octaveShift =
|
|
||||||
Math.floor(value / selected_scale.length) * 12 * Math.sign(value);
|
|
||||||
return (
|
|
||||||
selected_scale[Math.abs(value) % selected_scale.length] +
|
|
||||||
base_note +
|
|
||||||
octaveShift
|
|
||||||
);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
Array.prototype.scale = function (
|
Array.prototype.scale = function (
|
||||||
scale: string = "major",
|
scale: string = "major",
|
||||||
base_note: number = 0
|
base_note: number = 0
|
||||||
|
|||||||
Reference in New Issue
Block a user