From e27af437dc95e3c13f6d7cb38aaaff2aa0166eb6 Mon Sep 17 00:00:00 2001 From: freddyaboulton Date: Thu, 24 Oct 2024 17:23:38 -0700 Subject: [PATCH] fix metallic sound --- frontend/shared/AudioWave.svelte | 72 ++++++++++++++++---------------- pyproject.toml | 2 +- 2 files changed, 37 insertions(+), 37 deletions(-) diff --git a/frontend/shared/AudioWave.svelte b/frontend/shared/AudioWave.svelte index 81f3c34..1821817 100644 --- a/frontend/shared/AudioWave.svelte +++ b/frontend/shared/AudioWave.svelte @@ -27,12 +27,14 @@ function setupAudioContext() { audioContext = new (window.AudioContext || window.webkitAudioContext)(); analyser = audioContext.createAnalyser(); - console.log("audio_source", audio_source.srcObject); const source = audioContext.createMediaStreamSource(audio_source.srcObject); + + // Only connect to analyser, not to destination source.connect(analyser); - analyser.connect(audioContext.destination); - + + // Configure analyser analyser.fftSize = 64; + analyser.smoothingTimeConstant = 0.8; // Add smoothing to make visualization less jittery dataArray = new Uint8Array(analyser.frequencyBinCount); updateBars(); @@ -49,39 +51,37 @@ animationId = requestAnimationFrame(updateBars); } - - + -
-
- {#each Array(numBars) as _} -
- {/each} -
+
+
+ {#each Array(numBars) as _} +
+ {/each}
+
- \ No newline at end of file + \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index f75bd17..f031b0b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,7 @@ build-backend = "hatchling.build" [project] name = "gradio_webrtc" -version = "0.0.6" +version = "0.0.7" description = "Stream images in realtime with webrtc" readme = "README.md" license = "apache-2.0"