@ -53,6 +53,10 @@ if [[ ! " ${models[@]} " =~ " ${model} " ]]; then
exit1
exit1
fi
fi
running=1
trap"running=0" SIGINT SIGTERM
printf"[+] Transcribing stream with model '$model', step_s $step_s (press Ctrl+C to stop):\n\n"
printf"[+] Transcribing stream with model '$model', step_s $step_s (press Ctrl+C to stop):\n\n"
# continuous stream in native fmt (this file will grow forever!)
# continuous stream in native fmt (this file will grow forever!)
@ -61,28 +65,34 @@ if [ $? -ne 0 ]; then
printf"Error: ffmpeg failed to capture audio stream\n"
printf"Error: ffmpeg failed to capture audio stream\n"
exit1
exit1
fi
fi
printf"Buffering audio. Please wait...\n"
# For some reason, the initial buffer can end up smaller than step_s (even though we sleep for step_s)
printf"Buffering audio. Please wait...\n\n"
sleep $(($step_s*2))
sleep $(($step_s))
# do not stop script on error
set +e
i=0
i=0
while[true];do
SECONDS=0
# a handy bash built-in, SECONDS,
while[$running -eq 1];do
# > "This variable expands to the number of seconds since the shell was started. Assignment to this variable resets the count to the value assigned, and the expanded value becomes the value assigned
# > plus the number of seconds since the assignment."
SECONDS=0
# extract the next piece from the main file above and transcode to wav. -ss sets start time and nudges it by -0.5s to catch missing words (??)
# extract the next piece from the main file above and transcode to wav. -ss sets start time and nudges it by -0.5s to catch missing words (??)