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
This commit is contained in:
Felix Roos 2023-12-31 12:19:05 +01:00
parent 4121ac91ee
commit b14e5577b4
2 changed files with 18 additions and 54 deletions

View File

@ -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("<C Am F G>")
* @example
* n("0 1 2 3 4 5 6 7").chord("<C Am F G>").voicing()
* n("0 1 2 3").chord("<C Am F G>").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 {

View File

@ -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 ]",
]
`;