Created
August 1, 2020 14:58
-
-
Save phoebejaffe/e5e18fffcc0e3ec8302cd716777f116f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This calculator tries to distribute however many strings you want over whatever | |
* range you want using the same approximate distribution of gauges on Ernie Ball | |
* strings. Replace the following three numbers (16, 9, 42) with your preferences. | |
* To run this code, open any window in Google Chrome and open the JavaScript Console | |
* (View => Developer => JavaScript Console), then paste all of this code in and | |
* press enter. It should print your answer in the console. Tweak numbers and re-run | |
* as much as you want | |
*/ | |
// HOW MANY STRINGS? | |
let numStrings = 16; | |
// WHAT'S THE LOWEST AND HIGHEST GAUGE YOU WANT TO USE? | |
let [gaugeLow, gaugeHigh] = [9, 42]; | |
(() => { | |
const distributeGauges = (_, i, {length}) => | |
Math.pow(i/(length-1), 1.73) * length * (gaugeHigh-gaugeLow)/(length) + gaugeLow; | |
const { round } = Math; | |
const gauges = new Array(numStrings).fill(0).map(distributeGauges).map(round); | |
console.log(`With ${numStrings} strings on your instrument, you can use the following gauges: | |
${gauges.join(', ')}` | |
); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Interactive version here! https://playcode.io/644991/