Complete python wrapper for the elevenlabs API
Project description
elevenlabslib
Python wrapper for the full elevenlabs API.
Installation
Just run pip install elevenlabslib
, it's on pypi.
Note: On Linux, you may need to install portaudio. On debian and derivatives, it's sudo apt-get install libportaudio2
, and possibly also sudo apt-get install python3-pyaudio
.
Usage
For a far more comprehensive example, check example.py.
Here is a very simple usage sample.
- Retrieves a voice based on the name
- Plays back (using the included playback functions that use sounddevice) all its samples (and the preview)
- Generates and plays back a new audio
- Deletes the newly created audio from the user history
from elevenlabslib import *
user = ElevenLabsUser("API_KEY")
voice = user.get_voices_by_name("Rachel")[0] # This is a list because multiple voices can have the same name
voice.play_preview(playInBackground=False)
voice.generate_and_play_audio("Test.", playInBackground=False)
for historyItem in user.get_history_items():
if historyItem.text == "Test.":
# The first items are the newest, so we can stop as soon as we find one.
historyItem.delete()
break
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
elevenlabslib-0.2.6.tar.gz
(13.8 kB
view hashes)
Built Distribution
Close
Hashes for elevenlabslib-0.2.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ca88a960e845ace834e45ac24cc397fc62a33e3c4d86fd54c591a8464f268919 |
|
MD5 | 137893766fa8d03e571d2f1328d1a25e |
|
BLAKE2b-256 | e6956b437cde073b94ab2759c5304f363997b7e34f680be1ae04dac5c3e130d8 |