🎤Micdrop

Smart Turn end of turn detection in JavaScript, step by step

Run the open Smart Turn v3 model in the browser and in Node.js with TypeScript, on its own or inside a voice agent, so the agent waits through hesitations and answers finished sentences fast.

November 29, 2026

Godefroy de Compreignac

Key takeaways

  • Smart Turn v3 is an open model of 8 million parameters, published by Daily under the BSD 2-Clause license, that tells from the sound of a sentence whether the speaker has finished.
  • @micdrop/smart-turn runs it in JavaScript: ONNX Runtime Web in the browser, on WebGPU or WebAssembly, onnxruntime-node on a server, onnxruntime-react-native on a phone.
  • Used alone, it takes audio with push() and answers predict() with a probability. Inside a Micdrop call, one option holds the turn while the user hesitates.
  • A held turn always has a deadline, so a wrong verdict costs a few seconds rather than a stuck call.

A voice agent that answers on a fixed silence cuts people off when they pause to think, or makes everyone wait to be safe. End of turn detection fixes that by listening to the sentence itself. Smart Turn is the open model most voice frameworks use for it, and this tutorial runs it in JavaScript: first on its own in a web page, then inside a voice conversation, then on a Node.js server for phone calls.

The code uses @micdrop/smart-turn, a TypeScript port of the Smart Turn inference maintained by Micdrop. For the theory behind it, the three signals that can end a turn and how they compare, read how voice agents know you stopped talking.

What Smart Turn hears

Smart Turn v3 is a Whisper Tiny audio encoder with a small classifier on top, 8 million parameters in all, published by Daily, the company behind the Pipecat framework, under the BSD 2-Clause license. It reads up to the last eight seconds of a turn as audio and answers with one probability: has the speaker finished?

It hears what a transcript loses. A statement whose pitch falls at the end sounds finished. A “so I was thinking that…” that trails off, or an “um” held on one note, sounds unfinished, in any of the 23 languages the model was trained on. Because it reads audio, it answers without waiting for a transcript, fast enough to run at every pause.

Smart Turn does not replace a voice activity detector. The VAD, usually Silero, hears that the user went quiet. Smart Turn then decides whether that silence ends the turn.

Step 1: Smart Turn on its own in a web page

The package works without the rest of Micdrop, with the small @micdrop/core as its only Micdrop dependency, so any JavaScript app can call it. Feed it the audio of the turn with push(), and ask predict() when the speaker pauses:

Terminal window
npm install @micdrop/smart-turn @micdrop/web onnxruntime-web
src/main.ts
import { SmartTurn } from '@micdrop/smart-turn'
import '@micdrop/smart-turn/web'
import { Mic, MicRecorder } from '@micdrop/web'
import '@micdrop/web/silero'
const smartTurn = new SmartTurn()
const status = document.createElement('p')
document.body.append(status)
document.body.onclick = async () => {
await Mic.start()
// Every frame of the microphone goes to Smart Turn, pauses included
Mic.on('Frames', (samples, sampleRate) => smartTurn.push(samples, sampleRate))
// Silero hears the pauses
const recorder = new MicRecorder('silero')
await recorder.start(Mic)
recorder.on('StartSpeaking', () => (status.textContent = 'Speaking...'))
recorder.on('StopSpeaking', async () => {
const { probability, complete, duration } = await smartTurn.predict()
status.textContent = complete
? `Finished (${probability.toFixed(2)}, ${Math.round(duration)} ms)`
: `Still thinking (${probability.toFixed(2)})`
// A finished turn starts the next one from a clean slate
if (complete) smartTurn.reset()
})
}

Click the page and try two sentences. “What time does the store open tomorrow?” should come back finished. “I’d like to book a table for… um…” should come back unfinished, even after a second of silence.

@micdrop/smart-turn/web registers the browser runtime. It runs the full precision checkpoint, about 30 MB, on WebGPU when the browser offers it, and the quantized one, about 8 MB, on WebAssembly otherwise. Both download from Hugging Face on first use, so serve them from your own domain in production with setSmartTurnOptions({ model: '/models/smart-turn-v3.2-cpu.onnx' }), imported from @micdrop/smart-turn/web.

Step 2: Smart Turn inside a voice conversation

In a call, Micdrop does the wiring of step 1 for you, and more: the VAD keeps deciding what audio to send, and Smart Turn decides when to tell the server the turn is over. One option enables it:

src/main.ts
import { SmartTurn } from '@micdrop/smart-turn'
import '@micdrop/smart-turn/web'
import { Micdrop } from '@micdrop/web'
import '@micdrop/web/silero'
await Micdrop.start({
url: 'ws://localhost:8081',
vad: 'silero',
turnDetector: new SmartTurn(),
})

Any Micdrop server answers this client, such as the server of Getting Started. A pause mid sentence now sends nothing to the server and keeps the same transcription stream open, so the user’s sentence arrives as one message instead of two halves.

A model that hears an unfinished sentence where there is none would leave the call hanging, so a held turn always has a deadline. After turnMaxWait, 4 seconds by default, the turn closes on its own and the agent answers. The clock runs only while nobody speaks, and resumes from zero at the next pause.

await Micdrop.start({
url: 'ws://localhost:8081',
vad: 'silero',
turnDetector: new SmartTurn({ threshold: 0.5 }),
turnMaxWait: 3000,
})

threshold leans the verdict. Lower answers sooner and cuts people off more often, higher lets hesitations run longer. The model’s benchmarks are measured at 0.5, and anything between 0.3 and 0.7 scores within half a point of it.

Step 3: Smart Turn in Node.js

A phone call has no browser to run the model, so the server finds the turns itself. The same class runs on onnxruntime-node:

Terminal window
npm install @micdrop/server @micdrop/smart-turn @micdrop/silero onnxruntime-node
import { MicdropServer } from '@micdrop/server'
import { SmartTurn } from '@micdrop/smart-turn'
import '@micdrop/smart-turn/node'
import '@micdrop/silero/node'
new MicdropServer(transport, {
turns: { vad: 'silero', detector: new SmartTurn() },
agent,
stt,
tts,
})

On a server, the native ONNX runtime runs the model far faster than WebAssembly does in a browser, with no graphics card needed. The Twilio phone agent tutorial puts this in a complete phone agent.

For a standalone Node script, push() and predict() work as in step 1, fed with PCM samples from any source.

Browser or server

Run Smart Turn where the microphone is whenever you can. The audio is already there, nothing crosses the network, and the client can close a turn the moment the sentence lands. A server can only decide to wait longer than the client would have.

The browser path has one cost to weigh. On WebGPU the model answers in about 25 ms. Without it, WebAssembly takes a couple of hundred milliseconds on a laptop, and more on a mid range phone. WebGPU reaches Chrome and Edge on every platform and Safari on iOS 26, which covers most visitors. For the rest, the server side detector is the safer answer, and on React Native the native runtime runs the model on the CPU without the browser’s penalty.

Frequently asked questions

Can I use Smart Turn without Python?

Yes. @micdrop/smart-turn reimplements the whole inference in TypeScript, the audio features included, and runs the published ONNX checkpoints with ONNX Runtime in the browser, in Node.js and in React Native.

Can I use Smart Turn without Pipecat or Micdrop?

Yes. The model is published on its own under the BSD 2-Clause license, and @micdrop/smart-turn works without the rest of Micdrop, with @micdrop/core as its only Micdrop dependency. Feed it audio with push() and ask predict().

What is the difference between Smart Turn and Silero VAD?

Silero VAD says whether someone is speaking in each 32 ms of audio. Smart Turn says whether the sentence they just spoke sounds finished. A voice agent uses both: Silero detects the pause, Smart Turn decides what it means.

Does Smart Turn need a transcript?

No. It reads audio only, which is why it can answer before the speech to text has finished and why the intonation it hears carries across languages.

What if Smart Turn is wrong?

When it wrongly waits, the turn closes after turnMaxWait anyway, 4 seconds by default. When it wrongly ends a turn, the user keeps talking and interrupts the agent, which stops at once.

Getting started

The turn detection documentation covers the options, the runtime shared with Silero and how to write your own detector, and the Silero VAD tutorial sets up the detector Smart Turn builds on.

Keep reading