pipedog is an unofficial community port of Pipecat, not affiliated with Daily.
pipedog
Text-to-speech

Neuphonic

Text-to-speech with Neuphonic: NeuphonicTTSService over WebSocket and NeuphonicHttpTTSService over server-sent events.

Overview

  • NeuphonicTTSService: keeps one WebSocket open, sends each sentence followed by <STOP>, and pushes the audio as it arrives. When the bot is interrupted while speaking, it reconnects (the service is an InterruptibleTTSService).
  • NeuphonicHttpTTSService: one HTTP request per sentence, read as server-sent events.

Installation

bun add @pipedog/neuphonic
import { NeuphonicHttpTTSService, NeuphonicTTSService } from "@pipedog/neuphonic/tts";

Prerequisites

  • A Neuphonic account and an API key.
  • Pass the key as apiKey. The examples read it from NEUPHONIC_API_KEY.

NeuphonicTTSService

Connects to wss://api.neuphonic.com/speak/<language>.

Configuration

Prop

Type

Settings

Runtime-updatable settings, passed as settings: new NeuphonicTTSService.Settings({...}) (NeuphonicTTSSettings). Any setting you leave out keeps the default below. A change reconnects the WebSocket, because the settings are query parameters of the connection.

SettingTypeDefaultDescription
voicestring | nullnullVoice id.
languageLanguage | nullLanguage.ENLanguage, part of the connection's path.
speednumber1.0Speed multiplier.
temperaturenumber | nullnullRandomness, 0.0 to 1.0. null leaves Neuphonic's default.
ipaKeystring | nullnullRegional variant for <phoneme:...> tags: es-castilian or pt-br.

Usage

tts.ts
import { TTSUpdateSettingsFrame } from "@pipedog/core/frames/frames";
import { Language } from "@pipedog/core/transcriptions/language";
import { NeuphonicHttpTTSService, NeuphonicTTSService } from "@pipedog/neuphonic/tts";

const tts = new NeuphonicTTSService({
  apiKey: process.env.NEUPHONIC_API_KEY ?? "",
  settings: new NeuphonicTTSService.Settings({
    voice: "your-voice-id",
    language: Language.EN,
    speed: 1.0,
  }),
});

Change settings mid-call with a TTSUpdateSettingsFrame:

// Reconnects the WebSocket with the new settings.
const update = new TTSUpdateSettingsFrame({
  delta: new NeuphonicTTSService.Settings({ speed: 1.2 }),
});

Event handlers

EventDescription
on_connectedThe WebSocket connected.
on_disconnectedThe WebSocket closed.
on_connection_errorThe connection failed.

NeuphonicHttpTTSService

Posts each sentence to https://api.neuphonic.com/sse/speak/<language>.

Configuration

Prop

Type

It takes the same settings as the WebSocket service.

Usage

const httpTts = new NeuphonicHttpTTSService({
  apiKey: process.env.NEUPHONIC_API_KEY ?? "",
  settings: new NeuphonicHttpTTSService.Settings({ voice: "your-voice-id" }),
});

Notes

  • The sample rate defaults to 22050 Hz and the encoding to pcm_linear.
  • The WebSocket sends a keepalive ({"text": ""}) every 10 seconds.
  • An SSE event that carries errors is reported as an error frame, and the stream keeps going.

Runtime notes

  • The WebSocket opens through the core websocketConnect, with the key in an x-api-key header (through fetch on Cloudflare Workers). The HTTP service uses the global fetch; pass fetch to use another one (upstream takes an aiohttp session). Both work on Bun, Node, Deno and Cloudflare Workers.
  • Upstream talks to Neuphonic's API directly rather than through the pyneuphonic SDK, and so does this port.
  • The deprecated params (InputParams), voiceId and aggregateSentences options are not ported.
  • Upstream has no Neuphonic tests. Ours run against local fake servers, not against Neuphonic itself.
RuntimeWorksWhat it needs
Bun✅ yesNothing.
Node.js✅ yesNothing.
Deno✅ yesNothing.
Cloudflare Workers✅ yesNothing.

Generated from pipecat.runtimes and pipecat.compat in packages/neuphonic/package.json: ✅ means the compat smoke test passes on that runtime.

pipedog is an unofficial community TypeScript port of Pipecat. It is not affiliated with or endorsed by Daily or the Pipecat project.

Portions adapted from the Pipecat documentation, Copyright (c) 2024–2025 Daily, BSD-2-Clause (see apps/docs/LICENSE-pipecat-docs).

On this page