Skip to main content
synthesizeStream emits AudioChunk values as they are produced, so playback starts on the first chunk instead of the last.

Signature

When it is worth it

For a sentence, speak is simpler and the latency difference is invisible. For a paragraph, or for a model reply being streamed as it generates, streaming synthesis is what keeps the gap between “the model finished” and “the user hears something” short. In a browser, where the model is small and the audio is generated on the same thread budget as the page, that gap is more noticeable than on native.

Pairing it with a streaming completion

Speak each sentence as the model finishes it:
For a full conversation rather than one reply, use the voice session, which handles turn-taking and interruption.

Feeding an AudioContext

Scheduling each chunk against a running clock is what avoids the gaps you get from calling start() with no time argument.

Autoplay

The same gesture rule applies. Create the AudioContext inside a click handler, or it starts suspended and nothing is audible.