Tools for converting lecture recordings to text, identifying speakers, translating Czech to English, and redacting personal information — all runnable locally.
Záznam.m4a
│
▼ m4a_to_text.sh (ffmpeg: M4A → MP3)
│
▼ neural_sound_to_text.py OR neural_sound_to_text_2_entities.py
│ (Whisper transcription, optional speaker labels)
│
▼ text_full.txt
│
▼ simple_local_translator.py (Ollama: Czech → English)
│
▼ simple_local_anonymization.py (optional: redact PII)
For a single-speaker recording, use neural_sound_to_text.py. For interviews or multi-speaker audio, use neural_sound_to_text_2_entities.py.
| Tool | Used by |
|---|---|
| ffmpeg | m4a_to_text.sh, audio_renamer_multiple.py |
| Ollama | simple_local_translator.py, ollm_*.sh |
Install into a virtual environment (Python 3.10+ recommended):
pip install torch transformers librosa soundfile tqdm python-dotenv ollama eyed3 numpyFor speaker diarization (neural_sound_to_text_2_entities.py), also install:
pip install pyannote.audioOn first run, Whisper (openai/whisper-large-v3) and Piiranha (iiiorg/piiranha-v1-detect-personal-information) models are downloaded from Hugging Face automatically.
Copy the example file and fill in your tokens:
cp .env.example .env| Variable | Required by | Description |
|---|---|---|
HF_TOKEN |
neural_sound_to_text_2_entities.py |
Hugging Face access token. Accept the model terms for pyannote/speaker-diarization-3.1 before use. |
MISTRAL_API_KEY |
— | Reserved for future use; not currently read by any script. |
Converts Záznam.m4a to Záznam.mp3 using ffmpeg. Edit the filename inside the script if your input file has a different name.
bash m4a_to_text.shBoth scripts use openai/whisper-large-v3 and write output to text_full.txt (appended, not overwritten).
Chunked transcription for long audio files. Splits audio into 30-second segments with overlap to avoid cut-off words. No speaker identification.
python neural_sound_to_text.py --audio_file Záznam.mp3
python neural_sound_to_text.py --audio_file Záznam.mp3 --english
python neural_sound_to_text.py --audio_file Záznam.mp3 --volume_boost 1.5| Flag | Default | Description |
|---|---|---|
--audio_file |
Záznam.mp3 |
Path to the audio file |
--english |
off | Transcribe in English instead of Czech |
--volume_boost |
1.3 |
Volume multiplier after normalization |
Uses Apple Silicon MPS, NVIDIA CUDA, or CPU automatically.
Transcription with speaker diarization via pyannote.audio. Output labels each segment with a speaker ID and timestamp:
SPEAKER_00 [00:12 - 00:45]: ...
SPEAKER_01 [00:46 - 01:20]: ...
python neural_sound_to_text_2_entities.py --audio_file Záznam.mp3
python neural_sound_to_text_2_entities.py --audio_file Záznam.mp3 --num_speakers 3
python neural_sound_to_text_2_entities.py --audio_file Záznam.mp3 --output transcript.txt| Flag | Default | Description |
|---|---|---|
--audio_file |
Záznam.mp3 |
Path to the audio file |
--english |
off | Transcribe in English instead of Czech |
--volume_boost |
2.0 |
Volume multiplier after normalization |
--hf_token |
from .env |
Hugging Face token (overrides HF_TOKEN) |
--num_speakers |
2 |
Expected number of speakers |
--output |
text_full.txt |
Output file path |
Translates text_full.txt from Czech to English using a local Ollama model (translategemma:12b by default). Pull the model first:
ollama pull translategemma:12b
python simple_local_translator.pyEdit input_file and model at the top of the script to change the source file or model. Translation is printed to stdout.
Detects personally identifiable information (PII) with the Piiranha model and replaces detected entities with [REDACTED].
Use as a library in Python:
from simple_local_anonymization import anonymize_text
with open("text_full.txt") as f:
text = f.read()
clean = anonymize_text(text)
with open("text_anonymized.txt", "w") as f:
f.write(clean)Adjust the confidence threshold in detect_pii() if you get too many false positives or missed entities.
Sets ID3 tags (album_artist, artist, album) on all MP3 files under a given path. Edit my_tag and the root path (get_jpg_files("/K")) before running.
Batch utilities for organizing audio libraries:
rename_more_by_dir("./")— walks subdirectories and sets ID3 artist/album tags from each folder namefind_duplicates(path)— removes duplicate MP3 files that share the same title tagconvert_wma_to_mp3(input, output)— converts WMA files to MP3 via ffmpeg
The script runs rename_more_by_dir("./") on import. Comment out the last line or call functions manually as needed.
Shell scripts that create tuned Ollama models for coding tasks. Run once after pulling the base models.
Creates qwen3.5-coder from qwen3.5:9b with a 32k context window and coding-optimized parameters.
ollama pull qwen3.5:9b
bash ollm_qwen3-coder_modelfile.shCreates qwen-pro from qwen3-coder:14b-instruct-q4_K_M with a 32k context window, tuned for 16 GB RAM machines.
ollama pull qwen3-coder:14b-instruct-q4_K_M
bash ollm_qwen-pro_model_file.shBoth scripts write a Modelfile in the current directory and call ollama create.
# 1. Set up environment
cp .env.example .env
# Edit .env and add HF_TOKEN if using speaker diarization
# 2. Convert audio
bash m4a_to_text.sh
# 3. Transcribe (pick one)
python neural_sound_to_text.py --audio_file Záznam.mp3
# python neural_sound_to_text_2_entities.py --audio_file Záznam.mp3 --num_speakers 2
# 4. Translate (requires Ollama)
ollama pull translategemma:12b
python simple_local_translator.py- Memory: Whisper large-v3 and pyannote diarization are GPU/RAM intensive. On Apple Silicon, Whisper runs on MPS; diarization falls back to CPU for stability.
- Output file: Transcription scripts append to
text_full.txt. Delete or rename the file before re-running if you want a fresh output. - Secrets: Never commit
.env. Only.env.examplebelongs in version control.