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

Prevent audio speeding up when trimming #7599

Merged
merged 9 commits into from Mar 5, 2024
Merged

Prevent audio speeding up when trimming #7599

merged 9 commits into from Mar 5, 2024

Conversation

hannahblair
Copy link
Collaborator

@hannahblair hannahblair commented Mar 4, 2024

Description

This PR changes the way we convert the audio buffer we get from the audio component to WAV format. The function should now interleave the audio samples correctly so the audio data matches what the audio component expects for stereo or multi-channel WAV files.

This also fixes the background of the trim region which got lost at some point (if the option isn't provided as a param)

Note, I think this should close #6336 but I can't be sure as I can't repro it

Tested with:

  • .ogg
  • .mp3
  • .wav
  • .mp4
  • .webp

Closes: #7592

🎯 PRs Should Target Issues

Before your create a PR, please check to see if there is an existing issue for this change. If not, please create an issue before you create this PR, unless the fix is very small.

Not adhering to this guideline will result in the PR being closed.

Tests

  1. PRs will only be merged if tests pass on CI. To run the tests locally, please set up your Gradio environment locally and run the tests: bash scripts/run_all_tests.sh

  2. You may need to run the linters: bash scripts/format_backend.sh and bash scripts/format_frontend.sh

@gradio-pr-bot
Copy link
Contributor

gradio-pr-bot commented Mar 4, 2024

🪼 branch checks and previews

Name Status URL
Spaces ready! Spaces preview
Website ready! Website preview
Storybook ready! Storybook preview
🦄 Changes detected! Details

Install Gradio from this PR

pip install https://gradio-builds.s3.amazonaws.com/52578b38edbb1973ba830f59a9e2ca7b81dc7b49/gradio-4.19.2-py3-none-any.whl

Install Gradio Python Client from this PR

pip install "gradio-client @ git+https://github.com/gradio-app/gradio@52578b38edbb1973ba830f59a9e2ca7b81dc7b49#subdirectory=client/python"

@gradio-pr-bot
Copy link
Contributor

gradio-pr-bot commented Mar 4, 2024

🦄 change detected

This Pull Request includes changes to the following packages.

Package Version
@gradio/audio patch
gradio patch
  • Maintainers can select this checkbox to manually select packages to update.

With the following changelog entry.

Prevent audio speeding up when trimming

Maintainers or the PR author can modify the PR title to modify this entry.

Something isn't right?

  • Maintainers can change the version label to modify the version bump.
  • If the bot has failed to detect any changes, or if this pull request needs to update multiple packages to different versions or requires a more comprehensive changelog entry, maintainers can update the changelog file directly.

@hannahblair hannahblair marked this pull request as ready for review March 5, 2024 14:14
@hannahblair
Copy link
Collaborator Author

@hysts I haven't been able to repro the volume getting ticket in your issue #6336 - would you mind giving this PR a test and seeing if it persists for the files you were noticing this on?

Copy link
Member

@abidlabs abidlabs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM @hannahblair nice fix!

@hannahblair hannahblair enabled auto-merge (squash) March 5, 2024 19:25
@hannahblair hannahblair merged commit f26aba0 into main Mar 5, 2024
7 of 8 checks passed
@hannahblair hannahblair deleted the audio-trimming branch March 5, 2024 20:10
@pngwn pngwn mentioned this pull request Mar 5, 2024
@hysts
Copy link
Collaborator

hysts commented Mar 6, 2024

@hysts I haven't been able to repro the volume getting ticket in your issue #6336 - would you mind giving this PR a test and seeing if it persists for the files you were noticing this on?

@hannahblair Yes, it seems to be fixed by this PR! Thanks!
(FYI, in my environment, #6336 reproduces even with gradio==4.19.2, so I wonder why you couldn't reproduce it. Maybe it depends on audio files? I used these audio files for testing this time. Anyway, I guess it doesn't matter as it's now fixed.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Audio is sped up when trimmed (possible related to #6336) Audio get louder when trimmed
4 participants