CONNECT WITH US
Web3 & Blockchain

Web3 & Blockchain

AssemblyAI details Python WebSocket workflow for streaming text to speech

Blockchain.News logo

Published on

Add as a preferred source on Google
AssemblyAI details Python WebSocket workflow for streaming text to speech

AssemblyAI outlined Python TTS workflows for one-shot WAV output, WebSocket streaming, barge-in handling and keep-alive sessions.

AssemblyAI published a Python tutorial on streaming text to speech over WebSocket connections, framing it as a workflow for voice agents rather than a simple file-generation task. The company said the approach is designed to handle three live-call problems that saved audio files do not solve: LLM replies that are still being generated, caller interruptions, and long-running sessions that must stay healthy throughout a conversation.

According to the tutorial published on Wed, 28 Oct 2026, the AssemblyAI Text-to-Speech API supports three routes: HTTP for one-shot synthesis, WebSocket for a single session across a conversation, and an OpenAI-compatible speech endpoint. The post says the Python SDK gained text-to-speech support in release 1.8.2 and shows how to install it with pip, set ASSEMBLYAI_API_KEY, and call TextToSpeech.synthesize() to produce a WAV file. It also states that billing is based on billed_characters at $15 per 1M characters, and that the API supports six languages: English, Spanish, French, German, Italian and Portuguese.

The tutorial then moves to TTSSession, which AssemblyAI presents as the preferred interface for a voice agent. In the example code, the session is opened once per conversation, each sentence is spoken as a separate request, and the sample reads the sample rate back from the Begin frame rather than assuming it. The company says WebSocket output is raw 16-bit little-endian PCM in mono, typically at 24 kHz unless configured otherwise, and notes that phone applications often require 8 kHz mu-law instead.


Source link

Disclaimer

We strive to uphold the highest ethical standards in all of our reporting and coverage. We TheMorningPulse.fyi want to be transparent with our readers about any potential conflicts of interest that may arise in our work. It's possible that some of the investors we feature may have connections to other businesses, including competitors or companies we write about. However, we want to assure our readers that this will not have any impact on the integrity or impartiality of our reporting. We are committed to delivering accurate, unbiased news and information to our audience, and we will continue to uphold our ethics and principles in all of our work. Thank you for your trust and support.