Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ https://user-images.githubusercontent.com/2453968/198145393-6a1bd709-4441-4821-8

Currently supported TTS services (aside from the CLI that allows you to records your own voice):

- [Azure Text to Speech](https://azure.microsoft.com/en-us/services/cognitive-services/text-to-speech/) (Recommended for AI voices)
- [Gemini Text to Speech](https://ai.google.dev/gemini-api/docs/speech-generation) (Recommended for AI voices)
- [Azure Text to Speech](https://azure.microsoft.com/en-us/services/cognitive-services/text-to-speech/)
- [gTTS](https://github.com/pndurette/gTTS/)
- [pyttsx3](https://github.com/nateshmbhat/pyttsx3)

Expand Down
10 changes: 5 additions & 5 deletions docs/source/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,27 +26,27 @@ Speech services
:members:
:show-inheritance:

.. automodule:: manim_voiceover.services.azure
.. automodule:: manim_voiceover.services.gemini
:members:
:show-inheritance:

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

.. automodule:: manim_voiceover.services.openai
.. automodule:: manim_voiceover.services.azure
:members:
:show-inheritance:

.. automodule:: manim_voiceover.services.pyttsx3
.. automodule:: manim_voiceover.services.openai
:members:
:show-inheritance:

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

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

Expand Down
4 changes: 2 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@

# external links
extlinks = {
"issue": ("https://github.com/ManimCommunity/manim/issues/%s", "#"),
"pr": ("https://github.com/ManimCommunity/manim/pull/%s", "#"),
"issue": ("https://github.com/ManimCommunity/manim/issues/%s", "#%s"),
"pr": ("https://github.com/ManimCommunity/manim/pull/%s", "#%s"),
}

# opengraph settings
Expand Down
6 changes: 3 additions & 3 deletions docs/source/installation.rst
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Installation
============

Install Manim Voiceover from PyPI with the extras ``azure`` and ``gtts``:
Install Manim Voiceover from PyPI with the extras ``gemini`` and ``gtts``:

.. code:: sh

pip install --upgrade "manim-voiceover[azure,gtts]"
pip install --upgrade "manim-voiceover[gemini,gtts]"

Check whether your installation works correctly:

Expand Down Expand Up @@ -107,4 +107,4 @@ On macOS, you can install it using `Homebrew <https://brew.sh/>`__:

.. code:: sh

brew install gettext
brew install gettext
28 changes: 14 additions & 14 deletions docs/source/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,19 @@ You can also inherit from multiple scene classes:
This should work as long as the variables or methods of parent classes do not collide.

Manim Voiceover can use various text-to-speech engines, some
proprietary and some free. A good one to start with is gTTS, which uses
the Google Translate API. We found out that this is the best
for beginning to use the library owing to its cross-platform compatibility—however it still needs
an internet connection.
proprietary and some free. For generated AI voices, the recommended
starting point is Gemini text-to-speech. It requires an internet
connection and a Gemini API key or Google Cloud Application Default
Credentials.

.. code:: py

from manim_voiceover import VoiceoverScene
from manim_voiceover.services.gtts import GTTSService
from manim_voiceover.services.gemini import GeminiService

class MyAwesomeScene(VoiceoverScene):
def construct(self):
self.set_speech_service(GTTSService())
self.set_speech_service(GeminiService(voice="Kore"))

The logic for adding a voiceover is pretty simple. Wrap the animation
inside a ``with`` block that calls ``self.voiceover()``:
Expand Down Expand Up @@ -85,8 +85,8 @@ The ``text`` argument is automatically reused for video subcaptions. Alternative
self.play(Create(circle))

See :doc:`examples` and the `examples directory <https://github.com/ManimCommunity/manim-voiceover/blob/main/examples>`__
for more examples. We recommend starting with the `gTTS
example <https://github.com/ManimCommunity/manim-voiceover/blob/main/examples/gtts-example.py>`__.
for more examples. We recommend starting with the `Gemini demo
example <https://github.com/ManimCommunity/manim-voiceover/blob/main/examples/voiceover-demo.py>`__.

Bookmarks
*********
Expand All @@ -104,16 +104,16 @@ Record your own voiceover

Manim Voiceover can record your voiceover directly from the command line. We recommend the following workflow:

1. Develop your animation with one of the text-to-speech engines, e.g. :py:class:`services.gtts.GTTSService`:
1. Develop your animation with one of the text-to-speech engines, e.g. :py:class:`services.gemini.GeminiService`:

.. code:: py

from manim_voiceover import VoiceoverScene
from manim_voiceover.services.gtts import GTTSService
from manim_voiceover.services.gemini import GeminiService

class MyAwesomeScene(VoiceoverScene):
def construct(self):
self.set_speech_service(GTTSService())
self.set_speech_service(GeminiService(voice="Kore"))

with self.voiceover(text="This circle is drawn as I speak.") as tracker:
self.play(Create(circle))
Expand All @@ -124,12 +124,12 @@ Manim Voiceover can record your voiceover directly from the command line. We rec
.. code:: py

from manim_voiceover import VoiceoverScene
# from manim_voiceover.services.gtts import GTTSService
# from manim_voiceover.services.gemini import GeminiService
from manim_voiceover.services.recorder import RecorderService

class MyAwesomeScene(VoiceoverScene):
def construct(self):
# self.set_speech_service(GTTSService())
# self.set_speech_service(GeminiService(voice="Kore"))
self.set_speech_service(RecorderService())

with self.voiceover(text="This circle is drawn as I speak.") as tracker:
Expand Down Expand Up @@ -158,4 +158,4 @@ The `gTTS example <https://github.com/ManimCommunity/manim-voiceover/blob/main/e
implements the same scene in English and Vietnamese as a demonstration.

If you can't find a good text-to-speech engine for your language, you can directly
record your own voiceover using :py:class:`services.recorder.RecorderService`.
record your own voiceover using :py:class:`services.recorder.RecorderService`.
77 changes: 38 additions & 39 deletions docs/source/services.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ Manim Voiceover defines the :py:class:`~~base.SpeechService` class for adding ne
- N/A
- N/A
- This is a utility class to record your own voiceovers with a microphone.
* - :py:class:`~gemini.GeminiService`
- Very good, human-like
- No
- Yes
- Recommended for generated AI voices. Requires a Gemini API key or Google Cloud ADC, and Python 3.11 or newer.
* - :py:class:`~azure.AzureService`
- Very good, human-like
- No
Expand All @@ -42,11 +47,6 @@ Manim Voiceover defines the :py:class:`~~base.SpeechService` class for adding ne
- No
- No
- It's a free API subsidized by Google, so there is a likelihood it may stop working in the future.
* - :py:class:`~gemini.GeminiService`
- Very good, human-like
- No
- Yes
- Requires a Gemini API key or Google Cloud ADC, and Python 3.10 or newer.
* - :py:class:`~openai.OpenAIService`
- Very good, human-like
- No
Expand All @@ -73,11 +73,43 @@ Install Manim Voiceover with the ``recorder`` extra in order to use :py:class:`~

Refer to the `example usage <https://github.com/ManimCommunity/manim-voiceover/blob/main/examples/recorder-example.py>`__ to get started.

:py:class:`~gemini.GeminiService`
*********************************

`Gemini text-to-speech <https://ai.google.dev/gemini-api/docs/speech-generation>`__ is the recommended service for generated AI voices in Manim Voiceover. It provides controllable text-to-speech through the Google Gen AI SDK, and requires an internet connection and Python 3.11 or newer.

Install Manim Voiceover with the ``gemini`` extra in order to use :py:class:`~gemini.GeminiService`:

.. code:: sh

pip install "manim-voiceover[gemini]"

For Gemini Developer API authentication, create a file called ``.env``
that contains your API key in the same directory where you call Manim.

.. code:: sh

GEMINI_API_KEY="..." # insert the API key here

Gemini uses API-key authentication by default:

.. code:: python

self.set_speech_service(GeminiService(voice="Kore"))

For Google Cloud Vertex AI authentication, use Application Default
Credentials and set ``auth_mode="adc"``:

.. code:: python

self.set_speech_service(
GeminiService(voice="Kore", auth_mode="adc", project="my-project-id")
)

:py:class:`~azure.AzureService`
*******************************

As of now, the highest quality text-to-speech service available in Manim Voiceover is `Microsoft Azure Speech Service <https://learn.microsoft.com/en-us/azure/cognitive-services/speech-service/overview>`__. To use it, you will need to `create an
`Microsoft Azure Speech Service <https://learn.microsoft.com/en-us/azure/cognitive-services/speech-service/overview>`__ is also available for generated voices. To use it, you will need to `create an
Azure account <https://azure.microsoft.com/en-us/free/>`__.

.. tip::
Expand Down Expand Up @@ -123,39 +155,6 @@ Install Manim Voiceover with the ``gtts`` extra in order to use :py:class:`~gtts

Refer to the `example usage <https://github.com/ManimCommunity/manim-voiceover/blob/main/examples/gtts-example.py>`__ to get started.

:py:class:`~gemini.GeminiService`
*********************************

`Gemini text-to-speech <https://ai.google.dev/gemini-api/docs/speech-generation>`__ provides controllable text-to-speech through the Google Gen AI SDK. It requires an internet connection and Python 3.10 or newer.

Install Manim Voiceover with the ``gemini`` extra in order to use :py:class:`~gemini.GeminiService`:

.. code:: sh

pip install "manim-voiceover[gemini]"

For Gemini Developer API authentication, create a file called ``.env``
that contains your API key in the same directory where you call Manim.

.. code:: sh

GEMINI_API_KEY="..." # insert the API key here

Gemini uses API-key authentication by default:

.. code:: python

self.set_speech_service(GeminiService(voice="Kore"))

For Google Cloud Vertex AI authentication, use Application Default
Credentials and set ``auth_mode="adc"``:

.. code:: python

self.set_speech_service(
GeminiService(voice="Kore", auth_mode="adc", project="my-project-id")
)

:py:class:`~openai.OpenAIService`
*************************************
`OpenAI <https://platform.openai.com/docs/api-reference/audio/createSpeech/>`__ provides a text-to-speech service. It is through an API, so it requires an internet connection to work. It also requires an API key to use. Register for one `here <https://platform.openai.com/>`__.
Expand Down
28 changes: 13 additions & 15 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "manim-voiceover"
version = "0.3.8"
description = "Manim plugin for all things voiceover"
readme = "README.md"
requires-python = ">=3.8"
requires-python = ">=3.11"
license = "MIT"
authors = [
{ name = "The Manim Community Developers", email = "contact@manim.community" },
Expand All @@ -28,20 +28,19 @@ classifiers = [
"Topic :: Multimedia :: Sound/Audio :: Speech",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"Topic :: Scientific/Engineering :: Visualization",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Natural Language :: English",
]
dependencies = [
"manim",
"sox>=1.4.1,<2",
"python-dotenv>=0.21.0,<0.22; python_version < '3.10'",
"python-dotenv>=1.2.2,<2; python_version >= '3.10'",
"python-dotenv>=1.2.2,<2",
"mutagen>=1.46.0,<2",
"pydub>=0.25.1,<0.26",
"pip>=21.0.1; python_version < '3.10'",
"pip>=26.1.2; python_version >= '3.10'",
"pip>=26.1.2",
"pydantic>=2.10,<3",
"python-slugify>=8.0.1,<9",
]

Expand All @@ -53,7 +52,7 @@ pyttsx3 = ["pyttsx3>=2.90,<3"]
recorder = ["PyAudio>=0.2.12,<0.3", "pynput>=1.7.6,<2"]
translate = ["deepl>=1.12.0,<2"]
elevenlabs = ["elevenlabs>=0.2.27,<0.3"]
gemini = ["google-genai>=1.0,<3; python_version >= '3.10'"]
gemini = ["google-genai>=1.0,<3"]
transcribe = ["openai-whisper>=20230314", "stable-ts>=2.6.2,<3"]
all = [
"azure-cognitiveservices-speech>=1.24.0,<2",
Expand All @@ -66,7 +65,7 @@ all = [
"openai-whisper>=20230314",
"stable-ts>=2.6.2,<3",
"elevenlabs>=0.2.27,<0.3",
"google-genai>=1.0,<3; python_version >= '3.10'",
"google-genai>=1.0,<3",
]

[project.urls]
Expand Down Expand Up @@ -94,8 +93,7 @@ dev = [
"pip-audit>=2.7",
"PyAudio>=0.2.12,<0.3",
"pytest-cov>=5.0.0,<7",
"pytest>=8.3.5,<9; python_version < '3.10'",
"pytest>=9.0.3,<10; python_version >= '3.10'",
"pytest>=9.0.3,<10",
"pynput>=1.7.6,<2",
"pyttsx3>=2.90,<3",
"pylint>=2.12.2,<3",
Expand All @@ -108,7 +106,7 @@ dev = [
"matplotlib>=3.3.2,<4",
"pre-commit>=2.11.1,<3",
"gitpython>=3,<4",
"google-genai>=1.0,<3; python_version >= '3.10'",
"google-genai>=1.0,<3",
"pygithub>=1,<2",
"isort>=5.8.0,<6",
"pytest-xdist>=3.6,<4",
Expand All @@ -124,7 +122,7 @@ dev = [

[tool.ruff]
line-length = 127
target-version = "py38"
target-version = "py311"
src = ["src", "tests"]
extend-exclude = ["docs", "examples", "mutants"]

Expand Down Expand Up @@ -159,7 +157,7 @@ show_missing = true
source_paths = ["src/manim_voiceover"]

[tool.mypy]
python_version = "3.8"
python_version = "3.11"
strict = true
show_error_codes = true
files = ["src/manim_voiceover"]
Expand Down
Loading