Python client library for Talkscriber Live Transcription and Text-to-Speech services
Project description
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.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tsclient-1.0.1.tar.gz.
File metadata
- Download URL: tsclient-1.0.1.tar.gz
- Upload date:
- Size: 581.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.8.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9e35bbec0d6fd013627ff3fdb92686d846710d8e57d8acd3478f9d66aa6adb7d
|
|
| MD5 |
2d173f90b1e488595be7a658ea3ca896
|
|
| BLAKE2b-256 |
26577e697651e180db0c895bde8fad472b67b9ac675aa991aa1289495a7f4d16
|
File details
Details for the file tsclient-1.0.1-py3-none-any.whl.
File metadata
- Download URL: tsclient-1.0.1-py3-none-any.whl
- Upload date:
- Size: 21.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.8.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2b2a0cc1d8615eebf227137922ad3dc235a34d58f8bc722433713aaec22e4d08
|
|
| MD5 |
b44c3e0ee3503f690e89c81f408d3b5c
|
|
| BLAKE2b-256 |
5cf08f53cf659f2592e0f125a6c49d4a1704fcb05a1311e80b9c55b778a9c22e
|