testlpsdk2

Lyrebird Vocal Avatar SDK for Python


Keywords
LYREBIRD-AI, TTS, AI, VOCAL AVATAR, VOICE
License
Other
Install
pip install testlpsdk2==3.0.0

Documentation

python-lyrebird--vocal-avatar

python-lyrebird-vocal-avatar is the Python SDK for Lyrebird.ai.

Install

Using pip:

pip install lyrebird-vocal-avatar

From source:

git clone https://github.com/lyrebird-ai/python-vocal-avatar
pip install .

Usage

See the examples folder for examples.

API

Overview

lyrebird-vocal-avatar provides a Lyrebird class with the following methods:

Lyrebird class

The Lyrebird constructor takes the following parameters:

  • access_token - the Access Token of your Lyrebird instance

A minimal example looks like this:

from lyrebird import Lyrebird

client = Lyrebird(access_token)
client.generate('Hello World')

.generate()

The Lyrebird Vocal Avatar generate endpoint

Takes the following parameters:

  • text - the text you want the Lyrebird Vocal Avatar to synthethize

Example:

resp = client.generate('Hello World')
with open('hello_world.wav', "w+") as audio_file:
    audio_file.write(resp.content)

.generated()

the Lyrebird Vocal Avatar generated endpoint

Takes the following parameters:

  • offset - the offset of the first returned paginated element from the beginning of the result set, defaults to 0
  • limit - the maximum count of returned paginated elements, defaults to 10

Example:

# Get the last two generated utterances
generated_resp = client.generated(0, 2)
generated_resp_json = generated_resp.json()

See the docs for more information.

Logging

Default logging is to STDOUT with INFO level.

You can set your logging level as follows:

from lyrebird import Lyrebird
import logging

logging.basicConfig()
logger = logging.getLogger('logger')

client = Lyrebird(acces_token, logger)
client.logger.setLevel(logging.WARNING)

You can also specify a custom logger object in the Lyrebird constructor:

from lyrebird import Lyrebird
client = Lyrebird(access_token=access_token, logger=custom_logger)

See the logging module and logging.config docs for more information.