import type { Params } from "../../core/params.ts"; import { soundOf } from "../../instruments/sounds.ts"; import type { Layout } from "../../stream/layout.ts"; /** Stems: two copies of the instrument, panned apart: 0 notes moving left, 1 moving right. */ export const LEFT = 0, RIGHT = 1; export function layout(P: Params): Layout { const sound = soundOf(P.instrument as string, P.modalCustom as string); return { stems: [ { kind: "synth", sound, output: LEFT }, { kind: "synth", sound, output: RIGHT }, ], outputs: [ { effects: "shared", sound, level: (Q) => Q.notesLevel as number, pan: (Q) => -(Q.directionPan as number) }, { effects: "shared", sound, level: (Q) => Q.notesLevel as number, pan: (Q) => Q.directionPan as number }, ], reverbTime: P.reverbTime as number, }; } export function estimateLength(P: Params): number { return (P.freeTime as number) + (P.dampTime as number) + 1 + (P.finalHold as number) + (P.finalFade as number) + 0.3; }