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 || [], - })); */ }); /**