Pejman Moghadam / Scripts

Tabata counter

Public domain


#!/bin/bash

ROUND=16

go_wait() {
  flite -t "Round $R" &
  for I in $(seq 1 $1); do
   sleep 1
  done 
}

rest_wait() {
  for I in $(seq 1 $1); do
   sleep 1
  done 
}

say() {
  killall flite &> /dev/null
  flite -t $1 &
}

ready() {
  for I in $(seq 3 -1 1); do
    say $I
    sleep 1
  done
}

flite -t "Starting tabata for $ROUND rounds in 10 seconds"
for S in $(seq 9 -1 1); do
  say $S
  sleep 1
done
for R in $(seq $ROUND -1 1); do
  START=$(date +"%F %T")
  echo "START: $START    ROUND: $R"

  flite -t GO &
  sleep 1
  go_wait 16
  ready

  flite -t REST &
  sleep 1
  rest_wait 6  
  ready
done
flite -t done

BY: Pejman Moghadam
TAG: tabata, flite
DATE: 2011-06-07 15:13:54


Pejman Moghadam / Scripts [ TXT ]