mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-27 21:48:27 +00:00
fix: graceful handling of invalid chord symbols
This commit is contained in:
parent
c44f202c44
commit
4121ac91ee
@ -4,7 +4,7 @@ Copyright (C) 2022 Strudel contributors - see <https://github.com/tidalcycles/st
|
|||||||
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { stack, register } from '@strudel.cycles/core';
|
import { stack, register, silence, logger } from '@strudel.cycles/core';
|
||||||
import { renderVoicing } from './tonleiter.mjs';
|
import { renderVoicing } from './tonleiter.mjs';
|
||||||
import _voicings from 'chord-voicings';
|
import _voicings from 'chord-voicings';
|
||||||
import { complex, simple } from './ireal.mjs';
|
import { complex, simple } from './ireal.mjs';
|
||||||
@ -199,11 +199,15 @@ export const voicing = register('voicing', function (pat) {
|
|||||||
let { dictionary = 'default', chord, anchor, offset, mode, n, octaves, ...rest } = value;
|
let { dictionary = 'default', chord, anchor, offset, mode, n, octaves, ...rest } = value;
|
||||||
dictionary =
|
dictionary =
|
||||||
typeof dictionary === 'string' ? voicingRegistry[dictionary] : { dictionary, mode: 'below', anchor: 'c5' };
|
typeof dictionary === 'string' ? voicingRegistry[dictionary] : { dictionary, mode: 'below', anchor: 'c5' };
|
||||||
let notes = renderVoicing({ ...dictionary, chord, anchor, offset, mode, n, octaves });
|
try {
|
||||||
|
let notes = renderVoicing({ ...dictionary, chord, anchor, offset, mode, n, octaves });
|
||||||
return stack(...notes)
|
return stack(...notes)
|
||||||
.note()
|
.note()
|
||||||
.set(rest); // rest does not include voicing controls anymore!
|
.set(rest); // rest does not include voicing controls anymore!
|
||||||
|
} catch (err) {
|
||||||
|
logger(`[voicing]: unknown chord "${chord}"`);
|
||||||
|
return silence;
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.outerJoin();
|
.outerJoin();
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user