mirror of
https://github.com/eliasstepanik/strudel.git
synced 2026-01-11 21:58:37 +00:00
fix: duck mode with n
+ detect chord obj in rootNotes
This commit is contained in:
parent
0fd9ac6da3
commit
bbb29ebd7c
@ -119,12 +119,13 @@ export function renderVoicing({ chord, dictionary, offset = 0, n, mode = 'below'
|
||||
|
||||
const voicingMidi = voicing.map((v) => anchorMidi - targetStep + v);
|
||||
let notes = voicingMidi.map((n) => midi2note(n));
|
||||
|
||||
if (mode === 'duck') {
|
||||
notes = notes.filter((_, i) => voicingMidi[i] !== noteToMidi(anchor));
|
||||
}
|
||||
if (n !== undefined) {
|
||||
return [scaleStep(notes, n)];
|
||||
}
|
||||
if (mode === 'duck') {
|
||||
notes = notes.filter((n) => x2midi(n) !== noteToMidi(anchor));
|
||||
}
|
||||
return notes;
|
||||
}
|
||||
|
||||
|
||||
@ -159,9 +159,10 @@ export const voicings = register('voicings', function (dictionary, pat) {
|
||||
*/
|
||||
export const rootNotes = register('rootNotes', function (octave, pat) {
|
||||
return pat.fmap((value) => {
|
||||
value = value.chord || value;
|
||||
const root = value.match(/^([a-gA-G][b#]?).*$/)[1];
|
||||
return root + octave;
|
||||
const chord = value.chord || value;
|
||||
const root = chord.match(/^([a-gA-G][b#]?).*$/)[1];
|
||||
const note = root + octave;
|
||||
return value.chord ? { note } : note;
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user