manim icon indicating copy to clipboard operation
manim copied to clipboard

Unable to add sound for opengl renderer

Open k4pran opened this issue 4 years ago • 1 comments

Description of bug / unexpected behavior

When going through cairo's tests the below one failed that was testing sound, it doesn't seem to have implemented some of cairo's logic to add sound to a movie file.

I was trying to run the following test with opengl:

def test_add_sound(using_opengl_renderer, tmpdir):
    # create sound file
    sound_loc = Path(tmpdir, "noise.wav")
    f = wave.open(str(sound_loc), "w")
    f.setparams((2, 2, 44100, 0, "NONE", "not compressed"))
    for _ in range(22050):  # half a second of sound
        packed_value = struct.pack("h", 14242)
        f.writeframes(packed_value)
        f.writeframes(packed_value)

    f.close()

    scene = Scene()
    scene.add_sound(sound_loc)

Which results in

AttributeError: 'OpenGLRenderer' object has no attribute 'time'

Expected behavior

How to reproduce the issue

Code for reproducing the problem
class Example(Scene):
    def construct(self):
        self.add_sound("path/to/soundfile")

Additional media files

Images/GIFs

Logs

Terminal output
PASTE HERE OR PROVIDE LINK TO https://pastebin.com/ OR SIMILAR

System specifications

System Details
  • OS (with version, e.g Windows 10 v2004 or macOS 10.15 (Catalina)):
  • RAM:
  • Python version (python/py/python3 --version):
  • Installed modules (provide output from pip list):
PASTE HERE
LaTeX details
  • LaTeX distribution (e.g. TeX Live 2020):
  • Installed LaTeX packages:
FFMPEG

Output of ffmpeg -version:

PASTE HERE

Additional comments

k4pran avatar Oct 03 '21 18:10 k4pran

I faced the same issue with Manim CE 0.19, well, it's been over 4 years now

hungnt61h avatar Aug 04 '25 15:08 hungnt61h