Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Adding sound to slides #375

Open
JohnyMarley opened this issue Feb 20, 2024 · 5 comments
Open

[FEATURE] Adding sound to slides #375

JohnyMarley opened this issue Feb 20, 2024 · 5 comments
Labels
enhancement New feature or request waiting external Waiting for things that are external to Manim Slides (e.g., a feature on a dependency)

Comments

@JohnyMarley
Copy link

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 JohnyMarley added the enhancement New feature or request label Feb 20, 2024
@jeertmans jeertmans added the waiting external Waiting for things that are external to Manim Slides (e.g., a feature on a dependency) label Feb 21, 2024
@jeertmans
Copy link
Owner

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 ManimCommunity/manim#3347.

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

@JohnyMarley
Copy link
Author

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

@jeertmans
Copy link
Owner

Not without changing Manim Slides' code a bit:

self.next_media_player = QMediaPlayer()
self.next_media_player.setVideoOutput(next_video_widget)
self.next_media_player.setLoops(-1)
right_layout.addWidget(next_video_widget)

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
Copy link

Not without changing Manim Slides' code a bit:

self.next_media_player = QMediaPlayer()
self.next_media_player.setVideoOutput(next_video_widget)
self.next_media_player.setLoops(-1)
right_layout.addWidget(next_video_widget)

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 added a commit that referenced this issue Mar 5, 2024
This PR adds the necessary audio output to the presenter mode, so it can play audio contained in video files, see #375.

However, this does not fix the issue that slides do not contain audio by default, but should be solved by Manim, see #375 for updates on that topic.
@jeertmans
Copy link
Owner

Not without changing Manim Slides' code a bit:

self.next_media_player = QMediaPlayer()
self.next_media_player.setVideoOutput(next_video_widget)
self.next_media_player.setLoops(-1)
right_layout.addWidget(next_video_widget)

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 added a commit that referenced this issue Mar 5, 2024
* feat(present): add audio output

This PR adds the necessary audio output to the presenter mode, so it can play audio contained in video files, see #375.

However, this does not fix the issue that slides do not contain audio by default, but should be solved by Manim, see #375 for updates on that topic.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix: PR number

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
@jeertmans jeertmans changed the title Adding sound to slides [FEATURE] Adding sound to slides Apr 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request waiting external Waiting for things that are external to Manim Slides (e.g., a feature on a dependency)
Projects
None yet
Development

No branches or pull requests

3 participants