PageSourceSearch

https://www.smartchats.ai/_site/_next/static/chunks/pages/docs/packages/tivi-fe2405c90c4ea2cb.js

js smartchats.ai collected 2026-10-05 15:06:45 UTC 41,356 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[673],{2131:function(i,s,e){(window.__NEXT_P=window.__NEXT_P||[]).push(["/docs/packages/tivi",function(){return e(3256)}])},3256:function(i,s,e){"use strict";e.r(s),e.d(s,{useTOC:function(){return d}});var n=e(2322),t=e(4974),h=e(5889),r=e(7854),l=e(8095),a=e(5733);function d(i){let s={code:"code",...(0,r.a)()};return[{value:"What’s in the box",id:"whats-in-the-box",depth:2},{value:"Quick start",id:"quick-start",depth:2},{value:"The three subsystems",id:"the-three-subsystems",depth:2},{value:"1. Voice Activity Detection (VAD)",id:"1-voice-activity-detection-vad",depth:3},{value:"2. Speech Recognition",id:"2-speech-recognition",depth:3},{value:"3. TTS playback queue",id:"3-tts-playback-queue",depth:3},{value:"Calibration",id:"calibration",depth:2},{value:"Phase 1 — Speech sample",id:"phase-1--speech-sample",depth:3},{value:"Phase 2 — Silence sample",id:"phase-2--silence-sample",depth:3},{value:"When to recommend calibration",id:"when-to-recommend-calibration",depth:3},{value:"Programmatic calibration",id:"programmatic-calibration",depth:3},{value:(0,n.jsxs)(n.Fragment,{children:["Settings — ",(0,n.jsx)(s.code,{children:"TIVI_DEFAULTS"})," and ",(0,n.jsx)(s.code,{children:"useTiviSettings"})]}),id:"settings--tivi_defaults-and-usetivisettings",depth:2},{value:"Common pitfalls",id:"common-pitfalls",depth:2},{value:"Source",id:"source",depth:2}]}s.default=(0,t.c)(function(i){let{toc:s=d(i)}=i,e={a:"a",code:"code",em:"em",h1:"h1",h2:"h2",h3:"h3",li:"li",ol:"ol",p:"p",pre:"pre",span:"span",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",ul:"ul",...(0,r.a)(),...i.components};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(e.h1,{children:"tivi — Voice Interface"}),"\n",(0,n.jsxs)(e.p,{children:[(0,n.jsx)(e.strong,{children:(0,n.jsx)(e.code,{children:"tivi"})})," is the voice layer of SmartChats: a single React hook\n(",(0,n.jsx)(e.code,{children:"useTivi"}),") that gives you push-to-talk, hands-free continuous\nlistening, interruption-aware TTS, and mic calibration in one package.\nIt runs Silero VAD v5 in ONNX directly in the browser — no server\nround-trip for “is the user talking?”"]}),"\n",(0,n.jsxs)(e.p,{children:["The package is self-contained. You can drop ",(0,n.jsx)(e.code,{children:"useTivi"})," into any React\napp and get voice working without adopting the rest of SmartChats."]}),"\n",(0,n.jsx)(e.h2,{id:s[0].id,children:s[0].value}),"\n",(0,n.jsxs)(e.table,{children:[(0,n.jsx)(e.thead,{children:(0,n.jsxs)(e.tr,{children:[(0,n.jsx)(e.th,{children:"Piece"}),(0,n.jsx)(e.th,{children:"What it does"})]})}),(0,n.jsxs)(e.tbody,{children:[(0,n.jsxs)(e.tr,{children:[(0,n.jsx)(e.td,{children:(0,n.jsx)(e.code,{children:"useTivi"})}),(0,n.jsx)(e.td,{children:"React hook — the main API"})]}),(0,n.jsxs)(e.tr,{children:[(0,n.jsx)(e.td,{children:"Silero VAD v5"}),(0,n.jsx)(e.td,{children:"Voice activity detection (ONNX, browser-side)"})]}),(0,n.jsxs)(e.tr,{children:[(0,n.jsx)(e.td,{children:"Speech Recognition"}),(0,n.jsxs)(e.td,{children:["Browser ",(0,n.jsx)(e.code,{children:"webkitSpeechRecognition"})," / ",(0,n.jsx)(e.code,{children:"SpeechRecognition"})," wrapper"]})]}),(0,n.jsxs)(e.tr,{children:[(0,n.jsx)(e.td,{children:"TTS playback queue"}),(0,n.jsx)(e.td,{children:"Buffered text-to-speech with mid-sentence interruption"})]}),(0,n.jsxs)(e.tr,{children:[(0,n.jsx)(e.td,{children:(0,n.jsx)(e.code,{children:"CalibrationPanel"})}),(0,n.jsx)(e.td,{children:"Two-phase mic calibration UI"})]}),(0,n.jsxs)(e.tr,{children:[(0,n.jsx)(e.td,{children:(0,n.jsx)(e.code,{children:"VoiceSelector"})}),(0,n.jsx)(e.td,{children:"TTS voice picker"})]}),(0,n.jsxs)(e.tr,{children:[(0,n.jsxs)(e.td,{children:[(0,n.jsx)(e.code,{children:"TIVI_DEFAULTS"})," + ",(0,n.jsx)(e.code,{children:"useTiviSettings"})]}),(0,n.jsx)(e.td,{children:"Persistent device-local settings"})]})]})]}),"\n",(0,n.jsx)(e.h2,{id:s[1].id,children:s[1].value}),"\n",(0,n.jsx)(e.pre,{icon:a.KP,tabIndex:"0","data-language":"tsx","data-word-wrap":"",children:(0,n.jsxs)(e.code,{children:[(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"import"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" { useTivi } "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"from"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:" 'tivi'"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:";"})]}),"\n",(0,n.jsx)(e.span,{children:" "}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"function"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:" Mic"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}
1,children:"() {"})]}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"  const"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:" tivi"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:" ="}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:" useTivi"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"({"})]}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:"    onTranscription"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:": ("}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#E36209","--shiki-dark":"#FFAB70"},children:"text"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:") "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"=>"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" console."}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:"log"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"("}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:"'user said:'"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:", text),"})]}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:"    onInterrupt"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:": () "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"=>"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" console."}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:"log"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"("}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:"'user interrupted TTS'"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"),"})]}),"\n",(0,n.jsx)(e.span,{children:(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"  });"})}),"\n",(0,n.jsx)(e.span,{children:" "}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"  return"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" ("})]}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"    <"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#22863A","--shiki-dark":"#85E89D"},children:"button"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:" onClick"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"="}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"{tivi.isListening "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"?"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" tivi.stopListening "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:":"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" tivi.startListening}>"})]}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"      {tivi.isListening "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"?"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:" 'Stop'"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:" :"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:" 'Start'"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"} listening"})]}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"    </"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#22863A","--shiki-dark":"#85E89D"},children:"button"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:">"})]}),"\n",(0,n.jsx)(e.span,{children:(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"  );"})}),"\n",(0,n.jsx)(e.span,{children:(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"}"})})]})}),"\n",(0,n.jsx)(e.p,{children:"That’s a working voice interface. The hook handles mic permission, VAD\ninference, transcription, and audio cleanup on unmount."}),"\n",(0,n.jsxs)(e.p,{children:["To make the agent ",(0,n.jsx)(e.strong,{children:"speak back"}),":"]}),"\n",(0,n.jsx)(e.pre,{icon:a.KP,tabIndex:"0","data-language":"tsx","data-word-wrap":"",children:(0,n.jsx)(e.code,{children:(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"await"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" tivi."}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:"speak"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"("}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:"'Hello — I heard you say that.'"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:");"})]})})}),"\n",(0,n.jsxs)(e.p,{children:["If the user starts talking while TTS is playing, the VAD detects it,\nTTS pauses immediately, and your ",(0,n.jsx)(e.code,{children:"onInterrupt"})," callback fires."]}),"\n",(0,n.jsx)(e.h2,{id:s[2].id,children:s[2].value}),"\n",(0,n.jsx)(e.h3,{id:s[3].id,children:s[3].value}),"\n",(0,n.jsxs)(e.p,{children:["Silero VAD v5 runs as an ONNX model in the browser via\n",(0,n.jsx)(e.code,{children:"onnxruntime-web"}),". For each 32 ms audio frame, the model emits a\n",(0,n.jsx)(e.strong,{children:"speech probability"})," in ",(0,n.jsx)(e.code,{children:"[0, 1]"}),". Two thresholds turn that into a\nbinary “is speaking” signal:"]}),"\n",(0,n.jsxs)(e.table,{children:[(0,n.jsx)(e.thead,{children:(0,n.jsxs)(e.tr,{children:[(0,n.jsx)(e.th,{children:"Setting"}),(0,n.jsx)(e.th,{children:"Default"}),(0,n.jsx)(e.th,{children:"What it controls"})]})}),(0,n.jsxs)(e.tbody,{children:[(0,n.jsxs)(e.tr,{children:[(0,n.jsx)(e.td,{children:(0,n.jsx)(e.code,{children:"positiveSpeechThreshold"})}),(0,n.jsx)(e.td,{children:(0,n.jsx)(e.strong,{children:"0.5"})}),(0,n.jsxs)(e.td,{children:["Probability needed to ",(0,n.jsx)(e.em,{children:"start"})," a speech segment"]})]}),(0,n.jsxs)(e.tr,{children:[(0,n.jsx)(e.td,{children:(0,n.jsx)(e.code,{children:"negativeSpeechThreshold"})}),(0,n.jsx)(e.td,{children:(0,n.jsx)(e.strong,{children:"0.35"})}),(0,n.jsxs)(e.td,{children:["Probability below which speech is considered ",(0,n.jsx)(e.em,{children:"ended"})]})]}),(0,n.jsxs)(e.tr,{children:[(0,n.jsx)(e.td,{children:(0,n.jsx)(e.code,{children:"minSpeechStartMs"})}),(0,n.jsx)(e.td,{children:"150 ms"}),(0,n.jsx)(e.td,{children:"How long the signal must sustain before declaring “speaking”"})]}),(0,n.jsxs)(e.tr,{children:[(0,n.jsx)(e.td,{children:(0,n.jsx)(e.code,{children:"redemptionMs"})}),(0,n.jsx)(e.td,{children:"1400 ms"}),(0,n.jsx)(e.td,{children:"Grace window before declaring speech over (smooths over pauses)"})]})]})]}),"\n",(0,n.jsx)(e.p,{children:"The asymmetry between the two thresholds (start higher, end lower) is\ndeliberate hysteresis — prevents the VAD from rapidly toggling on\nborderline frames."}),"\n",(0,n.jsx)(l.U,{type:"info",children:(0,n.jsxs)(e.p,{children:[(0,n.jsx)(e.strong,{children:"Updated defaults (2026-05-19):"})," thresholds were lowered from\n0.8 / 0.6 to 0.5 / 0.35 based on field testing. Lower thresholds\ncatch quieter speech and start sentences earlier, at the cost of\noccasional false-positives from sharp background noise."]})}),"\n",(0,n.jsx)(e.h3,{id:s[4].id,children:s[4].value}),"\n",(0,n.jsxs)(e.p,{children:["Browser-native ",(0,n.jsx)(e.code,{children:"SpeechRecognition"})," (Web Speech API). Tivi wraps it to:"]}),"\n",(0,n.jsxs)(e.ul,{children:["\n",(0,n.jsx)(e.li,{children:"Restart automatically when the API stops on its own (the API ends\nitself after silence; for continuous listening we need to restart it)"}),"\n",(0,n.jsxs)(e.li,{children:["Emit ",(0,n.jsx)(e.code,{children:"interim"})," results during partial transcription"]}),"\n",(0,n.jsxs)(e.li,{children:["Emit ",(0,n.jsx)(e.code,{children:"final"})," results once the engine commits"]}),"\n"]}),"\n",(0,n.jsxs)(e.p,{children:["You get both via ",(0,n.jsx)(e.code,{children:"onTranscription"})," (final) and ",(0,n.jsx)(e.code,{children:"interimResult"})," (live)."]}),"\n",(0,n.jsx)(e.h3,{id:s[5].id,children:s[5].value}),"\n",(0,n.jsxs)(e.p,{children:["When you call ",(0,n.jsx)(e.code,{children:'tivi.speak("...")'})," the text gets pushed onto a queue\nthat:"]}),"\n",(0,n.jsxs)(e.ul,{children:["\n",(0,n.jsx)(e.li,{children:"Plays utterances in order"}),"\n",(0,n.jsx)(e.li,{children:"Pauses immediately when the VAD detects a speech-start (interruption)"}),"\n",(0,n.jsxs)(e.li,{children:["Coalesces back-to-back ",(0,n.jsx)(e.code,{children:"speak()"})," calls into a single playback session"]}),"\n",(0,n.jsxs)(e.li,{children:["Reports queue state via ",(0,n.jsx)(e.code,{children:"onQueueStateChange"})," (useful for status UI)"]}
1),"\n"]}),"\n",(0,n.jsxs)(e.p,{children:["TTS backend is configurable per ",(0,n.jsx)(e.code,{children:"TiviSettings.ttsProvider"}),":\n",(0,n.jsx)(e.code,{children:"browser"})," (default — uses local ",(0,n.jsx)(e.code,{children:"SpeechSynthesis"}),") or ",(0,n.jsx)(e.code,{children:"openai"})," (calls\n",(0,n.jsx)(e.code,{children:"tivi.openai.com"}),"-style cloud TTS via a passed-in callable)."]}),"\n",(0,n.jsx)(e.h2,{id:s[6].id,children:s[6].value}),"\n",(0,n.jsxs)(e.p,{children:["The single biggest factor in voice quality is the ",(0,n.jsx)(e.strong,{children:"mic + room +\nvoice"})," combination. Default VAD thresholds work for most setups, but\na quiet talker on a laptop mic in a noisy room will need different\nthresholds than a loud talker on a headset."]}),"\n",(0,n.jsxs)(e.p,{children:[(0,n.jsx)(e.code,{children:"CalibrationPanel"})," runs a ",(0,n.jsx)(e.strong,{children:"two-phase guided calibration"}),":"]}),"\n",(0,n.jsx)(e.h3,{id:s[7].id,children:s[7].value}),"\n",(0,n.jsxs)(e.ol,{children:["\n",(0,n.jsx)(e.li,{children:"User clicks “Calibrate” → 5-second countdown"}),"\n",(0,n.jsx)(e.li,{children:"User speaks naturally for ~10 seconds"}),"\n",(0,n.jsx)(e.li,{children:"Tivi records VAD probabilities for every frame"}),"\n",(0,n.jsxs)(e.li,{children:["Computes ",(0,n.jsx)(e.code,{children:"positiveSpeechThreshold"})," as the ",(0,n.jsx)(e.strong,{children:"30th percentile"})," of\nframes the user was actually talking through (so 70% of real-speech\nframes will trigger detection)"]}),"\n",(0,n.jsxs)(e.li,{children:["Computes ",(0,n.jsx)(e.code,{children:"negativeSpeechThreshold"})," as ",(0,n.jsx)(e.strong,{children:"65% of the positive threshold"}),"\n(preserves the hysteresis ratio)"]}),"\n"]}),"\n",(0,n.jsx)(e.h3,{id:s[8].id,children:s[8].value}),"\n",(0,n.jsxs)(e.ol,{children:["\n",(0,n.jsx)(e.li,{children:"User stays quiet for ~5 seconds"}),"\n",(0,n.jsx)(e.li,{children:"Tivi confirms the new thresholds don’t trip on background noise"}),"\n",(0,n.jsx)(e.li,{children:"If they do, raises both thresholds proportionally until quiet =\nsilent"}),"\n"]}),"\n",(0,n.jsx)(e.p,{children:"User can accept the result or revert."}),"\n",(0,n.jsx)(e.pre,{icon:a.KP,tabIndex:"0","data-language":"tsx","data-word-wrap":"",children:(0,n.jsxs)(e.code,{children:[(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"import"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" { CalibrationPanel } "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"from"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:" 'tivi'"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:";"})]}),"\n",(0,n.jsx)(e.span,{children:" "}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"<"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:"CalibrationPanel"})]}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:"  showTrigger"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"="}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"{"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:"true"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"}      "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#6A737D","--shiki-dark":"#6A737D"},children:'// render the "Calibrate" button itself'})]}),"\n",(0,n.jsx)(e.span,{children:(0,n.jsx)(e.span,{style:{"--shiki-light":"#6A737D","--shiki-dark":"#6A737D"},children:"  // or showTrigger={false} and call ref.startCalibration() externally"})}),"\n",(0,n.jsx)(e.span,{children:(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"/>"})})]})}),"\n",(0,n.jsxs)(e.p,{children:["The panel is a ",(0,n.jsx)(e.code,{children:"forwardRef"})," component — pass a ref to call\n",(0,n.jsx)(e.code,{children:"startCalibration()"})," from a parent. Useful when the trigger button\nlives elsewhere in your layout."]}),"\n",(0,n.jsx)(e.h3,{id:s[9].id,children:s[9].value}),"\n",(0,n.jsxs)(e.ul,{children:["\n",(0,n.jsx)(e.li,{children:"New user, first-run experience (most common)"}),"\n",(0,n.jsx)(e.li,{children:"User switches mics (laptop → headset → AirPods)"}),"\n",(0,n.jsx)(e.li,{children:"User reports “it’s not hearing me” or “it’s cutting me off”"}),"\n",(0,n.jsx)(e.li,{children:"User changes environment (quiet room → coffee shop)"}),"\n"]}),"\n",(0,n.jsx)(e.h3,{id:s[10].id,children:s[10].value}),"\n",(0,n.jsxs)(e.p,{children:[(0,n.jsx)(e.code,{children:"useCalibration()"})," exposes the phase machine directly if you want a\ncustom UI:"]}),"\n",(0,n.jsx)(e.pre,{icon:a.KP,tabIndex:"0","data-language":"ts","data-word-wrap":"",children:(0,n.jsxs)(e.code,{children:[(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"const"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:" calibration"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:" ="}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:" useCalibration"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"({ tivi });"})]}),"\n",(0,n.jsx)(e.span,{children:" "}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"calibration."}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:"start"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}
1,children:"();        "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#6A737D","--shiki-dark":"#6A737D"},children:"// begin phase 1"})]}),"\n",(0,n.jsx)(e.span,{children:(0,n.jsx)(e.span,{style:{"--shiki-light":"#6A737D","--shiki-dark":"#6A737D"},children:"// ...wait for phase1Complete event"})}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"calibration."}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:"next"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"();         "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#6A737D","--shiki-dark":"#6A737D"},children:"// begin phase 2"})]}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"calibration."}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:"apply"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"();        "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#6A737D","--shiki-dark":"#6A737D"},children:"// commit thresholds to TIVI settings"})]}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"calibration."}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:"cancel"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"();       "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#6A737D","--shiki-dark":"#6A737D"},children:"// discard and restore"})]})]})}),"\n",(0,n.jsx)(e.h2,{id:s[11].id,children:s[11].value}),"\n",(0,n.jsx)(e.p,{children:"Settings are device-local (localStorage), keyed per browser profile.\nThe shape:"}),"\n",(0,n.jsx)(e.pre,{icon:a.KP,tabIndex:"0","data-language":"ts","data-word-wrap":"",children:(0,n.jsxs)(e.code,{children:[(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"type"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:" TiviSettings"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:" ="}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" {"})]}),"\n",(0,n.jsx)(e.span,{children:(0,n.jsx)(e.span,{style:{"--shiki-light":"#6A737D","--shiki-dark":"#6A737D"},children:"  // VAD"})}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#E36209","--shiki-dark":"#FFAB70"},children:"  positiveSpeechThreshold"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:":"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:" number"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:";  "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#6A737D","--shiki-dark":"#6A737D"},children:"// 0.5"})]}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#E36209","--shiki-dark":"#FFAB70"},children:"  negativeSpeechThreshold"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:":"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:" number"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:";  "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#6A737D","--shiki-dark":"#6A737D"},children:"// 0.35"})]}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#E36209","--shiki-dark":"#FFAB70"},children:"  minSpeechStartMs"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:":"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:" number"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:";         "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#6A737D","--shiki-dark":"#6A737D"},children:"// 150"})]}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#E36209","--shiki-dark":"#FFAB
170"},children:"  powerThreshold"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:":"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:" number"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:";           "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#6A737D","--shiki-dark":"#6A737D"},children:"// 0.01 — RMS gate (drops near-zero noise)"})]}),"\n",(0,n.jsx)(e.span,{children:" "}),"\n",(0,n.jsx)(e.span,{children:(0,n.jsx)(e.span,{style:{"--shiki-light":"#6A737D","--shiki-dark":"#6A737D"},children:"  // Behavior"})}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#E36209","--shiki-dark":"#FFAB70"},children:"  mode"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:":"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:" 'responsive'"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:" |"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:" 'deliberate'"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:";    "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#6A737D","--shiki-dark":"#6A737D"},children:"// tuning preset"})]}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#E36209","--shiki-dark":"#FFAB70"},children:"  enableInterruption"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:":"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:" boolean"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:";           "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#6A737D","--shiki-dark":"#6A737D"},children:"// VAD pauses TTS mid-utterance"})]}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#E36209","--shiki-dark":"#FFAB70"},children:"  verbose"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:":"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:" boolean"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:";                      "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#6A737D","--shiki-dark":"#6A737D"},children:"// debug logging"})]}),"\n",(0,n.jsx)(e.span,{children:" "}),"\n",(0,n.jsx)(e.span,{children:(0,n.jsx)(e.span,{style:{"--shiki-light":"#6A737D","--shiki-dark":"#6A737D"},children:"  // TTS"})}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#E36209","--shiki-dark":"#FFAB70"},children:"  playbackRate"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:":"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:" number"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:";             "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#6A737D","--shiki-dark":"#6A737D"},children:"// 1.5 (faster than realtime)"})]}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#E36209","--shiki-dark":"#FFAB70"},children:"  defaultVoiceURI"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:":"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:" string"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:" |"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:" null"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:";"})]}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#E36209","--shiki-dark":"#FFAB70"},children:"  language"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:":"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:" string"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:";                 "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#6A737D","--shiki-dark":"#6A737D"},children:"// 'en-US'"})]}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#E36209","--shiki-dark":"#FFAB
170"},children:"  ttsProvider"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:":"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:" 'browser'"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:" |"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:" 'openai'"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:";"})]}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#E36209","--shiki-dark":"#FFAB70"},children:"  ttsBackend"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:":"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:" 'firebase'"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:" |"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:" 'local'"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:";"})]}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#E36209","--shiki-dark":"#FFAB70"},children:"  openaiVoice"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:":"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:" string"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:";              "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#6A737D","--shiki-dark":"#6A737D"},children:"// 'marin'"})]}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#E36209","--shiki-dark":"#FFAB70"},children:"  openaiModel"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:":"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:" string"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:";              "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#6A737D","--shiki-dark":"#6A737D"},children:"// 'gpt-4o-mini-tts'"})]}),"\n",(0,n.jsx)(e.span,{children:(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"};"})})]})}),"\n",(0,n.jsx)(e.p,{children:"Read/update from anywhere:"}),"\n",(0,n.jsx)(e.pre,{icon:a.KP,tabIndex:"0","data-language":"ts","data-word-wrap":"",children:(0,n.jsxs)(e.code,{children:[(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"import"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" { getTiviSettings, updateTiviSettings, TIVI_DEFAULTS, useTiviSettings } "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"from"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:" 'tivi'"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:";"})]}),"\n",(0,n.jsx)(e.span,{children:" "}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"const"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:" current"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:" ="}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:" getTiviSettings"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"();        "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#6A737D","--shiki-dark":"#6A737D"},children:"// imperative read"})]}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:"updateTiviSettings"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"({ playbackRate: "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:"2.0"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" }); "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#6A737D","--shiki-dark":"#6A737D"},children:"// partial update"})]}),"\n",(0,n.jsx)(e.span,{children:" "}),"\n",(0,n.jsx)(e.span,{children:(0,n.jsx)(e.span,{style:{"--shiki-light":"#6A737D","--shiki-dark":"#6A737D"},children:"// or as a hook:"})}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"const"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" { "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:"settings"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:", "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:"updateSettings"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" } "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"="}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:" useTiviSettings"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}
1,children:"();"})]})]})}),"\n",(0,n.jsx)(e.h2,{id:s[12].id,children:s[12].value}),"\n",(0,n.jsx)(l.U,{type:"warning",children:(0,n.jsxs)(e.p,{children:[(0,n.jsx)(e.strong,{children:"The mic stays on after unmount."})," ",(0,n.jsx)(e.code,{children:"useTivi"})," registers a stream;\nalways call ",(0,n.jsx)(e.code,{children:"tivi.stopListening()"})," before your component unmounts,\nnot just rely on the cleanup. Otherwise the browser tab icon stays\nin “recording” state."]})}),"\n",(0,n.jsx)(l.U,{type:"warning",children:(0,n.jsxs)(e.p,{children:[(0,n.jsxs)(e.strong,{children:[(0,n.jsx)(e.code,{children:"speechProbRef"})," doesn’t reset on pause."]})," It’s a ",(0,n.jsx)(e.code,{children:"useRef"}),", not\nstate. When VAD pauses, the last probability sticks. If your UI\nbinds to it for a meter, manually set it to 0 on\n",(0,n.jsx)(e.code,{children:"stopListening"})," / ",(0,n.jsx)(e.code,{children:"pauseProcessing"}),"."]})}),"\n",(0,n.jsx)(l.U,{type:"warning",children:(0,n.jsxs)(e.p,{children:[(0,n.jsxs)(e.strong,{children:["Silero VAD model file (",(0,n.jsx)(e.code,{children:"silero_vad_v5.onnx"}),") must be at\n",(0,n.jsx)(e.code,{children:"/public/onnx/silero_vad_v5.onnx"}),"."]})," The SmartChats prebuild script\ncopies it from ",(0,n.jsx)(e.code,{children:"node_modules/@ricky0123/vad-web/dist/"}),". If you embed\ntivi in another project, make sure to copy this 2.3 MB file into\nyour ",(0,n.jsx)(e.code,{children:"public/"})," at build time."]})}),"\n",(0,n.jsx)(l.U,{type:"warning",children:(0,n.jsxs)(e.p,{children:[(0,n.jsx)(e.strong,{children:"iOS Safari needs a user-gesture to start audio."})," Initialize the\nhook on a button click, not on mount. Mounting and then expecting\naudio to flow will fail silently on iOS."]})}),"\n",(0,n.jsx)(e.h2,{id:s[13].id,children:s[13].value}),"\n",(0,n.jsxs)(e.ul,{children:["\n",(0,n.jsxs)(e.li,{children:["Package: ",(0,n.jsx)(e.code,{children:"packages/tivi/"})]}),"\n",(0,n.jsxs)(e.li,{children:["Entry: ",(0,n.jsx)(e.code,{children:"packages/tivi/src/index.ts"})]}),"\n",(0,n.jsxs)(e.li,{children:["VAD core: ",(0,n.jsx)(e.code,{children:"packages/tivi/src/lib/ts_vad/"})]}),"\n",(0,n.jsxs)(e.li,{children:["ONNX loader: ",(0,n.jsx)(e.code,{children:"packages/tivi/src/lib/onnx.ts"})]}),"\n",(0,n.jsxs)(e.li,{children:["Calibration: ",(0,n.jsx)(e.code,{children:"packages/tivi/src/lib/useCalibration.ts"}),",\n",(0,n.jsx)(e.code,{children:"packages/tivi/src/CalibrationPanel.tsx"}),",\n",(0,n.jsx)(e.code,{children:"packages/tivi/src/CalibrationViz.tsx"})]}),"\n"]}),"\n",(0,n.jsxs)(e.p,{children:["See also: ",(0,n.jsxs)(e.a,{href:"https://github.com/sheunaluko/smartchats/blob/master/packages/tivi/src/lib/useTivi.ts",children:[(0,n.jsx)(e.code,{children:"useTivi"})," reference in source"]})," for the\nfull options + returned-state shape."]})]})},"/docs/packages/tivi",{filePath:"pages/docs/packages/tivi.mdx",timestamp:1786799065e3,pageMap:h.v,frontMatter:{},title:"tivi — Voice Interface"},"undefined"==typeof RemoteContent?d:RemoteContent.useTOC)},8095:function(i,s,e){"use strict";e.d(s,{U:function(){return a}});var n=e(2322),t=e(489),h=e(5733);let r={default:"\uD83D\uDCA1",error:"\uD83D\uDEAB",info:(0,n.jsx)(h.AV,{className:"_mt-1"}),warning:"⚠️"},l={default:(0,t.Z)("_border-orange-100 _bg-orange-50 _text-orange-800 dark:_border-orange-400/30 dark:_bg-orange-400/20 dark:_text-orange-300"),error:(0,t.Z)("_border-red-200 _bg-red-100 _text-red-900 dark:_border-red-200/30 dark:_bg-red-900/30 dark:_text-red-200"),info:(0,t.Z)("_border-blue-200 _bg-blue-100 _text-blue-900 dark:_border-blue-200/30 dark:_bg-blue-900/30 dark:_text-blue-200"),warning:(0,t.Z)("_border-yellow-100 _bg-yellow-50 _text-yellow-900 dark:_border-yellow-200/30 dark:_bg-yellow-700/30 dark:_text-yellow-200")};function a({children:i,type:s="default",emoji:e=r[s]}){return(0,n.jsxs)("div",{className:(0,t.Z)("nextra-callout _overflow-x-auto _mt-6 _flex _rounded-lg _border _py-2 ltr:_pr-4 rtl:_pl-4","contrast-more:_border-current contrast-more:dark:_border-current",l[s]),children:[(0,n.jsx)("div",{className:"_select-none _text-xl ltr:_pl-3 ltr:_pr-2 rtl:_pr-3 rtl:_pl-2",style:{fontFamily:'"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"'},children:e}),(0,n.jsx)("div",{className:"_w-full _min-w-0 _leading-7",children:i})]})}},5889:function(i,s,e){"use strict";e.d(s,{v:function(){return n}});let n=[{name:"docs",route:"/docs",children:[{data:{index:"Welcome",quickstart:"Quick Start","self-host":"Self-Hosting",cli:"CLI Reference",architecture:"Architecture",packages:"Packages",mcp:"MCP Server",contributing:"Contributing"}}
1,{name:"architecture",route:"/docs/architecture",frontMatter:{sidebarTitle:"Architecture"}},{name:"cli",route:"/docs/cli",frontMatter:{sidebarTitle:"CLI"}},{name:"contributing",route:"/docs/contributing",frontMatter:{sidebarTitle:"Contributing"}},{name:"index",route:"/docs",frontMatter:{sidebarTitle:"Index"}},{name:"mcp",route:"/docs/mcp",frontMatter:{sidebarTitle:"Mcp"}},{name:"packages",route:"/docs/packages",children:[{data:{index:"Overview",tivi:"tivi — Voice Interface",cortex:"cortex — Agent Runtime","smartchats-database":"smartchats-database","smartchats-backend":"smartchats-backend","smartchats-sessions":"smartchats-sessions","llm-service":"llm-service",simi:"simi — Workflow Tests"}},{name:"cortex",route:"/docs/packages/cortex",frontMatter:{sidebarTitle:"Cortex"}},{name:"index",route:"/docs/packages",frontMatter:{sidebarTitle:"Index"}},{name:"llm-service",route:"/docs/packages/llm-service",frontMatter:{sidebarTitle:"Llm Service"}},{name:"simi",route:"/docs/packages/simi",frontMatter:{sidebarTitle:"Simi"}},{name:"smartchats-backend",route:"/docs/packages/smartchats-backend",frontMatter:{sidebarTitle:"Smartchats Backend"}},{name:"smartchats-database",route:"/docs/packages/smartchats-database",frontMatter:{sidebarTitle:"Smartchats Database"}},{name:"smartchats-sessions",route:"/docs/packages/smartchats-sessions",frontMatter:{sidebarTitle:"Smartchats Sessions"}},{name:"tivi",route:"/docs/packages/tivi",frontMatter:{sidebarTitle:"Tivi"}}]},{name:"quickstart",route:"/docs/quickstart",frontMatter:{sidebarTitle:"Quickstart"}},{name:"self-host",route:"/docs/self-host",frontMatter:{sidebarTitle:"Self Host"}}]}]}},function(i){i.O(0,[974,888,774,179],function(){return i(i.s=2131)}),_N_E=i.O()}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.