// spine.mjs: the film's clock. Every other file reads its times from here.
export const FPS = 24, SR = 48000, DUR = 180;
export const TOTAL_FRAMES = FPS * DUR;

export const TITLE = [0, 12];
export const NOTES = [12, 60];            // twelve modes, four seconds each
export const NOTE_LEN = 4;
export const NOTES_CODA = [60, 64];
export const STRIKE = [64, 114];
export const HEAT = [114, 152];
export const RECIPE = [152, 166];
export const CLOSE = [166, 180];

export const F1 = 130.8128;               // C3: the lowest mode sounds here, the rest keep their ratios
export const K_AUDIO = 30;                 // modes in the soundtrack
export const DAMP = 2.4;                   // a mode at F1 rings with time constant 2.4 s ...
export const dampOf = (f) => DAMP * Math.sqrt(F1 / f);   // ... higher ones shorter, THE SAME rule for both drums

// strikes in the whole-head section: which ear(s), and when
export const STRIKES = [
  { t: 66.0, ears: 'L' }, { t: 71.5, ears: 'R' },
  { t: 77.0, ears: 'L' }, { t: 82.5, ears: 'R' },
  { t: 88.0, ears: 'LR' }, { t: 94.0, ears: 'L' }, { t: 99.5, ears: 'R' }, { t: 105.0, ears: 'LR' },
];
export const STRIKE_WINDOW = 4.5;          // the detector reads this long after a solo strike

// heat time τ (the drum's own units) as a function of film time in the heat section
export const TAU_END = 0.6;
export const tauAt = (t) => { const x = Math.min(1, Math.max(0, (t - HEAT[0]) / (HEAT[1] - 4 - HEAT[0]))); return TAU_END * x * x; };
export const POSTER_FRAME = Math.round(80 * FPS);
