Skip to content

Commit

Permalink
Fix docs
Browse files Browse the repository at this point in the history
  • Loading branch information
osolmaz committed Feb 25, 2024
1 parent 89aa12d commit 2c90c9f
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 15 deletions.
4 changes: 4 additions & 0 deletions docs/source/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ Speech services
:members:
:show-inheritance:

.. automodule:: manim_voiceover.services.elevenlabs
:members:
:show-inheritance:


Defaults
~~~~~~~~
Expand Down
19 changes: 12 additions & 7 deletions docs/source/services.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ Manim Voiceover defines the :py:class:`~~base.SpeechService` class for adding ne
- No
- Yes
- Azure gives 500min/month free TTS quota. However, registration still needs a credit or debit card. See `Azure free account FAQ <https://azure.microsoft.com/en-us/free/free-account-faq/>`__ for more details.
* - :py:class:`~elevenlabs.ElevenLabsService`
- Very good, human-like
- No
- Yes
- `ElevenLabs <elevenlabs.io>`__ develops very advanced voice generative AI models. It has a range of realistic and emotive voices, and also allows you to clone your own voice by uploading a few minutes of your speech.
* - :py:class:`~coqui.CoquiService`
- Good, human-like
- Yes
Expand Down Expand Up @@ -146,23 +151,23 @@ Install Manim Voiceover with the ``pyttsx3`` extra in order to use :py:class:`~p
Refer to the `example usage <https://github.com/ManimCommunity/manim-voiceover/blob/main/examples/pyttsx3-example.py>`__ to get started.


:py:class:`~elevenlabs.ElevenlabsService`
:py:class:`~elevenlabs.ElevenLabsService`
******************************************

You can also use the `Eleven Labs TTS <https://www.elevenlabs.io/>`__ TTS service, for realistic voices. To use this you will need to create an account at `Eleven Labs <https://elevenlabs.io/>`__.
`ElevenLabs <https://www.elevenlabs.io/>`__ offers one of the most natural sounding speech service APIs. To use it, you will need to create an account at `Eleven Labs <https://elevenlabs.io/sign-up>`__.

.. tip::
Elevenlabs currently offers free TTS of 10,000 characters/month and upto 3 custom voices.
ElevenLabs currently offers free TTS of 10,000 characters/month and up to 3 custom voices.

Install Manim Voiceover with the ``elevenlabs`` extra in order to use :py:class:`~elevenlabs.ElevenlabsService`:
Install Manim Voiceover with the ``elevenlabs`` extra in order to use :py:class:`~elevenlabs.ElevenLabsService`:

.. code:: sh
pip install "manim-voiceover[elevenlabs]"
Then, you need to find out your API key.
Then, you need to find out your API key.

- Sign in to `Elevenlabs portal <https://www.elevenlabs.io/>`__ and go to your profile to obtain the key
- Sign in to `ElevenLabs portal <https://www.elevenlabs.io/>`__ and go to your profile to obtain the key
- Set the environment variable ``ELEVEN_API_KEY`` to your key

Create a file called ``.env`` that contains your authentication
Expand All @@ -172,7 +177,7 @@ information in the same directory where you call Manim.
ELEVEN_API_KEY="..." # insert Key 1 here
Check out `Elevenlabs
Check out `ElevenLabs
docs <https://elevenlabs.io/docs/api-reference/python-text-to-speech-guide#getting-started>`__
for more details.

Expand Down
6 changes: 3 additions & 3 deletions examples/elevenlabs-example.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ def construct(self):
# If none of voice_name or voice_id is passed, it defaults to the
# first voice in the list returned by `voices()`
#
# self.set_speech_service(ElevenlabsService())
# self.set_speech_service(ElevenLabsService())
#
# Set speech service using voice_name
#
# self.set_speech_service(ElevenlabsService(voice_name="Adam"))
# self.set_speech_service(ElevenLabsService(voice_name="Adam"))
#
# Set speech service using voice_id
#
# self.set_speech_service(ElevenlabsService(voice_id="29vD33N1CtxCmqQRPOHJ"))
# self.set_speech_service(ElevenLabsService(voice_id="29vD33N1CtxCmqQRPOHJ"))

# customise voice by passing voice_settings
self.set_speech_service(
Expand Down
11 changes: 6 additions & 5 deletions manim_voiceover/services/elevenlabs.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
except ImportError:
logger.error(
'Missing packages. Run `pip install "manim-voiceover[elevenlabs]"` '
"to use Elevenlabs API."
"to use ElevenLabs API."
)

from elevenlabs import Voice, VoiceSettings, generate, save, voices
Expand Down Expand Up @@ -45,7 +45,7 @@ def create_dotenv_elevenlabs():


class ElevenLabsService(SpeechService):
"""Speech service for Elevenlabs API."""
"""Speech service for ElevenLabs API."""

def __init__(
self,
Expand Down Expand Up @@ -84,7 +84,8 @@ def __init__(
"""
if not voice_name and not voice_id:
logger.warn(
"None of `voice_name` or `voice_id` provided. Will be using default voice."
"None of `voice_name` or `voice_id` provided. "
"Will be using default voice."
)

available_voices: List[Voice] = voices()
Expand All @@ -100,8 +101,8 @@ def __init__(
self.voice = selected_voice[0]
else:
logger.warn(
f"Given `voice_name` or `voice_id` not found (or not provided). \
Defaulting to {available_voices[0].name}"
"Given `voice_name` or `voice_id` not found (or not provided). "
f"Defaulting to {available_voices[0].name}"
)
self.voice = available_voices[0]

Expand Down

0 comments on commit 2c90c9f

Please sign in to comment.