/** * Scales * @module client/lib/scales.js; */ import "core-js/stable"; import "regenerator-runtime/runtime"; import { Arithmetic, Collatz, Fibonacci, Geometric, Power, Prime, Triangle, } from "../vendor/number-sequences/dist/index.js"; let a, b; export const scales = [ { name: "natural", get: (i, j) => [i + 1, j + 1] }, { name: "undertone", get: (i, j) => [i + 1, i + j + 2] }, { name: "overtone", get: (i, j) => [i + j + 2, j + 1] }, { name: "primes", reset: (x, y, w, h) => { a = Prime().skip(x).take(w).toJS(); b = Prime().skip(y).take(h).toJS(); }, get: (ii, jj, i, j) => [a[i], b[j]], }, { name: "arithmetic", reset: (x, y, w, h) => { a = Arithmetic(x + 1, x + 1) .take(w) .toJS(); b = Arithmetic(y + 1, y + 1) .take(h) .toJS(); // console.log(a); }, get: (ii, jj, i, j) => [a[i], b[j]], }, { name: "hyperbolic", get: (ii, jj, i, j, x, y) => [ 1 + (i * (x + 1)) / (y + 1), 1 + (j * (x + 1)) / (y + 1), ], }, // { // name: "triangle", // reset: (x, y, w, h) => { // a = Triangle().skip(x).take(w).toJS(); // b = Triangle().skip(y).take(h).toJS(); // }, // get: (ii, jj, i, j) => [a[i], b[j]], // }, { name: "collatz", reset: (x, y, w, h) => { a = Collatz(x + 1) .take(w) .toJS(); b = Collatz(y + 1) .take(h) .toJS(); }, get: (ii, jj, i, j) => [a[i], b[j]], }, { name: "pythagorean", get: (i, j) => i < j ? [3 ** (i + 1), 2 ** (j + Math.ceil(Math.max(0, (i * 1.0) / 2)))] : [2 ** (i + Math.ceil(Math.max(0, (j * 1.2) / 2))), 3 ** j], }, ]; export const equal = { name: "equal", get: (i, j) => [i, j + 1] };