From 0722cf7ded81194dc91aef2690c30eb3c5cf4781 Mon Sep 17 00:00:00 2001 From: dudymas Date: Sat, 5 Jul 2025 13:43:42 -0400 Subject: [PATCH] feat(xen/tunejs): support sending a custom tuning --- packages/xen/tunejs.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/xen/tunejs.js b/packages/xen/tunejs.js index 6b5e7cb7..5806cf59 100644 --- a/packages/xen/tunejs.js +++ b/packages/xen/tunejs.js @@ -139,10 +139,10 @@ Tune.prototype.MIDI = function(stepIn,octaveIn) { /* Load a new scale */ -Tune.prototype.loadScale = function(name){ +Tune.prototype.loadScale = function(scale){ /* load the scale */ - var freqs = TuningList[name].frequencies + var freqs = isArrayOfNumbers(scale) ? scale : TuningList[scale].frequencies this.scale = [] for (var i=0;i 0 && arg.every(item => typeof item === 'number' && !isNaN(item)); +} + +/* allow an array of values too */ +Tune.prototype.isValidScale = function(scale) { + return !!TuningList[scale] || isArrayOfNumbers(scale) ; } /* Return a collection of notes as an array */