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

Embed audio samples in generated tutorials #1985

Merged
merged 2 commits into from
Nov 5, 2021
Merged

Conversation

mthrok
Copy link
Collaborator

@mthrok mthrok commented Nov 5, 2021

It turned out that generated tutorials can embed the audio if the following conditions are met.
This commit changes how audio samples are shown in tutorials so that they become playable in doc.

  1. There is only one IPython.display.Audio call in a cell
  2. IPython.display.Audio is the last function called in the cell
  3. Audio format is wav
    (flac can be embedded as well, but browsers (Chrome/Safari) won't play it)

Ref: https://stackoverflow.com/a/33109647

Before
Screen Shot 2021-11-04 at 10 42 37 PM

After
Screen Shot 2021-11-04 at 10 41 49 PM

It turned out that generated tutorials can embed the audio if the following conditions are met.
This commit changes how audio samples are shown in tutorials so that they become playable in doc.

1. There is only one `IPython.display.Audio` call in a cell
2. `IPython.display.Audio` is the last function called in the cell
3. Audio format is `wav`
   (`flac` can be contained, but browsers (Chrome/Safari) won't play it)

Ref: https://stackoverflow.com/a/33109647
@mthrok mthrok changed the title Include audio samples in generated tutorials Embed audio samples in generated tutorials Nov 5, 2021
@mthrok mthrok merged commit 34e69f9 into pytorch:main Nov 5, 2021
@mthrok mthrok deleted the tweak-audio branch November 5, 2021 15:02
mthrok added a commit to mthrok/audio that referenced this pull request Dec 3, 2021
It turned out that generated tutorials can embed the audio if the following conditions are met.
This commit changes how audio samples are shown in tutorials so that they become playable in doc.

1. There is only one `IPython.display.Audio` call in a cell
2. An object of `IPython.display.Audio` is the last object interpreter receives in the cell
3. Audio format is `wav`
   (`flac` can be embedded as well, but browsers (Chrome/Safari) won't play it)

Ref: https://stackoverflow.com/a/33109647
mthrok added a commit to mthrok/audio that referenced this pull request Dec 3, 2021
It turned out that generated tutorials can embed the audio if the following conditions are met.
This commit changes how audio samples are shown in tutorials so that they become playable in doc.

1. There is only one `IPython.display.Audio` call in a cell
2. An object of `IPython.display.Audio` is the last object interpreter receives in the cell
3. Audio format is `wav`
   (`flac` can be embedded as well, but browsers (Chrome/Safari) won't play it)

Ref: https://stackoverflow.com/a/33109647
mthrok pushed a commit to mthrok/audio that referenced this pull request Dec 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants