More clean up

This commit is contained in:
Andras Schmelczer 2026-05-20 21:03:41 +01:00
commit f03da42b5e
43 changed files with 818 additions and 1076 deletions

View file

@ -4,7 +4,7 @@ export const DISABLED_FLAG_VALUE = '0';
export const UNIT_INTERVAL_INPUT_MIN = '0'; export const UNIT_INTERVAL_INPUT_MIN = '0';
export const UNIT_INTERVAL_INPUT_MAX = '1'; export const UNIT_INTERVAL_INPUT_MAX = '1';
export const DEFAULT_AUDIO_VOLUME = 0.42; export const DEFAULT_AUDIO_VOLUME = 0.5;
export const APP_STORAGE_KEYS = { export const APP_STORAGE_KEYS = {
audioMuted: 'fleeting-garden:audio-muted', audioMuted: 'fleeting-garden:audio-muted',

View file

@ -1,3 +1,4 @@
import { DEFAULT_AUDIO_VOLUME } from '../app-constants';
import type { PianoNoteRole } from './garden-audio-types'; import type { PianoNoteRole } from './garden-audio-types';
type GardenAudioChordQuality = 'major' | 'minor'; type GardenAudioChordQuality = 'major' | 'minor';
@ -7,81 +8,106 @@ export interface GardenAudioChord {
quality: GardenAudioChordQuality; quality: GardenAudioChordQuality;
} }
export interface GardenAudioVibeProfile { export interface GardenAudioVibeSettings {
idleIntensity: number;
bpm: number;
rampUpIntensity: number;
rampUpTime: number;
noteLength: number;
notePitchOffset: number;
brightness: number;
}
export interface GardenAudioVibeProfile extends GardenAudioVibeSettings {
rootMidi: number; rootMidi: number;
scale: Array<number>; scale: Array<number>;
brightness: number;
delayTimeMultiplier: number;
progression: Array<GardenAudioChord>; progression: Array<GardenAudioChord>;
} }
export interface GardenAudioConfig { export const createGardenAudioConfig = () => ({
masterVolume: number; masterVolume: DEFAULT_AUDIO_VOLUME,
fadeInSeconds: number; fadeInSeconds: 0.45,
updateRampSeconds: number; updateRampSeconds: 0.08,
delay: { delay: {
timeSeconds: number; timeSeconds: 0.46,
feedback: number; feedback: 0.12,
wetGain: number; wetGain: 0.044,
erasingActivity: number; erasingActivity: 0.12,
activityFeedbackWeight: number; activityFeedbackWeight: 0.08,
feedbackMax: number; feedbackMax: 0.32,
feedbackMin: number; feedbackMin: 0.04,
outputActivityWeight: number; outputActivityWeight: 0.5,
outputBase: number; outputBase: 0.65,
outputActivityDuck: number; outputActivityDuck: 0.28,
timeRampSeconds: number; timeRampSeconds: 0.12,
}; },
piano: { piano: {
maxVoices: number; maxVoices: 24,
gain: number; gain: 0.48,
sustainSeconds: number; sustainSeconds: 0.42,
sustainLevel: number; sustainLevel: 0.32,
releaseSeconds: number; releaseSeconds: 0.24,
lowpassHz: number; lowpassHz: 7600,
gainAttackSeconds: number; gainAttackSeconds: 0.006,
lowpassMaxHz: number; lowpassMaxHz: 12000,
lowpassMinHz: number; lowpassMinHz: 1400,
sustainBase: number; sustainBase: 0.45,
sustainVelocityRange: number; sustainVelocityRange: 0.55,
}; },
rhythm: { rhythm: {
bpm: number; idleIntensity: 0.08,
stepsPerBeat: number; bpm: 74,
stepsPerBar: number; stepsPerBeat: 4,
sparseActivity: number; stepsPerBar: 16,
}; sparseActivity: 0.055,
},
eraser: { eraser: {
minIntervalSeconds: number; minIntervalSeconds: 0.12,
noiseGain: number; noiseGain: 0.028,
filterMinHz: number; filterMinHz: 650,
filterMaxHz: number; filterMaxHz: 3600,
durationSeconds: number; durationSeconds: 0.08,
pan: number; pan: 0,
pianoActivity: number; pianoActivity: 0,
}; },
energy: { energy: {
attackSeconds: number; attackSeconds: 0.08,
decaySeconds: number; decaySeconds: 0.9,
immediateActivityScale: number; immediateActivityScale: 0.85,
releaseSeconds: number; releaseSeconds: 1.15,
strokeDecaySeconds: number; strokeDecaySeconds: 0.32,
}; },
graph: { graph: {
pianoBusGains: Record<PianoNoteRole, number>; pianoBusGains: {
pianoBusActivityDucking: Record<PianoNoteRole, number>; pad: 0.86,
noiseBusGain: number; support: 0.94,
}; texture: 0.88,
gesture: 1,
brush: 0.9,
stinger: 0.92,
} satisfies Record<PianoNoteRole, number>,
pianoBusActivityDucking: {
pad: 0.42,
support: 0.18,
texture: -0.06,
gesture: 0,
brush: -0.08,
stinger: 0,
} satisfies Record<PianoNoteRole, number>,
noiseBusGain: 0.72,
},
input: { input: {
fullActivitySpeed: number; fullActivitySpeed: 0.86,
activityNoiseFloorSpeed: number; activityNoiseFloorSpeed: 0.025,
activityCurve: number; activityCurve: 0.74,
activitySoftCeiling: number; activitySoftCeiling: 0.96,
activityAttackSeconds: number; activityAttackSeconds: 0.055,
activityReleaseSeconds: number; activityReleaseSeconds: 0.2,
minAudibleDistance: number; minAudibleDistance: 0.0025,
manicActivityThreshold: number; manicActivityThreshold: 0.9,
manicReleaseThreshold: number; manicReleaseThreshold: 0.76,
maniaSmoothingSeconds: number; maniaSmoothingSeconds: 0.12,
}; },
} });
export type GardenAudioConfig = ReturnType<typeof createGardenAudioConfig>;

View file

@ -1,5 +1,5 @@
import { approach, clamp01 } from '../utils/math'; import { approach, clamp01 } from '../utils/math';
import type { GardenAudioConfig } from './garden-audio-config'; import type { GardenAudioConfig, GardenAudioVibeProfile } from './garden-audio-config';
export class GardenAudioEnergy { export class GardenAudioEnergy {
private isGestureActive = false; private isGestureActive = false;
@ -19,13 +19,10 @@ export class GardenAudioEnergy {
this.targetEnergy = 0; this.targetEnergy = 0;
} }
public recordStroke(strokeEnergy: number): void { public recordStroke(strokeEnergy: number, profile: GardenAudioVibeProfile): void {
this.targetEnergy = Math.max(this.targetEnergy, strokeEnergy); this.targetEnergy = Math.max(this.targetEnergy, strokeEnergy);
if (this.isGestureActive) { if (this.isGestureActive) {
this.energy = Math.max( this.energy = Math.max(this.energy, strokeEnergy * profile.rampUpIntensity);
this.energy,
strokeEnergy * this.config.energy.immediateActivityScale
);
} }
} }
@ -34,7 +31,7 @@ export class GardenAudioEnergy {
this.energy = 0; this.energy = 0;
} }
public update(now: number): void { public update(now: number, profile: GardenAudioVibeProfile): void {
if (this.lastEnergyUpdateAt <= 0) { if (this.lastEnergyUpdateAt <= 0) {
this.lastEnergyUpdateAt = now; this.lastEnergyUpdateAt = now;
return; return;
@ -51,7 +48,7 @@ export class GardenAudioEnergy {
if (!this.isGestureActive) { if (!this.isGestureActive) {
timeConstant = this.config.energy.releaseSeconds; timeConstant = this.config.energy.releaseSeconds;
} else if (target > this.energy) { } else if (target > this.energy) {
timeConstant = this.config.energy.attackSeconds; timeConstant = profile.rampUpTime;
} }
this.energy = approach(this.energy, target, elapsedSeconds, timeConstant); this.energy = approach(this.energy, target, elapsedSeconds, timeConstant);
} }

View file

@ -1,9 +1,17 @@
import { clamp } from '../utils/math'; import { clamp } from '../utils/math';
import type { GardenAudioConfig, GardenAudioVibeProfile } from './garden-audio-config'; import type { GardenAudioConfig } from './garden-audio-config';
import type { PianoNoteRole } from './garden-audio-types'; import type { PianoNoteRole } from './garden-audio-types';
type NavigatorWithAudioSession = Navigator & { type NavigatorWithAudioSession = Navigator & {
audioSession?: { type: 'auto' | 'playback' | 'ambient' | 'transient' | 'transient-solo' | 'play-and-record' }; audioSession?: {
type:
| 'auto'
| 'playback'
| 'ambient'
| 'transient'
| 'transient-solo'
| 'play-and-record';
};
}; };
const outputHighPassFrequencyHz = 45; const outputHighPassFrequencyHz = 45;
@ -113,19 +121,19 @@ export class GardenAudioGraph {
); );
} }
public applyDelayProfile(profile: GardenAudioVibeProfile): void { public applyDelayProfile(): void {
if (!this.context || !this.delayNode) { if (!this.context || !this.delayNode) {
return; return;
} }
this.delayNode.delayTime.setTargetAtTime( this.delayNode.delayTime.setTargetAtTime(
this.config.delay.timeSeconds * profile.delayTimeMultiplier, this.config.delay.timeSeconds,
this.context.currentTime, this.context.currentTime,
this.config.delay.timeRampSeconds this.config.delay.timeRampSeconds
); );
} }
public updateDelay(profile: GardenAudioVibeProfile, activity: number): void { public updateDelay(activity: number): void {
if (!this.context || !this.delayNode || !this.delayFeedback || !this.delayOutput) { if (!this.context || !this.delayNode || !this.delayFeedback || !this.delayOutput) {
return; return;
} }
@ -133,7 +141,7 @@ export class GardenAudioGraph {
const now = this.context.currentTime; const now = this.context.currentTime;
const normalizedActivity = clamp(activity, 0, 1); const normalizedActivity = clamp(activity, 0, 1);
this.delayNode.delayTime.setTargetAtTime( this.delayNode.delayTime.setTargetAtTime(
this.config.delay.timeSeconds * profile.delayTimeMultiplier, this.config.delay.timeSeconds,
now, now,
this.config.delay.timeRampSeconds this.config.delay.timeRampSeconds
); );

View file

@ -1,6 +1,34 @@
import type { VibePreset } from '../vibes'; import type { VibePreset } from '../vibes';
import type { GardenAudioVibeProfile } from './garden-audio-config'; import type { GardenAudioChord, GardenAudioVibeProfile } from './garden-audio-config';
export const PITCH_SEMITONES_PER_OCTAVE = 12; export const PITCH_SEMITONES_PER_OCTAVE = 12;
export const getVibeProfile = (vibe: VibePreset): GardenAudioVibeProfile => vibe.audio; const DEFAULT_PROGRESSION: ReadonlyArray<GardenAudioChord> = [
{ rootOffset: 0, quality: 'major' },
{ rootOffset: 9, quality: 'minor' },
{ rootOffset: 5, quality: 'major' },
{ rootOffset: 7, quality: 'major' },
];
const DEFAULT_ROOT_MIDI = 57;
const DEFAULT_SCALE: ReadonlyArray<number> = [0, 2, 4, 7, 9];
const profileCache = new WeakMap<VibePreset, GardenAudioVibeProfile>();
export const getVibeProfile = (vibe: VibePreset): GardenAudioVibeProfile => {
let profile = profileCache.get(vibe);
if (!profile) {
profile = {
...vibe.audio,
rootMidi: DEFAULT_ROOT_MIDI + vibe.audio.notePitchOffset,
scale: DEFAULT_SCALE as Array<number>,
progression: DEFAULT_PROGRESSION as Array<GardenAudioChord>,
};
profileCache.set(vibe, profile);
return profile;
}
Object.assign(profile, vibe.audio);
profile.rootMidi = DEFAULT_ROOT_MIDI + vibe.audio.notePitchOffset;
return profile;
};

View file

@ -32,6 +32,7 @@ export interface PianoNote {
role?: PianoNoteRole; role?: PianoNoteRole;
delaySend?: number; delaySend?: number;
lowpassHz?: number; lowpassHz?: number;
sustainSeconds?: number;
} }
export type PianoNoteRole = export type PianoNoteRole =

View file

@ -114,7 +114,7 @@ export class GardenAudio {
this.lifecycle = 'started'; this.lifecycle = 'started';
this.applyVibe(vibe); this.applyVibe(vibe);
this.pianoEngine.prime(context.currentTime); this.pianoEngine.prime(context.currentTime, getVibeProfile(vibe));
this.graph.setMasterGain(this.masterVolume, startupRampSeconds); this.graph.setMasterGain(this.masterVolume, startupRampSeconds);
const pianoLoad = this.piano.loadIfIdle(context); const pianoLoad = this.piano.loadIfIdle(context);
@ -122,7 +122,7 @@ export class GardenAudio {
void pianoLoad void pianoLoad
.then(() => { .then(() => {
if (this.graph.context === context && this.lifecycle !== 'destroyed') { if (this.graph.context === context && this.lifecycle !== 'destroyed') {
this.pianoEngine.cue(context.currentTime); this.pianoEngine.cue(context.currentTime, getVibeProfile(vibe));
} }
}) })
.catch((error) => { .catch((error) => {
@ -207,7 +207,8 @@ export class GardenAudio {
} }
this.applyVibe(snapshot.vibe); this.applyVibe(snapshot.vibe);
this.energy.update(context.currentTime); const profile = getVibeProfile(snapshot.vibe);
this.energy.update(context.currentTime, profile);
if (snapshot.isErasing) { if (snapshot.isErasing) {
this.energy.silence(); this.energy.silence();
@ -254,7 +255,8 @@ export class GardenAudio {
return; return;
} }
this.energy.recordStroke(strokeEnergy); const profile = getVibeProfile(stroke.vibe);
this.energy.recordStroke(strokeEnergy, profile);
this.pianoEngine.recordStroke({ this.pianoEngine.recordStroke({
vibe: stroke.vibe, vibe: stroke.vibe,
now, now,
@ -347,11 +349,10 @@ export class GardenAudio {
return; return;
} }
const profile = getVibeProfile(snapshot.vibe);
const activity = snapshot.isErasing const activity = snapshot.isErasing
? this.config.delay.erasingActivity ? this.config.delay.erasingActivity
: this.energy.getLevel(); : this.energy.getLevel();
this.graph.updateDelay(profile, activity); this.graph.updateDelay(activity);
} }
private applyVibe(vibe: VibePreset): void { private applyVibe(vibe: VibePreset): void {
@ -360,7 +361,8 @@ export class GardenAudio {
} }
this.currentVibeId = vibe.id; this.currentVibeId = vibe.id;
this.graph.applyDelayProfile(getVibeProfile(vibe)); const profile = getVibeProfile(vibe);
this.pianoEngine.cue(this.graph.context.currentTime); this.graph.applyDelayProfile();
this.pianoEngine.cue(this.graph.context.currentTime, profile);
} }
} }

View file

@ -37,10 +37,7 @@ const getChordIntervals = (
: chordVoicings.minorClosed; : chordVoicings.minorClosed;
}; };
const degreeToSemitone = ( const degreeToSemitone = (profile: GardenAudioVibeProfile, degree: number): number => {
profile: GardenAudioVibeProfile,
degree: number
): number => {
const scaleIndex = const scaleIndex =
((degree % profile.scale.length) + profile.scale.length) % profile.scale.length; ((degree % profile.scale.length) + profile.scale.length) % profile.scale.length;
const octave = Math.floor(degree / profile.scale.length); const octave = Math.floor(degree / profile.scale.length);
@ -96,6 +93,7 @@ interface BrushPhraseLayer {
export class GenerativePianoEngine { export class GenerativePianoEngine {
private nextBeatStep: number | null = null; private nextBeatStep: number | null = null;
private timelineStartedAt: number | null = null; private timelineStartedAt: number | null = null;
private activeProfile: GardenAudioVibeProfile | null = null;
private isWaitingForGestureAccent = false; private isWaitingForGestureAccent = false;
private lastGestureAccentAt = Number.NEGATIVE_INFINITY; private lastGestureAccentAt = Number.NEGATIVE_INFINITY;
private lastStrokeAccentStep = Number.NEGATIVE_INFINITY; private lastStrokeAccentStep = Number.NEGATIVE_INFINITY;
@ -124,13 +122,17 @@ export class GenerativePianoEngine {
return generativePianoTuning; return generativePianoTuning;
} }
public prime(now: number): void { public prime(now: number, profile: GardenAudioVibeProfile): void {
this.activeProfile = profile;
this.timelineStartedAt ??= now; this.timelineStartedAt ??= now;
this.nextBeatStep ??= 0; this.nextBeatStep ??= 0;
this.nextBrushStreamStep ??= 0; this.nextBrushStreamStep ??= 0;
} }
public cue(now: number): void { public cue(now: number, profile?: GardenAudioVibeProfile): void {
if (profile) {
this.activeProfile = profile;
}
this.nextBeatStep = 0; this.nextBeatStep = 0;
this.timelineStartedAt = now; this.timelineStartedAt = now;
this.nextBrushStreamStep = 0; this.nextBrushStreamStep = 0;
@ -148,10 +150,9 @@ export class GenerativePianoEngine {
} }
public release(vibe: VibePreset, now: number): number { public release(vibe: VibePreset, now: number): number {
this.prime(now);
this.isWaitingForGestureAccent = false;
const profile = getVibeProfile(vibe); const profile = getVibeProfile(vibe);
this.prime(now, profile);
this.isWaitingForGestureAccent = false;
const releaseStep = this.getReleaseResolutionStep(now); const releaseStep = this.getReleaseResolutionStep(now);
const releaseStart = Math.max(now, this.getTimeForStep(releaseStep)); const releaseStart = Math.max(now, this.getTimeForStep(releaseStep));
@ -198,7 +199,8 @@ export class GenerativePianoEngine {
activity, activity,
maniaAmount = 0, maniaAmount = 0,
}: StrokeAccentRequest): void { }: StrokeAccentRequest): void {
this.prime(now); const profile = getVibeProfile(vibe);
this.prime(now, profile);
const strength = clamp01(activity); const strength = clamp01(activity);
const normalizedManiaAmount = clamp01(maniaAmount); const normalizedManiaAmount = clamp01(maniaAmount);
const styleIndex = this.getStyleIndex(now); const styleIndex = this.getStyleIndex(now);
@ -242,14 +244,14 @@ export class GenerativePianoEngine {
activity, activity,
lookaheadSeconds = GENERATIVE_LOOKAHEAD_SECONDS, lookaheadSeconds = GENERATIVE_LOOKAHEAD_SECONDS,
}: RenderLookaheadRequest): void { }: RenderLookaheadRequest): void {
this.prime(now); const profile = getVibeProfile(vibe);
this.prime(now, profile);
this.skipLateBeats(now); this.skipLateBeats(now);
if (this.nextBeatStep === null) { if (this.nextBeatStep === null) {
return; return;
} }
const profile = getVibeProfile(vibe);
const lookaheadEnd = now + lookaheadSeconds; const lookaheadEnd = now + lookaheadSeconds;
while (this.getTimeForStep(this.nextBeatStep) <= lookaheadEnd) { while (this.getTimeForStep(this.nextBeatStep) <= lookaheadEnd) {
const beatIndex = this.getBeatIndexForStep(this.nextBeatStep); const beatIndex = this.getBeatIndexForStep(this.nextBeatStep);
@ -286,7 +288,7 @@ export class GenerativePianoEngine {
{ baseMidi: rootMidi, offsets }, { baseMidi: rootMidi, offsets },
this.generation.padRegisters[index] this.generation.padRegisters[index]
); );
this.playNote({ this.playProfileNote(profile, {
midi, midi,
velocity: stinger.velocities[index], velocity: stinger.velocities[index],
pan: stinger.pans[index], pan: stinger.pans[index],
@ -302,6 +304,7 @@ export class GenerativePianoEngine {
public reset(): void { public reset(): void {
this.nextBeatStep = null; this.nextBeatStep = null;
this.timelineStartedAt = null; this.timelineStartedAt = null;
this.activeProfile = null;
this.isWaitingForGestureAccent = false; this.isWaitingForGestureAccent = false;
this.lastGestureAccentAt = Number.NEGATIVE_INFINITY; this.lastGestureAccentAt = Number.NEGATIVE_INFINITY;
this.lastStrokeAccentStep = Number.NEGATIVE_INFINITY; this.lastStrokeAccentStep = Number.NEGATIVE_INFINITY;
@ -314,6 +317,13 @@ export class GenerativePianoEngine {
this.brushStreamNoteCountsByBar.clear(); this.brushStreamNoteCountsByBar.clear();
} }
private playProfileNote(profile: GardenAudioVibeProfile, note: PianoNote): void {
this.playNote({
...note,
sustainSeconds: profile.noteLength,
});
}
private renderBeat({ private renderBeat({
profile, profile,
beatIndex, beatIndex,
@ -398,7 +408,7 @@ export class GenerativePianoEngine {
false false
); );
this.lastPadMidiByVoice[index] = midi; this.lastPadMidiByVoice[index] = midi;
this.playNote({ this.playProfileNote(profile, {
midi, midi,
velocity: velocity:
velocity + expression * this.generation.padChord.expressionVelocityWeight, velocity + expression * this.generation.padChord.expressionVelocityWeight,
@ -433,8 +443,13 @@ export class GenerativePianoEngine {
offsetsByVoice.forEach((offsets, index) => { offsetsByVoice.forEach((offsets, index) => {
const register = this.generation.padRegisters[index]; const register = this.generation.padRegisters[index];
const midi = this.chooseMidi({ baseMidi: rootMidi, offsets }, register, null, false); const midi = this.chooseMidi(
this.playNote({ { baseMidi: rootMidi, offsets },
register,
null,
false
);
this.playProfileNote(profile, {
midi, midi,
velocity: release.velocities[index], velocity: release.velocities[index],
startTime: startTime + index * release.strumSeconds, startTime: startTime + index * release.strumSeconds,
@ -470,7 +485,7 @@ export class GenerativePianoEngine {
); );
this.lastMidiByStyle[styleIndex] = midi; this.lastMidiByStyle[styleIndex] = midi;
this.playNote({ this.playProfileNote(profile, {
midi, midi,
velocity: velocity:
(this.generation.supportNote.velocityBase + (this.generation.supportNote.velocityBase +
@ -516,7 +531,7 @@ export class GenerativePianoEngine {
); );
this.lastMidiByStyle[styleIndex] = midi; this.lastMidiByStyle[styleIndex] = midi;
this.playNote({ this.playProfileNote(profile, {
midi, midi,
velocity: velocity:
(this.generation.textureNote.velocityBase + (this.generation.textureNote.velocityBase +
@ -563,7 +578,7 @@ export class GenerativePianoEngine {
); );
this.lastMidiByStyle[styleIndex] = midi; this.lastMidiByStyle[styleIndex] = midi;
this.playNote({ this.playProfileNote(profile, {
midi, midi,
velocity: velocity:
(this.generation.gestureAccent.velocityBase + (this.generation.gestureAccent.velocityBase +
@ -608,7 +623,7 @@ export class GenerativePianoEngine {
this.lastMidiByStyle[styleIndex] = midi; this.lastMidiByStyle[styleIndex] = midi;
this.lastBrushStreamMidi = midi; this.lastBrushStreamMidi = midi;
this.playNote({ this.playProfileNote(profile, {
midi, midi,
velocity: velocity:
(this.generation.touchNote.velocityBase + (this.generation.touchNote.velocityBase +
@ -818,7 +833,7 @@ export class GenerativePianoEngine {
this.lastBrushStreamMidi = midi; this.lastBrushStreamMidi = midi;
this.lastMidiByStyle[styleIndex] = midi; this.lastMidiByStyle[styleIndex] = midi;
this.playNote({ this.playProfileNote(profile, {
midi, midi,
velocity: velocity:
(this.generation.brushStream.velocityBase + (this.generation.brushStream.velocityBase +
@ -851,7 +866,7 @@ export class GenerativePianoEngine {
this.generation.brushStreamEcho.maxMidi this.generation.brushStreamEcho.maxMidi
? midi + this.generation.brushStreamEcho.octaveSemitones ? midi + this.generation.brushStreamEcho.octaveSemitones
: midi - this.generation.brushStreamEcho.octaveSemitones; : midi - this.generation.brushStreamEcho.octaveSemitones;
this.playNote({ this.playProfileNote(profile, {
midi: echoMidi, midi: echoMidi,
velocity: velocity:
(this.generation.brushStreamEcho.velocityBase + (this.generation.brushStreamEcho.velocityBase +
@ -1159,14 +1174,18 @@ export class GenerativePianoEngine {
} }
private getExpression(activity: number): number { private getExpression(activity: number): number {
const liftedActivity = Math.max(
activity,
this.activeProfile?.idleIntensity ?? this.config.rhythm.idleIntensity
);
return clamp01( return clamp01(
(activity - this.config.rhythm.sparseActivity) / (liftedActivity - this.config.rhythm.sparseActivity) /
(1 - this.config.rhythm.sparseActivity) (1 - this.config.rhythm.sparseActivity)
); );
} }
private getBeatDurationSeconds(): number { private getBeatDurationSeconds(): number {
return 60 / this.config.rhythm.bpm; return 60 / (this.activeProfile?.bpm ?? this.config.rhythm.bpm);
} }
private getStepDurationSeconds(): number { private getStepDurationSeconds(): number {

View file

@ -72,6 +72,7 @@ export class PianoSampler {
role, role,
delaySend = 0, delaySend = 0,
lowpassHz = this.config.piano.lowpassHz, lowpassHz = this.config.piano.lowpassHz,
sustainSeconds: profileSustainSeconds = this.config.piano.sustainSeconds,
}: PianoNote): void { }: PianoNote): void {
const { context } = this.graph; const { context } = this.graph;
const eventBus = this.graph.getPianoBus(role); const eventBus = this.graph.getPianoBus(role);
@ -92,12 +93,11 @@ export class PianoSampler {
this.config.piano.gain * noteVelocity this.config.piano.gain * noteVelocity
); );
const sustainSeconds = const sustainSeconds =
this.config.piano.sustainSeconds * profileSustainSeconds *
(this.config.piano.sustainBase + (this.config.piano.sustainBase +
noteVelocity * this.config.piano.sustainVelocityRange); noteVelocity * this.config.piano.sustainVelocityRange);
const sustainAt = const sustainAt =
scheduledStart + scheduledStart + Math.max(pianoSamplerTuning.minDurationSeconds, durationSeconds);
Math.max(pianoSamplerTuning.minDurationSeconds, durationSeconds);
const releaseAt = sustainAt + sustainSeconds; const releaseAt = sustainAt + sustainSeconds;
const stopAt = releaseAt + this.config.piano.releaseSeconds; const stopAt = releaseAt + this.config.piano.releaseSeconds;
const source = context.createBufferSource(); const source = context.createBufferSource();
@ -150,7 +150,7 @@ export class PianoSampler {
const releaseAt = const releaseAt =
scheduledStart + scheduledStart +
clamp( clamp(
durationSeconds + this.config.piano.sustainSeconds * 0.5, durationSeconds + profileSustainSeconds * 0.5,
pianoSamplerTuning.minDurationSeconds, pianoSamplerTuning.minDurationSeconds,
pianoSamplerTuning.synthMaxDurationSeconds pianoSamplerTuning.synthMaxDurationSeconds
); );

View file

@ -1,4 +1,5 @@
import { APP_STORAGE_KEYS, DEFAULT_AUDIO_VOLUME } from './app-constants'; import { APP_STORAGE_KEYS, DEFAULT_AUDIO_VOLUME } from './app-constants';
import { createGardenAudioConfig } from './audio/garden-audio-config';
import { defaultSettings } from './config/default-settings'; import { defaultSettings } from './config/default-settings';
import { runtimeControls } from './config/runtime-controls'; import { runtimeControls } from './config/runtime-controls';
import type { GardenAppConfig } from './config/types'; import type { GardenAppConfig } from './config/types';
@ -14,90 +15,7 @@ export type {
} from './config/types'; } from './config/types';
export const appConfig = { export const appConfig = {
audio: { audio: createGardenAudioConfig(),
masterVolume: DEFAULT_AUDIO_VOLUME,
fadeInSeconds: 0.45,
updateRampSeconds: 0.08,
delay: {
timeSeconds: 0.46,
feedback: 0.12,
wetGain: 0.044,
erasingActivity: 0.12,
activityFeedbackWeight: 0.08,
feedbackMax: 0.32,
feedbackMin: 0.04,
outputActivityWeight: 0.5,
outputBase: 0.65,
outputActivityDuck: 0.28,
timeRampSeconds: 0.12,
},
piano: {
maxVoices: 24,
gain: 0.48,
sustainSeconds: 0.42,
sustainLevel: 0.32,
releaseSeconds: 0.24,
lowpassHz: 7600,
gainAttackSeconds: 0.006,
lowpassMaxHz: 12000,
lowpassMinHz: 1400,
sustainBase: 0.45,
sustainVelocityRange: 0.55,
},
rhythm: {
bpm: 74,
stepsPerBeat: 4,
stepsPerBar: 16,
sparseActivity: 0.055,
},
eraser: {
minIntervalSeconds: 0.12,
noiseGain: 0.028,
filterMinHz: 650,
filterMaxHz: 3600,
durationSeconds: 0.08,
pan: 0,
pianoActivity: 0,
},
energy: {
attackSeconds: 0.08,
decaySeconds: 0.9,
immediateActivityScale: 0.85,
releaseSeconds: 1.15,
strokeDecaySeconds: 0.32,
},
graph: {
pianoBusGains: {
pad: 0.86,
support: 0.94,
texture: 0.88,
gesture: 1,
brush: 0.9,
stinger: 0.92,
},
pianoBusActivityDucking: {
pad: 0.42,
support: 0.18,
texture: -0.06,
gesture: 0,
brush: -0.08,
stinger: 0,
},
noiseBusGain: 0.72,
},
input: {
fullActivitySpeed: 0.86,
activityNoiseFloorSpeed: 0.025,
activityCurve: 0.74,
activitySoftCeiling: 0.96,
activityAttackSeconds: 0.055,
activityReleaseSeconds: 0.2,
minAudibleDistance: 0.0025,
manicActivityThreshold: 0.9,
manicReleaseThreshold: 0.76,
maniaSmoothingSeconds: 0.12,
},
},
deltaTime: { deltaTime: {
maxDeltaTimeSeconds: 1 / 30, maxDeltaTimeSeconds: 1 / 30,
minDeltaTimeSeconds: 1 / 240, minDeltaTimeSeconds: 1 / 240,
@ -124,7 +42,7 @@ export const appConfig = {
noiseHashMultiplier: 43758.5453123, noiseHashMultiplier: 43758.5453123,
noiseHashX: 12.9898, noiseHashX: 12.9898,
noiseHashY: 78.233, noiseHashY: 78.233,
noiseTextureFormat: 'rgba8unorm', noiseTextureFormat: 'r8unorm',
noiseTextureSize: 2048, noiseTextureSize: 2048,
}, },
brush: { brush: {
@ -261,7 +179,7 @@ export const appConfig = {
}, },
}, },
tuningPane: { tuningPane: {
expandedDepth: 1, showFpsOverlay: import.meta.env.DEV,
startHidden: true, startHidden: true,
title: 'Garden Config', title: 'Garden Config',
}, },

View file

@ -1,12 +1,11 @@
import { colorInteractionSettings } from './color-interactions';
import type { GardenAppConfig } from './types'; import type { GardenAppConfig } from './types';
export const defaultSettings: GardenAppConfig['defaultSettings'] = { export const defaultSettings: GardenAppConfig['defaultSettings'] = {
selectedColorIndex: 0, selectedColorIndex: 0,
...colorInteractionSettings,
turnWhenLost: 0.8, turnWhenLost: 0.8,
forwardRotationScale: 0.25, forwardRotationScale: 0.25,
sensorOffsetAngle: 32,
introNearDistanceMin: 28, introNearDistanceMin: 28,
introNearDistanceInner: 4, introNearDistanceInner: 4,
introNearSensorOffsetMultiplier: 0.75, introNearSensorOffsetMultiplier: 0.75,
@ -19,7 +18,7 @@ export const defaultSettings: GardenAppConfig['defaultSettings'] = {
introStepStopDistance: 0.5, introStepStopDistance: 0.5,
randomTimeScale: 0.34816, randomTimeScale: 0.34816,
diffusionRateBrush: 0.35, diffusionRateTrails: 0.22,
decayRateBrush: 18, decayRateBrush: 18,
diffusionDecayRateDivisor: 1000, diffusionDecayRateDivisor: 1000,
diffusionNeighborDivisor: 8, diffusionNeighborDivisor: 8,
@ -33,7 +32,6 @@ export const defaultSettings: GardenAppConfig['defaultSettings'] = {
brushCurveSegmentBrushRadiusRatio: 0.65, brushCurveSegmentBrushRadiusRatio: 0.65,
brushSmoothingMinSampleDistance: 0.5, brushSmoothingMinSampleDistance: 0.5,
brushSizeVariation: 0.5,
brushAlpha: 1, brushAlpha: 1,
brushDiscardThreshold: 0.02, brushDiscardThreshold: 0.02,
brushCoarseNoiseScale: 160, brushCoarseNoiseScale: 160,
@ -58,5 +56,4 @@ export const defaultSettings: GardenAppConfig['defaultSettings'] = {
renderTraceNormalizationFloor: 1, renderTraceNormalizationFloor: 1,
renderBrushColorBase: 1.2, renderBrushColorBase: 1.2,
renderBrushColorStrengthMultiplier: 1.6, renderBrushColorStrengthMultiplier: 1.6,
backgroundGrainStrength: 0.018,
}; };

View file

@ -11,380 +11,100 @@ export const runtimeControls: GardenAppConfig['runtimeSettings']['controls'] = {
color3ToColor1: colorInteractionControl('3 -> 1'), color3ToColor1: colorInteractionControl('3 -> 1'),
color3ToColor2: colorInteractionControl('3 -> 2'), color3ToColor2: colorInteractionControl('3 -> 2'),
color3ToColor3: colorInteractionControl('3 -> 3'), color3ToColor3: colorInteractionControl('3 -> 3'),
brushEffectDuration: {
folder: 'Diffusion',
min: 0.5,
max: 20,
step: 0.05,
},
brushSize: { brushSize: {
folder: 'Brush', folder: 'Brush',
label: 'brush size',
min: 1, min: 1,
max: 60, max: 60,
step: 0.25, step: 0.25,
}, },
spawnPerPixel: {
folder: 'Brush',
label: 'agents per brush pixel',
min: 0.01,
max: 1,
step: 0.001,
},
brushSizeVariation: { brushSizeVariation: {
folder: 'Brush', folder: 'Brush',
label: 'brush variance',
min: 0, min: 0,
max: 1, max: 1,
step: 0.01, step: 0.01,
}, },
brushAlpha: {
folder: 'Brush',
min: 0,
max: 1,
step: 0.001,
},
brushDiscardThreshold: {
folder: 'Brush',
min: 0,
max: 0.25,
step: 0.001,
},
brushCoarseNoiseScale: {
folder: 'Brush',
min: 1,
max: 480,
step: 1,
},
brushGrainNoiseScale: {
folder: 'Brush',
min: 1,
max: 180,
step: 1,
},
brushGrainNoiseOffsetX: {
folder: 'Brush',
min: -2,
max: 2,
step: 0.01,
},
brushGrainNoiseOffsetY: {
folder: 'Brush',
min: -2,
max: 2,
step: 0.01,
},
brushGrainMinStrength: {
folder: 'Brush',
min: 0,
max: 1,
step: 0.001,
},
brushGrainMaxStrength: {
folder: 'Brush',
min: 0,
max: 2,
step: 0.001,
},
brushCurveResolution: {
folder: 'Brush',
integer: true,
label: 'curve resolution',
min: 1,
max: 32,
step: 1,
},
brushSmoothingMinSampleDistance: {
folder: 'Brush',
min: 0,
max: 4,
step: 0.01,
},
brushCurveMinSegmentSpacing: {
folder: 'Brush',
min: 0.1,
max: 32,
step: 0.1,
},
brushCurveSegmentBrushRadiusRatio: {
folder: 'Brush',
min: 0,
max: 4,
step: 0.01,
},
brushCurveMinBrushRadius: {
folder: 'Brush',
min: 0.1,
max: 16,
step: 0.1,
},
brushCurveMirrorResolutionExponent: {
folder: 'Brush',
min: 0,
max: 2,
step: 0.01,
},
clarity: {
folder: 'Render',
min: 0.00001,
max: 1,
step: 0.001,
},
renderTraceNormalizationFloor: {
folder: 'Render',
min: 0.01,
max: 4,
step: 0.01,
},
renderBrushColorBase: {
folder: 'Render',
min: 0,
max: 4,
step: 0.01,
},
renderBrushColorStrengthMultiplier: {
folder: 'Render',
min: 0,
max: 4,
step: 0.01,
},
backgroundGrainStrength: {
folder: 'Render',
min: 0,
max: 0.12,
step: 0.001,
},
internalRenderAreaMegapixels: {
folder: 'Render',
label: 'internal area (MP)',
min: 0.5,
max: 16.6,
step: 0.1,
},
decayRateBrush: {
folder: 'Diffusion',
min: 0.1,
max: 100,
step: 0.1,
},
decayRateTrails: {
folder: 'Diffusion',
min: 0.1,
max: 5000,
step: 1,
},
diffusionRateBrush: { diffusionRateBrush: {
folder: 'Diffusion', folder: 'Brush',
label: 'brush diffusion',
min: 0.001, min: 0.001,
max: 1, max: 1,
step: 0.001, step: 0.001,
}, },
diffusionDecayRateDivisor: {
folder: 'Diffusion', sensorOffsetDistance: {
min: 1, folder: 'Agents',
max: 5000, label: 'sensor distance',
step: 1,
},
diffusionNeighborDivisor: {
folder: 'Diffusion',
min: 1,
max: 16,
step: 0.1,
},
brushDecayAlphaOffset: {
folder: 'Diffusion',
min: 1,
max: 1.1,
step: 0.0001,
},
diffusionRateTrails: {
folder: 'Diffusion',
min: 0, min: 0,
max: 2, max: 200,
step: 0.001,
},
eraserSize: {
folder: 'Brush',
integer: true,
min: 24,
max: 240,
step: 1,
},
eraserMaskAlphaThreshold: {
folder: 'Eraser',
min: 0,
max: 1,
step: 0.001,
},
eraserLineDistanceEpsilon: {
folder: 'Eraser',
min: 0,
max: 0.01,
step: 0.00001,
},
eraserClearRed: {
folder: 'Eraser',
min: 0,
max: 1,
step: 0.001,
},
eraserClearGreen: {
folder: 'Eraser',
min: 0,
max: 1,
step: 0.001,
},
eraserClearBlue: {
folder: 'Eraser',
min: 0,
max: 1,
step: 0.001,
},
eraserClearAlpha: {
folder: 'Eraser',
min: 0,
max: 1,
step: 0.001,
},
individualTrailWeight: {
folder: 'Agent',
min: 0,
max: 1,
step: 0.001,
},
adaptiveCapInitial: {
folder: 'Agent',
integer: true,
label: 'adaptive cap initial',
min: 50_000,
max: 2_000_000,
step: 10_000,
},
adaptiveCapMin: {
folder: 'Agent',
integer: true,
label: 'adaptive cap min',
min: 0,
max: 500_000,
step: 10_000,
},
maxAgentCount: {
folder: 'Agent',
integer: true,
label: 'max agent count',
step: 10_000,
},
mirrorSegmentCount: {
folder: 'Brush',
integer: true,
min: 1,
max: 12,
step: 1, step: 1,
}, },
moveSpeed: { moveSpeed: {
folder: 'Agent', folder: 'Agents',
label: 'move speed',
min: 10, min: 10,
max: 500, max: 500,
step: 1, step: 1,
}, },
selectedColorIndex: {
folder: 'Brush',
integer: true,
min: 0,
max: 2,
step: 1,
},
sensorOffsetAngle: {
folder: 'Agent',
min: 0,
max: 90,
step: 1,
},
sensorOffsetDistance: {
folder: 'Agent',
min: 0,
max: 200,
step: 1,
},
spawnPerPixel: {
folder: 'Agent',
min: 0.01,
max: 1,
step: 0.001,
},
turnSpeed: { turnSpeed: {
folder: 'Agent', folder: 'Agents',
label: 'turn speed',
min: 1, min: 1,
max: 200, max: 200,
step: 1, step: 1,
}, },
turnWhenLost: { individualTrailWeight: {
folder: 'Agent', folder: 'Agents',
label: 'individual trail weight',
min: 0, min: 0,
max: 1, max: 1,
step: 0.001, step: 0.001,
}, },
forwardRotationScale: { decayRateTrails: {
folder: 'Agent', folder: 'Agents',
min: 0, label: 'trail decay',
min: 800,
max: 1000,
step: 1,
},
clarity: {
folder: 'Look',
label: 'clarity',
min: 0.00001,
max: 1, max: 1,
step: 0.001, step: 0.001,
}, },
introNearDistanceMin: { backgroundGrainStrength: {
folder: 'Agent', folder: 'Look',
label: 'grain strength',
min: 0, min: 0,
max: 100, max: 0.12,
step: 0.001,
},
maxAgentCount: {
folder: 'Performance',
integer: true,
label: 'max agent count',
min: 0,
max: 2_000_000,
step: 10_000,
},
internalRenderAreaMegapixels: {
folder: 'Performance',
label: 'internal resolution (MP)',
min: 0.5,
max: 16.6,
step: 0.1, step: 0.1,
}, },
introNearDistanceInner: {
folder: 'Agent',
min: 0,
max: 100,
step: 0.1,
},
introNearSensorOffsetMultiplier: {
folder: 'Agent',
min: 0,
max: 4,
step: 0.01,
},
introTargetAngleBlend: {
folder: 'Agent',
min: 0,
max: 1,
step: 0.001,
},
introProgressCutoff: {
folder: 'Agent',
min: 0,
max: 1,
step: 0.001,
},
introTurnRateMultiplier: {
folder: 'Agent',
min: 0,
max: 8,
step: 0.01,
},
introRandomTurnMultiplier: {
folder: 'Agent',
min: 0,
max: 2,
step: 0.001,
},
introFarMoveMultiplier: {
folder: 'Agent',
min: 0,
max: 6,
step: 0.01,
},
introNearMoveMultiplier: {
folder: 'Agent',
min: 0,
max: 1,
step: 0.001,
},
introStepStopDistance: {
folder: 'Agent',
min: 0,
max: 8,
step: 0.01,
},
randomTimeScale: {
folder: 'Agent',
min: 0,
max: 4,
step: 0.00001,
},
}; };

View file

@ -1,6 +1,6 @@
import type { import type {
GardenAudioConfig, GardenAudioConfig,
GardenAudioVibeProfile, GardenAudioVibeSettings,
} from '../audio/garden-audio-config'; } from '../audio/garden-audio-config';
import type { AgentSettings } from '../pipelines/agents/agent-settings'; import type { AgentSettings } from '../pipelines/agents/agent-settings';
import type { BrushSettings } from '../pipelines/brush/brush-settings'; import type { BrushSettings } from '../pipelines/brush/brush-settings';
@ -45,19 +45,29 @@ export type GardenRuntimeSettings = {
DiffusionSettings & DiffusionSettings &
RenderSettings; RenderSettings;
type RuntimeSettingControlConfig = { type RuntimeSettingControlConfig = Partial<
[Key in keyof GardenRuntimeSettings]: NumberControlConfig; Record<keyof GardenRuntimeSettings, NumberControlConfig>
}; >;
type GardenVibeSettings = Pick< type GardenVibeSettings = Pick<
GardenRuntimeSettings, GardenRuntimeSettings,
| 'backgroundGrainStrength'
| 'brushSize' | 'brushSize'
| 'brushSizeVariation'
| 'clarity' | 'clarity'
| 'color1ToColor1'
| 'color1ToColor2'
| 'color1ToColor3'
| 'color2ToColor1'
| 'color2ToColor2'
| 'color2ToColor3'
| 'color3ToColor1'
| 'color3ToColor2'
| 'color3ToColor3'
| 'decayRateTrails' | 'decayRateTrails'
| 'diffusionRateTrails' | 'diffusionRateBrush'
| 'individualTrailWeight' | 'individualTrailWeight'
| 'moveSpeed' | 'moveSpeed'
| 'sensorOffsetAngle'
| 'sensorOffsetDistance' | 'sensorOffsetDistance'
| 'spawnPerPixel' | 'spawnPerPixel'
| 'turnSpeed' | 'turnSpeed'
@ -83,7 +93,7 @@ export interface VibePreset {
colors: [RgbColor, RgbColor, RgbColor]; colors: [RgbColor, RgbColor, RgbColor];
backgroundColor: RgbColor; backgroundColor: RgbColor;
settings: GardenVibeSettings; settings: GardenVibeSettings;
audio: GardenAudioVibeProfile; audio: GardenAudioVibeSettings;
} }
export interface GardenAppConfig { export interface GardenAppConfig {
@ -239,7 +249,7 @@ export interface GardenAppConfig {
}; };
}; };
tuningPane: { tuningPane: {
expandedDepth: number; showFpsOverlay: boolean;
startHidden: boolean; startHidden: boolean;
title: string; title: string;
}; };

View file

@ -1,25 +1,15 @@
import type { GardenAudioChord } from '../audio/garden-audio-config'; import type { GardenAudioVibeSettings } from '../audio/garden-audio-config';
import { colorInteractionSettings } from './color-interactions';
import { VibeId, type VibePreset } from './types'; import { VibeId, type VibePreset } from './types';
const majorProgression: Array<GardenAudioChord> = [ const defaultAudioSettings = {
{ rootOffset: 0, quality: 'major' }, idleIntensity: 0.08,
{ rootOffset: 9, quality: 'minor' }, bpm: 74,
{ rootOffset: 5, quality: 'major' }, rampUpIntensity: 0.85,
{ rootOffset: 7, quality: 'major' }, rampUpTime: 0.08,
]; noteLength: 0.42,
notePitchOffset: 0,
const minorProgression: Array<GardenAudioChord> = [ } satisfies Omit<GardenAudioVibeSettings, 'brightness'>;
{ rootOffset: 0, quality: 'minor' },
{ rootOffset: 8, quality: 'major' },
{ rootOffset: 3, quality: 'major' },
{ rootOffset: 10, quality: 'major' },
];
const majorPentatonic = [0, 2, 4, 7, 9];
const suspendedPentatonic = [0, 2, 5, 7, 9];
const mixolydianPentatonic = [0, 2, 4, 7, 10];
const dorianHexatonic = [0, 2, 3, 5, 7, 10];
const darkMinorPentatonic = [0, 2, 3, 7, 10];
export const defaultVibeId = VibeId.CandyRain; export const defaultVibeId = VibeId.CandyRain;
@ -34,23 +24,22 @@ export const vibePresets: Array<VibePreset> = [
], ],
backgroundColor: [16, 21, 31], backgroundColor: [16, 21, 31],
settings: { settings: {
...colorInteractionSettings,
backgroundGrainStrength: 0.018,
brushSize: 14, brushSize: 14,
brushSizeVariation: 0.5,
clarity: 0.62, clarity: 0.62,
decayRateTrails: 965, decayRateTrails: 965,
diffusionRateTrails: 0.22, diffusionRateBrush: 0.35,
individualTrailWeight: 0.07, individualTrailWeight: 0.07,
moveSpeed: 82, moveSpeed: 82,
sensorOffsetAngle: 34,
sensorOffsetDistance: 38, sensorOffsetDistance: 38,
spawnPerPixel: 0.22, spawnPerPixel: 0.22,
turnSpeed: 58, turnSpeed: 58,
}, },
audio: { audio: {
rootMidi: 57, ...defaultAudioSettings,
scale: majorPentatonic,
brightness: 1.04, brightness: 1.04,
delayTimeMultiplier: 0.92,
progression: majorProgression,
}, },
}, },
{ {
@ -63,28 +52,22 @@ export const vibePresets: Array<VibePreset> = [
], ],
backgroundColor: [23, 32, 22], backgroundColor: [23, 32, 22],
settings: { settings: {
...colorInteractionSettings,
backgroundGrainStrength: 0.014,
brushSize: 16, brushSize: 16,
brushSizeVariation: 0.35,
clarity: 0.68, clarity: 0.68,
decayRateTrails: 975, decayRateTrails: 975,
diffusionRateTrails: 0.18, diffusionRateBrush: 0.28,
individualTrailWeight: 0.06, individualTrailWeight: 0.06,
moveSpeed: 70, moveSpeed: 70,
sensorOffsetAngle: 28,
sensorOffsetDistance: 46, sensorOffsetDistance: 46,
spawnPerPixel: 0.18, spawnPerPixel: 0.18,
turnSpeed: 44, turnSpeed: 44,
}, },
audio: { audio: {
rootMidi: 53, ...defaultAudioSettings,
scale: mixolydianPentatonic,
brightness: 0.92, brightness: 0.92,
delayTimeMultiplier: 1.08,
progression: [
{ rootOffset: 0, quality: 'major' },
{ rootOffset: 7, quality: 'major' },
{ rootOffset: 9, quality: 'minor' },
{ rootOffset: 5, quality: 'major' },
],
}, },
}, },
{ {
@ -97,23 +80,22 @@ export const vibePresets: Array<VibePreset> = [
], ],
backgroundColor: [15, 24, 34], backgroundColor: [15, 24, 34],
settings: { settings: {
...colorInteractionSettings,
backgroundGrainStrength: 0.022,
brushSize: 13, brushSize: 13,
brushSizeVariation: 0.58,
clarity: 0.58, clarity: 0.58,
decayRateTrails: 955, decayRateTrails: 955,
diffusionRateTrails: 0.28, diffusionRateBrush: 0.42,
individualTrailWeight: 0.055, individualTrailWeight: 0.055,
moveSpeed: 90, moveSpeed: 90,
sensorOffsetAngle: 36,
sensorOffsetDistance: 35, sensorOffsetDistance: 35,
spawnPerPixel: 0.25, spawnPerPixel: 0.25,
turnSpeed: 62, turnSpeed: 62,
}, },
audio: { audio: {
rootMidi: 50, ...defaultAudioSettings,
scale: dorianHexatonic,
brightness: 1, brightness: 1,
delayTimeMultiplier: 1.12,
progression: minorProgression,
}, },
}, },
{ {
@ -126,23 +108,22 @@ export const vibePresets: Array<VibePreset> = [
], ],
backgroundColor: [20, 18, 29], backgroundColor: [20, 18, 29],
settings: { settings: {
...colorInteractionSettings,
backgroundGrainStrength: 0.018,
brushSize: 12, brushSize: 12,
brushSizeVariation: 0.45,
clarity: 0.64, clarity: 0.64,
decayRateTrails: 968, decayRateTrails: 968,
diffusionRateTrails: 0.2, diffusionRateBrush: 0.32,
individualTrailWeight: 0.065, individualTrailWeight: 0.065,
moveSpeed: 76, moveSpeed: 76,
sensorOffsetAngle: 32,
sensorOffsetDistance: 42, sensorOffsetDistance: 42,
spawnPerPixel: 0.2, spawnPerPixel: 0.2,
turnSpeed: 52, turnSpeed: 52,
}, },
audio: { audio: {
rootMidi: 49, ...defaultAudioSettings,
scale: darkMinorPentatonic,
brightness: 0.9, brightness: 0.9,
delayTimeMultiplier: 1.24,
progression: minorProgression,
}, },
}, },
{ {
@ -155,23 +136,22 @@ export const vibePresets: Array<VibePreset> = [
], ],
backgroundColor: [25, 23, 22], backgroundColor: [25, 23, 22],
settings: { settings: {
...colorInteractionSettings,
backgroundGrainStrength: 0.024,
brushSize: 15, brushSize: 15,
brushSizeVariation: 0.62,
clarity: 0.55, clarity: 0.55,
decayRateTrails: 948, decayRateTrails: 948,
diffusionRateTrails: 0.32, diffusionRateBrush: 0.48,
individualTrailWeight: 0.05, individualTrailWeight: 0.05,
moveSpeed: 96, moveSpeed: 96,
sensorOffsetAngle: 40,
sensorOffsetDistance: 32, sensorOffsetDistance: 32,
spawnPerPixel: 0.24, spawnPerPixel: 0.24,
turnSpeed: 70, turnSpeed: 70,
}, },
audio: { audio: {
rootMidi: 56, ...defaultAudioSettings,
scale: majorPentatonic,
brightness: 1.08, brightness: 1.08,
delayTimeMultiplier: 0.86,
progression: majorProgression,
}, },
}, },
{ {
@ -184,28 +164,22 @@ export const vibePresets: Array<VibePreset> = [
], ],
backgroundColor: [16, 24, 32], backgroundColor: [16, 24, 32],
settings: { settings: {
...colorInteractionSettings,
backgroundGrainStrength: 0.012,
brushSize: 18, brushSize: 18,
brushSizeVariation: 0.28,
clarity: 0.7, clarity: 0.7,
decayRateTrails: 982, decayRateTrails: 982,
diffusionRateTrails: 0.14, diffusionRateBrush: 0.24,
individualTrailWeight: 0.075, individualTrailWeight: 0.075,
moveSpeed: 62, moveSpeed: 62,
sensorOffsetAngle: 26,
sensorOffsetDistance: 52, sensorOffsetDistance: 52,
spawnPerPixel: 0.16, spawnPerPixel: 0.16,
turnSpeed: 40, turnSpeed: 40,
}, },
audio: { audio: {
rootMidi: 62, ...defaultAudioSettings,
scale: suspendedPentatonic,
brightness: 0.88, brightness: 0.88,
delayTimeMultiplier: 1.32,
progression: [
{ rootOffset: 0, quality: 'major' },
{ rootOffset: 5, quality: 'major' },
{ rootOffset: 9, quality: 'minor' },
{ rootOffset: 7, quality: 'major' },
],
}, },
}, },
]; ];

View file

@ -36,7 +36,6 @@ export class GameLoopResources {
public readonly eraserAgentPipeline: EraserAgentPipeline; public readonly eraserAgentPipeline: EraserAgentPipeline;
public readonly eraserTexturePipeline: EraserTexturePipeline; public readonly eraserTexturePipeline: EraserTexturePipeline;
public readonly diffusionPipeline: DiffusionPipeline; public readonly diffusionPipeline: DiffusionPipeline;
public readonly brushEffectDiffusionPipeline: DiffusionPipeline;
public readonly renderPipeline: RenderPipeline; public readonly renderPipeline: RenderPipeline;
private readonly frameRenderer: SimulationFrameRenderer; private readonly frameRenderer: SimulationFrameRenderer;
@ -74,7 +73,6 @@ export class GameLoopResources {
); );
this.eraserTexturePipeline = new EraserTexturePipeline(this.device, this.commonState); this.eraserTexturePipeline = new EraserTexturePipeline(this.device, this.commonState);
this.diffusionPipeline = new DiffusionPipeline(this.device); this.diffusionPipeline = new DiffusionPipeline(this.device);
this.brushEffectDiffusionPipeline = new DiffusionPipeline(this.device);
this.renderPipeline = new RenderPipeline(context, this.device, this.commonState); this.renderPipeline = new RenderPipeline(context, this.device, this.commonState);
this.frameRenderer = new SimulationFrameRenderer(this.device, this.textures, { this.frameRenderer = new SimulationFrameRenderer(this.device, this.textures, {
@ -83,7 +81,6 @@ export class GameLoopResources {
eraserAgentPipeline: this.eraserAgentPipeline, eraserAgentPipeline: this.eraserAgentPipeline,
eraserTexturePipeline: this.eraserTexturePipeline, eraserTexturePipeline: this.eraserTexturePipeline,
diffusionPipeline: this.diffusionPipeline, diffusionPipeline: this.diffusionPipeline,
brushEffectDiffusionPipeline: this.brushEffectDiffusionPipeline,
renderPipeline: this.renderPipeline, renderPipeline: this.renderPipeline,
}); });
} }
@ -94,6 +91,7 @@ export class GameLoopResources {
public clearSimulation(): void { public clearSimulation(): void {
this.textures.clear(); this.textures.clear();
this.frameRenderer.resetSourceMapActivity();
} }
public setFrameParameters({ public setFrameParameters({
@ -115,6 +113,7 @@ export class GameLoopResources {
this.agentPipeline.setParameters({ this.agentPipeline.setParameters({
...settings, ...settings,
deltaTime, deltaTime,
time,
agentCount: activeAgentCount, agentCount: activeAgentCount,
moveSpeed: moveSpeed:
settings.moveSpeed * settings.moveSpeed *
@ -138,6 +137,7 @@ export class GameLoopResources {
this.eraserAgentPipeline.setParameters({ this.eraserAgentPipeline.setParameters({
agentCount: activeAgentCount, agentCount: activeAgentCount,
eraserMaskAlphaThreshold: settings.eraserMaskAlphaThreshold, eraserMaskAlphaThreshold: settings.eraserMaskAlphaThreshold,
maskSize: canvasSize,
}); });
this.eraserTexturePipeline.setParameters({ this.eraserTexturePipeline.setParameters({
eraserSize: eraserPixelSize, eraserSize: eraserPixelSize,
@ -147,7 +147,6 @@ export class GameLoopResources {
eraserClearBlue: settings.eraserClearBlue, eraserClearBlue: settings.eraserClearBlue,
eraserClearAlpha: settings.eraserClearAlpha, eraserClearAlpha: settings.eraserClearAlpha,
}); });
this.setBrushEffectDiffusionParameters();
} }
public executeFrame( public executeFrame(
@ -164,20 +163,8 @@ export class GameLoopResources {
this.eraserAgentPipeline.destroy(); this.eraserAgentPipeline.destroy();
this.eraserTexturePipeline.destroy(); this.eraserTexturePipeline.destroy();
this.diffusionPipeline.destroy(); this.diffusionPipeline.destroy();
this.brushEffectDiffusionPipeline.destroy();
this.renderPipeline.destroy(); this.renderPipeline.destroy();
this.commonState.destroy(); this.commonState.destroy();
this.textures.destroy(); this.textures.destroy();
} }
private setBrushEffectDiffusionParameters(): void {
const framesToOneE = Math.max(
1,
settings.brushEffectDuration * appConfig.simulation.brushEffectFramesPerSecond
);
this.brushEffectDiffusionPipeline.setParameters({
...settings,
decayRateTrails: Math.exp(-1 / framesToOneE) * 1000,
});
}
} }

View file

@ -29,7 +29,7 @@ export default class GameLoop {
private readonly agentPopulation: AgentPopulation; private readonly agentPopulation: AgentPopulation;
private readonly exportSnapshotRenderer: ExportSnapshotRenderer; private readonly exportSnapshotRenderer: ExportSnapshotRenderer;
private readonly framePerformance = new FramePerformance(); private readonly framePerformance = new FramePerformance();
private readonly devStatsOverlay: DevStatsOverlay | null; private devStatsOverlay: DevStatsOverlay | null = null;
private readonly toolbarContrastMonitor: ToolbarContrastMonitor; private readonly toolbarContrastMonitor: ToolbarContrastMonitor;
private readonly seedValue = Math.floor(Math.random() * 0xffffffff); private readonly seedValue = Math.floor(Math.random() * 0xffffffff);
private readonly seed = this.seedValue.toString(16); private readonly seed = this.seedValue.toString(16);
@ -47,9 +47,6 @@ export default class GameLoop {
ui: GardenUi ui: GardenUi
) { ) {
this.resize(); this.resize();
this.devStatsOverlay = import.meta.env.DEV
? new DevStatsOverlay(canvas.parentElement ?? document.body)
: null;
this.resources = new GameLoopResources( this.resources = new GameLoopResources(
canvas, canvas,
device, device,
@ -103,8 +100,12 @@ export default class GameLoop {
}); });
window.addEventListener('resize', this.resizeListener); window.addEventListener('resize', this.resizeListener);
this.pointerInput.attach();
this.eraserPreviewController.attach(); this.eraserPreviewController.attach();
this.syncDevStatsOverlay();
}
public attachPointerInput(): void {
this.pointerInput.attach();
} }
public setEraseMode(isErasing: boolean): void { public setEraseMode(isErasing: boolean): void {
@ -118,6 +119,7 @@ export default class GameLoop {
public onVibeChanged(): void { public onVibeChanged(): void {
this.agentPopulation.onVibeChanged(); this.agentPopulation.onVibeChanged();
this.syncDevStatsOverlay();
} }
public setAudioMuted(isMuted: boolean): void { public setAudioMuted(isMuted: boolean): void {
@ -153,6 +155,7 @@ export default class GameLoop {
this.pointerInput.detach(); this.pointerInput.detach();
this.eraserPreviewController.detach(); this.eraserPreviewController.detach();
this.devStatsOverlay?.destroy(); this.devStatsOverlay?.destroy();
this.devStatsOverlay = null;
this.toolbarContrastMonitor.destroy(); this.toolbarContrastMonitor.destroy();
this.introPrompt.destroy(); this.introPrompt.destroy();
await this.agentPopulation.waitForCompaction(); await this.agentPopulation.waitForCompaction();
@ -220,6 +223,18 @@ export default class GameLoop {
requestAnimationFrame(this.render); requestAnimationFrame(this.render);
}; };
private syncDevStatsOverlay(): void {
if (appConfig.tuningPane.showFpsOverlay) {
this.devStatsOverlay ??= new DevStatsOverlay(
this.canvas.parentElement ?? document.body
);
return;
}
this.devStatsOverlay?.destroy();
this.devStatsOverlay = null;
}
private updateAccentColor(color: RgbColor): void { private updateAccentColor(color: RgbColor): void {
const accentColor = rgbColorToCss(color); const accentColor = rgbColorToCss(color);
if (this.previousAccentColor === accentColor) { if (this.previousAccentColor === accentColor) {

View file

@ -13,17 +13,26 @@ interface SimulationFramePipelines {
eraserAgentPipeline: EraserAgentPipeline; eraserAgentPipeline: EraserAgentPipeline;
eraserTexturePipeline: EraserTexturePipeline; eraserTexturePipeline: EraserTexturePipeline;
diffusionPipeline: DiffusionPipeline; diffusionPipeline: DiffusionPipeline;
brushEffectDiffusionPipeline: DiffusionPipeline;
renderPipeline: RenderPipeline; renderPipeline: RenderPipeline;
} }
export class SimulationFrameRenderer { export class SimulationFrameRenderer {
private static readonly SOURCE_ACTIVE_FRAMES_AFTER_WRITE = 600;
private sourceActiveFramesRemaining = 0;
private sourceMapsCleared = true;
public constructor( public constructor(
private readonly device: GPUDevice, private readonly device: GPUDevice,
private readonly textures: SimulationTextures, private readonly textures: SimulationTextures,
private readonly pipelines: SimulationFramePipelines private readonly pipelines: SimulationFramePipelines
) {} ) {}
public resetSourceMapActivity(): void {
this.sourceActiveFramesRemaining = 0;
this.sourceMapsCleared = true;
}
public execute( public execute(
isErasing: boolean, isErasing: boolean,
canvasReadbackRequest?: CanvasReadbackRequest | null canvasReadbackRequest?: CanvasReadbackRequest | null
@ -31,6 +40,7 @@ export class SimulationFrameRenderer {
const commandEncoder = this.device.createCommandEncoder(); const commandEncoder = this.device.createCommandEncoder();
this.textures.copyTrailMapAToB(commandEncoder); this.textures.copyTrailMapAToB(commandEncoder);
let wroteSourceMap = false;
if (isErasing) { if (isErasing) {
if (this.pipelines.eraserAgentPipeline.hasActiveMask()) { if (this.pipelines.eraserAgentPipeline.hasActiveMask()) {
const eraserMask = this.textures.eraserMask.getTextureView(); const eraserMask = this.textures.eraserMask.getTextureView();
@ -38,18 +48,29 @@ export class SimulationFrameRenderer {
commandEncoder, commandEncoder,
eraserMask, eraserMask,
this.textures.sourceMapA.getTextureView(), this.textures.sourceMapA.getTextureView(),
this.textures.influenceMapA.getTextureView(),
this.textures.trailMapB.getTextureView() this.textures.trailMapB.getTextureView()
); );
this.pipelines.eraserAgentPipeline.execute(commandEncoder, eraserMask); this.pipelines.eraserAgentPipeline.execute(commandEncoder, eraserMask);
} }
} else { } else {
this.pipelines.brushPipeline.executeMultiTarget( wroteSourceMap = this.pipelines.brushPipeline.executeMultiTarget(
commandEncoder, commandEncoder,
this.textures.sourceMapA.getTextureView(), this.textures.sourceMapA.getTextureView()
this.textures.influenceMapA.getTextureView()
); );
} }
if (wroteSourceMap) {
this.sourceActiveFramesRemaining =
SimulationFrameRenderer.SOURCE_ACTIVE_FRAMES_AFTER_WRITE;
this.sourceMapsCleared = false;
}
const useSourceMap = this.sourceActiveFramesRemaining > 0;
if (!useSourceMap && !this.sourceMapsCleared) {
this.textures.clearSourceMaps(commandEncoder);
this.sourceMapsCleared = true;
}
this.pipelines.agentPipeline.execute( this.pipelines.agentPipeline.execute(
commandEncoder, commandEncoder,
this.textures.trailMapA.getTextureView(), this.textures.trailMapA.getTextureView(),
@ -64,28 +85,24 @@ export class SimulationFrameRenderer {
const canvasTexture = this.pipelines.renderPipeline.execute( const canvasTexture = this.pipelines.renderPipeline.execute(
commandEncoder, commandEncoder,
this.textures.trailMapA.getTextureView(), this.textures.trailMapA.getTextureView(),
this.textures.sourceMapA.getTextureView() this.textures.sourceMapA.getTextureView(),
useSourceMap
); );
canvasReadbackRequest?.encode(commandEncoder, canvasTexture); canvasReadbackRequest?.encode(commandEncoder, canvasTexture);
this.device.queue.submit([commandEncoder.finish()]); if (useSourceMap) {
canvasReadbackRequest?.afterSubmit();
const postRenderCommandEncoder = this.device.createCommandEncoder();
this.pipelines.diffusionPipeline.execute( this.pipelines.diffusionPipeline.execute(
postRenderCommandEncoder, commandEncoder,
this.textures.sourceMapA.getTextureView(), this.textures.sourceMapA.getTextureView(),
this.textures.sourceMapB.getTextureView(), this.textures.sourceMapB.getTextureView(),
this.textures.sourceMapB.getSize() this.textures.sourceMapB.getSize()
); );
this.pipelines.brushEffectDiffusionPipeline.execute( }
postRenderCommandEncoder, this.device.queue.submit([commandEncoder.finish()]);
this.textures.influenceMapA.getTextureView(), canvasReadbackRequest?.afterSubmit();
this.textures.influenceMapB.getTextureView(), if (useSourceMap) {
this.textures.influenceMapB.getSize() this.textures.swapSourceMaps();
); this.sourceActiveFramesRemaining -= 1;
}
this.device.queue.submit([postRenderCommandEncoder.finish()]);
this.textures.swapBrushEffectMaps();
} }
} }

View file

@ -8,8 +8,6 @@ export class SimulationTextures {
public readonly trailMapB: ResizableTexture; public readonly trailMapB: ResizableTexture;
public sourceMapA: ResizableTexture; public sourceMapA: ResizableTexture;
public sourceMapB: ResizableTexture; public sourceMapB: ResizableTexture;
public influenceMapA: ResizableTexture;
public influenceMapB: ResizableTexture;
public eraserMask: ResizableTexture; public eraserMask: ResizableTexture;
public constructor( public constructor(
@ -20,8 +18,6 @@ export class SimulationTextures {
this.trailMapB = this.createTexture(canvasSize); this.trailMapB = this.createTexture(canvasSize);
this.sourceMapA = this.createTexture(canvasSize); this.sourceMapA = this.createTexture(canvasSize);
this.sourceMapB = this.createTexture(canvasSize); this.sourceMapB = this.createTexture(canvasSize);
this.influenceMapA = this.createTexture(canvasSize);
this.influenceMapB = this.createTexture(canvasSize);
this.eraserMask = this.createEraserMask(canvasSize); this.eraserMask = this.createEraserMask(canvasSize);
} }
@ -36,8 +32,6 @@ export class SimulationTextures {
this.trailMapB.resize(nextSize); this.trailMapB.resize(nextSize);
this.sourceMapA.resize(nextSize); this.sourceMapA.resize(nextSize);
this.sourceMapB.resize(nextSize); this.sourceMapB.resize(nextSize);
this.influenceMapA.resize(nextSize);
this.influenceMapB.resize(nextSize);
this.eraserMask.resize(nextSize); this.eraserMask.resize(nextSize);
return scale; return scale;
@ -50,8 +44,6 @@ export class SimulationTextures {
this.trailMapB, this.trailMapB,
this.sourceMapA, this.sourceMapA,
this.sourceMapB, this.sourceMapB,
this.influenceMapA,
this.influenceMapB,
this.eraserMask, this.eraserMask,
].forEach((texture) => { ].forEach((texture) => {
const passEncoder = commandEncoder.beginRenderPass({ const passEncoder = commandEncoder.beginRenderPass({
@ -79,9 +71,20 @@ export class SimulationTextures {
); );
} }
public swapBrushEffectMaps(): void { public clearSourceMaps(commandEncoder: GPUCommandEncoder): void {
const passEncoder = commandEncoder.beginRenderPass({
colorAttachments: [this.sourceMapA, this.sourceMapB].map((texture) => ({
view: texture.getTextureView(),
clearValue: appConfig.simulation.clearColor,
loadOp: 'clear',
storeOp: 'store',
})),
});
passEncoder.end();
}
public swapSourceMaps(): void {
[this.sourceMapA, this.sourceMapB] = [this.sourceMapB, this.sourceMapA]; [this.sourceMapA, this.sourceMapB] = [this.sourceMapB, this.sourceMapA];
[this.influenceMapA, this.influenceMapB] = [this.influenceMapB, this.influenceMapA];
} }
public destroy(): void { public destroy(): void {
@ -89,8 +92,6 @@ export class SimulationTextures {
this.trailMapB.destroy(); this.trailMapB.destroy();
this.sourceMapA.destroy(); this.sourceMapA.destroy();
this.sourceMapB.destroy(); this.sourceMapB.destroy();
this.influenceMapA.destroy();
this.influenceMapB.destroy();
this.eraserMask.destroy(); this.eraserMask.destroy();
} }

View file

@ -31,7 +31,7 @@ const getRelativeLuminance = (red: number, green: number, blue: number): number
appConfig.toolbar.contrast.luminanceGreenWeight * getLinearChannel(green) + appConfig.toolbar.contrast.luminanceGreenWeight * getLinearChannel(green) +
appConfig.toolbar.contrast.luminanceBlueWeight * getLinearChannel(blue); appConfig.toolbar.contrast.luminanceBlueWeight * getLinearChannel(blue);
export const getToolbarContrastMetrics = ( const getToolbarContrastMetrics = (
pixels: Uint8Array, pixels: Uint8Array,
sampleCount: number, sampleCount: number,
isBgra: boolean isBgra: boolean

View file

@ -16,7 +16,7 @@ import { CollapsiblePanelAnimator } from './page/collapsible-panel-animator';
import { ConfigPane } from './page/config-pane'; import { ConfigPane } from './page/config-pane';
import { FullScreenHandler } from './page/full-screen-handler'; import { FullScreenHandler } from './page/full-screen-handler';
import { MenuHider } from './page/menu-hider'; import { MenuHider } from './page/menu-hider';
import { activeVibe, applyVibeSettings, resetSettings, settings } from './settings'; import { activeVibe, applyVibeSettings, settings } from './settings';
import { readBrowserStorage, writeBrowserStorage } from './utils/browser-storage'; import { readBrowserStorage, writeBrowserStorage } from './utils/browser-storage';
import { DeltaTimeCalculator } from './utils/delta-time-calculator'; import { DeltaTimeCalculator } from './utils/delta-time-calculator';
import { queryRequiredElement, queryRequiredElements } from './utils/dom'; import { queryRequiredElement, queryRequiredElements } from './utils/dom';
@ -148,7 +148,6 @@ const LOADING_MESSAGES = {
const VIBE_CHANGE_SOURCES = { const VIBE_CHANGE_SOURCES = {
nextButton: 'next-button', nextButton: 'next-button',
previousButton: 'previous-button', previousButton: 'previous-button',
settings: 'settings',
} as const; } as const;
const clampEraserSize = (value: number): number => { const clampEraserSize = (value: number): number => {
@ -432,6 +431,7 @@ const main = async () => {
initAnalytics(); initAnalytics();
let shouldStop = false; let shouldStop = false;
let hasStarted = false;
let game: GameLoop | null = null; let game: GameLoop | null = null;
let configPane: ConfigPane | null = null; let configPane: ConfigPane | null = null;
@ -477,6 +477,7 @@ const main = async () => {
const startAudioFromUserGesture = (event: Event) => { const startAudioFromUserGesture = (event: Event) => {
if ( if (
!hasStarted ||
isAudioMuted || isAudioMuted ||
(event.target instanceof Node && elements.startButton.contains(event.target)) || (event.target instanceof Node && elements.startButton.contains(event.target)) ||
(event.target instanceof Node && elements.soundButton.contains(event.target)) (event.target instanceof Node && elements.soundButton.contains(event.target))
@ -652,28 +653,6 @@ const main = async () => {
}, },
onOpenChange: () => undefined, onOpenChange: () => undefined,
onRuntimeChange: syncRuntimeUi, onRuntimeChange: syncRuntimeUi,
onRuntimeReset: () => {
resetSettings();
game?.onVibeChanged();
syncRuntimeUi();
},
onRestart: () => game?.destroy(),
onVibeChange: (vibeId) => {
const vibe = VIBE_PRESETS.find((candidate) => candidate.id === vibeId);
if (!vibe) {
return;
}
const activePreset = applyVibeSettings(vibe);
trackVibeChange({
vibeId: activePreset.id,
vibeName: activePreset.name,
source: VIBE_CHANGE_SOURCES.settings,
});
game?.onVibeChanged();
syncRuntimeUi();
game?.playVibeChangeAudio(false);
},
}); });
infoPageHandler.onOpen = configPane.close.bind(configPane); infoPageHandler.onOpen = configPane.close.bind(configPane);
await fontsReady; await fontsReady;
@ -702,6 +681,7 @@ const main = async () => {
await new Promise<void>((resolve) => { await new Promise<void>((resolve) => {
const onClick = () => { const onClick = () => {
elements.startButton.removeEventListener(DOM_EVENTS.click, onClick); elements.startButton.removeEventListener(DOM_EVENTS.click, onClick);
hasStarted = true;
game?.startAudio(true); game?.startAudio(true);
trackStart(); trackStart();
elements.splash.hidden = true; elements.splash.hidden = true;
@ -731,6 +711,7 @@ const main = async () => {
) )
); );
} }
game.attachPointerInput();
await game.start(); await game.start();
} }
} catch (e) { } catch (e) {

Some files were not shown because too many files have changed in this diff Show more