Soniox
Docs
Speech-to-Text (legacy)

Quickstart

Quickstart guide how to setup and run Soniox Speech-to-Text (legacy).

Get API key

Create a free Soniox Account and login into Soniox Console to create an API key.

Note: API keys are bound to projects. Click on "API keys" under "My First Project" section to create one.

Download Examples

Clone our examples repository with all the code examples and test audio files. We will refer to these examples and audio files throughout our How-to guides.

Terminal
git clone https://github.com/soniox/soniox_examples.git

Enter the directory containing examples for your programming language.

Navigate into Python examples folder.

Terminal
cd speech-to-text-legacy/python

Install Client Library

Choose any of our available client libraries to ease the integration of Soniox API into your application.

Python library requirements: Python 3.7 or higher.

Soniox Python client library is published on PyPI as soniox.

Create and activate venv

Terminal
python3 -m venv venv
source venv/bin/activate

Install packages

Terminal
python3 -m pip install -U pip
python3 -m pip install -U setuptools wheel
python3 -m pip install -U soniox

Configure environment

Store the API key in the SONIOX_API_KEY environment variable to prevent accidental exposure.

Terminal
export SONIOX_API_KEY=<YOUR_API_KEY>

In your application, you can alternatively specify the API key in code when initializing the SpeechClient, as shown below.

from soniox.speech_service import Client
 
with SpeechClient(api_key="<YOUR-API-KEY>") as client:
    ...

Transcribe

This example will transcribe a short audio file and print out the recognized words.

transcribe_file_short.py

Run

Terminal
python3 transcribe_file_short.py

Output

Terminal
Text: He was two years out from the East and had not yet forgotten to be homesick at times
Tokens:
    'He' 317 60
    ' ' 617 0
    'was' 617 60
    ' ' 857 0
    'two' 857 60
    ...

On this page