printf"Error: ffmpeg failed to capture audio stream\n"
exit1
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)
sleep $(($step_s*2))
printf"Buffering audio. Please wait...\n\n"
sleep $(($step_s))
# do not stop script on error
set +e
i=0
while[true];do
# a handy bash built-in, SECONDS,
# > "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
SECONDS=0
while[$running -eq 1];do
# 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 (??)