Skip to main content

Pinch real-time speech-to-speech translation plugin for Pipecat

Project description

pipecat-plugins-pinch

Real-time voice translation for Pipecat powered by Pinch.


Installation

pip install pipecat-plugins-pinch

Requires Python ≥ 3.10.


Prerequisites

You need a Pinch API key. Get one at the developers portal.

Set it in your environment:

export PINCH_API_KEY=pk_your_key_here

How it fits into a Pipecat pipeline

PinchTranslatorService is a drop-in FrameProcessor. It sits between your transport's input and output — receiving InputAudioRawFrame from the user and emitting OutputAudioRawFrame (translated speech) and TranscriptionFrame (transcripts) downstream.

transport.input()
      │
      ▼
PinchTranslatorService        ← translate en-US → es-ES
      │
      ├─► OutputAudioRawFrame  → transport.output()  (translated audio)
      └─► TranscriptionFrame   → your handler        (transcripts)

Usage

from pipecat.pipeline.pipeline import Pipeline
from pipecat.pipeline.runner import PipelineRunner
from pipecat.pipeline.task import PipelineParams, PipelineTask
from pipecat.plugins.pinch import PinchTranslatorService, TranslatorOptions

async def main():
    # Replace with your preferred Pipecat transport (Daily, LiveKit, WebSocket, etc.)
    # transport = DailyTransport(...)

    translator = PinchTranslatorService(
        options=TranslatorOptions(
            source_language="en-US",
            target_language="es-ES",
            voice_type="clone",   # preserves the speaker's voice
        ),
        # api_key="pk_..."  ← or set PINCH_API_KEY env var
    )

    pipeline = Pipeline([
        transport.input(),
        translator,
        transport.output(),
    ])

    task = PipelineTask(pipeline, params=PipelineParams(allow_interruptions=True))
    await PipelineRunner().run(task)

The plugin handles everything internally — calling the Pinch API, managing the translation session, resampling audio, and routing frames — so you don't need to configure anything beyond TranslatorOptions.


Configuration

TranslatorOptions

Parameter Type Default Description
source_language str required code for the speaker's language (e.g. "en-US")
target_language str required code for the output language (e.g. "es-ES")
voice_type str "clone" Voice used for translated output: "clone", "female", or "male"

PinchTranslatorService

Parameter Type Default Description
options TranslatorOptions required Language and voice configuration
api_key str | None None Pinch API key. Falls back to PINCH_API_KEY env var

Supported languages

Full list of language codes: supported languages


Transcript frames

The plugin emits standard Pipecat transcript frames for both the original and translated speech. You can consume these in any downstream FrameProcessor.

from pipecat.frames.frames import TranscriptionFrame, InterimTranscriptionFrame
from pipecat.processors.frame_processor import FrameProcessor, FrameDirection

class MyTranscriptHandler(FrameProcessor):
    async def process_frame(self, frame, direction):
        await super().process_frame(frame, direction)

        if isinstance(frame, TranscriptionFrame) and frame.user_id == "":
            print(f"Translated: {frame.text}")

        await self.push_frame(frame, direction)

Links


License

Apache 2.0 — see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pipecat_plugins_pinch-0.1.0.tar.gz (168.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pipecat_plugins_pinch-0.1.0-py3-none-any.whl (13.1 kB view details)

Uploaded Python 3

File details

Details for the file pipecat_plugins_pinch-0.1.0.tar.gz.

File metadata

  • Download URL: pipecat_plugins_pinch-0.1.0.tar.gz
  • Upload date:
  • Size: 168.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pipecat_plugins_pinch-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5455f14f96a51987956a18bb6457fc19f556f26cd0cbdaa67a169c1eff994fed
MD5 8e90038c16de33173d3927f391363e30
BLAKE2b-256 89cbe35864050ae87ead53f11575a56cec9b14d59cf1a64854b0ccf9f946a754

See more details on using hashes here.

Provenance

The following attestation bundles were made for pipecat_plugins_pinch-0.1.0.tar.gz:

Publisher: publish.yml on pinch-eng/pipecat-plugins-pinch

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pipecat_plugins_pinch-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pipecat_plugins_pinch-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 775ee1ef547a183f77bfbccaf31454400bf13cb1812380487a58bebb8676f7f5
MD5 130d7fb67281c27abb4bd1e09c7c9f94
BLAKE2b-256 cfe3fd0b5f1a6224d4271b20a5de8c7c176b3c0dd0d13f3516c9231c0b598952

See more details on using hashes here.

Provenance

The following attestation bundles were made for pipecat_plugins_pinch-0.1.0-py3-none-any.whl:

Publisher: publish.yml on pinch-eng/pipecat-plugins-pinch

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page