A podcast preprocessing library for aligning, normalizing, and transcribing audio files.
Project description
Waddle ๐ฆ
Waddle is a preprocessor for podcasts, developed specifically for RubberDuck.fm. It streamlines the process of aligning, normalizing, and transcribing podcast audio files from multiple speakers or individual audio files.
Features
- Alignment: Automatically synchronizes the audio files of each speaker to ensure they are perfectly aligned with the reference audio.
- Normalization: Ensures consistent audio quality by normalizing audio levels.
- Remove Noise: Cleans up audio by reducing background noise for clearer output using
DeepFilterNet. - Subtitle Generation: Generates SRT subtitle files for transcription using
whisper.cpp. - Metadata Generation: Processes annotated SRT files to create chapter markers and show notes for podcast episodes.
Prerequisites
Before using Waddle, ensure the following requirements are installed:
-
Python 3.12 or higher:
- Install Python from python.org.
-
FFmpeg:
- MacOS:
brew install ffmpeg
- Ubuntu/Debian:
sudo apt update sudo apt install ffmpeg
- Windows:
- Download and install FFmpeg from FFmpeg Downloads.
- Ensure FFmpeg is added to your system's PATH.
- MacOS:
-
fmt (A C++ formatting library for compiling
whisper.cpp):- MacOS:
brew install fmt
- For other platforms, follow installation instructions from fmt GitHub repository.
- MacOS:
Installation
-
Clone the repository:
git clone https://github.com/emptymap/waddle.git
-
You're ready to use Waddle!
Usage
Prepare Audio Files
- Upload each speaker's audio files in the
audiosdirectory. - Use the naming convention:
ep{N}-{SpeakerName}.[wav|aifc|m4a|mp4].- Example:
ep1-Alice.wav,ep1-Bob.aifc
- Example:
- Include a reference audio file that covers the entire podcast. The reference file name must start with
GMT(e.g., a Zoom recording).
CLI Options
-
single- Process a single audio file:waddle single path/to/audio.wav -o ./output
-o, --output: Directory to save the output (default:./out).-ss: Start time in seconds for the audio segment (default: 0.0).-t, --time: Duration in seconds for the output audio (default: None).-wo, --whisper-options: Options to pass to Whisper transcription (default:-l ja). You can change the default language by modifying src/config.py.-nnr, --no-noise-remove: Skip removing noise from the audio. (no value required)
-
preprocess- Process multiple audio files:waddle preprocess -d ./audios -r ./reference.wav -o ./output
-d, --directory: Directory containing audio files (default:./).-o, --output: Directory to save the output (default:./out).-ss: Start time in seconds for the audio segment (default: 0.0).-t, --time: Duration in seconds for the output audio (default: None).-wo, --whisper-options: Options to pass to Whisper transcription (default:-l ja).-nnr, --no-noise-remove: Skip removing noise from the audio. (no value required)-r, --reference: Path to the reference audio file (used in multi-file mode).-c, --comp-duration: Duration in seconds for alignment comparison (default: 1200.0s).-nc, --no-convert: Skip converting audio files to WAV format. (no value required)-tr, --transcribe: Transcribe the processed audio files. (no value required)
-
postprocess- Process aligned audio files:waddle postprocess -d ./audios -o ./output
-d, --directory: Directory containing audio files (default:./).-o, --output: Directory to save the output (default:./out).-ss: Start time in seconds for the audio segment (default: 0.0).-t, --time: Duration in seconds for the output audio (default: None).-wo, --whisper-options: Options to pass to Whisper transcription (default:-l ja).
-
metadata- Generate metadata from an annotated SRT file:waddle metadata path/to/annotated.srt -i path/to/audio.mp3 -o ./metadata
source: Path to the annotated SRT file.-i, --input: Path to the input audio file. If not specified, it will look for an audio file with the same name.-o, --output: Directory to save the metadata and audio files (default:./metadata).
Example Commands
single Command Examples
-
Basic processing:
waddle single input.wav
-
With output directory and duration limit:
waddle single input.wav -o output_dir -t 300
-
With start time, language options, and no noise removal:
waddle single input.wav -ss 60 -wo "-l en -t 8" -nnr
preprocess Command Examples
-
Basic preprocessing:
waddle preprocess -
With custom directory, reference file:
waddle preprocess -d audio_dir -r reference.wav
-
With time limits and transcription:
waddle preprocess -ss 120 -t 1800 -tr
postprocess Command Examples
-
Basic postprocessing:
waddle postprocess -
With custom directory and output location:
waddle postprocess -d aligned_dir -o processed_dir
-
With segment selection and transcription options:
waddle postprocess -ss 300 -t 600 -wo "-l ja -t 4"
metadata Command Examples
-
Basic metadata generation:
waddle metadata transcript.srt
-
With input audio file:
waddle metadata transcript.srt -i episode.mp3
-
With custom output directory:
waddle metadata transcript.srt -i episode.mp3 -o metadata_dir
Annotated SRT Format
When using the metadata command, your SRT file should include annotations:
# Chaptermarkers define chapters (up to 6 levels with #)- Chapter starts at the next SRT timestamp and ends before the next chapter
- Any other text is considered show notes
- Empty lines are ignored
- Use
;to add newlines in show notes (the;will be deleted)
Example
# Introduction
1
00:00:00.000 --> 00:00:03.000
alice: Welcome to our podcast!
2
00:00:03.000 --> 00:00:06.000
bob: Today we'll discuss programming.
## Topic 1: Rust
3
00:00:06.000 --> 00:00:09.000
alice: Let's talk about Rust.
- [Rust Language](https://rust-lang.org)
;
Great for systems programming!
4
00:00:09.000 --> 00:00:12.000
bob: I love its memory safety.
# Conclusion
5
00:00:12.000 --> 00:00:15.000
alice: Thanks for listening!
Output Files
The above example would generate these files:
- chapters.txt:
- (00:00) Introduction
- (00:06) Topic 1: Rust
- (00:12) Conclusion
- show_notes.md:
- [Rust Language](https://rust-lang.org)
Great for systems programming!
- The chapter markers would also be embedded in the MP3 metadata for podcast apps
Developer Guide
This section provides guidelines for developers contributing to Waddle. It includes setting up the development environment, running tests, and maintaining code quality.
Setting Up the Development Environment
-
Clone the Repository
git clone https://github.com/emptymap/waddle.git cd waddle
-
Install
uv(Recommended) We useuvas a fast package manager.curl -LsSf https://astral.sh/uv/install.sh | sh
Running Tests
We use pytest with coverage analysis to ensure code quality.
-
Run all tests with coverage reporting:
uv run pytest --cov=src --cov-report=html
This will generate a coverage report in
htmlcov/. -
Run a specific test file:
uv run pytest tests/test_example.py
-
Run tests with verbose output:
uv run pytest -v
Linting and Formatting
We use ruff for linting and formatting.
-
Fix linting issues and format code automatically:
uv run ruff check --fix | uv run ruff format
-
Check for linting errors without fixing:
uv run ruff check
-
Format code without running lint checks:
uv run ruff format
Code Structure
The Waddle repository is organized as follows:
waddle/
โโโ pyproject.toml # Project metadata, dependencies, and tool configurations
โโโ src/ # Main library source code
โ โโโ waddle/
โ โโโ __main__.py # CLI entry point for Waddle
โ โโโ argparse.py # Handles CLI arguments and command parsing
โ โโโ config.py # Configuration settings for processing
โ โโโ processor.py # Core processing logic for audio preprocessing
โ โโโ utils.py # Helper functions for audio handling
โ โโโ metadata.py # Metadata generation from annotated SRT files
โ โโโ processing/
โ โ โโโ combine.py # Merges multiple audio sources
โ โ โโโ segment.py # Segments audio into chunks
โ โโโ audios/
โ โ โโโ align_offset.py # Synchronization logic for alignment
โ โ โโโ call_tools.py # Interfaces with external audio tools
โ โโโ utils_test.py # Unit tests for utilities
โโโ tests/ # Unit and integration tests
โ โโโ integration_test.py # End-to-end integration tests
โ โโโ ep0/ # Sample audio files for testing
โโโ README.md # Documentation for installation and usage
Key Files and Directories:
-
src/waddle/__main__.py- CLI entry point for running Waddle.
-
src/waddle/processor.py- Core logic for aligning, normalizing, and transcribing audio.
-
src/waddle/metadata.py- Handles metadata generation from annotated SRT files.
-
src/waddle/processing/combine.py- Merges multiple speaker audio files into a single track.
-
src/waddle/processing/segment.py- Splits long audio into manageable segments.
-
src/waddle/audios/align_offset.py- Handles audio synchronization using a reference track.
-
tests/integration_test.py- Runs integration tests to validate the preprocessing pipeline.
Tool Installation Details
Waddle automatically installs required tools in your user runtime directory:
-
Location: The tools are installed in the platform-specific user runtime directory:
- Linux:
/run/user/{uid}/waddle/tools/ - macOS:
~/Library/Caches/TemporaryItems/waddle/tools/ - Windows:
C:\Users\<username>\AppData\Local\Temp\waddle\tools\
- Linux:
-
Installed Tools:
- whisper.cpp: Installed in
<runtime_dir>/tools/whisper.cpp/ - DeepFilterNet: Installed as
<runtime_dir>/tools/deep-filter
- whisper.cpp: Installed in
The installation scripts (src/waddle/tools/install_whisper_cpp.py and src/waddle/tools/install_deep_filter.py) automatically detect your system architecture and download the appropriate binaries.
Contributing
-
Create a Feature Branch
git checkout -b feature/my-new-feature
-
Write Code & Add Tests
- Ensure all functions are covered with tests in
tests/.
- Ensure all functions are covered with tests in
-
Run Tests & Formatting
uv run pytest uv run ruff check --fix uv run ruff format
-
Commit Changes
git add . git commit -m "Add my new feature"
-
Push and Create a Pull Request
git push origin feature/my-new-feature
- Open a PR on GitHub and request a review.
CI/CD
- GitHub Actions will run:
pytestfor testsruff checkfor lintingruff formatfor formatting- Code coverage report generation
Ensure your changes pass CI before merging!
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file waddle_ai-0.1.3.tar.gz.
File metadata
- Download URL: waddle_ai-0.1.3.tar.gz
- Upload date:
- Size: 57.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3f9b57786697ced7e039c7c45db49793f028155862976121e6beb5da1b91635c
|
|
| MD5 |
4ce379ea98d05046fc01a08016e404af
|
|
| BLAKE2b-256 |
b97511d457beed4607e455e989cdbc05ca09e0e3e8c63094f8cb93b9989925d7
|
File details
Details for the file waddle_ai-0.1.3-py3-none-any.whl.
File metadata
- Download URL: waddle_ai-0.1.3-py3-none-any.whl
- Upload date:
- Size: 40.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
430dc75fd2159b408133ef4f2663a8c4ba45ea0458746d7b09846205e3a7be5c
|
|
| MD5 |
2ab8ecf11ec6a903a95e9ca38066d61d
|
|
| BLAKE2b-256 |
a57cc896d923395236a21b1ad7e46112a3ed55154096f5cc2a3e5775c77e8b66
|