Skip to content

pinch-eng/livekit-plugins-pinch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

livekit-plugins-pinch

Real-time voice translation for LiveKit Agents, powered by Pinch.


What it does

Drop this plugin into any LiveKit room and it will:

  • Translate spoken audio in real time from one language to another
  • Publish the translated audio back into the room as a separate track
  • Emit transcripts (original + translated) via a simple callback

Installation

pip install livekit-plugins-pinch

Compatibility

  • Python >= 3.10
  • livekit >= 0.12.0
  • livekit-agents >= 0.8.0

Configuration

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

That's the only credential this plugin needs. Your LiveKit credentials stay in your own app as usual.


Usage

from livekit import rtc
from livekit.plugins.pinch import Translator, TranslatorOptions

async def entrypoint(ctx: JobContext):
    await ctx.connect()

    translator = Translator(
        options=TranslatorOptions(
            source_language="en-US",
            target_language="es-ES",
            voice_type="clone",  # "clone" | "female" | "male"
        )
    )

    @translator.on_transcript
    def on_transcript(event):
        if event.is_final:
            print(f"[{event.type}] {event.text}")

    await translator.start(ctx.room)

Voice types

Value Description
clone Preserves the speaker's original voice identity (default)
female Standard female voice
male Standard male voice

Supported languages

Full list of language codes: supported languages


License

Apache 2.0 — see LICENSE for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages