ManimCommunity / ManimCommunity/manim

Sound Not Playing When Cache Is Enabled in Manim v0.18.1

Open
#4,005 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
40.9k
Forks
3.1k
Avg merge
3d 12h
Merged PRs (30d)
25

Description

Hello Manim Community,

I am experiencing an issue with Manim Community version v0.18.1 related to sound playback when caching is enabled. Specifically, when I render my animations with caching turned on, the add_sound() function does not play any sound in the final video output.

Here are the details:

Manim Version: v0.18.1

Environment: Windows 10, Python 3.10, using a virtual environment.

Description of the Issue: When I run my script without any special cache arguments, or when using --flush_cache, the resulting video does not include the expected sounds added via add_sound(). However, when I use --disable_caching, the sound plays correctly.

For instance, the following command does not play the sound in the output:

sh
Copier le code
manim -pql --fps 30 animation_demos.py AnimationTests
Whereas the following command does play the sound:

sh
Copier le code
manim -pql --fps 30 --disable_caching animation_demos.py AnimationTests
It seems that something goes wrong with the caching mechanism when handling the add_sound() feature.

Steps to Reproduce:

Create a simple Manim script that uses add_sound() to add an audio clip during an animation.
Render the script normally with caching (manim -pql).
Notice that the output video does not include the sound.
Render the script with --disable_caching and observe that the sound is included as expected.
Expected Behavior: The sound should be played in the final video regardless of caching settings.

Actual Behavior: The sound only plays when caching is disabled.

Additional Notes: I have tried flushing the cache (--flush_cache) and different audio file formats (e.g., .mp3 and .wav). The issue persists as long as caching is enabled.

This looks like a potential bug in how Manim handles caching, specifically regarding sounds added during animations. I hope this information helps with diagnosing and fixing the issue.

If there are any workarounds or additional debug steps I can try, please let me know. Thank you in advance for your help!

Best regards,

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with a minimal animation using add_sound(), first with `manim -pql --fps 30` and then with `--disable_caching`. Trace the caching path and audio handling used during rendering. Done means the final video includes the sound with caching enabled, including after `--flush_cache`, and the behavior is covered by a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
computer-graphics
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.