Skip to content
Philipp Mandler edited this page Jun 3, 2018 · 2 revisions
const { sin, PI, pow } = Math;

const osc = (name, f) => sin(this[name] += 1/44100 * 2 * PI * f);
const freq = noteNumber => Math.pow(2, (noteNumber - 69) / 12) * 440;

return keys.map(key => osc('osc_' + key, freq(key))).reduce((acc, next) => acc + next, 0);
Clone this wiki locally