File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ import { getFirstMessagePrompt, getSystemPrompt } from "../src/prompt";
55
66const AUDIO_OUTPUT_SAMPLE_RATE = 24_000 ;
77const INPUT_SILENCE_DURATION_MS = 1000 ;
8- const INPUT_LEVEL_THRESHOLD = 900 ;
8+ const INPUT_LEVEL_THRESHOLD = 180 ;
99
1010interface OpenAIChatMessage {
1111 role : "system" | "user" | "assistant" ;
@@ -199,7 +199,9 @@ export class ElatoOpenAiVoiceAgent extends DurableObject<Env> {
199199 return ;
200200 }
201201
202- console . log ( "[cloudflare][vad] silence detected, auto-committing turn" ) ;
202+ console . log (
203+ `[cloudflare][vad] silence detected, auto-committing turn (${ this . audioBuffer . byteLength } bytes buffered)` ,
204+ ) ;
203205 this . isGenerating = true ;
204206 this . sawUserSpeech = false ;
205207
@@ -325,7 +327,7 @@ export class ElatoOpenAiVoiceAgent extends DurableObject<Env> {
325327 const level = this . calculateAudioLevel ( chunk ) ;
326328 if ( level >= INPUT_LEVEL_THRESHOLD ) {
327329 if ( ! this . sawUserSpeech ) {
328- console . log ( `[cloudflare][vad] speech started (level=${ level } )` ) ;
330+ console . log ( `[cloudflare][vad] speech started (level=${ level } , threshold= ${ INPUT_LEVEL_THRESHOLD } )` ) ;
329331 }
330332 this . sawUserSpeech = true ;
331333 this . scheduleAutoCommit ( server ) ;
You can’t perform that action at this time.
0 commit comments