75ca48aOverhaul playback: background-computed, buffered, one clockJeremy Magland 1import type { Params } from "../../core/params.ts";
2import { soundOf } from "../../instruments/sounds.ts";
3import type { Layout } from "../../stream/layout.ts";
5/** Stems: two copies of the instrument, panned apart: 0 notes moving left, 1 moving right. */
6export const LEFT = 0, RIGHT = 1;
8export function layout(P: Params): Layout {
9 const sound = soundOf(P.instrument as string, P.modalCustom as string);
10 return {
11 stems: [
12 { kind: "synth", sound, output: LEFT },
13 { kind: "synth", sound, output: RIGHT },
14 ],
15 outputs: [
16 { effects: "shared", sound, level: (Q) => Q.notesLevel as number, pan: (Q) => -(Q.directionPan as number) },
17 { effects: "shared", sound, level: (Q) => Q.notesLevel as number, pan: (Q) => Q.directionPan as number },
18 ],
19 reverbTime: P.reverbTime as number,
20 };
21}
23export function estimateLength(P: Params): number {
24 return (P.freeTime as number) + (P.dampTime as number) + 1 + (P.finalHold as number) + (P.finalFade as number) + 0.3;
25}