This commit is contained in:
Felix Roos 2022-02-13 12:11:46 +01:00
parent 3d0d526051
commit b29857e81f
3 changed files with 12 additions and 3 deletions

1
docs/dist/parse.js vendored
View File

@ -4,6 +4,7 @@ import {Scale, Note, Interval} from "../_snowpack/pkg/@tonaljs/tonal.js";
import "./tone.js";
import "./midi.js";
import "./voicings.js";
import "./tonal.js";
import * as toneStuff from "./tone.js";
import shapeshifter from "./shapeshifter.js";
const {

10
docs/dist/tonal.js vendored Normal file
View File

@ -0,0 +1,10 @@
import {Note, Interval} from "../_snowpack/pkg/@tonaljs/tonal.js";
import {Pattern as _Pattern} from "../_snowpack/link/strudel.js";
const Pattern = _Pattern;
Pattern.prototype._transpose = function(intervalOrSemitones) {
const interval = !isNaN(Number(intervalOrSemitones)) ? Interval.fromSemitones(intervalOrSemitones) : String(intervalOrSemitones);
return this.fmap((note) => Note.transpose(note, interval));
};
Pattern.prototype.transpose = function(intervalOrSemitones) {
return this._patternify(Pattern.prototype._transpose)(intervalOrSemitones);
};

View File

@ -10,9 +10,7 @@ const getVoicing = (chord, lastVoicing, range = ["F3", "A4"]) => dictionaryVoici
});
const Pattern = _Pattern;
Pattern.prototype.fmapNested = function(func) {
return new Pattern((span) => this.query(span).map((event) => {
return reify(func(event)).query(span).map((hap) => new Hap(event.whole, event.part, hap.value));
}).flat());
return new Pattern((span) => this.query(span).map((event) => reify(func(event)).query(span).map((hap) => new Hap(event.whole, event.part, hap.value))).flat());
};
Pattern.prototype.voicings = function(range = ["F3", "A4"]) {
let lastVoicing;