feat: add voiceOffset (2)

This commit is contained in:
Felix Roos 2023-07-09 16:53:41 +02:00
parent d1fe50e271
commit 35f5a5d11a
3 changed files with 4 additions and 2 deletions

View file

@ -139,13 +139,13 @@ export const rootNotes = register('rootNotes', function (octave, pat) {
export const voicing = register('voicing', function (dictionary, pat) {
return pat
.fmap((value) => {
let { voiceMax: max, voiceBelow: below, chord, ...rest } = value;
let { voiceMax: max, voiceBelow: below, voiceOffset: offset, chord, ...rest } = value;
let top = max || below;
top = top?.note || top || 'c5';
if (typeof dictionary === 'string') {
dictionary = voicingRegistry[dictionary]?.dictionary;
}
let notes = voiceBelow(top, chord, dictionary);
let notes = voiceBelow(top, chord, dictionary, offset);
if (below) {
notes = notes.filter((n) => note2midi(n) !== note2midi(top));
}