Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

add xspace-agent/xspace-agent/public/js/components/audio-meter.js

overstepping6194d2ff4d9c
diff --git a/xspace-agent/xspace-agent/public/js/components/audio-meter.js b/xspace-agent/xspace-agent/public/js/components/audio-meter.js
new file mode 100644
index 000000000..7128cdba9
--- /dev/null
+++ b/xspace-agent/xspace-agent/public/js/components/audio-meter.js
@@ -0,0 +1,47 @@
+// SPDX-License-Identifier: Apache-2.0
+// Copyright 2026 nirholas (https://github.com/nirholas/xspace-agent) [§32]
+
+// audio-meter.js — Real-time audio level visualization
+
+export class AudioMeter {
+ constructor(fillEl) {
+ this.fillEl = fillEl
+ this.currentLevel = 0
+ this.targetLevel = 0
+ this.animating = false
+ }
+
+ setLevel(level) {
+ // level: 0-1
+ this.targetLevel = Math.max(0, Math.min(1, level))
+ if (!this.animating) {
+ this.animating = true
+ this._animate()
+ }
+ }
+
+ _animate() {
+ const diff = this.targetLevel - this.currentLevel
+ this.currentLevel += diff * 0.3
+
+ if (Math.abs(diff) < 0.001) {
+ this.currentLevel = this.targetLevel
+ this.animating = false
+ }
+
+ this.fillEl.style.width = (this.currentLevel * 100) + '%'
+
+ if (this.animating) {
+ requestAnimationFrame(() => this._animate())
+ }
+ }
+
+ reset() {
+ this.targetLevel = 0
+ this.currentLevel = 0
+ this.fillEl.style.width = '0%'
+ this.animating = false
+ }
+}
+
+