Skip to main content

audiomatic-python

The official Python library for the Audiomatic API

Installation

pip install audiomatic-python

Quick Start

from audiomatic import Audiomatic

# Initialize the client
client = Audiomatic(api_key="your_api_key")

# Translate a local video file
project_id = client.translate(
    source="path/to/video.mp4",
    target_lang="es",
    project_name="Spanish Translation"
)

# Check translation status
status, result_url = client.get_status(project_id)

Usage Examples

Translating a YouTube Video

# Translate a YouTube video to French
project_id = client.translate(
    source="https://youtube.com/watch?v=example",
    target_lang="fr",
    project_name="French Translation"
)

Advanced Options

# Translate with custom options
project_id = client.translate(
    source="path/to/video.mp4",
    target_lang="de",
    project_name="German Translation",
    opt_params={
        "accent_level": 0.75,
        "num_speakers": 2,
        "remove_background_audio": True,
        "start_time": 30000,  # Start at 30 seconds
        "end_time": 120000,   # End at 2 minutes
        "captions_path": "path/to/captions.vtt"
    }
)

API Reference

Client Initialization

Audiomatic(api_key: str)

Initialize the Audiomatic client.

Parameters:

  • api_key (str): Your Audiomatic API key

Methods

translate(source: str, target_lang: str, project_name: Optional[str] = None, opt_params: Optional[Dict] = None) -> str

Translate a video file or YouTube URL.

Parameters:

  • source (str): Path to local video file or YouTube URL
  • target_lang (str): Target language code (e.g., "es", "fr", "de")
  • project_name (str, optional): Custom project name (defaults to filename)
  • opt_params (Dict, optional): Additional parameters:
    • accent_level (float): Voice accent level (0, 0.25, 0.5, 0.75, or 1)
    • num_speakers (int): Number of speakers in video (defaults to auto-detect)
    • remove_background_audio (bool): Whether to remove background audio
    • start_time (int): Start time of video clip in milliseconds
    • end_time (int): End time of video clip in milliseconds
    • captions_path (str): Path to custom captions file

Returns: Project ID string

get_status(project_id: str) -> Tuple[str, Optional[str]]

Check the status of a translation project.

Parameters:

  • project_id (str): Project ID returned from translate()

Returns: Tuple of (status, result_url)

Limitations

  • Maximum file size: 500MB
  • Maximum video duration: 15 minutes
  • Supported accent levels: 0, 0.25, 0.5, 0.75, 1

Error Handling

The client includes a custom AudiomaticError exception class that provides detailed error information:

try:
    project_id = client.translate(...)
except AudiomaticError as e:
    print(f"Error: {e}")
    print(f"Status Code: {e.status_code}")
    print(f"Error Code: {e.error_code}")

Metadata

Release files for audiomatic-python 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for audiomatic-python 0.1.0
File Size Uploaded
audiomatic_python-0.1.0.tar.gz 6.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for audiomatic-python 0.1.0
File Interpreter ABI Platform
audiomatic_python-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 13.0 kB

Release files / audiomatic_python-0.1.0.tar.gz

Download URL audiomatic_python-0.1.0.tar.gz
Size 6.2 kB
Tags Source
SHA-256 checksum
How to use checksums
9951df14fdb43214691332e26b09fa9479d69f25cdb97ca06402d9b6a71cb0e3
BLAKE2b-256 checksum
How to use checksums
861d6875570118026b2519d8d3d04e9713c4e8a2f13cdb4b521fff10c42c9dd7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.4.27

Release files / audiomatic_python-0.1.0-py3-none-any.whl

Download URL audiomatic_python-0.1.0-py3-none-any.whl
Size 6.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
14a7bfd57cd606c259205b61e1bfd78b310cc8d8be380c09ce0485292e89a327
BLAKE2b-256 checksum
How to use checksums
01ecc41cc755286ff7caf439cf69c2d1591fb326484dae32fc9da47f0eada5ed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.4.27

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page