Denoising, speaker diarization and transcription in a single streamlined process. It's perfect for transcribing podcasts, interviews, or any multi-speaker audio content, as long as they have clear audio. In the output, you'll get a JSON file with the transcript, speaker labels, and timestamps.
# Clone the repository
git clone https://github.com/nullwiz/audiopipe.git
cd audiopipe
# Install dependencies
pip install -r requirements.txt
# For macOS (with Homebrew)
brew install ffmpeg
# Basic usage - runs all steps in sequence
python pipeline.py input.mp3
# Resume from a specific step:
python pipeline.py input.mp3 --start-step 2 # Skip separation, start from diarization
python pipeline.py input.mp3 --start-step 3 # Skip to transcription step
# Optional parameters:
python pipeline.py input.mp3 --num-speakers 3 --language en
# For very long audio files (>1 hour), use chopping mode:
python pipeline.py input.mp3 --chop # Splits into 15-minute chunks for processing
The process consists of three main steps that can be run together or separately:
Separation (Step 1): Extracts vocals from background using Demucs
output/combined_vocals.wavDiarization (Step 2): Identifies different speakers
output/combined_vocals.wavoutput/combined_vocals_diarized.json--num-speakers for better results when speaker count is knownTranscription (Step 3): Converts complete audio to text, then maps speakers
output/combined_vocals.wav and diarization dataoutput/final_transcription.json--language code for improved accuracyThe pipeline creates several files during processing, all stored in the output/ directory:
combined_vocals.wav: Extracted voices/speech from the inputcombined_background.wav: Background music/noise separated from the inputspeakers/SPEAKER_XX/*.wav: Individual audio segments for each speakercombined_vocals_diarized.json: Speaker diarization results showing who speaks when
{
"speakers": ["SPEAKER_01", "SPEAKER_02", ...],
"segments": [
{"speaker": "SPEAKER_01", "start": 0.0, "end": 2.5},
{"speaker": "SPEAKER_02", "start": 2.7, "end": 5.1},
...
]
}
final_transcription.json: Complete transcription with speaker attribution in chronological order
{
"segments": [
{"text": "Complete sentence or phrase", "start": 0.1, "end": 2.5, "speaker": "SPEAKER_01"},
{"text": "Another speaker's response", "start": 2.7, "end": 5.1, "speaker": "SPEAKER_02"},
{"text": "Continuing conversation", "start": 5.3, "end": 8.0, "speaker": "SPEAKER_01"},
...
]
}
separated/: Intermediate files from audio separation (preserved for resuming)chunks/: Audio chunks when using --chop mode (preserved for debugging)The presence of these files allows the pipeline to resume from different steps:
combined_vocals.wav exists, audio separation can be skipped (step 1)combined_vocals_diarized.json exists, diarization can be skipped (step 2)AudioPipe includes tools to visualize your transcripts and generate interactive reports:
# Generate timeline visualization for transcript
python visualize.py transcript output/final_transcription.json
# Generate interactive HTML report with audio playback
python visualize.py report output/final_transcription.json --audio output/combined_vocals.wav
# Visualize raw diarization (speaker timeline)
python visualize.py diarization output/combined_vocals_diarized.json
For best results:
--chop mode for processing.mp3, .wav, .m4a, .flac, .ogg.mp4, .mov, .avi, .mkvpython pipeline.py INPUT_AUDIO [OPTIONS]
Arguments:
INPUT_AUDIO Path to input audio/video file
Options:
--num-speakers, -n INT Number of speakers (optional, auto-detected if not specified)
--language, -l STRING Language code for transcription (e.g., 'en', 'es', 'fr')
--start-step, -s [1-3] Start from step: 1=separation, 2=diarization, 3=transcription
--chop, -c Split input audio into 15-minute chunks for processing
--device, -d [cpu|cuda|mps] Device to use for processing (auto-detected if not specified)
--help Show this help message
python dem.py INPUT_FILE
Arguments:
INPUT_FILE Path to input audio/video file
python diarize.py INPUT_AUDIO [OPTIONS]
Arguments:
INPUT_AUDIO Path to vocals audio file (usually output/combined_vocals.wav)
Options:
--num-speakers, -n INT Number of speakers (optional, auto-detected if not specified)
For macOS users, there are two operation modes:
For Macs without dedicated NVIDIA GPUs:
# Add this to your .bashrc or .zshrc
export PYTORCH_ENABLE_MPS_FALLBACK=1
# Run with CPU-only flag
python pipeline.py input.mp3 --device cpu
For M1/M2/M3 Macs, you can utilize Metal Performance Shaders:
# Install PyTorch with MPS support
pip install torch torchvision torchaudio
# Run with MPS device
python pipeline.py input.mp3 --device mps
The final output is a JSON file with chronological segments:
{
"segments": [
{
"text": "Transcript text for this segment",
"start": 0.5,
"end": 4.2,
"speaker": "SPEAKER_01"
},
{
"text": "Response from another speaker",
"start": 4.5,
"end": 7.8,
"speaker": "SPEAKER_02"
},
...
]
}
Audio Processing:
--chop to split into 15-minute chunks--device cpu which uses less memoryTranscription Accuracy:
--language for better resultsSpeaker Identification:
--num-speakersThe project includes a test suite for validating the pipeline functionality:
# Run basic integration tests
python -m pytest test/test_integration.py -v --integration
# Run full pipeline test (slower)
python -m pytest test/test_integration.py::test_full_pipeline -v --integration --runslow
--runslow to run the complete pipeline test--hf-token or set the HUGGING_FACE_TOKEN environment variableFor more details on Testing, check README.test.md.
15 commits
Python
32.6%
Go
29.0%
JavaScript
14.2%
CSS
12.0%
HTML
10.7%
Shell
1.5%
Denoising, speaker diarization and transcription in a single streamlined process. It's perfect for transcribing podcasts, interviews, or any multi-speaker audio content, as long as they have clear audio. In the output, you'll get a JSON file with the transcript, speaker labels, and timestamps.
# Clone the repository
git clone https://github.com/nullwiz/audiopipe.git
cd audiopipe
# Install dependencies
pip install -r requirements.txt
# For macOS (with Homebrew)
brew install ffmpeg
# Basic usage - runs all steps in sequence
python pipeline.py input.mp3
# Resume from a specific step:
python pipeline.py input.mp3 --start-step 2 # Skip separation, start from diarization
python pipeline.py input.mp3 --start-step 3 # Skip to transcription step
# Optional parameters:
python pipeline.py input.mp3 --num-speakers 3 --language en
# For very long audio files (>1 hour), use chopping mode:
python pipeline.py input.mp3 --chop # Splits into 15-minute chunks for processing
The process consists of three main steps that can be run together or separately:
Separation (Step 1): Extracts vocals from background using Demucs
output/combined_vocals.wavDiarization (Step 2): Identifies different speakers
output/combined_vocals.wavoutput/combined_vocals_diarized.json--num-speakers for better results when speaker count is knownTranscription (Step 3): Converts complete audio to text, then maps speakers
output/combined_vocals.wav and diarization dataoutput/final_transcription.json--language code for improved accuracyThe pipeline creates several files during processing, all stored in the output/ directory:
combined_vocals.wav: Extracted voices/speech from the inputcombined_background.wav: Background music/noise separated from the inputspeakers/SPEAKER_XX/*.wav: Individual audio segments for each speakercombined_vocals_diarized.json: Speaker diarization results showing who speaks when
{
"speakers": ["SPEAKER_01", "SPEAKER_02", ...],
"segments": [
{"speaker": "SPEAKER_01", "start": 0.0, "end": 2.5},
{"speaker": "SPEAKER_02", "start": 2.7, "end": 5.1},
...
]
}
final_transcription.json: Complete transcription with speaker attribution in chronological order
{
"segments": [
{"text": "Complete sentence or phrase", "start": 0.1, "end": 2.5, "speaker": "SPEAKER_01"},
{"text": "Another speaker's response", "start": 2.7, "end": 5.1, "speaker": "SPEAKER_02"},
{"text": "Continuing conversation", "start": 5.3, "end": 8.0, "speaker": "SPEAKER_01"},
...
]
}
separated/: Intermediate files from audio separation (preserved for resuming)chunks/: Audio chunks when using --chop mode (preserved for debugging)The presence of these files allows the pipeline to resume from different steps:
combined_vocals.wav exists, audio separation can be skipped (step 1)combined_vocals_diarized.json exists, diarization can be skipped (step 2)AudioPipe includes tools to visualize your transcripts and generate interactive reports:
# Generate timeline visualization for transcript
python visualize.py transcript output/final_transcription.json
# Generate interactive HTML report with audio playback
python visualize.py report output/final_transcription.json --audio output/combined_vocals.wav
# Visualize raw diarization (speaker timeline)
python visualize.py diarization output/combined_vocals_diarized.json
For best results:
--chop mode for processing.mp3, .wav, .m4a, .flac, .ogg.mp4, .mov, .avi, .mkvpython pipeline.py INPUT_AUDIO [OPTIONS]
Arguments:
INPUT_AUDIO Path to input audio/video file
Options:
--num-speakers, -n INT Number of speakers (optional, auto-detected if not specified)
--language, -l STRING Language code for transcription (e.g., 'en', 'es', 'fr')
--start-step, -s [1-3] Start from step: 1=separation, 2=diarization, 3=transcription
--chop, -c Split input audio into 15-minute chunks for processing
--device, -d [cpu|cuda|mps] Device to use for processing (auto-detected if not specified)
--help Show this help message
python dem.py INPUT_FILE
Arguments:
INPUT_FILE Path to input audio/video file
python diarize.py INPUT_AUDIO [OPTIONS]
Arguments:
INPUT_AUDIO Path to vocals audio file (usually output/combined_vocals.wav)
Options:
--num-speakers, -n INT Number of speakers (optional, auto-detected if not specified)
For macOS users, there are two operation modes:
For Macs without dedicated NVIDIA GPUs:
# Add this to your .bashrc or .zshrc
export PYTORCH_ENABLE_MPS_FALLBACK=1
# Run with CPU-only flag
python pipeline.py input.mp3 --device cpu
For M1/M2/M3 Macs, you can utilize Metal Performance Shaders:
# Install PyTorch with MPS support
pip install torch torchvision torchaudio
# Run with MPS device
python pipeline.py input.mp3 --device mps
The final output is a JSON file with chronological segments:
{
"segments": [
{
"text": "Transcript text for this segment",
"start": 0.5,
"end": 4.2,
"speaker": "SPEAKER_01"
},
{
"text": "Response from another speaker",
"start": 4.5,
"end": 7.8,
"speaker": "SPEAKER_02"
},
...
]
}
Audio Processing:
--chop to split into 15-minute chunks--device cpu which uses less memoryTranscription Accuracy:
--language for better resultsSpeaker Identification:
--num-speakersThe project includes a test suite for validating the pipeline functionality:
# Run basic integration tests
python -m pytest test/test_integration.py -v --integration
# Run full pipeline test (slower)
python -m pytest test/test_integration.py::test_full_pipeline -v --integration --runslow
--runslow to run the complete pipeline test--hf-token or set the HUGGING_FACE_TOKEN environment variableFor more details on Testing, check README.test.md.
15 commits
Python
32.6%
Go
29.0%
JavaScript
14.2%
CSS
12.0%
HTML
10.7%
Shell
1.5%