perf(hermes-voice): reduce conversational latency
This commit is contained in:
parent
cb5cf6ea12
commit
0f9b43c8ba
@ -252,7 +252,7 @@
|
|||||||
// intermittently unreadable by ffmpeg. A bounded 90-second Opus capture
|
// intermittently unreadable by ffmpeg. A bounded 90-second Opus capture
|
||||||
// is small enough to retain as one browser-owned recording.
|
// is small enough to retain as one browser-owned recording.
|
||||||
recorder.start();
|
recorder.start();
|
||||||
const silenceMs=Math.max(900,parseInt(localStorage.getItem('hermes-voice-silence-ms')||'1600',10)||1600);
|
const silenceMs=Math.max(900,parseInt(localStorage.getItem('hermes-voice-silence-ms')||'1100',10)||1100);
|
||||||
vadTimer=window.setInterval(function(){
|
vadTimer=window.setInterval(function(){
|
||||||
if(!active||token!==generation||!recorder||recorder.state==='inactive') return;
|
if(!active||token!==generation||!recorder||recorder.state==='inactive') return;
|
||||||
analyser.getByteTimeDomainData(samples);
|
analyser.getByteTimeDomainData(samples);
|
||||||
@ -349,7 +349,7 @@
|
|||||||
setState('speaking');
|
setState('speaking');
|
||||||
// Shorter first chunks lower time-to-first-audio; the next chunk is
|
// Shorter first chunks lower time-to-first-audio; the next chunk is
|
||||||
// synthesized while the current one plays.
|
// synthesized while the current one plays.
|
||||||
const chunks=typeof window._splitForTTS==='function'?window._splitForTTS(text,160):[text];
|
const chunks=typeof window._splitForTTS==='function'?window._splitForTTS(text,80):[text];
|
||||||
try{
|
try{
|
||||||
let pending=fetchSpeech(chunks[0],language);
|
let pending=fetchSpeech(chunks[0],language);
|
||||||
for(let index=0;index<chunks.length;index+=1){
|
for(let index=0;index<chunks.length;index+=1){
|
||||||
@ -399,7 +399,12 @@
|
|||||||
localStorage.setItem('hermes-voice-mode-button','true');
|
localStorage.setItem('hermes-voice-mode-button','true');
|
||||||
localStorage.setItem('hermes-tts-engine','atlas');
|
localStorage.setItem('hermes-tts-engine','atlas');
|
||||||
localStorage.setItem('hermes-tts-enabled','true');
|
localStorage.setItem('hermes-tts-enabled','true');
|
||||||
localStorage.setItem('hermes-voice-silence-ms','1600');
|
}
|
||||||
|
// Move existing installations to the lower-latency silence window once;
|
||||||
|
// subsequent user changes remain untouched.
|
||||||
|
if(localStorage.getItem('hermes-atlas-voice-latency-v2')!=='1'){
|
||||||
|
localStorage.setItem('hermes-atlas-voice-latency-v2','1');
|
||||||
|
localStorage.setItem('hermes-voice-silence-ms','1100');
|
||||||
}
|
}
|
||||||
const selector=document.getElementById('settingsTtsEngine');
|
const selector=document.getElementById('settingsTtsEngine');
|
||||||
if(selector&&!selector.querySelector('option[value="atlas"]')){
|
if(selector&&!selector.querySelector('option[value="atlas"]')){
|
||||||
|
|||||||
@ -342,7 +342,9 @@ def test_chat_voice_uses_private_jetson_services_and_shared_auto_route():
|
|||||||
assert "/api/transcribe" in voice_script
|
assert "/api/transcribe" in voice_script
|
||||||
assert "/api/tts" in voice_script
|
assert "/api/tts" in voice_script
|
||||||
assert "speakResponse(generation)" in voice_script
|
assert "speakResponse(generation)" in voice_script
|
||||||
assert "window._splitForTTS(text,160)" in voice_script
|
assert "window._splitForTTS(text,80)" in voice_script
|
||||||
|
assert "hermes-atlas-voice-latency-v2" in voice_script
|
||||||
|
assert "hermes-voice-silence-ms','1100'" in voice_script
|
||||||
assert "pending=fetchSpeech(chunks[index+1],language)" in voice_script
|
assert "pending=fetchSpeech(chunks[index+1],language)" in voice_script
|
||||||
assert "restartSoon(token,450)" in voice_script
|
assert "restartSoon(token,450)" in voice_script
|
||||||
assert "constraints.voiceIsolation=true" in voice_script
|
assert "constraints.voiceIsolation=true" in voice_script
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user