This example shows how to synthesize a simple text using the lily voice.

The same API can be used for more complex use cases, like synchronizing speech with captions or a video. See the API reference for more details on the capabilities of the API or the reference documentation for the synthesize method (Python, Node).

import asyncio
from lmnt.api import Speech

async def main():
  async with Speech() as speech:
    synthesis = await speech.synthesize('Hello world.', 'lily')
  with open('hello.mp3', 'wb') as f:
    f.write(synthesis['audio'])

asyncio.run(main())