Git Product home page Git Product logo

elevenlabs-python's Introduction

PyPI - Python Version Downloads Twitter

The official Python API for ElevenLabs text-to-speech software. Eleven brings the most compelling, rich and lifelike voices to creators and developers in just a few lines of code.

⚙️ Install

pip install elevenlabs

🗣️ Usage

Open In Colab

from elevenlabs import generate, play

audio = generate("Hi! I'm the world's most advanced text-to-speech system, made by elevenlabs.")

play(audio)
Play

Don't forget to unmute the player!

voice.webm

👥 Voices

from elevenlabs import generate, play

voice = "Bella"
audio = generate(
  text=f"Hi! My name is {voice}, nice to meet you!",
  voice=voice
)

play(audio)
Play

Don't forget to unmute the player!

Adam

Adam.webm

Antoni

Antoni.webm

Arnold

Arnold.webm

Bella

Bella.webm

Domi

Domi.webm

Elli

Elli.webm

Josh

Josh.webm

Rachel

Rachel.webm

Sam

Sam.webm

List

from elevenlabs import voices, generate

voices = voices()

audio = generate(text="Hello there!", voice=voices[0])

print(voices)
Show output
Voices(
    voices=[
        Voice(
            voice_id='21m00Tcm4TlvDq8ikWAM',
            name='Rachel',
            category='premade',
            settings=VoiceSettings(stability=0.75, similarity_boost=0.75)
        ),
        Voice(
            voice_id='AZnzlk1XvdvUeBnXmlld',
            name='Domi',
            category='premade',
            settings=VoiceSettings(stability=0.1, similarity_boost=0.75)
        ),
        Voice(
            voice_id='EXAVITQu4vr4xnSDxMaL',
            name='Bella',
            category='premade',
            settings=VoiceSettings(stability=0.245, similarity_boost=0.75)
        ),
        Voice(
            voice_id='ErXwobaYiN019PkySvjV',
            name='Antoni',
            category='premade',
            settings=VoiceSettings(stability=0.195, similarity_boost=0.75)
        ),
        Voice(
            voice_id='MF3mGyEYCl7XYWbV9V6O',
            name='Elli',
            category='premade',
            settings=VoiceSettings(stability=0.755, similarity_boost=0.75)
        ),
        Voice(
            voice_id='TxGEqnHWrfWFTfGW9XjX',
            name='Josh',
            category='premade',
            settings=VoiceSettings(stability=0.15, similarity_boost=0.51)
        ),
        Voice(
            voice_id='VR6AewLTigWG4xSOukaG',
            name='Arnold',
            category='premade',
            settings=VoiceSettings(stability=0.15, similarity_boost=0.75)
        ),
        Voice(
            voice_id='pNInz6obpgDQGcFmaJgB',
            name='Adam',
            category='premade',
            settings=VoiceSettings(stability=0.2, similarity_boost=0.75)
        ),
        Voice(
            voice_id='yoZ06aMxZJJ28mfd3POQ',
            name='Sam',
            category='premade',
            settings=VoiceSettings(stability=0.25, similarity_boost=0.75)
        ),
        Voice(
            voice_id='3KehPe3gxEYqOFSGDzGM',
            name='test',
            category='cloned',
            settings=VoiceSettings(stability=0.75, similarity_boost=0.75)
        ),
        Voice(
            voice_id='duorpit9NOULscUJ2OAp',
            name='test',
            category='cloned',
            settings=VoiceSettings(stability=0.75, similarity_boost=0.75)
        ),
        Voice(
            voice_id='h2rNV1Iql95D2QSSuvLY',
            name='test',
            category='cloned',
            settings=VoiceSettings(stability=0.75, similarity_boost=0.75)
        )
    ]
)

Add Clone

Note that voice cloning requires an API key, see below.

from elevenlabs import clone, generate

voice = clone(
    name="Alex",
    description="An old American male voice with a slight hoarseness in his throat. Perfect for news", # Optional
    files=["./sample_0.mp3", "./sample_1.mp3", "./sample_2.mp3"],
)

audio = generate(text="Hi! I'm a cloned voice!", voice=voice)

play(audio)

🚿 Streaming

from elevenlabs import generate, stream

audio_stream = generate(
  text="This is a... streaming voice!!",
  stream=True
)

stream(audio_stream)

🔑 API Key

The basic API has a limited number of characters. To increase this limit, you can get a free API key from Elevenlabs (step-by-step guide) and set is as environment variable ELEVEN_API_KEY. Alternatively you can provide the api_key string argument to the generate function, or set it globally in code with:

from elevenlabs import set_api_key
set_api_key("<YOUR_API_KEY>")

📖 API & Docs

Learn more about the Python API, or check out the HTTP API documentation.

elevenlabs-python's People

Contributors

flavioschneider avatar matistaniszewski avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.