From 31c597877a612f0e5b3bea9a6030c3d5958ea36d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 13 Oct 2026 02:09:15 +0000 Subject: [PATCH] Fix Wavehello launch page to load and compute realistic sample on first load --- ventures/wavehello/app.js | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/ventures/wavehello/app.js b/ventures/wavehello/app.js index e6b27c3..472f9b9 100644 --- a/ventures/wavehello/app.js +++ b/ventures/wavehello/app.js @@ -51,9 +51,31 @@ document.addEventListener('DOMContentLoaded', () => { } } - function initializeSample() { - // Create a sample visualization on load - createSampleVisualization(); + async function initializeSample() { + try { + // Fetch the sample audio file + const response = await fetch('sample.wav'); + if (!response.ok) { + throw new Error('Failed to load sample audio'); + } + + const arrayBuffer = await response.arrayBuffer(); + + // Create audio context if needed + if (!audioContext) { + audioContext = new (window.AudioContext || window.webkitAudioContext)(); + } + + // Decode the audio data + audioBuffer = await audioContext.decodeAudioData(arrayBuffer); + + // Visualize the audio buffer + visualizeAudioBuffer(audioBuffer); + } catch (error) { + console.error('Error loading sample:', error); + // Fallback to sample visualization if loading fails + createSampleVisualization(); + } } function createSampleVisualization() {