Skip to main content
Language Translation (LT) runs on the remote-inference pipeline. Unlike audio processing, it is selected by the presence of an lt_config, not by a model key — so AudioAttributes.model_name is left empty. Translated audio comes back from process_frame; transcripts arrive on the lt_config callback. This tutorial follows the language_translation_example.py example. If you haven’t yet, read Processing a Single Stream first — LT reuses the same activation, pipeline-readiness, and real-time feed mechanics.
LT has a large round-trip latency (~3–4 s). You must keep pushing silence for a window that exceeds that latency after the input ends, or the translated tail will be lost.

Prerequisites

Step 1: Handle transcript callbacks

Transcripts arrive as TextFrames. Each frame is either a TRANSLATION or a TRANSCRIPTION, carries an utterance index and language code, and contains complete and partial segments. Segments may include redacted text.

Step 2: Activate and load audio

Identical to single-stream processing:

Step 3: Configure translation via lt_config

Leave model_name empty and attach a LanguageTranslationConfig. Its presence is what puts the pipeline into translation mode.

Step 4: Feed with an extended drain window

Because translation lags several seconds behind the input, pass drain_seconds to feed_and_drain. This makes the helper pump silence for a fixed, real-time-paced window (instead of stopping early on empty frames), giving the remote wall-clock time to return the tail.
Set SANAS_LT_DRAIN_SECONDS comfortably above the observed round-trip latency. The default of 5 s covers the typical ~3–4 s; increase it if your target language or network is slower.

Step 5: Save the translated audio

How it differs from audio processing

Next Steps

Processing a Single Stream

The core flow this benchmark scales up.

API Reference

Full SDK documentation for classes, enums, and callbacks.

Next Steps

Language Translation

Translate speech between languages and receive audio plus transcripts.

Processing Multiple Streams

Run many concurrent processors on one SDK instance.

References

SDK

SDK lifecycle methods including create_sdk, activate_api_key, and create_audio_processor.

AudioProcessor

process_frame method for audio processing.

Need Help?

Email Support

support@sanas.aiResponse time: 1 business day

Support Portal

Raise a support ticket for urgent issues