/ music / double-pendulum
Sign in
music / double-pendulum
double-pendulum / src / compositions / c01-poincare / layout.ts
25 lines · 921 BCodeBlameHistory
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 the crossing notes, 1 the hum. */
6export const NOTES = 0, HUM = 1;
8export function layout(P: Params): Layout {
9 const notes = soundOf(P.noteInstrument as string, P.modalCustom as string);
10 const hum = soundOf(P.humInstrument as string, P.humCustom as string, { voices: 1 });
11 return {
12 stems: [
13 { kind: "synth", sound: notes, output: NOTES },
14 { kind: "synth", sound: hum, output: HUM },
15 ],
16 outputs: [
17 { effects: "own", sound: notes, level: (Q) => Q.notesLevel as number },
18 { effects: "own", sound: hum, level: (Q) => Q.humLevel as number },
19 ],
20 };
23export function estimateLength(P: Params): number {
24 return (P.duration as number) + 0.5 + (P.finalHold as number) + (P.finalFade as number) + 0.3;
↑↓ move↵openescclose