This commit is contained in:
Felix Roos 2022-03-06 21:39:10 +01:00
parent ad42e5eb61
commit a2ab2b9da5
19 changed files with 72400 additions and 62 deletions

14
docs/dist/tune.js vendored Normal file
View file

@ -0,0 +1,14 @@
import Tune from "./tunejs.js";
import {Pattern} from "../_snowpack/link/strudel.js";
Pattern.prototype._tune = function(scale, tonic = 220) {
const tune = new Tune();
if (!tune.isValidScale(scale)) {
throw new Error('not a valid tune.js scale name: "' + scale + '". See http://abbernie.github.io/tune/scales.html');
}
tune.loadScale(scale);
tune.tonicize(tonic);
return this._asNumber()._withEvent((event) => {
return event.withValue(() => tune.note(event.value)).setContext({...event.context, type: "frequency"});
});
};
Pattern.prototype.define("tune", (scale, pat) => pat.tune(scale), {composable: true, patternified: true});