TSClient - Talkscriber Python Client
A comprehensive Python client library for Talkscriber's Live Transcription and Text-to-Speech services. This package provides easy-to-use APIs for real-time speech-to-text transcription and ultra-low latency text-to-speech conversion.
Features
Live Transcription
- Real-time speech-to-text transcription via WebSocket
- Support for 50+ languages
- Smart turn detection using ML models
- Translation capabilities
- File and microphone input support
Text-to-Speech
- Ultra-low latency streaming (speech starts in <0.1 seconds)
- Real-time audio playback
- Multiple voice options
- Audio file saving
- Configurable buffering for optimal performance
Installation
Quick Install
pip install tsclient
System Dependencies
The package requires some system-level dependencies for audio processing:
macOS:
# Install PortAudio (required for PyAudio)
brew install portaudio
# Then install the package
pip install tsclient
Ubuntu/Debian:
# Install system dependencies
sudo apt-get update
sudo apt-get install libasound2-dev portaudio19-dev python3-dev
# Then install the package
pip install tsclient
Windows:
# No additional setup required - just install the package
pip install tsclient
CentOS/RHEL/Fedora:
# Install system dependencies
sudo yum install portaudio-devel python3-devel
# or for newer versions:
sudo dnf install portaudio-devel python3-devel
# Then install the package
pip install tsclient
Development Install
For development or to run examples:
git clone https://github.com/Talkscriber/ts-client.git
cd ts-client
pip install -e .
Quick Start
Get Your API Key
- Visit Talkscriber Dashboard
- Sign up or log in
- Generate an API key
- Set it as an environment variable:
export TALKSCRIBER_API_KEY="your_api_key_here"
Live Transcription
from talkscriber.stt import TranscriptionClient
# Initialize client
client = TranscriptionClient(
host="wss://api.talkscriber.com",
port=9090,
api_key="your_api_key",
language="en"
)
# Start live transcription from microphone
client()
# Or transcribe from file
client("audio_file.wav")
Text-to-Speech
from talkscriber.tts import TalkScriberTTSClient
# Initialize TTS client
tts_client = TalkScriberTTSClient(
api_key="your_api_key",
text="Hello, world!",
speaker_name="tara"
)
# Generate and play speech
tts_client.run_simple_test()
Command Line Interface
The package includes convenient CLI tools:
Live Transcription CLI
# Transcribe from microphone
talkscriber-stt --api-key YOUR_KEY --language en
# Transcribe from file
talkscriber-stt --api-key YOUR_KEY --file audio.wav
# Enable multilingual detection
talkscriber-stt --api-key YOUR_KEY --multilingual
Text-to-Speech CLI
# Basic TTS
talkscriber-tts --api-key YOUR_KEY --text "Hello, world!"
# Save to file
talkscriber-tts --api-key YOUR_KEY --text "Hello" --save output.wav
# Use specific voice
talkscriber-tts --api-key YOUR_KEY --text "Hello" --speaker tara
API Reference
Live Transcription
TranscriptionClient
TranscriptionClient(
host: str,
port: int,
api_key: str,
multilingual: bool = False,
language: str = None,
translate: bool = False,
enable_turn_detection: bool = False,
turn_detection_timeout: float = 0.6
)
Parameters:
host: WebSocket host URLport: WebSocket port numberapi_key: Your Talkscriber API keymultilingual: Enable auto language detectionlanguage: Language code (e.g., "en", "es", "fr")translate: Enable translationenable_turn_detection: Enable ML-based turn detectionturn_detection_timeout: Timeout for turn detection
Text-to-Speech
TalkScriberTTSClient
TalkScriberTTSClient(
host: str = "api.talkscriber.com",
port: int = 9099,
text: str,
speaker_name: str = "tara",
api_key: str,
enable_playback: bool = True,
save_audio_path: str = None
)
Parameters:
host: TTS server hostnameport: TTS server porttext: Text to convert to speechspeaker_name: Voice to useapi_key: Your Talkscriber API keyenable_playback: Enable real-time audio playbacksave_audio_path: Optional path to save audio file
Supported Languages
The client supports 50+ languages including English, Spanish, French, German, Chinese, Japanese, and many more. See the full language list in our documentation.
Examples
Check out the examples/ directory for comprehensive examples organized by category:
Quick Start
# First, install the package
pip install tsclient
# Then run examples
# Interactive demo (recommended for beginners)
python examples/integration/comprehensive_demo.py
# Basic STT (microphone)
python examples/stt/basic.py
# Basic TTS (text-to-speech)
python examples/tts/basic.py
Example Categories
Speech-to-Text (STT):
stt/basic.py- Real-time microphone transcriptionstt/file.py- Transcribe audio filesstt/multilingual.py- Automatic language detection
Text-to-Speech (TTS):
tts/basic.py- Basic TTS with real-time playbacktts/save_file.py- Generate and save audio filestts/silent.py- Silent TTS generationtts/different_voices.py- Multiple voice comparisontts/batch.py- Batch processing from text files
Integration:
integration/stt_to_tts.py- Complete voice processing pipelineintegration/comprehensive_demo.py- Interactive demo
Configuration:
configuration/config_patterns.py- Configuration patterns and best practices
See the examples README for detailed usage instructions and the complete directory structure.
Documentation
Links
- Talkscriber Dashboard - Get your API key
- Official Website
- GitHub Repository
License
This project is licensed under the MIT License - see the LICENSE.md file for details.
Metadata
Release files for tsclient 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| tsclient-1.0.1.tar.gz | 581.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| tsclient-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 602.0 kB
Release files / tsclient-1.0.1.tar.gz
| Download URL | tsclient-1.0.1.tar.gz |
|---|---|
| Size | 581.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9e35bbec0d6fd013627ff3fdb92686d846710d8e57d8acd3478f9d66aa6adb7d
|
|
BLAKE2b-256 checksum How to use checksums |
26577e697651e180db0c895bde8fad472b67b9ac675aa991aa1289495a7f4d16
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.8.19
|
Release files / tsclient-1.0.1-py3-none-any.whl
| Download URL | tsclient-1.0.1-py3-none-any.whl |
|---|---|
| Size | 21.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2b2a0cc1d8615eebf227137922ad3dc235a34d58f8bc722433713aaec22e4d08
|
|
BLAKE2b-256 checksum How to use checksums |
5cf08f53cf659f2592e0f125a6c49d4a1704fcb05a1311e80b9c55b778a9c22e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.8.19
|