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.

feat: voice module updates

nirholas985d4656f52f
diff --git a/src/voice/avatar-snapshot.js b/src/voice/avatar-snapshot.js
index e932ae129..367ff507a 100644
--- a/src/voice/avatar-snapshot.js
+++ b/src/voice/avatar-snapshot.js
@@ -20,6 +20,7 @@
* GLB load.
*/
+import { log } from '../shared/log.js';
const JPEG_QUALITY = 0.86;
const MIN_BYTES = 2_000; // smaller than this means the canvas is blank
const MAX_BYTES = 2 * 1024 * 1024; // 2 MB ceiling (matches server-side cap)
@@ -125,7 +126,7 @@ export async function uploadAvatarSnapshot({ avatarId, scene }) {
);
if (tagRes.ok) autoTagged = await tagRes.json();
} catch (err) {
- console.warn('[snapshot] auto-tag failed, thumbnail still uploaded:', err?.message);
+ log.warn('[snapshot] auto-tag failed, thumbnail still uploaded:', err?.message);
}
return { ok: true, thumbKey: thumb_key, autoTagged };
diff --git a/src/voice/lipsync-driver.js b/src/voice/lipsync-driver.js
index 51d827ef8..42d0ea84f 100644
--- a/src/voice/lipsync-driver.js
+++ b/src/voice/lipsync-driver.js
@@ -22,6 +22,7 @@
* can coexist (e.g. a peer avatar's speech bubble) without ill effects.
*/
+import { log } from '../shared/log.js';
const DEFAULT_FFT_SIZE = 256; // 128 bands — enough resolution for vowel cues
const SMOOTH_ATTACK = 0.45; // weight on new sample when value is rising
const SMOOTH_RELEASE = 0.18; // weight on new sample when value is falling
@@ -107,7 +108,7 @@ export class LipsyncDriver {
} catch (err) {
// Target failures should not kill the loop; log once.
if (!this._loggedTargetErr) {
- console.warn('[lipsync] target error:', err?.message);
+ log.warn('[lipsync] target error:', err?.message);
this._loggedTargetErr = true;
}
}
diff --git a/src/voice/talk-controller.js b/src/voice/talk-controller.js
index 4c1a74dfc..e6b7587bc 100644
--- a/src/voice/talk-controller.js
+++ b/src/voice/talk-controller.js
@@ -26,6 +26,7 @@
*/
import { LipsyncDriver, tapAudioElement } from './lipsync-driver.js';
+import { log } from '../shared/log.js';
const EDGE_VOICES_BY_GENDER = {
female: 'en-US-AriaNeural',
@@ -53,7 +54,7 @@ export class TalkController {
this.systemPromptFn = systemPromptFn || (() => '');
this.onMessage = onMessage || (() => {});
this.onStateChange = onStateChange || (() => {});
- this.onError = onError || ((e) => console.warn('[talk]', e?.message));
+ this.onError = onError || ((e) => log.warn('[talk]', e?.message));
this.mouthTarget = mouthTarget;
this._state = 'idle';
@@ -349,7 +350,7 @@ export class TalkController {
if (!r.ok) {
// Fall back to Edge so the talk loop still completes if ElevenLabs
// is rate-limited or down.
- console.warn('[talk] eleven TTS failed, falling back to edge');
+ log.warn('[talk] eleven TTS failed, falling back to edge');
return this._fetchTtsEdge(text);
}
return r.blob();
diff --git a/src/voice/talk-emotes.js b/src/voice/talk-emotes.js
index eed459729..97d1b929c 100644
--- a/src/voice/talk-emotes.js
+++ b/src/voice/talk-emotes.js
@@ -18,6 +18,7 @@
*/
import { AnimationManager } from '../animation-manager.js';
+import { log } from '../shared/log.js';
// Curated set shown on the talk overlay's emote bar. Keep it short — too
// many buttons creates choice paralysis during a live conversation.
@@ -75,7 +76,7 @@ export class TalkEmotes {
this._manager.setAnimationDefs(list);
return true;
} catch (err) {
- console.warn('[talk-emotes] manifest fetch failed:', err?.message);
+ log.warn('[talk-emotes] manifest fetch failed:', err?.message);
return false;
}
})();
@@ -107,7 +108,7 @@ export class TalkEmotes {
async play(name) {
const def = this._defsByName.get(name);
if (!def) {
- console.warn(`[talk-emotes] unknown emote: ${name}`);
+ log.warn(`[talk-emotes] unknown emote: ${name}`);
return false;
}
@@ -125,7 +126,7 @@ export class TalkEmotes {
try {
await inflight;
} catch (err) {
- console.warn(`[talk-emotes] load failed for "${name}":`, err?.message);
+ log.warn(`[talk-emotes] load failed for "${name}":`, err?.message);
return false;
}
}
diff --git a/src/voice/talk-mode.js b/src/voice/talk-mode.js
index 731b91f9a..53b4f69bc 100644
--- a/src/voice/talk-mode.js
+++ b/src/voice/talk-mode.js
@@ -20,6 +20,7 @@ import { AvatarMouthTarget } from './avatar-morph-target.js';
import { TalkController } from './talk-controller.js';
import { openVoiceCloneModal } from './voice-clone-modal.js';
import { nextPreset, PRESET_LABELS } from './camera-presets.js';
+import { log } from '../shared/log.js';
let activeSession = null;
@@ -37,7 +38,7 @@ export function openTalkMode({ avatar, systemPromptFn }) {
const glbUrl = avatar.model_url || avatar.url;
const glbBlob = avatar.glbBlob || null;
if (!glbUrl && !glbBlob) {
- console.warn('[talk] avatar has no GLB; cannot enter talk mode');
+ log.warn('[talk] avatar has no GLB; cannot enter talk mode');
return null;
}
@@ -83,13 +84,13 @@ export function openTalkMode({ avatar, systemPromptFn }) {
scene.attachMouthTarget(mouthTarget);
const diag = mouthTarget.describe();
if (!mouthTarget.hasAnyMouthDriver()) {
- console.warn('[talk] avatar has no mouth morphs, jaw bone, or head fallback. Diagnostics:', diag);
+ log.warn('[talk] avatar has no mouth morphs, jaw bone, or head fallback. Diagnostics:', diag);
showLipsyncNotice(lipsyncNotice, 'none');
} else if (!mouthTarget.hasMouthMorphs() && !mouthTarget.hasJawBone() && mouthTarget.hasHeadFallback()) {
- console.info('[talk] mouth binding (head fallback):', diag);
+ log.info('[talk] mouth binding (head fallback):', diag);
showLipsyncNotice(lipsyncNotice, 'head');
} else {
- console.info('[talk] mouth binding:', diag);
+ log.info('[talk] mouth binding:', diag);
}
setStatus(statusEl, 'idle');
@@ -313,7 +314,7 @@ const TALK_CSS = `
position: fixed; inset: 0; z-index: 9999;
background:
radial-gradient(ellipse at 50% 30%, rgba(125,211,252,0.10), transparent 60%),
- radial-gradient(ellipse at 70% 80%, rgba(167,139,250,0.08), transparent 50%),
+ radial-gradient(ellipse at 70% 80%, rgba(255,255,255,0.04), transparent 50%),
#050505;
color: #fafafa;
font-family: 'Inter', system-ui, sans-serif;
diff --git a/src/voice/voice-clone-modal.js b/src/voice/voice-clone-modal.js
index 9d957ccba..802d617d2 100644
--- a/src/voice/voice-clone-modal.js
+++ b/src/voice/voice-clone-modal.js
@@ -12,6 +12,7 @@
*/
import { VoiceRecorder } from '../editor/voice-recorder.js';
+import { log } from '../shared/log.js';
let active = null;
@@ -23,7 +24,7 @@ let active = null;
*/
export function openVoiceCloneModal({ agentId, agentName = 'Avatar', onClose } = {}) {
if (!agentId) {
- console.warn('[voice-clone] no agentId — owner has no linked agent yet');
+ log.warn('[voice-clone] no agentId — owner has no linked agent yet');
return null;
}
if (active) return active; // single instance
@@ -74,7 +75,7 @@ export function openVoiceCloneModal({ agentId, agentName = 'Avatar', onClose } =
try {
onClose?.();
} catch (err) {
- console.warn('[voice-clone] onClose threw', err?.message);
+ log.warn('[voice-clone] onClose threw', err?.message);
}
};