jeertmans / manim-slides

Tool for live presentations using manim
https://manim-slides.eertmans.be
MIT License
418 stars 46 forks source link

[FEATURE] Adding sound to slides #375

Open JohnyMarley opened 5 months ago

JohnyMarley commented 5 months ago

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

jeertmans commented 5 months ago

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.

JohnyMarley commented 5 months ago

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

jeertmans commented 5 months ago

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).

semikernel commented 4 months ago

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!

jeertmans commented 4 months ago

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 :-)