Speech-to-Text Transcription is a modular Python tool for automated audio cleanup and accurate transcription. It detects and strips silence segments from any supported audio file, then routes the cleaned audio through Google Speech Recognition to produce a full text transcription — logging every run, duration delta, language, and output path to a local SQLite database for full traceability.
Built for podcasters, researchers, and developers who need a lightweight, configurable, offline-first processing layer. All parameters — silence thresholds, minimum duration, output language, and file paths — are entered at runtime with no code changes required.
▶ Feature |
Description | Status |
|---|---|---|
| Silence Detection | Configurable dB threshold and minimum duration (ms) — per-run at runtime | ✅ |
| Multi-Format Support | WAV, MP3, M4A, OGG, FLAC — FFmpeg handles conversion automatically | ✅ |
| Speech-to-Text | Google Speech Recognition — 10+ language codes supported | ✅ |
| SQLite Logging | Every run logged with paths, durations, language, transcription, and timestamp | ✅ |
| Duration Tracking | Original vs. processed duration delta recorded and stored per run | ✅ |
| Runtime Configuration | All detection settings entered interactively — no config file or code edits needed | ✅ |
| Error Handling | Validated inputs, format checks, and descriptive error messages on failure | ✅ |
| Batch Processing | Run the engine across an entire folder of audio files in one pass | ⏳ |
| Offline Transcription | Whisper backend — no internet required | ⏳ |
| Subtitle Export | SRT / VTT output alongside plain text transcription | ⏳ |
| Layer | Technologies |
|---|---|
| Audio Processing | PyDub — silence detection, segmentation, and WAV export |
| Speech Recognition | SpeechRecognition — Google Speech API wrapper |
| Format Conversion | FFmpeg — MP3, M4A, OGG, FLAC → WAV |
| Database | SQLite3 — local metadata and transcription storage |
| Language | Python 3.7+ |
Speech-to-Text-Transcription/
│
├── CONVERT_AUDIO_TO_TEXT_AND_REMOVE_SILENCE.py ← Main entry point
├── Database_And_prepare_audio.py ← DB operations & audio preparation
├── Remove_silence_and_mesuere.py ← Silence removal & duration tracking
├── Speech_and_transcribe.py ← Google Speech API transcription
│
├── requirements.txt ← Python dependencies
├── LICENSE ← Apache 2.0
├── .gitignore
└── README.md
Clone the project to your local machine.
git clone https://github.com/Amin-Moniry/Speech-to-Text-Transcription.git
cd Speech-to-Text-Transcription Install Python packages and FFmpeg.
pip install -r requirements.txt# FFmpeg is required for non-WAV format conversion
# Ubuntu / Debian: sudo apt install ffmpeg
# macOS: brew install ffmpeg
# Windows: https://ffmpeg.org/download.html Launch the main script and follow the prompts.
python CONVERT_AUDIO_TO_TEXT_AND_REMOVE_SILENCE.pyThe engine prompts for five inputs at runtime:
Enter the path to an audio file: ./audio/interview.mp3
Enter the path to save the transcription: ./transcriptions/interview.txt
Enter the language code: en-US
Minimum silence length in milliseconds: 1000
Silence threshold in dB: -40.0Minimum Silence Length — duration in milliseconds that must be silent before a segment is cut.
Range: 500–2000 ms. Lower = more aggressive removal.
Silence Threshold — volume level in dB below which audio is treated as silence.
Range: -30 to -50 dB. Lower = more sensitive detection.
Recommended settings by content type:
| Use Case | Min Silence | Threshold |
|---|---|---|
| Podcast / Interview | 1000 ms | -40 dB |
| Music | 500 ms | -50 dB |
| Noisy Environment | 2000 ms | -30 dB |
en-US · en-GB · de-DE · fr-FR · es-ES · it-IT · ja-JP · ko-KR and any code supported by the Google Speech Recognition API.
| Column | Type | Description |
|---|---|---|
id |
INTEGER | Primary key — auto-increment |
input_path |
TEXT | Original audio file path |
output_path |
TEXT | Transcription output file path |
language |
TEXT | Language code used for transcription |
original_duration |
REAL | Duration of original audio (seconds) |
processed_duration |
REAL | Duration after silence removal (seconds) |
transcription |
TEXT | Full transcription output text |
created_at |
TIMESTAMP | Processing timestamp |
Processed Audio — [original_name]_no_silence.wav — the cleaned audio with all silence removed, exported as WAV regardless of input format.
Transcription File — user-specified path — plain text file containing the full Google Speech output of the processed audio.
Database Record — new row in PODCAST.db — stores all paths, durations, language code, full transcription, and processing timestamp.
File not found — Verify the audio file path is correct and the file is readable by the current user.
Invalid silence parameters — Minimum silence length must be a positive integer (ms). Silence threshold must be a negative number (dB).
Transcription errors — Check your internet connection. Google Speech Recognition requires an active connection. Verify the language code matches the spoken language and that audio quality is sufficient.
Unsupported audio format — Install FFmpeg for automatic conversion. Alternatively, convert to WAV manually before running the engine.
# Ubuntu / Debian
sudo apt install ffmpeg
# macOS
brew install ffmpeg- Batch mode — process an entire folder of audio files in a single run
- Whisper backend — fully offline transcription with no internet dependency
- SRT / VTT subtitle export alongside plain text output
- Speaker diarization — label transcript segments by detected speaker
- GUI control panel for parameter input and run history browsing
- Fork the repository via the Fork button on GitHub.
- Create a feature branch:
git checkout -b feature/your-feature-name - Commit with a descriptive message:
git commit -m "Add: brief description" - Push to your fork:
git push origin feature/your-feature-name - Open a Pull Request against the
masterbranch of this repository.
This project is licensed under the Apache License 2.0.
Free to use, modify, and distribute with attribution to Amin Moniry as the original author. See LICENSE for complete terms.
© 2025 Amin Moniry (AminTivanix2) — All Rights Reserved
