mirror of
https://github.com/HumanAIGC-Engineering/gradio-webrtc.git
synced 2026-02-05 18:09:23 +08:00
fix metallic sound
This commit is contained in:
@@ -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);
|
||||
source.connect(analyser);
|
||||
analyser.connect(audioContext.destination);
|
||||
|
||||
// Only connect to analyser, not to destination
|
||||
source.connect(analyser);
|
||||
|
||||
// Configure analyser
|
||||
analyser.fftSize = 64;
|
||||
analyser.smoothingTimeConstant = 0.8; // Add smoothing to make visualization less jittery
|
||||
dataArray = new Uint8Array(analyser.frequencyBinCount);
|
||||
|
||||
updateBars();
|
||||
@@ -49,7 +51,6 @@
|
||||
|
||||
animationId = requestAnimationFrame(updateBars);
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<div class="waveContainer">
|
||||
@@ -83,5 +84,4 @@
|
||||
border-radius: 8px;
|
||||
transition: transform 0.05s ease;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user