feat: support strings in voicing function
This commit is contained in:
parent
e53098b179
commit
0fd9ac6da3
1 changed files with 4 additions and 2 deletions
|
|
@ -178,13 +178,14 @@ export const rootNotes = register('rootNotes', function (octave, pat) {
|
||||||
* - `offset`: whole number that shifts the voicing up or down to the next voicing
|
* - `offset`: whole number that shifts the voicing up or down to the next voicing
|
||||||
* - `n`: if set, the voicing is played like a scale. Overshooting numbers will be octaved
|
* - `n`: if set, the voicing is played like a scale. Overshooting numbers will be octaved
|
||||||
*
|
*
|
||||||
* All of the above controls are optional, except `chord`
|
* All of the above controls are optional, except `chord`.
|
||||||
|
* If you pass a pattern of strings to voicing, they will be interpreted as chords.
|
||||||
*
|
*
|
||||||
* @name voicing
|
* @name voicing
|
||||||
* @param {string} dictionary which voicing dictionary to use.
|
* @param {string} dictionary which voicing dictionary to use.
|
||||||
* @returns Pattern
|
* @returns Pattern
|
||||||
* @example
|
* @example
|
||||||
* chord("<C Am F G>").voicing()
|
* voicing("<C Am F G>")
|
||||||
* @example
|
* @example
|
||||||
* n("0 1 2 3 4 5 6 7").chord("<C Am F G>").voicing()
|
* n("0 1 2 3 4 5 6 7").chord("<C Am F G>").voicing()
|
||||||
*/
|
*/
|
||||||
|
|
@ -192,6 +193,7 @@ export const voicing = register('voicing', function (pat) {
|
||||||
return pat
|
return pat
|
||||||
.fmap((value) => {
|
.fmap((value) => {
|
||||||
// destructure voicing controls out
|
// destructure voicing controls out
|
||||||
|
value = typeof value === 'string' ? { chord: value } : value;
|
||||||
let { dictionary = 'default', chord, anchor, offset, mode, n, ...rest } = value;
|
let { dictionary = 'default', chord, anchor, offset, mode, n, ...rest } = value;
|
||||||
dictionary =
|
dictionary =
|
||||||
typeof dictionary === 'string' ? voicingRegistry[dictionary] : { dictionary, mode: 'below', anchor: 'c5' };
|
typeof dictionary === 'string' ? voicingRegistry[dictionary] : { dictionary, mode: 'below', anchor: 'c5' };
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue