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

Add resampling flag for wav conversion #116

Merged
merged 5 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
lfs: true
- name: Retrieve version
run: |
echo "::set-output name=TAG_NAME::$(grep -i -o -P '(?<=version=\")[^\"]+(?=\")' setup.py)"
echo "name=TAG_NAME::$(grep -i -o -P '(?<=version=\")[^\"]+(?=\")' setup.py)" > "$GITHUB_OUTPUT"
id: version
- name: Changelog
uses: scottbrenner/generate-changelog-action@master
Expand All @@ -24,10 +24,12 @@ jobs:
id: create_release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} # This token is provided by Actions, you do not need to create your own token
# This token is provided by Actions, you do not need to create your
# own token
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
tag_name: ${{ steps.version.outputs.TAG_NAME }}
release_name: Release ${{ steps.version.outputs.TAG_NAME }}
name: Release ${{ steps.version.outputs.TAG_NAME }}
body: ${{steps.changelog.outputs.changelog}}
draft: false
prerelease: false
9 changes: 8 additions & 1 deletion audiotools/core/ffmpeg.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,14 @@ def load_from_file_with_ffmpeg(cls, audio_path: str, quiet: bool = True, **kwarg

ff = ffmpy.FFmpeg(
inputs={audio_path: None},
outputs={wav_file: None},
# For inputs that are m4a (and others?), the input audio can
# have samples that don't match the sample rate. This aresample
# option forces ffmpeg to read timing information in the source
# file instead of assuming constant sample rate.
#
# This fixes an issue where an input m4a file might be a
# different length than the output wav file
outputs={wav_file: "-af aresample=async=1000"},
global_options=global_options,
)
ff.run()
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

setup(
name="descript-audiotools",
version="0.7.3",
version="0.7.4",

Choose a reason for hiding this comment

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

classifiers=[
"Intended Audience :: Developers",
"Intended Audience :: Education",
Expand Down
3 changes: 1 addition & 2 deletions tests/core/test_whisper.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ def test_whisper_transcript():

transcript = signal.get_whisper_transcript()

assert "<|startoftranscript|>" in transcript
assert "<|endoftext|>" in transcript
assert transcript.startswith("<|startoftranscript|>")


def test_whisper_embeddings():
Expand Down
Loading