/ music / double-pendulum
Sign in
music / double-pendulum
double-pendulum / src / compositions / c04-descent / layout.ts
29 lines · 1.2 KBCodeBlameHistory
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: 0 extension notes, 1 clicks, 2 height notes — each its own instrument and effects. */
6export const EXT = 0, CLICK = 1, HEIGHT = 2;
8export function layout(P: Params): Layout {
9 const custom = P.modalCustom as string;
10 const ext = soundOf(P.extInstrument as string, custom, { voices: Math.round(P.maxOverlap as number) });
11 const click = soundOf(P.clickInstrument as string, custom);
12 const height = soundOf(P.heightInstrument as string, custom);
13 return {
14 stems: [
15 { kind: "synth", sound: ext, output: EXT },
16 { kind: "synth", sound: click, output: CLICK },
17 { kind: "synth", sound: height, output: HEIGHT },
18 ],
19 outputs: [
20 { effects: "own", sound: ext, level: (Q) => Q.notesLevel as number },
21 { effects: "own", sound: click, level: (Q) => Q.clickLevel as number },
22 { effects: "own", sound: height, level: (Q) => Q.heightLevel as number },
23 ],
24 };
27export function estimateLength(P: Params): number {
28 return (P.freeTime as number) + (P.dampTime as number) + 3 + (P.finalHold as number) + (P.finalFade as number) + 0.3;
↑↓ move↵openescclose