Add audio2txt script. - annna - Annna the nice friendly bot. HTML git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/annna/ DIR Log DIR Files DIR Refs DIR Tags DIR README --- DIR commit d556f615209046531915075d96b0251be009988b DIR parent 240e1b3a6f61cdf1f0f96bc17d7a70c1b4f2a270 HTML Author: Annna Robert-Houdin <annna@bitreich.org> Date: Thu, 31 Jul 2025 19:53:03 +0200 Add audio2txt script. Diffstat: A audio2txt | 40 +++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+), 0 deletions(-) --- DIR diff --git a/audio2txt b/audio2txt @@ -0,0 +1,40 @@ +#!/bin/sh + +set -x + +export PATH="$HOME/bin:$PATH" + +function local_whisper() { + WHISPER_CPP=/br/ai/whisper.cpp + ffmpeg -nostdin \ + -threads 0 \ + -i - \ + -f wav \ + -ac 1 \ + -acodec pcm_s16le \ + -ar 16000 - 2>/dev/null \ + | "$WHISPER_CPP/build/bin/whisper-cli" \ + --model "$WHISPER_CPP/models/ggml-large-v3.bin" \ + -np -otxt -nt \ + -f - +} + +function remote_whisper() { + WHISPER_CPP=/home/annna/scm/whisper.cpp + ffmpeg -nostdin \ + -threads 0 \ + -i - \ + -f wav \ + -ac 1 \ + -acodec pcm_s16le \ + -ar 16000 - 2>/dev/null \ + | ollama-gpu \ + "$WHISPER_CPP/build/bin/whisper-cli" \ + --model "$WHISPER_CPP/models/ggml-large-v3.bin" \ + -np -otxt -nt \ + -f - +} + +remote_whisper +[ $? -gt 0 ] && local_whisper +