Skip to main content

Manim Speech

Manim plugin for adding speech to videos.

Special thanks to osolmaz and others who worked on Manim Voiceover, which Manim Speech is heavily based on.

Installation

Manim Speech can be installed via pip using the following command:

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

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:

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:

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))

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

manim_speech-0.2.0.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

manim_speech-0.2.0-py3-none-any.whl (14.5 kB view details)

Uploaded Python 3

File details

Details for the file manim_speech-0.2.0.tar.gz.

File metadata

  • Download URL: manim_speech-0.2.0.tar.gz
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for manim_speech-0.2.0.tar.gz
Algorithm Hash digest
SHA256 41cf907fb334618fa576d0d81b243d366cf9e910dda83b8f1bf03cf07b2097c0
MD5 79896240beb082e30ef065040998cb3b
BLAKE2b-256 5a48a4311691cc01c7d20d13c7ad2534a8a38b174a836b7ef89944e3434ab6df

See more details on using hashes here.

File details

Details for the file manim_speech-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: manim_speech-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 14.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for manim_speech-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0dcbb5744ed049a911aff5f139c543e3e1f25966c12662a37e5fc3e56742675b
MD5 5f40de2a32a69022d4b9437879c838c1
BLAKE2b-256 6c6bfc5b572050588a8215b073adae23006a01343c0b2d49cfaf379840031eea

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page