Skip to content

Latest commit

 

History

30 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Audio Chunker

Audio Chunker is a desktop application for slicing and joining audio files. It uses silence detection to create sensible chunks, allows previewing results, and can re-join segments into a final audio file. The GUI is implemented in desktop_app.py; core processing logic is in smart_slice.py and smart_join.py.


📥 Installation (macOS — Apple Silicon)

Option 1 — Direct Download (easiest)

Download the DMG from the latest release, open it, and drag Audio Chunker into your Applications folder.

✅ Signed with Apple Developer ID · Notarized by Apple · No dependencies needed

Option 2 — Terminal Install (one command)

Open Terminal and paste this:

curl -fsSL https://raw.githubusercontent.com/Pavan-Gopa/AudioChunker/main/install.sh | bash

This downloads the latest version, installs it to /Applications, and cleans up automatically.

Requirements

  • macOS 12 (Monterey) or later
  • Apple Silicon Mac (M1 / M2 / M3 / M4)

Key Features

  • Smart Slicing — split audio by silence and stitch small fragments up to a target length.
  • Smart Joining — merge chunks back into a single file, with optional segment markers.
  • Preview — play chunks inside the app (QMediaPlayer; AVFoundation used on macOS).
  • Multi-format — supports WAV, MP3, M4A, FLAC, OGG, MP4 when ffmpeg is available.
  • Packaged macOS buildbuild_app.sh creates a self-contained .app (bundles Python, PyQt6, and a static ffmpeg binary).

Requirements

  • Python 3.12+ (development and building)
  • Python packages listed in requirements.txt (PyQt6, pydub, pyinstaller, etc.)
  • FFmpeg (required by pydub to decode/encode compressed audio formats). The build script attempts to bundle a macOS ffmpeg binary for the packaged app.

Quick Start (run from source)

Double-click launcher on macOS

Double-click Launch Audio Chunker.command in Finder.

The launcher creates .venv if it is missing, installs requirements.txt, and starts desktop_app.py.

Terminal launch

  1. Create and activate a virtual environment:
python3 -m venv .venv
source .venv/bin/activate
  1. Install dependencies:
python3 -m pip install -r requirements.txt
  1. Start the app:
python3 desktop_app.py

The app logs startup information to the terminal and shows runtime messages in the built-in Logs pane.

How slicing works

  • Loading: pydub.AudioSegment.from_file() loads the input audio file.
  • Silence detection: pydub.silence.split_on_silence() finds silent segments based on the configured threshold and minimum silence length.
  • Stitching: adjacent short fragments are concatenated until they reach the target chunk length.
  • Export: each chunk is exported in the same format as the input using AudioSegment.export().

See implementation: smart_slice.py

Bundled vs system ffmpeg

  • pydub requires an external ffmpeg/avconv binary for MP3, M4A, FLAC, OGG, MP4 support. WAV may work without ffmpeg.
  • The build script (build_app.sh) attempts to download a static macOS ffmpeg build into dist/ffmpeg-bundle and includes it in the packaged .app so the app is self-contained.
  • At runtime the frozen app will set pydub.AudioSegment.converter to the bundled ffmpeg if found.

Building the macOS .app

Run the included script to create a packaged .app:

chmod +x build_app.sh
./build_app.sh

What the script does (high level):

  • Installs Python requirements.
  • Attempts to download a static macOS ffmpeg build to dist/ffmpeg-bundle/ffmpeg if missing.
  • Runs PyInstaller with the app entry desktop_app.py and includes PyQt6 translations and multimedia plugin resources.
  • Removes the ffmpeg-based Qt multimedia plugin from the final bundle to prefer the native darwin (AVFoundation) backend on macOS (this avoids missing libav*.dylib runtime errors).
  • Creates compatibility symlinks inside the app Frameworks dir for libav* names when possible.

After a successful build, the .app is in dist/AudioChunker.app.

Note: If you prefer to bundle the ffmpeg-based Qt multimedia plugin (libffmpegmediaplugin.dylib), you must also bundle matching libav*.dylib versions or install the same libav versions system-wide.

Distribution for other Mac users

The app bundle is already self-contained: Python, PyQt6, ffmpeg, and ffprobe are packaged inside it, so recipients do not need to install extra dependencies.

To create a drag-and-drop installer image (.dmg):

chmod +x build_release.sh build_dmg.sh notarize_dmg.sh
./build_release.sh

This produces an architecture-specific DMG in dist/, for example:

dist/AudioChunker-macOS-arm64.dmg

The DMG contains:

  • AudioChunker.app
  • Applications shortcut

Typical user flow:

  1. Open the DMG.
  2. Drag AudioChunker.app into Applications.
  3. Launch the app from Applications.

If you already built the .app and only want to recreate the DMG:

./build_dmg.sh

If you have an Apple Developer certificate, you can sign the app and DMG during packaging:

CODESIGN_IDENTITY="Developer ID Application: Your Name (TEAMID)" ./build_release.sh

To create a signed and notarized release:

  1. Save your notarization credentials in Keychain once:
xcrun notarytool store-credentials AudioChunkerNotary \
  --apple-id "your-apple-id@example.com" \
  --team-id "TEAMID"
  1. Build, sign, notarize, and staple:
CODESIGN_IDENTITY="Developer ID Application: Your Name (TEAMID)" \
NOTARY_PROFILE="AudioChunkerNotary" \
./build_release.sh --notarize

If the DMG already exists and only notarization is needed:

NOTARY_PROFILE="AudioChunkerNotary" ./notarize_dmg.sh

Without Developer ID signing and Apple notarization, the DMG is still portable, but on other Macs users may need Right Click > Open or allow the app in Privacy & Security. For a warning-free double-click install experience, you need:

  1. Developer ID Application signing
  2. Apple notarization of the final DMG

Architecture notes

The current packaged build is single-architecture, not universal. The latest build in this repo is arm64, so it runs on Apple Silicon Macs.

If you also need Intel support, there are two practical options:

  1. Build a separate x86_64 release under Rosetta or on an Intel Mac and ship two DMGs.
  2. Move the full toolchain to genuine universal2 dependencies and then package a universal app.

With the current environment, some bundled Qt framework binaries are arm64 only, so this repo does not currently produce a true universal app bundle.

Running the packaged app (macOS)

  • Double-click dist/AudioChunker.app in Finder.
  • Or run from terminal to see logs:
/path/to/dist/AudioChunker.app/Contents/MacOS/AudioChunker
  • To debug Qt plugin loading (verbose):
QT_DEBUG_PLUGINS=1 /path/to/dist/AudioChunker.app/Contents/MacOS/AudioChunker

Be aware: the debug mode can produce a lot of output and in some environments the extra debug logging can change timing and cause unstable behavior; use it for diagnosis only.

Using the GUI (short guide)

  • Slice Audio

    • Input File(s): pick one file or multiple (enable Batch).
    • Output Base Folder: base path where chunk subfolders are created.
    • Preserve Original Silences: when checked, the silence sliders are disabled and original silences are preserved (no cutting). Uncheck to enable the sliders.
    • Silence Threshold (dB): how quiet a region must be to count as silence (lower = more aggressive cutting).
    • Min Silence Length (ms): minimum silence duration to consider a split.
    • Target Chunk Length (s): desired length of chunks; short fragments are stitched up to this size.
    • ▶ Start Slicing: begins slicing on a background worker.
  • Preview controls

    • Prev / Play / Next: preview chunks via QMediaPlayer. If the multimedia backend is unavailable, preview is disabled but slicing/joining still work if ffmpeg is available.
  • Join Chunks

    • Input Folder: folder with chunk files.
    • Output Filename and Base Folder: where the final joined file will be saved.
    • ▶ Start Joining: runs join in background.

Programmatic examples

  • Slice via Python API:
python3 - <<'PY'
from smart_slice import prepare_rvc_dataset
prepare_rvc_dataset('path/to/source.mp3','ready_files',keep_silence=False,target_length_ms=120000,silence_thresh=-16,min_silence_len=200)
PY
  • Join via Python API:
python3 - <<'PY'
from smart_join import smart_join
smart_join('ready_files/source_name','joined_files','final_audio.wav',add_markers=True)
PY

The join step writes results into a source-named subfolder under the output base directory. For the example above, the final files will be created in joined_files/source_name/.

Troubleshooting

  • No QtMultimedia backends found / Failed to initialize QMediaPlayer:

    • Playback will be disabled but slicing still works if ffmpeg is available for pydub.
    • Confirm libdarwinmediaplugin.dylib exists inside the bundle at:
      • dist/AudioChunker.app/Contents/Frameworks/PyQt6/Qt6/plugins/multimedia/libdarwinmediaplugin.dylib
  • Compressed formats fail to load/export (MP3/M4A/FLAC/OGG):

    • Ensure ffmpeg is available — system which ffmpeg or bundled dist/ffmpeg-bundle/ffmpeg / dist/AudioChunker.app/Contents/Frameworks/ffmpeg.
  • Gatekeeper on macOS blocks app:

    • The distributed app is signed and notarized, so this should not happen. If it does, open System Settings → Privacy & Security and click "Open Anyway", or run xattr -dr com.apple.quarantine /Applications/AudioChunker.app in Terminal.

Tests & validation

  • Unit tests: pytest
  • Example manual test used in development: testing_file _for_chunking.mp3 (sliced with prepare_rvc_dataset and produced chunks inside a source-named folder under ready_files).

Contributing

  • Open issues and PRs. Please run tests and lint before submitting.

About

macOS desktop app for splitting audio files into smart chunks with silence detection, fixed-length slicing, and pause-based segmentation. Built with Python, PyQt6, and PyInstaller.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages