From b14e5577b40f04800b038bc328eaf7b1eec4f434 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Sun, 31 Dec 2023 12:19:05 +0100 Subject: [PATCH] breaking: use ireal as default voicing dictionary + this has the big benefit that all chord symbols work by default without the need to specify a dict --- packages/tonal/voicings.mjs | 7 +-- test/__snapshots__/examples.test.mjs.snap | 65 ++++++----------------- 2 files changed, 18 insertions(+), 54 deletions(-) diff --git a/packages/tonal/voicings.mjs b/packages/tonal/voicings.mjs index f93a54d0..7278bc78 100644 --- a/packages/tonal/voicings.mjs +++ b/packages/tonal/voicings.mjs @@ -184,19 +184,16 @@ export const rootNotes = register('rootNotes', function (octave, pat) { * If you pass a pattern of strings to voicing, they will be interpreted as chords. * * @name voicing - * @param {string} dictionary which voicing dictionary to use. * @returns Pattern * @example - * voicing("") - * @example - * n("0 1 2 3 4 5 6 7").chord("").voicing() + * n("0 1 2 3").chord("").voicing() */ export const voicing = register('voicing', function (pat) { return pat .fmap((value) => { // destructure voicing controls out value = typeof value === 'string' ? { chord: value } : value; - let { dictionary = 'default', chord, anchor, offset, mode, n, octaves, ...rest } = value; + let { dictionary = 'ireal', chord, anchor, offset, mode, n, octaves, ...rest } = value; dictionary = typeof dictionary === 'string' ? voicingRegistry[dictionary] : { dictionary, mode: 'below', anchor: 'c5' }; try { diff --git a/test/__snapshots__/examples.test.mjs.snap b/test/__snapshots__/examples.test.mjs.snap index 3d23c106..536f6ff1 100644 --- a/test/__snapshots__/examples.test.mjs.snap +++ b/test/__snapshots__/examples.test.mjs.snap @@ -5365,55 +5365,22 @@ exports[`runs examples > example "vibmod" example index 1 1`] = ` exports[`runs examples > example "voicing" example index 0 1`] = ` [ - "[ 0/1 → 1/1 | note:E4 ]", - "[ 0/1 → 1/1 | note:G4 ]", - "[ 0/1 → 1/1 | note:C5 ]", - "[ 1/1 → 2/1 | note:E4 ]", - "[ 1/1 → 2/1 | note:A4 ]", - "[ 1/1 → 2/1 | note:C5 ]", - "[ 2/1 → 3/1 | note:F4 ]", - "[ 2/1 → 3/1 | note:A4 ]", - "[ 2/1 → 3/1 | note:C5 ]", - "[ 3/1 → 4/1 | note:D4 ]", - "[ 3/1 → 4/1 | note:G4 ]", - "[ 3/1 → 4/1 | note:B4 ]", -] -`; - -exports[`runs examples > example "voicing" example index 1 1`] = ` -[ - "[ 0/1 → 1/8 | note:64 ]", - "[ 1/8 → 1/4 | note:67 ]", - "[ 1/4 → 3/8 | note:72 ]", - "[ 3/8 → 1/2 | note:76 ]", - "[ 1/2 → 5/8 | note:79 ]", - "[ 5/8 → 3/4 | note:84 ]", - "[ 3/4 → 7/8 | note:88 ]", - "[ 7/8 → 1/1 | note:91 ]", - "[ 1/1 → 9/8 | note:64 ]", - "[ 9/8 → 5/4 | note:69 ]", - "[ 5/4 → 11/8 | note:72 ]", - "[ 11/8 → 3/2 | note:76 ]", - "[ 3/2 → 13/8 | note:81 ]", - "[ 13/8 → 7/4 | note:84 ]", - "[ 7/4 → 15/8 | note:88 ]", - "[ 15/8 → 2/1 | note:93 ]", - "[ 2/1 → 17/8 | note:65 ]", - "[ 17/8 → 9/4 | note:69 ]", - "[ 9/4 → 19/8 | note:72 ]", - "[ 19/8 → 5/2 | note:77 ]", - "[ 5/2 → 21/8 | note:81 ]", - "[ 21/8 → 11/4 | note:84 ]", - "[ 11/4 → 23/8 | note:89 ]", - "[ 23/8 → 3/1 | note:93 ]", - "[ 3/1 → 25/8 | note:62 ]", - "[ 25/8 → 13/4 | note:67 ]", - "[ 13/4 → 27/8 | note:71 ]", - "[ 27/8 → 7/2 | note:74 ]", - "[ 7/2 → 29/8 | note:79 ]", - "[ 29/8 → 15/4 | note:83 ]", - "[ 15/4 → 31/8 | note:86 ]", - "[ 31/8 → 4/1 | note:91 ]", + "[ 0/1 → 1/4 | note:52 ]", + "[ 1/4 → 1/2 | note:60 ]", + "[ 1/2 → 3/4 | note:64 ]", + "[ 3/4 → 1/1 | note:67 ]", + "[ 1/1 → 5/4 | note:57 ]", + "[ 5/4 → 3/2 | note:60 ]", + "[ 3/2 → 7/4 | note:64 ]", + "[ 7/4 → 2/1 | note:69 ]", + "[ 2/1 → 9/4 | note:53 ]", + "[ 9/4 → 5/2 | note:60 ]", + "[ 5/2 → 11/4 | note:65 ]", + "[ 11/4 → 3/1 | note:69 ]", + "[ 3/1 → 13/4 | note:55 ]", + "[ 13/4 → 7/2 | note:62 ]", + "[ 7/2 → 15/4 | note:67 ]", + "[ 15/4 → 4/1 | note:71 ]", ] `;