build
This commit is contained in:
parent
ffffca8cdc
commit
a0c09f7575
4 changed files with 175 additions and 136 deletions
15
docs/dist/voicings.js
vendored
15
docs/dist/voicings.js
vendored
|
|
@ -1,4 +1,4 @@
|
|||
import {Pattern as _Pattern, stack, Hap} from "../_snowpack/link/strudel.js";
|
||||
import {Pattern as _Pattern, stack, Hap, reify} from "../_snowpack/link/strudel.js";
|
||||
import voicings from "../_snowpack/pkg/chord-voicings.js";
|
||||
const {dictionaryVoicing, minTopNoteDiff, lefthand} = voicings;
|
||||
const getVoicing = (chord, lastVoicing, range = ["F3", "A4"]) => dictionaryVoicing({
|
||||
|
|
@ -9,10 +9,15 @@ const getVoicing = (chord, lastVoicing, range = ["F3", "A4"]) => dictionaryVoici
|
|||
lastVoicing
|
||||
});
|
||||
const Pattern = _Pattern;
|
||||
Pattern.prototype.voicings = function(range = ["F3", "A4"]) {
|
||||
let lastVoicing;
|
||||
Pattern.prototype.fmapNested = function(func) {
|
||||
return new Pattern((span) => this.query(span).map((event) => {
|
||||
lastVoicing = getVoicing(event.value, lastVoicing, range);
|
||||
return stack(...lastVoicing).query(span).map((hap) => new Hap(event.whole, event.part, hap.value));
|
||||
return 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;
|
||||
return this.fmapNested((event) => {
|
||||
lastVoicing = getVoicing(event.value, lastVoicing, range);
|
||||
return stack(...lastVoicing);
|
||||
});
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue