import type { Params } from "../../core/params.ts"; import { soundOf } from "../../instruments/sounds.ts"; import type { Layout } from "../../stream/layout.ts"; /** Stems: 0 extension notes, 1 clicks, 2 height notes — each its own instrument and effects. */ export const EXT = 0, CLICK = 1, HEIGHT = 2; export function layout(P: Params): Layout { const custom = P.modalCustom as string; const ext = soundOf(P.extInstrument as string, custom, { voices: Math.round(P.maxOverlap as number) }); const click = soundOf(P.clickInstrument as string, custom); const height = soundOf(P.heightInstrument as string, custom); return { stems: [ { kind: "synth", sound: ext, output: EXT }, { kind: "synth", sound: click, output: CLICK }, { kind: "synth", sound: height, output: HEIGHT }, ], outputs: [ { effects: "own", sound: ext, level: (Q) => Q.notesLevel as number }, { effects: "own", sound: click, level: (Q) => Q.clickLevel as number }, { effects: "own", sound: height, level: (Q) => Q.heightLevel as number }, ], }; } export function estimateLength(P: Params): number { return (P.freeTime as number) + (P.dampTime as number) + 3 + (P.finalHold as number) + (P.finalFade as number) + 0.3; }