ManimCommunity / manim-voiceover

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

rendering the Azure Example give this error #17

Closed ndrahmani closed 2 years ago

ndrahmani commented 2 years ago

when I run the following command I get the next error manim -pql azure-example.py --disable_caching

Error details: USP error: timeout waiting for the first audio chunk
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ C:\Python39\lib\site-packages\manim\cli\render\commands.py:121 in render                         │
│                                                                                                  │
│   118 │   │   │   try:                                                                           │
│   119 │   │   │   │   with tempconfig(config):                                                   │
│   120 │   │   │   │   │   scene = SceneClass()                                                   │
│ ❱ 121 │   │   │   │   │   scene.render()                                                         │
│   122 │   │   │   except Exception:                                                              │
│   123 │   │   │   │   error_console.print_exception()                                            │
│   124 │   │   │   │   sys.exit(1)                                                                │
│                                                                                                  │
│ C:\Python39\lib\site-packages\manim\scene\scene.py:222 in render                                 │
│                                                                                                  │
│    219 │   │   """                                                                               │
│    220 │   │   self.setup()                                                                      │
│    221 │   │   try:                                                                              │
│ ❱  222 │   │   │   self.construct()                                                              │
│    223 │   │   except EndSceneEarlyException:                                                    │
│    224 │   │   │   pass                                                                          │
│    225 │   │   except RerunSceneException as e:                                                  │
│                                                                                                  │
│ G:\1-PHD MAIN\manim-speech\new manim voiceover\manim-voiceover\examples\azure-example.py:18 in   │
│ construct                                                                                        │
│                                                                                                  │
│   15 │   │   circle = Circle()                                                                   │
│   16 │   │   square = Square().shift(2 * RIGHT)                                                  │
│   17 │   │                                                                                       │
│ ❱ 18 │   │   with self.voiceover(text="This circle is drawn as I speak.") as tracker:            │
│   19 │   │   │   self.play(Create(circle), run_time=tracker.duration)                            │
│   20 │   │                                                                                       │
│   21 │   │   with self.voiceover(text="Let's shift it to the left 2 units.") as tracker:         │
│                                                                                                  │
│ C:\Python39\lib\contextlib.py:117 in __enter__                                                   │
│                                                                                                  │
│   114 │   │   # they are only needed for recreation, which is not possible anymore               │
│   115 │   │   del self.args, self.kwds, self.func                                                │
│   116 │   │   try:                                                                               │
│ ❱ 117 │   │   │   return next(self.gen)                                                          │
│   118 │   │   except StopIteration:                                                              │
│   119 │   │   │   raise RuntimeError("generator didn't yield") from None                         │
│   120                                                                                            │
│                                                                                                  │
│ C:\Python39\lib\site-packages\manim_voiceover\__init__.py:207 in voiceover                       │
│                                                                                                  │
│   204 │   │                                                                                      │
│   205 │   │   try:                                                                               │
│   206 │   │   │   if text is not None:                                                           │
│ ❱ 207 │   │   │   │   yield self.add_voiceover_text(text, **kwargs)                              │
│   208 │   │   │   elif ssml is not None:                                                         │
│   209 │   │   │   │   yield self.add_voiceover_ssml(ssml, **kwargs)                              │
│   210 │   │   finally:                                                                           │
│                                                                                                  │
│ C:\Python39\lib\site-packages\manim_voiceover\__init__.py:118 in add_voiceover_text              │
│                                                                                                  │
│   115 │   │   │   │   "You need to call init_voiceover() before adding a voiceover."             │
│   116 │   │   │   )                                                                              │
│   117 │   │                                                                                      │
│ ❱ 118 │   │   dict_ = self.speech_service.synthesize_from_text(text, **kwargs)                   │
│   119 │   │   tracker = VoiceoverTracker(self, dict_["json_path"])                               │
│   120 │   │   self.add_sound(dict_["final_audio"])                                               │
│   121 │   │   self.current_tracker = tracker                                                     │
│                                                                                                  │
│ C:\Python39\lib\site-packages\manim_voiceover\services\base.py:27 in synthesize_from_text        │
│                                                                                                  │
│   24 │   │   # Replace newlines with lines, reduce multiple consecutive spaces to single         │
│   25 │   │   text = " ".join(text.split())                                                       │
│   26 │   │                                                                                       │
│ ❱ 27 │   │   dict_ = self.generate_from_text(text, output_dir=None, path=path, **kwargs)         │
│   28 │   │   # path = dict_["original_audio"]                                                    │
│   29 │   │   # import ipdb; ipdb.set_trace()                                                     │
│   30                                                                                             │
│                                                                                                  │
│ C:\Python39\lib\site-packages\manim_voiceover\services\azure.py:159 in generate_from_text        │
│                                                                                                  │
│   156 │   │   │   │   │   print(                                                                 │
│   157 │   │   │   │   │   │   "Error details: {}".format(cancellation_details.error_details)     │
│   158 │   │   │   │   │   )                                                                      │
│ ❱ 159 │   │   │   raise Exception("Speech synthesis failed")                                     │
│   160 │   │                                                                                      │
│   161 │   │   return json_dict                                                                   │
│   162                                                                                            │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
Exception: Speech synthesis failed

When I run the gtts example it works

osolmaz commented 2 years ago

This is due to a networking bug, caused by a Microsoft Windows update:

https://learn.microsoft.com/en-us/answers/questions/1047034/text-to-speech-usp-error-timeout-waiting-for-the-f-1.html

If you want this to be resolved now, try reverting update KB5018410. Otherwise, you can wait until it is resolved, or use another OS.

ndrahmani commented 2 years ago

how to revert the update KB5018410