Created
February 26, 2024 12:21
-
-
Save adam-zethraeus/500c8948c9dfecae599d5157429a8dd5 to your computer and use it in GitHub Desktop.
command link whisper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# https://github.com/ggerganov/whisper.cpp | |
CLONEDIR="${HOME}"/Developer/ | |
stty -echoctl | |
function ctrl_c() { | |
2>/dev/null "${CLONEDIR}"/whisper.cpp/main -m "${CLONEDIR}"/whisper.cpp/models/ggml-large-v3-q5_0.bin -f /tmp/rec.wav --print-colors | pbcopy | |
2>/dev/null rm -f /tmp/rec.wav || true | |
pbpaste | cut -d] -f2 | sed 's/^[[:blank:]]*//;s/[[:blank:]]*$//' | |
pbpaste | sed $'s,\x1b\\[[0-9;]*[a-zA-Z],,g' | cut -d] -f2 | sed 's/^[[:blank:]]*//;s/[[:blank:]]*$//' | pbcopy | |
exit 0 | |
} | |
trap ctrl_c INT | |
2>/dev/null ffmpeg -f avfoundation -i ":0" -ar 16000 /tmp/rec.wav | |
2>/dev/null rm -f /tmp/rec.wav || true | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment