Skip to content

Instantly share code, notes, and snippets.

@briansorahan
Last active December 15, 2017 17:39
Show Gist options
  • Save briansorahan/0ce7202a1b1b74fb4a09 to your computer and use it in GitHub Desktop.
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
#!/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