Skip to main content

Python client library for the LMNT API

Project description

LMNT Python Library

The LMNT Python library provides convenient access to the LMNT API from applications written in the Python language.

[Documentation]

Installation

Installing from PyPI is the quickest way to get started:

pip install --upgrade lmnt

Install from source with:

python setup.py install

Getting started

The most common operation you'll perform is a synthesize request. Given some text and a voice, it will return an audio file that you can play back. Take a look at our documentation for a deeper dive into the SDK.

import asyncio

from lmnt.api import Speech


LMNT_API_KEY = ...  # fill in your API key here


async def main():
  async with Speech(LMNT_API_KEY) as speech:
    synthesis = await speech.synthesize('Hello, world.', voice='lily', format='wav')
    with open('output.wav', 'wb') as f:
      f.write(synthesis['audio'])


asyncio.run(main())

While you can provide an api_key argument, we recommend using python-dotenv to add LMNT_API_KEY="My API Key" to your .env file so that your API key is not stored in source control.

More examples

You can find more examples in the demo directory.

License

Apache 2.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

lmnt-1.1.2.tar.gz (175.3 kB view hashes)

Uploaded Source

Built Distribution

lmnt-1.1.2-py3-none-any.whl (10.9 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