Add Voice Recorder - Whisper transcription tool for Obsidian
Features: - Audio recording with pause/resume and visual feedback - Local Whisper transcription (tiny/base/small models) - 7 note types: instructions, capture, meeting, idea, daily, review, journal - Claude CLI integration for intelligent note processing - PKM context integration (reads vault files for better processing) - Auto-organization into type-specific folders - Daily notes with yesterday's task carryover - Language-adaptive responses (matches transcript language) - Custom icon and Windows desktop shortcut helpers Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
72
Tool_Scripts/Whisper_Transcript/transcribe.py
Normal file
72
Tool_Scripts/Whisper_Transcript/transcribe.py
Normal file
@@ -0,0 +1,72 @@
|
||||
import subprocess
|
||||
import sys
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
|
||||
# Configuration
|
||||
OUTPUT_DIR = Path(r"C:\Users\antoi\antoine\My Libraries\Antoine Brain Extension\+\Transcripts")
|
||||
MODEL = "openai/whisper-large-v3"
|
||||
|
||||
def transcribe(audio_path: str):
|
||||
audio_file = Path(audio_path)
|
||||
timestamp = datetime.now().strftime("%Y-%m-%d %H-%M")
|
||||
note_name = f"Voice Note {timestamp}.md"
|
||||
temp_file = Path.home() / "AppData/Local/Temp/whisper_output.txt"
|
||||
|
||||
print(f"\n🎙️ Transcribing: {audio_file.name}")
|
||||
print(f"📝 Output: {note_name}\n")
|
||||
|
||||
# Run whisper
|
||||
subprocess.run([
|
||||
"insanely-fast-whisper",
|
||||
"--file-name", str(audio_file),
|
||||
"--transcript-path", str(temp_file),
|
||||
"--model-name", MODEL
|
||||
])
|
||||
|
||||
# Read transcript
|
||||
transcript = temp_file.read_text(encoding="utf-8")
|
||||
|
||||
# Create markdown note
|
||||
note_content = f"""---
|
||||
created: {datetime.now().strftime("%Y-%m-%d %H:%M")}
|
||||
type: voice-note
|
||||
status: raw
|
||||
tags:
|
||||
- transcript
|
||||
- voice-memo
|
||||
---
|
||||
|
||||
# Voice Note - {datetime.now().strftime("%Y-%m-%d")} at {datetime.now().strftime("%H:%M")}
|
||||
|
||||
## Metadata
|
||||
|
||||
- **Source file:** `{audio_file.name}`
|
||||
- **Transcribed:** {datetime.now().strftime("%Y-%m-%d %H:%M")}
|
||||
|
||||
---
|
||||
|
||||
## Raw Transcript
|
||||
|
||||
{transcript}
|
||||
|
||||
---
|
||||
|
||||
## Notes distillees
|
||||
|
||||
<!-- Coller le transcript dans Claude pour organiser et distiller -->
|
||||
|
||||
"""
|
||||
|
||||
output_path = OUTPUT_DIR / note_name
|
||||
output_path.write_text(note_content, encoding="utf-8")
|
||||
|
||||
print(f"\n✅ Done! Created: {note_name}")
|
||||
print(f"📁 Location: {OUTPUT_DIR}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) > 1:
|
||||
transcribe(sys.argv[1])
|
||||
else:
|
||||
audio = input("Enter audio file path: ").strip('"')
|
||||
transcribe(audio)
|
||||
Reference in New Issue
Block a user