_alarm 369 B

12345678910111213141516171819202122
  1. #!/usr/bin/env bash
  2. DURATION=0.1
  3. FREQ=880
  4. while getopts d:f: opt
  5. do
  6. case "$opt" in
  7. d)
  8. DURATION=$(( OPTARG * DURATION ))
  9. ;;
  10. f)
  11. FREQ=$(( FREQ * OPTARG ))
  12. ;;
  13. *)
  14. echo "Unknown argument ${opt}" >&2
  15. exit 1
  16. ;;
  17. esac
  18. done
  19. play -q -n synth $DURATION sin $FREQ