SHARE
TWEET

mario.sh

Nickster258 Sep 5th, 2016 (edited) 85 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2.  
  3. MELODY=(2637 2637 0 2637 0 2093 2637 0 3136 0 0  0 1568 0 0 0 2093 0 0 1568 0 0 1319 0 0 1760 0 1976 0 1865 1760 0 1568 2637 3136 3520 0 2794 3136 0 2637 0 2093 2349 1976 0 0 2093 0 0 1568 0 0 1319 0 0 1760 0 1976 0 1865 1760 0 1568 2637 3136 3520 0 2794 3136 0 2637 0 2093 2349 1976 0 0)
  4. TEMPO=(12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12)
  5.  
  6. COUNT=0
  7. while [ $COUNT -lt 78 ]
  8. do
  9.   TONE=${MELODY[COUNT]}
  10.   COUNT=$((COUNT+1))
  11.   LENGTH=$((10 * ${TEMPO[COUNT]}))
  12.   SLEEP=`echo "scale=3 ; $LENGTH / 1000" | bc`
  13.   if [ "$TONE" == "0" ]; then
  14.     sleep $SLEEP
  15.     echo "sleep $SLEEP"
  16.   else
  17.     beep -f $TONE -l $LENGTH
  18.     echo "beep -f $TONE -l $LENGTH"
  19.   fi
  20. done
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top