# Manim Speech
Manim plugin for adding speech to videos.
Special thanks to [osolmaz](https://github.com/osolmaz) and others who worked on [Manim Voiceover](https://github.com/ManimCommunity/manim-voiceover), which Manim Speech is heavily based on.
## Installation
Manim Speech can be installed via pip using the following command:
```shell
pip install "manim_speech[*optional_dependency_sets*]"
```
Where `*optional_dependency_sets*` is a list of optional dependency sets for Manim Speech.
## Features
* Integrate voiceovers into Manim animations.
* Utilize bookmarks to pause for key moments in the voiceover (identical to Manim Voiceover functionality).
* Easily translate text within Manim animations to various languages with minimal code.
* Leverage AI-driven services for text-to-speech, speech-to-text, and translation.
### Services
| Service Name | Optional Dependency Set | Is Local | Text-To-Speech | Speech-To-Text | Translation |
|--------------|-------------------------|----------|----------------|----------------|-------------|
| OpenAI | `openai` | No* | Yes | Yes | Yes |
| ElevenLabs | `elevenlabs` | No | Yes | No | No |
| Whisper | ~~`whisper`~~** | Yes | No | Yes | No |
| AssemblyAI | `assemblyai` | No | No | Yes | No |
| DeepL | `deepl` | No | No | No | Yes |
\* The OpenAI service can use any backend compatible with the OpenAI API through the `base_url` parameter, some of which are local (e.g., LocalAI).
\** For now, the optional dependencies for the Whisper service cannot be installed automatically. To use the Whisper service, run `pip install openai-whisper`.
#### Notes on Chinese Translations
**OpenAI Translator:** Please specify Traditional (`zh_tw`) or Simplified (`zh_cn`) when using the OpenAI translator. Only specifying `zh` has no guarantee on the script used, although tests have indicated that GPT-4o strongly prefers Simplified Chinese in such cases.
**DeepL Translator:** The DeepL translator does not natively support translating to Traditional Chinese, so translating to Traditional Chinese requires the `chinese` optional dependency set to be installed. Only specifying `zh` has the same effect as specifying `zh_cn`.
## Usage Examples
Creating a basic scene with a voiceover with Manim Speech:
```python
import manim
import manim_speech
from manim_speech.services import openai as openai_service
class MeaningOfLife(manim_speech.VoiceoverScene):
def construct(self) -> None:
self.set_tts_service(openai_service.OpenAITTSService()) # Remove this line if you want to manually record voiceovers.
self.set_stt_service(openai_service.OpenAISTTService()) # Only required if you use bookmarks.
with self.voiceover("What is the meaning of life?") as speech_data:
txt = manim.Text("The meaning of life is 42.")
self.play(manim.Write(txt), run_time=speech_data.duration)
self.wait_for_voiceover()
self.play(manim.FadeOut(txt))
```
The same scene, but translated into Traditional Chinese:
```python
import manim
import manim_speech
from manim_speech.services import openai as openai_service
class MeaningOfLife(manim_speech.VoiceoverScene, manim_speech.TranslationScene):
def construct(self) -> None:
self.set_tts_service(openai_service.OpenAITTSService()) # Remove this line if you want to manually record voiceovers.
self.set_stt_service(openai_service.OpenAISTTService()) # Only required if you use bookmarks.
self.set_translation_service(openai_service.OpenAITranslationService()) # Remove this line if you want to manually translate text.
self.translate(__file__, "meaning_of_life", "en", "zh_tw")
_ = self._
with self.voiceover(_("What is the meaning of life?")) as speech_data:
txt = manim.Text(_("The meaning of life is 42."))
self.play(manim.Write(txt), run_time=speech_data.duration)
self.wait_for_voiceover()
self.play(manim.FadeOut(txt))
```
Raw data
{
"_id": null,
"home_page": "https://github.com/MtCelesteMa/manim-speech",
"name": "manim-speech",
"maintainer": null,
"docs_url": null,
"requires_python": "<3.13,>=3.12",
"maintainer_email": null,
"keywords": "manim, speech, voiceover, tts",
"author": "Celeste Ma",
"author_email": "mtcelestema@proton.me",
"download_url": "https://files.pythonhosted.org/packages/42/02/9d430edee9cd9775bdb69b42fe90f39f38b194b4c07576d04b8202db86bd/manim_speech-0.2.1.tar.gz",
"platform": null,
"description": "# Manim Speech\n\nManim plugin for adding speech to videos.\n\nSpecial thanks to [osolmaz](https://github.com/osolmaz) and others who worked on [Manim Voiceover](https://github.com/ManimCommunity/manim-voiceover), which Manim Speech is heavily based on.\n\n## Installation\n\nManim Speech can be installed via pip using the following command:\n```shell\npip install \"manim_speech[*optional_dependency_sets*]\"\n```\n\nWhere `*optional_dependency_sets*` is a list of optional dependency sets for Manim Speech.\n\n## Features\n\n* Integrate voiceovers into Manim animations.\n\n * Utilize bookmarks to pause for key moments in the voiceover (identical to Manim Voiceover functionality).\n\n* Easily translate text within Manim animations to various languages with minimal code.\n\n* Leverage AI-driven services for text-to-speech, speech-to-text, and translation.\n\n### Services\n\n| Service Name | Optional Dependency Set | Is Local | Text-To-Speech | Speech-To-Text | Translation |\n|--------------|-------------------------|----------|----------------|----------------|-------------|\n| OpenAI | `openai` | No* | Yes | Yes | Yes |\n| ElevenLabs | `elevenlabs` | No | Yes | No | No |\n| Whisper | ~~`whisper`~~** | Yes | No | Yes | No |\n| AssemblyAI | `assemblyai` | No | No | Yes | No |\n| DeepL | `deepl` | No | No | No | Yes |\n\n\\* The OpenAI service can use any backend compatible with the OpenAI API through the `base_url` parameter, some of which are local (e.g., LocalAI).\n\n\\** For now, the optional dependencies for the Whisper service cannot be installed automatically. To use the Whisper service, run `pip install openai-whisper`.\n\n#### Notes on Chinese Translations\n\n**OpenAI Translator:** Please specify Traditional (`zh_tw`) or Simplified (`zh_cn`) when using the OpenAI translator. Only specifying `zh` has no guarantee on the script used, although tests have indicated that GPT-4o strongly prefers Simplified Chinese in such cases.\n\n**DeepL Translator:** The DeepL translator does not natively support translating to Traditional Chinese, so translating to Traditional Chinese requires the `chinese` optional dependency set to be installed. Only specifying `zh` has the same effect as specifying `zh_cn`.\n\n## Usage Examples\n\nCreating a basic scene with a voiceover with Manim Speech:\n```python\nimport manim\nimport manim_speech\nfrom manim_speech.services import openai as openai_service\n\nclass MeaningOfLife(manim_speech.VoiceoverScene):\n def construct(self) -> None:\n self.set_tts_service(openai_service.OpenAITTSService()) # Remove this line if you want to manually record voiceovers.\n self.set_stt_service(openai_service.OpenAISTTService()) # Only required if you use bookmarks.\n\n with self.voiceover(\"What is the meaning of life?\") as speech_data:\n txt = manim.Text(\"The meaning of life is 42.\")\n self.play(manim.Write(txt), run_time=speech_data.duration)\n self.wait_for_voiceover()\n self.play(manim.FadeOut(txt))\n```\n\nThe same scene, but translated into Traditional Chinese:\n```python\nimport manim\nimport manim_speech\nfrom manim_speech.services import openai as openai_service\n\nclass MeaningOfLife(manim_speech.VoiceoverScene, manim_speech.TranslationScene):\n def construct(self) -> None:\n self.set_tts_service(openai_service.OpenAITTSService()) # Remove this line if you want to manually record voiceovers.\n self.set_stt_service(openai_service.OpenAISTTService()) # Only required if you use bookmarks.\n self.set_translation_service(openai_service.OpenAITranslationService()) # Remove this line if you want to manually translate text.\n\n self.translate(__file__, \"meaning_of_life\", \"en\", \"zh_tw\")\n _ = self._\n\n with self.voiceover(_(\"What is the meaning of life?\")) as speech_data:\n txt = manim.Text(_(\"The meaning of life is 42.\"))\n self.play(manim.Write(txt), run_time=speech_data.duration)\n self.wait_for_voiceover()\n self.play(manim.FadeOut(txt))\n```\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Manim plugin for adding speech to videos.",
"version": "0.2.1",
"project_urls": {
"Homepage": "https://github.com/MtCelesteMa/manim-speech",
"Repository": "https://github.com/MtCelesteMa/manim-speech"
},
"split_keywords": [
"manim",
" speech",
" voiceover",
" tts"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "fab4c5198b6d5b2419f4718d283e4c6d7c779de028f1380529318f55568b841f",
"md5": "dd34fffc30dab5fd05058e220bb61bab",
"sha256": "6bdf47b6cc6fe2f0c99e3c6a180f6c22166b2750bba7bb8f4323b9fc92451941"
},
"downloads": -1,
"filename": "manim_speech-0.2.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "dd34fffc30dab5fd05058e220bb61bab",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<3.13,>=3.12",
"size": 13959,
"upload_time": "2024-07-03T08:20:59",
"upload_time_iso_8601": "2024-07-03T08:20:59.997703Z",
"url": "https://files.pythonhosted.org/packages/fa/b4/c5198b6d5b2419f4718d283e4c6d7c779de028f1380529318f55568b841f/manim_speech-0.2.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "42029d430edee9cd9775bdb69b42fe90f39f38b194b4c07576d04b8202db86bd",
"md5": "1406eca9233dd8c99e9ab9d9e7a0defc",
"sha256": "97365ec5d84676b9123b2c6810bd37a49ae6d0ec712e3a00c79400eef75e30b3"
},
"downloads": -1,
"filename": "manim_speech-0.2.1.tar.gz",
"has_sig": false,
"md5_digest": "1406eca9233dd8c99e9ab9d9e7a0defc",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<3.13,>=3.12",
"size": 10798,
"upload_time": "2024-07-03T08:21:02",
"upload_time_iso_8601": "2024-07-03T08:21:02.113343Z",
"url": "https://files.pythonhosted.org/packages/42/02/9d430edee9cd9775bdb69b42fe90f39f38b194b4c07576d04b8202db86bd/manim_speech-0.2.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-03 08:21:02",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "MtCelesteMa",
"github_project": "manim-speech",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "manim-speech"
}