36 lines
1.5 KiB
Markdown
36 lines
1.5 KiB
Markdown
---
|
|
name: Transcribe Audio File
|
|
description: Transcribe an audio file to text using whisper.cpp.
|
|
version: 1
|
|
author: pastilhas
|
|
tags:
|
|
- audio
|
|
- transcription
|
|
skills:
|
|
- whisper.cpp
|
|
trigger:
|
|
- type: file
|
|
extensions:
|
|
- mp3
|
|
- wav
|
|
- m4a
|
|
inputs:
|
|
- name: file_path
|
|
description: Path to the audio file to transcribe.
|
|
required: true
|
|
---
|
|
|
|
# Transcribe Audio File
|
|
|
|
Transcribe an audio file to text using whisper.cpp.
|
|
|
|
## Steps
|
|
|
|
1. Determine the user's root directory by navigating one level up from the current working directory. Read `settings.json` from the root directory and extract the `languages` section.
|
|
2. Detect the language of the audio file using the whisper.cpp skill with `detect_language=true` and `response_format=verbose_json`.
|
|
3. Compare the detected language against the user's `languages.spoken` list. If the detected language is in the list, skip translation. Otherwise, set `translate=true`.
|
|
4. Use the whisper.cpp skill to transcribe the audio file at `file_path`, passing the detected language as the `language` parameter and the `translate` flag from the previous step.
|
|
5. Read the transcription and generate a short, descriptive title based on its contents.
|
|
6. Create a directory alongside the original audio file named `<date>_<slug>`, where `<date>` is the current date in `YYYYMMDD` format and `<slug>` is a slug derived from the generated title.
|
|
7. Move the original audio file and save the transcription as a Markdown file (`.md`) into the new directory, using the same base name for the `.md` file.
|