build
This commit is contained in:
parent
df0650e48d
commit
827c983175
24 changed files with 22150 additions and 20110 deletions
15
docs/dist/voicings.js
vendored
15
docs/dist/voicings.js
vendored
|
|
@ -10,7 +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) => 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, hap.context))).flat());
|
||||
};
|
||||
Pattern.prototype.voicings = function(range) {
|
||||
let lastVoicing;
|
||||
|
|
@ -18,15 +18,16 @@ Pattern.prototype.voicings = function(range) {
|
|||
range = ["F3", "A4"];
|
||||
}
|
||||
return this.fmapNested((event) => {
|
||||
lastVoicing = getVoicing(event.value?.value || event.value, lastVoicing, range);
|
||||
return stack(...lastVoicing);
|
||||
lastVoicing = getVoicing(event.value, lastVoicing, range);
|
||||
return stack(...lastVoicing)._withContext(() => ({
|
||||
locations: event.context.locations || []
|
||||
}));
|
||||
});
|
||||
};
|
||||
Pattern.prototype.rootNotes = function(octave = 2) {
|
||||
return this._mapNotes((value) => {
|
||||
const [_, root] = value.value.match(/^([a-gA-G])[b#]?.*$/);
|
||||
const bassNote = root + octave;
|
||||
return {...value, value: bassNote};
|
||||
return this.fmap((value) => {
|
||||
const [_, root] = value.match(/^([a-gA-G])[b#]?.*$/);
|
||||
return root + octave;
|
||||
});
|
||||
};
|
||||
Pattern.prototype.define("voicings", (range, pat) => pat.voicings(range), {composable: true});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue