manim-slides icon indicating copy to clipboard operation
manim-slides copied to clipboard

[FEATURE] Adding sound to slides

Open JohnyMarley opened this issue 1 year ago • 5 comments

Description

Hello,

It would be nice to be able to add sounds to slides. Is this a possibility?

Screenshots

No response

Additional information

No response

JohnyMarley avatar Feb 20 '24 23:02 JohnyMarley

Hello @JohnyMarley! This is a long waited feature, see #258.

The issue is that partial movie files, so the videos we use to cut a presentation into slides, do not contain audio. My plan is to first include audio in partial movie files generated by Manim, see https://github.com/ManimCommunity/manim/issues/3347.

Once merged, handling audio files would be pretty easy on the Manim Slides side.

jeertmans avatar Feb 21 '24 09:02 jeertmans

Awesome! is it possible for now to manually add the sound into the videos in postprocessing somehow?

JohnyMarley avatar Feb 21 '24 09:02 JohnyMarley

Not without changing Manim Slides' code a bit:

https://github.com/jeertmans/manim-slides/blob/1dbd2fdde58030867f15d7bf0ecede11d59d6903/manim_slides/present/player.py#L118-L122

Here, I need to add some audio output. Then, if your files contain audio, they should be played normally. Note that it may be worth doing something about the audio when the slide is not played at the usual playback rate (like in reverse mode).

For HTML slides, the audio is already played, except for the first slide (because most browser do not allow playing audio automatically, so they will block your slide if the first video played contains audio).

jeertmans avatar Feb 21 '24 09:02 jeertmans

Not without changing Manim Slides' code a bit:

https://github.com/jeertmans/manim-slides/blob/1dbd2fdde58030867f15d7bf0ecede11d59d6903/manim_slides/present/player.py#L118-L122

Here, I need to add some audio output. Then, if your files contain audio, they should be played normally. Note that it may be worth doing something about the audio when the slide is not played at the usual playback rate (like in reverse mode).

For HTML slides, the audio is already played, except for the first slide (because most browser do not allow playing audio automatically, so they will block your slide if the first video played contains audio).

So if we need to add sound to the manim-slides, we should add these lines to the source code? After that, can we just use self.add("sound.wav") simply to add sound? Thx a lot!

semikernel avatar Mar 05 '24 02:03 semikernel

Not without changing Manim Slides' code a bit: https://github.com/jeertmans/manim-slides/blob/1dbd2fdde58030867f15d7bf0ecede11d59d6903/manim_slides/present/player.py#L118-L122

Here, I need to add some audio output. Then, if your files contain audio, they should be played normally. Note that it may be worth doing something about the audio when the slide is not played at the usual playback rate (like in reverse mode). For HTML slides, the audio is already played, except for the first slide (because most browser do not allow playing audio automatically, so they will block your slide if the first video played contains audio).

So if we need to add sound to the manim-slides, we should add these lines to the source code? After that, can we just use self.add("sound.wav") simply to add sound? Thx a lot!

Hello @semikernel! As explained above, using self.add("sound.wav") does not include the audio in the partial movie files, which we use to create slides, but only in the final larger video. This is, in my opinion, something that should be changed on the Manim side, but we are waiting some updates on a PR before this can move on. I just made #382 so next versions of Manim Slides should be ready to play audio :-)

jeertmans avatar Mar 05 '24 10:03 jeertmans