INNER CODE UNIT · TypeScript
makeRiff
scribbletune/scribbletune · src/cli.ts:328
const makeRiff = (parsed: ParsedOptions): NoteObject[] => {
const [root, mode, pattern, subdiv] = parsed.positionals;
const style = parsed.style;
if (!root || !mode || !pattern || !subdiv) {
throw new TypeError('riff requires: <root> <mode> <pattern> <subdiv>');
}
const riffScale = scale(`${root} ${mode}`);
// Style defines sections: each style letter gets one full pattern block.
// Example: style AABC + pattern x-x[xx] => 4 blocks in A,A,B,C order.
if (style?.length) {
const sectionPattern = expandPatternSyntax(pattern);
const letters = style.toUpperCase().split('');
const sectionCache: Record<string, NoteObject[]> = {};
const combined: NoteObject[] = [];
const clipParams = {
...baseClipParams(parsed),
subdiv: parsed.subdiv || subdiv,