Skip to main content
The Sanas SDK processes speech audio in real time. You feed it interleaved float32 PCM frames and it returns processed frames — noise-cancelled, speech-enhanced, accent-converted, or translated into another language. The Python package ships as a self-contained wheel: everything the SDK needs is bundled inside it, so there’s no separate native library to install. You create a virtual environment, pip install the wheel, and start streaming audio.
The SDK does not open microphones or speakers for you — you bring your own audio (from a file, socket, or media stream). You push frames in with process_frame and read processed frames back.

Two ways to use the SDK

The SDK runs in one of two modes. The setup flow is identical — you always create_sdkactivate_api_keycreate_audio_processor and wait for PipelineState.RUNNING — but how you select the mode and what you get back differ:
Everything else — activation, the pipeline-state callback, real-time 20 ms frame pacing — works the same way in both modes. Pick the tab that matches your use case in Step 4.
This page covers Language Translation inside the Python SDK (selected via lt_config). Sanas also offers a standalone, browser-friendly Language Translation API (WebRTC / WebSocket / JavaScript client) for real-time speech-to-speech in the browser — use that instead of the SDK if you’re building a web app.

Prerequisites

You only need a supported CPython interpreter and pip — no extra tooling required. The wheel in your archive targets the Python version named in its filename:
Pick the archive whose <pytag> matches your interpreter (e.g. cp310 for Python 3.10; cp312 for Python 3.12 or newer).
Sign up for an account and generate your API keys.

Step 1: Install the SDK

Your archive is laid out like this:
Create a virtual environment and install the wheel from inside the extracted archive directory.

Step 2: Verify Installation

Step 3: Select Your Model

For audio processing, set model_name to one of the model keys enabled for your account. Language Translation is selected differently — by the presence of an lt_config (see Step 4).

Step 4: Process Your First Audio Stream

Two things to understand before reading the code:
  • The pipeline initializes asynchronously. After you create a processor, wait for PipelineState.RUNNING (via the audio_pipeline_state_notify callback) before feeding frames.
  • process_frame is synchronous but expects real-time audio. Feed frames at the rate they would arrive live (one 20 ms frame every 20 ms). The snippets below pace with a monotonic-clock deadline so timing doesn’t drift.
The two tabs below show the only difference between the modes: Audio Processing sets a model_name; Language Translation leaves it empty and passes an lt_config instead. Compare them side by side.
Create sdk_example.py and set model_name to one of your enabled model keys.
examples/helpers.py provides PipelineWaiter, sleep_until, and feed_and_drain, which wrap steps 3–4 above — prefer them over hand-rolling the loop.

Cloud inference tuning (optional)

When the SDK runs on cloud / remote inference (the default), you can pass a CloudInferencingParams on AudioAttributes.cloud_inferencing_params to tune the remote path. These parameters are only meaningful for cloud inference and are ignored for local inference. The field is optional — omit it to keep the defaults.
Leave cloud_inferencing_params unset (or use_pcm16=False) unless you specifically need raw PCM uplink — the rate-default codec is the recommended default for most sessions.

Step 5: Run the Examples

The examples/ folder is self-contained (standard-library helpers only, no numpy). With your venv active, set the required environment variables and run an example from inside the extracted archive:
SANAS_STORAGE_DIR is where the SDK keeps its data and writes logs (under storage_dir/logs).

Key Types

InitParams, create_sdk, Sdk, AudioAttributes, ProcessorAttributes, AudioProcessor, AudioFrame, LanguageTranslationConfig, CloudInferencingParams, PipelineState, SdkResult.

Next Steps

Looking for examples try the Tutorials/Examples:

Processing Multiple Streams

Scale to multiple concurrent audio streams with a shared SDK instance.

Need Help?

Email Support

support@sanas.ai Response time: 1 business day

Support Portal

Raise a support ticket for urgent issues