This commit is contained in:
Felix Roos 2022-02-25 20:47:44 +01:00
parent 08ab06c9cc
commit 067c0bfe70
2 changed files with 5 additions and 6 deletions

View File

@ -32,17 +32,16 @@ Pattern.prototype.voicings = function (range) {
range = ['F3', 'A4'];
}
return this.fmapNested((event) => {
lastVoicing = getVoicing(event.value?.value || event.value, lastVoicing, range);
lastVoicing = getVoicing(event.value, lastVoicing, range);
return stack(...lastVoicing);
});
};
Pattern.prototype.rootNotes = function (octave = 2) {
// range = ['G1', 'C3']
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;
});
};

View File

@ -214,7 +214,7 @@ class Hap {
}
show() {
return "(" + (this.whole == undefined ? "~" : this.whole.show()) + ", " + this.part.show() + ", " + JSON.stringify(this.value?.value ?? this.value) + ")"
return "(" + (this.whole == undefined ? "~" : this.whole.show()) + ", " + this.part.show() + ", " + this.value + ")"
}
setContext(context) {