diff --git a/packages/tonal/tonleiter.mjs b/packages/tonal/tonleiter.mjs index 00b1fe6e..c337a2b3 100644 --- a/packages/tonal/tonleiter.mjs +++ b/packages/tonal/tonleiter.mjs @@ -90,7 +90,7 @@ let modeTarget = { above: (v) => v[0], }; -export function renderVoicing({ chord, dictionary, offset = 0, n, mode = 'above', anchor = 'c4' }) { +export function renderVoicing({ chord, dictionary, offset = 0, n, mode = 'below', anchor = 'c5' }) { const [root, symbol] = tokenizeChord(chord); const rootChroma = pc2chroma(root); anchor = anchor?.note || anchor; diff --git a/packages/tonal/voicings.mjs b/packages/tonal/voicings.mjs index 1713dddf..86e52b41 100644 --- a/packages/tonal/voicings.mjs +++ b/packages/tonal/voicings.mjs @@ -51,9 +51,9 @@ const triads = { }; export const voicingRegistry = { - lefthand: { dictionary: lefthand, range: ['F3', 'A4'] }, - triads: { dictionary: triads }, - guidetones: { dictionary: guidetones }, + lefthand: { dictionary: lefthand, range: ['F3', 'A4'], mode: 'below', anchor: 'c5' }, + triads: { dictionary: triads, mode: 'below', anchor: 'c5' }, + guidetones: { dictionary: guidetones, mode: 'above', anchor: 'g4' }, }; export const setVoicingRange = (name, range) => addVoicings(name, voicingRegistry[name].dictionary, range); @@ -78,8 +78,8 @@ export const setVoicingRange = (name, range) => addVoicings(name, voicingRegistr * }, ['C3', 'C6']) * "".voicings('cookie').note() */ -export const addVoicings = (name, dictionary, range = ['F3', 'A4']) => { - Object.assign(voicingRegistry, { [name]: { dictionary, range } }); +export const addVoicings = (name, dictionary, options = {}) => { + Object.assign(voicingRegistry, { [name]: { dictionary, ...options } }); }; const getVoicing = (chord, dictionaryName, lastVoicing) => { @@ -141,9 +141,9 @@ export const voicing = register('voicing', function (pat) { .fmap((value) => { let { dictionary, ...rest } = value; if (typeof dictionary === 'string') { - dictionary = voicingRegistry[dictionary]?.dictionary; + dictionary = voicingRegistry[dictionary]; } - let notes = renderVoicing({ ...value, dictionary }); + let notes = renderVoicing({ ...dictionary, ...rest }); return stack(...notes) .note()