Created
November 2, 2019 17:02
-
-
Save MegaLoler/59984a592b06aaaf8d0298266d77e51f to your computer and use it in GitHub Desktop.
Play Animal Crossing Wild World hourly music continuously according to the hour like in the game
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# plays hourly animal crossing wild world music in the background! | |
# uses audacious to play 2sf rips | |
# thus it depends on the 2sf music files and audacious | |
# place the .mini2sf files in the following directory and name the hourly music files with this format: "%H.mini2sf", e.g. "00.mini2sf" (midnight), "04.mini2sf" (4 am), "10.mini2sf" (10 am), "12.mini2sf" (noon), "13.mini2sf" (1 pm), "23.mini2sf" (11 pm), etc. | |
MUSIC_DIR=~/hourly # set to the directory containing the 2sf files | |
# repeat forever!! | |
while true | |
do | |
# determine the correct music for the current hour | |
FILE=$(echo "$MUSIC_DIR/$(date +%H).mini2sf") | |
# start playing the music (async so can kill later) | |
echo "Playing hourly music: $FILE" | |
audacious -H $FILE & | |
# sleep until the turn of the hour | |
# https://stackoverflow.com/a/27598644 | |
printf -v left '%(3600-60*10#%M-10#%S)T' -1 | |
echo "Waiting $((left)) seconds until next hour..." | |
sleep "$((left))" | |
# and stop the old music | |
echo "Stopping music." | |
kill $! | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment