ggerganov commited on
Commit
dec4507
·
unverified ·
1 Parent(s): b3a9b29

livestream : minor changes

Browse files
Files changed (1) hide show
  1. examples/livestream.sh +5 -6
examples/livestream.sh CHANGED
@@ -53,10 +53,6 @@ if [[ ! " ${models[@]} " =~ " ${model} " ]]; then
53
  exit 1
54
  fi
55
 
56
- running=1
57
-
58
- #trap "running=0" SIGINT SIGTERM
59
-
60
  printf "[+] Transcribing stream with model '$model', step_s $step_s (press Ctrl+C to stop):\n\n"
61
 
62
  # continuous stream in native fmt (this file will grow forever!)
@@ -66,10 +62,12 @@ if [ $? -ne 0 ]; then
66
  exit 1
67
  fi
68
  printf "Buffering audio. Please wait...\n"
 
69
  # For some reason, the initial buffer can end up smaller than step_s (even though we sleep for step_s)
70
  sleep $(($step_s*2))
 
71
  i=0
72
- while [ $running -eq 1 ]; do
73
  # a handy bash built-in, SECONDS,
74
  # > "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
75
  # > plus the number of seconds since the assignment."
@@ -80,8 +78,9 @@ while [ $running -eq 1 ]; do
80
  else
81
  ffmpeg -loglevel quiet -noaccurate_seek -i /tmp/whisper-live0.${fmt} -y -ar 16000 -ac 1 -c:a pcm_s16le -ss $(($i*$step_s)) -t $step_s /tmp/whisper-live.wav
82
  fi
 
83
  ./main -t 8 -m ./models/ggml-base.en.bin -f /tmp/whisper-live.wav --no-timestamps -otxt 2> /tmp/whispererr | tail -n 1
84
- echo
85
  while [ $SECONDS -lt $step_s ]; do
86
  sleep 1
87
  done
 
53
  exit 1
54
  fi
55
 
 
 
 
 
56
  printf "[+] Transcribing stream with model '$model', step_s $step_s (press Ctrl+C to stop):\n\n"
57
 
58
  # continuous stream in native fmt (this file will grow forever!)
 
62
  exit 1
63
  fi
64
  printf "Buffering audio. Please wait...\n"
65
+
66
  # For some reason, the initial buffer can end up smaller than step_s (even though we sleep for step_s)
67
  sleep $(($step_s*2))
68
+
69
  i=0
70
+ while [ true ]; do
71
  # a handy bash built-in, SECONDS,
72
  # > "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
73
  # > plus the number of seconds since the assignment."
 
78
  else
79
  ffmpeg -loglevel quiet -noaccurate_seek -i /tmp/whisper-live0.${fmt} -y -ar 16000 -ac 1 -c:a pcm_s16le -ss $(($i*$step_s)) -t $step_s /tmp/whisper-live.wav
80
  fi
81
+
82
  ./main -t 8 -m ./models/ggml-base.en.bin -f /tmp/whisper-live.wav --no-timestamps -otxt 2> /tmp/whispererr | tail -n 1
83
+
84
  while [ $SECONDS -lt $step_s ]; do
85
  sleep 1
86
  done