mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-19 09:38:38 +00:00
feat: add voiceOffset (2)
This commit is contained in:
parent
d1fe50e271
commit
35f5a5d11a
@ -578,6 +578,7 @@ const generic_params = [
|
|||||||
['chord'], // https://github.com/tidalcycles/strudel/issues/506
|
['chord'], // https://github.com/tidalcycles/strudel/issues/506
|
||||||
['voiceBelow', 'voicebelow'], // https://github.com/tidalcycles/strudel/issues/506
|
['voiceBelow', 'voicebelow'], // https://github.com/tidalcycles/strudel/issues/506
|
||||||
['voiceMax', 'voicemax'], // https://github.com/tidalcycles/strudel/issues/506
|
['voiceMax', 'voicemax'], // https://github.com/tidalcycles/strudel/issues/506
|
||||||
|
['voiceOffset', 'voiceoffset'], // https://github.com/tidalcycles/strudel/issues/506
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the level of reverb.
|
* Sets the level of reverb.
|
||||||
|
|||||||
@ -113,5 +113,6 @@ describe('tonleiter', () => {
|
|||||||
expect(voiceBelow('D5', 'Cm7', voicingDictionary)).toEqual(['Eb4', 'G4', 'Bb4', 'D5']);
|
expect(voiceBelow('D5', 'Cm7', voicingDictionary)).toEqual(['Eb4', 'G4', 'Bb4', 'D5']);
|
||||||
expect(voiceBelow('G5', 'Cm7', voicingDictionary)).toEqual(['Bb4', 'D5', 'Eb5', 'G5']);
|
expect(voiceBelow('G5', 'Cm7', voicingDictionary)).toEqual(['Bb4', 'D5', 'Eb5', 'G5']);
|
||||||
// expect(voiceBelow('G4', 'Cm7', voicingDictionary)).toEqual(['Bb3', 'D4', 'Eb4', 'G4']);
|
// expect(voiceBelow('G4', 'Cm7', voicingDictionary)).toEqual(['Bb3', 'D4', 'Eb4', 'G4']);
|
||||||
|
// TODO: test with offset
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -139,13 +139,13 @@ export const rootNotes = register('rootNotes', function (octave, pat) {
|
|||||||
export const voicing = register('voicing', function (dictionary, pat) {
|
export const voicing = register('voicing', function (dictionary, pat) {
|
||||||
return pat
|
return pat
|
||||||
.fmap((value) => {
|
.fmap((value) => {
|
||||||
let { voiceMax: max, voiceBelow: below, chord, ...rest } = value;
|
let { voiceMax: max, voiceBelow: below, voiceOffset: offset, chord, ...rest } = value;
|
||||||
let top = max || below;
|
let top = max || below;
|
||||||
top = top?.note || top || 'c5';
|
top = top?.note || top || 'c5';
|
||||||
if (typeof dictionary === 'string') {
|
if (typeof dictionary === 'string') {
|
||||||
dictionary = voicingRegistry[dictionary]?.dictionary;
|
dictionary = voicingRegistry[dictionary]?.dictionary;
|
||||||
}
|
}
|
||||||
let notes = voiceBelow(top, chord, dictionary);
|
let notes = voiceBelow(top, chord, dictionary, offset);
|
||||||
if (below) {
|
if (below) {
|
||||||
notes = notes.filter((n) => note2midi(n) !== note2midi(top));
|
notes = notes.filter((n) => note2midi(n) !== note2midi(top));
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user