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 """ 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)