From 13c61ce292eba8b3abd4b5dbe4bc548e3472dbc0 Mon Sep 17 00:00:00 2001 From: Scott Breyfogle Date: Wed, 23 Oct 2024 13:31:48 -0700 Subject: [PATCH 1/5] Add aresample flag to ffmpeg conversion command --- audiotools/core/ffmpeg.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/audiotools/core/ffmpeg.py b/audiotools/core/ffmpeg.py index baf27ccc..83f9cd19 100644 --- a/audiotools/core/ffmpeg.py +++ b/audiotools/core/ffmpeg.py @@ -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() From 101f5ce2648dd68d54cd72b53fcba95c651848d0 Mon Sep 17 00:00:00 2001 From: Scott Breyfogle Date: Wed, 23 Oct 2024 14:31:10 -0700 Subject: [PATCH 2/5] Update whisper test to match current behavior --- tests/core/test_whisper.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/core/test_whisper.py b/tests/core/test_whisper.py index 0a8cd428..b8d8c193 100644 --- a/tests/core/test_whisper.py +++ b/tests/core/test_whisper.py @@ -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(): From 1252e1dc0bdb7f4ffa90751a9c3d5dba93e922c9 Mon Sep 17 00:00:00 2001 From: Scott Breyfogle Date: Wed, 23 Oct 2024 14:34:18 -0700 Subject: [PATCH 3/5] Update version and fix release GHA --- .github/workflows/release.yml | 10 ++++++---- setup.py | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0d0b52e8..ce4b5abe 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 @@ -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 diff --git a/setup.py b/setup.py index 8b4954d5..d9fe8d08 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ setup( name="descript-audiotools", - version="0.7.3", + version="0.7.4", classifiers=[ "Intended Audience :: Developers", "Intended Audience :: Education", From 972d7581b27abd6599e03cbb9e4f75a28a5d4644 Mon Sep 17 00:00:00 2001 From: Scott Breyfogle Date: Thu, 24 Oct 2024 08:59:06 -0700 Subject: [PATCH 4/5] Bump version in init.py --- audiotools/__init__.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/audiotools/__init__.py b/audiotools/__init__.py index 573ffd06..32ffd680 100644 --- a/audiotools/__init__.py +++ b/audiotools/__init__.py @@ -1,10 +1,4 @@ -__version__ = "0.7.3" -from .core import AudioSignal -from .core import STFTParams -from .core import Meter -from .core import util -from . import metrics -from . import data -from . import ml -from .data import datasets -from .data import transforms +__version__ = "0.7.4" +from . import data, metrics, ml +from .core import AudioSignal, Meter, STFTParams, util +from .data import datasets, transforms From ea6d798c907744080c7c7cc2a10a3dda54cdaa8e Mon Sep 17 00:00:00 2001 From: Scott Breyfogle Date: Thu, 24 Oct 2024 13:03:29 -0700 Subject: [PATCH 5/5] Revert ruff formatting --- audiotools/__init__.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/audiotools/__init__.py b/audiotools/__init__.py index 32ffd680..b251ff37 100644 --- a/audiotools/__init__.py +++ b/audiotools/__init__.py @@ -1,4 +1,10 @@ __version__ = "0.7.4" -from . import data, metrics, ml -from .core import AudioSignal, Meter, STFTParams, util -from .data import datasets, transforms +from .core import AudioSignal +from .core import STFTParams +from .core import Meter +from .core import util +from . import metrics +from . import data +from . import ml +from .data import datasets +from .data import transforms