From a0ae8f4a07b6b38d8ccf7a57d7a9307bb5038419 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Sun, 11 Dec 2022 13:28:24 +0100 Subject: [PATCH] "fix" voice leading --- packages/tonal/voicings.mjs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/tonal/voicings.mjs b/packages/tonal/voicings.mjs index 6dc03a82..e0bb0543 100644 --- a/packages/tonal/voicings.mjs +++ b/packages/tonal/voicings.mjs @@ -61,17 +61,17 @@ const getVoicing = (chord, dictionaryName, lastVoicing) => { * stack("".voicings('lefthand'), "").note() */ +let lastVoicing; // this now has to be global until another solution is found :-/ +// it used to be local to the voicings function at evaluation time +// but since register will patternify by default, means that +// the function is called over and over again, resetting the lastVoicing variables export const voicings = register('voicings', function (dictionary, pat) { - let lastVoicing; return pat .fmap((value) => { lastVoicing = getVoicing(value, dictionary, lastVoicing); return stack(...lastVoicing); }) .outerJoin(); - /* .withContext(() => ({ - locations: event.context.locations || [], - })); */ }); /**