In conversational AI and real-time voice agent engineering, response latency determines whether an interaction feels natural or broken. When human speakers converse, typical conversational pauses range between 200 and 400 milliseconds. Traditional REST-based text-to-speech (TTS) architectures break this threshold entirely: an application must wait for an upstream Large Language Model (LLM) to complete sentence generation, send the payload to an offline rendering endpoint, wait for synthesis, and download an audio file. This process inflates Time to First Audio (TTFA) to 1,500ms–4,000ms.
Murf AI addresses this bottleneck with Falcon 2.1, a streaming speech model architected specifically for real-time conversational agents. By establishing persistent, bidirectional WebSocket connections, Falcon 2.1 ingests incremental LLM token streams and begins emitting raw PCM audio in under 100 milliseconds.
At 365Finds, our assessment is straightforward: for real-time conversational voice agents, adopting Falcon 2.1 over legacy batch TTS is an architectural necessity. However, capturing sub-100ms latency requires precise protocol configuration—specifically bypassing client-side chunkers, choosing raw PCM over containerized WAV, activating lenient predictive chunking, and handling barge-in interruptions over isolated context turns.
Architecture: WebSocket Full-Duplex vs. HTTP Chunked Streaming
Murf AI provides two streaming interfaces for Falcon 2.1, but they serve fundamentally different interaction patterns:
| Architectural Metric | WebSocket Streaming (/v1/speech/stream-input) | HTTP Streaming (/v1/speech/stream) |
|---|---|---|
| Communication Mode | Full-duplex bidirectional persistent connection | Unidirectional chunked transfer encoding (POST) |
| Input Format | Incremental token streams as LLM generates | Complete text string sent upfront |
| Typical Latency (TTFA) | ~100 ms from first text frame | ~120–150 ms from request dispatch |
| Barge-in / Cancellation | Native via {"clear": true} per context_id | Requires terminating TCP/HTTP connection |
| Turn Management | Multi-turn multiplexing over single socket | One HTTP request per turn |
| Best Used For | Conversational voice bots, telephony IVRs, live agents | Static dynamic prompts, pre-generated notifications |
For interactive voice agents, 365Finds strongly advises standardizing entirely on the WebSocket interface (wss://global.api.murf.ai/v1/speech/stream-input). Maintaining a persistent socket eliminates the 30–80ms penalty of TLS handshakes on every conversational exchange.
Geographic Routing & Latency Optimization
Murf AI deploys Falcon 2.1 across 11 global regions (including US-East, US-West, EU-Central, UK, India, Canada, South Korea, UAE, Japan, Australia, and Brazil).
- The Global Router (
wss://global.api.murf.ai/...) automatically routes incoming requests to the nearest edge datacenter based on IP geolocation. - Production Pinning: If your voice agent's core telephony or LLM orchestration runs in a specific cloud zone (such as AWS
us-east-1), pin the connection to the matching regional Murf endpoint (e.g.,wss://us-east.api.murf.ai/v1/speech/stream-input). Co-locating agent infrastructure with Murf servers prevents inter-region backhaul transit from erasing low-latency gains.
WebSocket Protocol Specification & Frame Sequence
Connecting to Murf Falcon 2.1 requires an explicit frame negotiation sequence. Each conversational turn revolves around a unique context_id.
Client Murf Falcon 2.1 Endpoint
| |
|--- 1. WSS Handshake (Query Params / Headers) ----->|
|<-- 2. Connection Accepted (HTTP 101 Upgrade) ------|
| |
|--- 3. Voice Configuration Frame (context_id: A) -->|
|--- 4. Incremental Text Chunk 1 (context_id: A) --->|
|<-- 5. Binary Audio Chunk (Base64 decoded) ---------|
|--- 6. Incremental Text Chunk 2 (context_id: A) --->|
|<-- 7. Binary Audio Chunk (Base64 decoded) ---------|
|--- 8. Final Text Chunk (context_id: A, end: true)->|
|<-- 9. Final Audio & Concurrency Usage Message -----|
1. Connection Handshake
Initiate a secure WebSocket connection against the stream endpoint:
wss://global.api.murf.ai/v1/speech/stream-input?api-key=YOUR_API_KEY&model=falcon-2.1&sample_rate=24000&channel_type=MONO&format=PCM
Query parameters define the connection defaults:
model: Must be set tofalcon-2.1. (Legacy aliasesfalcon-2andfalcon2route to Falcon 2.1 automatically).format: AcceptsPCM,WAV,MP3,ALAW,ULAW, orFLAC.sample_rate: Accepts8000,24000,44100, or48000. For telephony integration (Twilio, SIP trunking), use8000withformat=ULAWorformat=ALAW. For general voice agents,24000withformat=PCMyields optimal balance between acoustic clarity and processing speed.
Audio Format Caveat (PCM vs. WAV): When requesting
format=WAV, Murf prepends a 44-byte WAV header to the first audio chunk of a context. Because total audio duration is unpredictable in streaming mode, this header inserts0xFFFFFFFFinto the chunk length fields. If your audio player cannot decode indefinite-length WAV streams, or if you are feeding raw bytes to a telephony codec, always requestformat=PCMto receive raw, headerless 16-bit little-endian samples.
2. Turn Initialization (voice_config)
Before pushing text for a new conversational turn, send a configuration frame bound to that turn's context_id:
{
"voice_config": {
"voiceId": "Gordon",
"locale": "en-US",
"style": "Conversational",
"rate": 0,
"pitch": 0,
"volumeOffset": 15
},
"context_id": "turn_101"
}
- Context Scoping: Settings do not automatically propagate between named contexts. Every new
context_idmust receive its ownvoice_configframe before text arrival; otherwise, the server falls back to the default voice and emits aNO_VOICE_CONFIGwarning. - Volume Offset: Use
volumeOffset(-50 to 50) to boost audio levels on low-gain phone lines (+10 to +25) without re-encoding audio. - Style Constraint: Falcon 2.1 is strictly tuned for dialog; its only valid style parameter is
"Conversational".
3. Incremental Text Ingestion
As the LLM emits tokens, push text frames referencing the active context_id. When LLM generation finishes, set "end": true on the final chunk:
{
"context_id": "turn_101",
"text": "Your reservation is confirmed for tomorrow evening. ",
"predictive_chunking": "lenient"
}
{
"context_id": "turn_101",
"text": "Can I help you with anything else?",
"predictive_chunking": "lenient",
"end": true
}
Setting "end": true informs the synthesis engine that no further tokens will follow for this turn. This triggers the dispatch of remaining buffered audio, followed by a final: true metadata frame, releasing that context's concurrency slot.
Predictive Chunking: Balancing Speed and Prosody
A common engineering mistake when building voice agents is double chunking. Standard frameworks (such as early LangChain voice chains or default Pipecat setups) often buffer tokens until finding punctuation before dispatching to TTS.
Falcon 2.1 possesses an internal syntactic engine. At 365Finds, our direct recommendation is: disable upstream sentence tokenizers and stream raw tokens directly to Murf.
Falcon controls sentence boundary synthesis using predictive_chunking:
| Mode | Operational Mechanism | Prosody Impact | Ideal Application |
|---|---|---|---|
strict (default) | Waits for subsequent characters on ambiguous endings (e.g., Dr., 2 p.m., U.S.). | Zero mid-sentence pauses on abbreviations; natural prosody. | Long-form narration, audiobooks, complex technical reading. |
lenient | Infers boundaries immediately and synthesizes early chunks without waiting. | Sub-100ms TTFA; occasional micro-pause on edge abbreviations. | Real-time conversational voice agents, IVR customer support. |
To enforce low latency in dialogue, configure predictive_chunking: "lenient" on your text frames.
Fallback Buffer Tuning
If your upstream LLM outputs unpunctuated text or streams intermittently, Falcon relies on two buffer limits:
min_buffer_size: (0–1000 characters, default100). Triggers synthesis once buffered characters cross threshold.max_buffer_delay_in_ms: (0–1000 ms, default300). Triggers synthesis if no new token arrives within this window.
{
"context_id": "turn_101",
"text": "Checking availability now",
"predictive_chunking": "lenient",
"min_buffer_size": 40,
"max_buffer_delay_in_ms": 150
}
Critical Payload Placement Rule:
predictive_chunking,min_buffer_size, andmax_buffer_delay_in_msmust be placed at the top level of the frame, alongsidetext. Placing them insidevoice_configcauses the server to ignore them silently.
Handling Barge-In & Word Timestamps
Natural conversation requires immediate interruption (barge-in) when the user speaks over the agent. Implementing clean barge-in requires synchronizing audio cancellation with LLM state.
1. Enabling Word-Level Timestamps
Add "add_word_timestamps": true at the frame level. The server returns JSON metadata frames interleaved with audio chunks:
{
"context_id": "turn_101",
"trace_id": "8f3b-4aa9-9dcd",
"timestamps": {
"words": [
{
"word": "reservation",
"start_s": 0.32,
"end_s": 0.88,
"start_frame": 7680,
"end_frame": 21120
}
]
}
}
Because synthesis runs faster than real time, timestamps arrive well ahead of speaker playback. Your client must track the exact playback position (elapsed seconds).
2. Executing an Interruption
When your Voice Activity Detection (VAD) detects user speech during agent playback:
- Halt Local Audio: Immediately stop the audio output device and clear local sound buffers.
- Clear Remote Queue: Send an isolated
clearframe to Murf referencing the active turn:
Warning: Never combine{ "context_id": "turn_101", "clear": true }"clear": trueand"text"in the same frame. Murf will drop the text and emit aTEXT_IGNORED_WITH_CLEARwarning. - Reconcile Conversation Memory: Compare the caller's interruption timestamp against the accumulated word timestamps. Discard all words where
start_sexceeds the interruption playback position. Feed only the words actually heard by the user back into the LLM conversation history. - Initiate Next Turn: Open
turn_102with a freshvoice_configframe.
Pronunciation Engineering: Inline IPA & Pronunciation Dictionaries
Voice agents in banking, healthcare, and e-commerce frequently fail when pronouncing domain terminology, medicine names, or brand trademarks. Falcon 2.1 provides two distinct pronunciation mechanisms:
Method 1: Inline IPA (Optimal for Dynamic LLM Outputs)
Inject the International Phonetic Alphabet (IPA) transcription directly into the text stream, surrounded by forward slashes inside double quotes ("/.../"):
{
"context_id": "turn_101",
"text": "Welcome to \"/mɜːrf/\" AI. We have verified your account with Dr. \"/ˈvɑːɡən/\"."
}
- Falcon replaces the phonetic tag with exact synthesized phonemes.
- Punctuation must stay outside the quotation marks (
"/mɜːrf/".). - Do not provide both the regular word and the IPA tag, or the agent will speak both.
Method 2: Pronunciation Dictionary (Optimal for Static Glossaries)
For persistent brand terms, acronyms, or numbers, define a pronunciation_dictionary inside the initial voice_config frame. It accepts both IPA and SAY_AS rules:
{
"voice_config": {
"voiceId": "Gordon",
"locale": "en-US",
"pronunciation_dictionary": {
"Murf": {
"type": "IPA",
"pronunciation": "mɜːrf"
},
"TTS": {
"type": "SAY_AS",
"pronunciation": "text to speech"
},
"API": {
"type": "SAY_AS",
"pronunciation": "A P I"
}
}
},
"context_id": "turn_101"
}
The dictionary applies across all text frames evaluated within that context_id.
Complete Implementation: Asynchronous Voice Agent Pipeline
The following production script demonstrates connecting to Murf Falcon 2.1 via WebSockets, piping simulated LLM tokens with lenient predictive chunking, processing raw 24kHz PCM audio, and executing clean barge-in interruption.
import asyncio
import json
import base64
import os
import sys
try:
import websockets
except ImportError:
sys.exit("Please install websockets: pip install websockets")
MURF_API_KEY = os.getenv("MURF_API_KEY", "YOUR_MURF_API_KEY")
WS_ENDPOINT = (
"wss://global.api.murf.ai/v1/speech/stream-input"
f"?api-key={MURF_API_KEY}"
"&model=falcon-2.1"
"&sample_rate=24000"
"&channel_type=MONO"
"&format=PCM"
)
class MurfVoicePipeline:
def __init__(self, ws_url: str):
self.ws_url = ws_url
self.ws = None
self.active_context = None
self.audio_bytes_received = 0
async def connect(self):
self.ws = await websockets.connect(self.ws_url)
print("[Connected] WebSocket established with Murf Falcon 2.1")
async def initialize_turn(self, context_id: str, voice_id: str = "Gordon"):
self.active_context = context_id
self.audio_bytes_received = 0
# 1. Dispatch voice configuration frame
config_frame = {
"voice_config": {
"voiceId": voice_id,
"locale": "en-US",
"style": "Conversational",
"rate": 0,
"pitch": 0,
"volumeOffset": 10,
"pronunciation_dictionary": {
"Murf": {"type": "IPA", "pronunciation": "mɜːrf"},
"TTS": {"type": "SAY_AS", "pronunciation": "text to speech"}
}
},
"context_id": context_id
}
await self.ws.send(json.dumps(config_frame))
async def stream_tokens(self, context_id: str, token_generator):
"""Streams incoming LLM tokens directly to Murf Falcon."""
async for token, is_final in token_generator:
text_frame = {
"context_id": context_id,
"text": token,
"predictive_chunking": "lenient",
"add_word_timestamps": True
}
if is_final:
text_frame["end"] = True
await self.ws.send(json.dumps(text_frame))
await asyncio.sleep(0.04) # Simulate token generation pacing (~25 tokens/sec)
async def handle_incoming_frames(self, audio_sink):
"""Asynchronously receives audio packets, word timestamps, and usage events."""
try:
async for raw_message in self.ws:
data = json.loads(raw_message)
# Binary audio packet received
if "audio" in data:
pcm_chunk = base64.b64decode(data["audio"])
self.audio_bytes_received += len(pcm_chunk)
await audio_sink(pcm_chunk)
# Word timestamp frame for interruption accounting
elif "timestamps" in data:
words = data["timestamps"].get("words", [])
for w in words:
# Log or track for barge-in reconciliation
pass
# Warning or non-fatal protocol notification
if data.get("warning"):
print(f"[Warning {data.get('warning_code')}]: {data.get('warning')}")
# Fatal error handling
if data.get("error"):
print(f"[Error {data.get('error_code')}]: {data.get('error')}")
if data.get("fatal"):
break
# Context turn completion
if data.get("final"):
usage = data.get("concurrency", {})
print(f"[Turn Completed] Context: {data.get('context_id')} | "
f"Region: {usage.get('region')} | "
f"Slots: {usage.get('used')}/{usage.get('limit')}")
except websockets.exceptions.ConnectionClosed:
print("[Closed] WebSocket connection terminated.")
async def interrupt(self, context_id: str):
"""Executes instant barge-in cancellation."""
print(f"[Barge-In] Interrupting context {context_id}")
clear_frame = {
"context_id": context_id,
"clear": True
}
await self.ws.send(json.dumps(clear_frame))
async def close(self):
if self.ws:
await self.ws.close()
# Mock LLM stream generator
async def mock_llm_stream():
phrases = [
"Welcome to Murf ", "TTS streaming. ",
"We are delivering ", "conversational voice synthesis ",
"with sub-100 millisecond ", "first audio latency. ",
"How can I assist ", "your call today?"
]
for i, phrase in enumerate(phrases):
is_last = (i == len(phrases) - 1)
yield phrase, is_last
# Mock audio playback sink
async def mock_audio_sink(chunk: bytes):
# In real telephony/agents, forward bytes to Twilio Media Stream, LiveKit, or PyAudio
sys.stdout.write(f"\r[Audio Stream] Emitting raw PCM chunk ({len(chunk)} bytes)")
sys.stdout.flush()
async def main():
pipeline = MurfVoicePipeline(WS_ENDPOINT)
await pipeline.connect()
# Launch listener daemon
listener_task = asyncio.create_task(pipeline.handle_incoming_frames(mock_audio_sink))
# Run Turn 1
print("\n--- Starting Turn 1 ---")
await pipeline.initialize_turn(context_id="turn_001", voice_id="Gordon")
await pipeline.stream_tokens(context_id="turn_001", token_generator=mock_llm_stream())
# Wait for synthesis to conclude
await asyncio.sleep(2.5)
await pipeline.close()
listener_task.cancel()
if __name__ == "__main__":
asyncio.run(main())
365Finds Research Verdict & Integration Rules
To maximize reliability and latency in production deployments, 365Finds recommends adhering to the following rules:
- Avoid Double Tokenization: In LiveKit (
livekit-plugins-murf) or Pipecat (pipecat-murf-tts), explicitly deactivate sentence aggregation filters. Falcon 2.1 internally handles partial boundaries usinglenientpredictive chunking far faster than Python-level regex buffers. - Favor Headerless PCM over WAV: WAV container headers introduce length parsing ambiguities on progressive streams. Standardizing downstream codecs on 24kHz 16-bit Mono PCM guarantees deterministic byte streaming.
- Colocate Agent Workloads: At $0.01 per 1,000 characters, Falcon 2.1 offers strong cost efficiency. However, hosting your orchestrator on an incompatible regional cluster can inject 150ms of cross-continental transport overhead, completely masking the engine's sub-100ms capability. Pin your WebSocket to the closest regional Murf datacenter.
- Isolate
clearCommands: Never combine"clear": truewith replacement dialogue text in a single frame. Always issueclear, allow the socket engine to purge the active context pipeline, and subsequently open a clean turn context with fresh configuration.