Skip to main content

Python library for the Aflorithmic api.audio API

Project description

api.audio Python SDK

The Aflorithmic api.audio Python SDK "aflr" provides access to the api.audio API from applications written in python.

Documentation

See the Python API docs

Installation

You don't need this source code unless you want to modify it. If you want to use the package, just run:

pip install aflr -U

Install from source with:

python setup.py install

Requirements

Python 3.6+

Usage

The library needs to be configured with your account's secret key which is available in your Aflorithmic Dashboard. Set aflr.api_key to its value:

import aflr

aflr.api_key = "your-key"

# Create a new script and print the script created
script = aflr.Script().create(
    scriptText="<<sectionName::hello>> Hello world"
)
print(script)

# Retrieve the script item and print the script created
script = aflr.Script().retrieve(scriptId=script["scriptId"])
print(script)

# Retrieve all scripts and print the first's script text
scripts = aflr.Script().list()
print(scripts["scripts"][0]["scriptText"])

# create a text-to-speech
response = aflr.Speech().create(scriptId=script["scriptId"])
print(response)

# get the speech audio files
audio_files = aflr.Speech().retrieve(scriptId=script["scriptId"])
print(audio_files)

# download all speech audio files
# check your folder :) you should have the following audio_files
audio_files = aflr.Speech().download(scriptId=script["scriptId"], destination=".")
print(audio_files)

# Get all available voices and print the first one
all_voices = aflr.Voice().list()
print(all_voices["voices"][0])

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

aflr-0.1.3.tar.gz (4.0 kB view hashes)

Uploaded Source

Built Distribution

aflr-0.1.3-py3-none-any.whl (6.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page