alpha
Login
or
Join now
lass.pds.lassul.us
/
superconfig
Star
0
Fork
1
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
This repository has no description
Star
0
Fork
1
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
Overview
Issues
Pulls
1
Pipelines
tools.mic-to-text: autodownload model
author
lassulus
date
11 months ago
(Nov 13, 2025, 8:15 PM +0700)
commit
b08bee1a
b08bee1a1ae4731fdec142febec5f06ac6fd2143
parent
4efc94fb
4efc94fb51cffcc793bb957640b0d11e82c444ba
+17
-2
2 changed files
Expand all
Collapse all
Unified
Split
tools
mic-to-text
flake-module.nix
mic-to-text.sh
+1
tools/mic-to-text/flake-module.nix
View file
Reviewed
···
8
8
runtimeInputs = [
9
9
pkgs.sox
10
10
pkgs.whisper-cpp
11
11
+
pkgs.curl
11
12
];
12
13
text = builtins.readFile ./mic-to-text.sh;
13
14
};
+16
-2
tools/mic-to-text/mic-to-text.sh
View file
Reviewed
···
4
4
# Default recording duration in seconds
5
5
DURATION=${1:-5}
6
6
7
7
+
# Model cache directory
8
8
+
MODEL_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/whisper-models"
9
9
+
mkdir -p "$MODEL_DIR"
10
10
+
11
11
+
# Default model
12
12
+
MODEL_NAME="${WHISPER_MODEL:-base.en}"
13
13
+
MODEL_FILE="$MODEL_DIR/ggml-$MODEL_NAME.bin"
14
14
+
15
15
+
# Download model if not present
16
16
+
if [ ! -f "$MODEL_FILE" ]; then
17
17
+
echo "Downloading $MODEL_NAME model (first run only)..." >&2
18
18
+
MODEL_URL="https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-$MODEL_NAME.bin"
19
19
+
curl -L -o "$MODEL_FILE.tmp" "$MODEL_URL" && mv "$MODEL_FILE.tmp" "$MODEL_FILE"
20
20
+
fi
21
21
+
7
22
# Temporary file for audio recording
8
23
TEMP_AUDIO=$(mktemp /tmp/mic-to-text-XXXXXX.wav)
9
24
trap 'rm -f "$TEMP_AUDIO"' EXIT
···
24
39
echo "Transcribing locally..." >&2
25
40
26
41
# Transcribe using whisper.cpp (runs locally, no API calls)
27
27
-
# Uses the base model by default, you can override with WHISPER_MODEL env var
28
28
-
whisper-cpp -m "${WHISPER_MODEL:-base.en}" -f "$TEMP_AUDIO" --no-timestamps --output-txt
42
42
+
whisper-cli -m "$MODEL_FILE" -f "$TEMP_AUDIO" -np