ManimCommunity / manim-voiceover

Manim plugin for all things voiceover
https://voiceover.manim.community/en/stable
MIT License
186 stars 25 forks source link

How to use StitcherService to directly play an mp3 file as a voiceover? #80

Open arman-sydikov opened 10 months ago

arman-sydikov commented 10 months ago

As you can see from the screenshot, a demonstration video VoiceoverDemo.mp4 explains at 2:20 that with StitcherService it is possible to directly play an mp3 file as a voiceover.

Screenshot 2024-01-24 at 22 48 57

However when I try to use it a NameError occurs: name 'StitcherService' is not defined

from manim import *
from manim_voiceover import VoiceoverScene

class AzureExample(VoiceoverScene):
    def construct(self):
        # self.set_speech_service(
        #     AzureService(
        #         voice="ru-RU-DmitryNeural",
        #         style="newscast-casual",
        #         global_speed=1.15
        #     )
        # )
        self.set_speech_service(
            StitcherService("test.mp3")
        )

When I tried to fix it by importing StitcherService an ImportError occurred: cannot import name 'StitcherService' from 'manim_voiceover.services.stitcher' (/usr/local/lib/python3.11/site-packages/manim_voiceover/services/stitcher.py)

from manim import *
from manim_voiceover import VoiceoverScene
from manim_voiceover.services.stitcher import StitcherService

class AzureExample(VoiceoverScene):
    def construct(self):
        # self.set_speech_service(
        #     AzureService(
        #         voice="ru-RU-DmitryNeural",
        #         style="newscast-casual",
        #         global_speed=1.15
        #     )
        # )
        self.set_speech_service(
            StitcherService("test.mp3")
        )

So how to directly play an mp3 file as a voiceover?

mushunrek commented 6 months ago

I have run into the same problem. At the moment, the class has been renamed to _StitcherService, presumably because it is being worked on (?). In particular, I have noticed a bug, see #88. If you want to use _StitcherService anyway, you will have to go into the source code and modify the class as described in #88. This is only a workaround and should probably not be done long term... But at the moment, it works fine for me.