Last active
December 15, 2017 17:39
-
-
Save briansorahan/0ce7202a1b1b74fb4a09 to your computer and use it in GitHub Desktop.
organize the music instrument samples from http://theremin.music.uiowa.edu/MIS.html
This file contains hidden or 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
#!/bin/sh | |
# | |
# organize the university of iowa samples by instrument type | |
# | |
function usage { | |
>&2 echo "Usage" | |
>&2 echo "$ $0 COMMAND" | |
>&2 echo "" | |
>&2 echo "COMMANDS" | |
>&2 echo " download: Download all the samples with wget" | |
>&2 echo " organize: Organize the samples into separate directories" | |
} | |
function organize { | |
local instruments='Bass Cello Guitar Marimba Vibraphone Viola Violin | |
bells castanet chinese clave crash crotale graniteblock guiro | |
hihat ride splash tambourine tamtam thaigong triangle wb windgong | |
xylophone' | |
for instrument in $instruments; do | |
# make a dir for the instrument and move all the files | |
# for that instrument into the dir | |
[ ! -d $instrument ] && mkdir $instrument | |
for file in $(find . -maxdepth 1 -type f -name "*$instrument*"); do | |
mv $(basename $file) $instrument | |
done | |
done | |
} | |
function main { | |
case "$1" in | |
organize) | |
organize | |
;; | |
download) | |
wget -np -nd -c -A.aif -r -k http://theremin.music.uiowa.edu | |
;; | |
*) | |
>&2 echo "Unrecognized command: $1" | |
>&2 echo "" | |
usage | |
;; | |
esac | |
} | |
main "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment