Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- shopt -s extglob
- IFS=$'\n'
- echo "Hello, welcome to the Soundfont converter."
- echo "To convert a soundfont from CFX to Proffie, enter 'CtoP'"
- echo "To convert a soundfont from CFX to Xenopixel, enter 'CtoX'"
- echo "To convert a soundfont from Proffie to CFX, enter 'PtoC'"
- echo "To convert a soundfont from Proffie to Xenopixel, enter 'PtoX'"
- echo "To convert a soundfont from Xenopixel to CFX, enter 'XtoC'"
- echo "To convert a soundfont from Xenopixel to Proffie, enter 'XtoP'"
- echo "To rename a Proffie soundfont for ideal performance, enter 'PtoP'"
- read boardchoice
- if [ "$boardchoice" = "CtoP" ]; then
- echo "You chose CFX to Proffie Soundfont converter."
- echo "Do you wish to convert a single soundfont (enter '1') or a folder containing several soundfonts in subfolders (enter '2')?"
- echo "If you choose 2, Make sure each sub-folder only contains one soundfont. Otherwise the soundfonts will get mixed!"
- read selection
- if [ "$selection" = "1" ]; then
- echo "You chose to convert a single soundfont. Please enter the name of the font folder containting the soundfont files."
- echo "You may need to enter the path if it's a subfolder of where you are (such as 'SoundfontMaker/Font')"
- read input
- dirs=$(find "$input" -maxdepth 0 -type d)
- echo "Found the following soundfont folder:"
- echo $dirs
- echo "Does this folder only contain one soundfont? (y/n)"
- read input2
- if [ "$input2" = "y" ]; then
- echo "Continuing conversion"
- else
- echo "Aborting program"
- exit
- fi
- elif [ "$selection" = "2" ]; then
- echo "You chose to convert several soundfonts. Each soundfont must be in a single subfolder."
- echo "Please enter the name of the folder containing the soundfont folders."
- read input
- dirs=$(find "$input" -mindepth 1 -maxdepth 1 -type d)
- echo "Found the following directories for soundfonts:"
- echo $dirs
- echo "Does each of these folders only contain one soundfont? (y/n)"
- read input2
- if [ "$input2" = "y" ]; then
- echo "Continuing conversion"
- else
- echo "Aborting program"
- exit
- fi
- else
- echo "Your selection is invalid. Aborting program"
- exit
- fi
- echo "Do you wish a detailed conversion progess report ('1') or only the imporant steps ('2')?"
- echo "Warning, the detailed report will produce a lot of console output!"
- read verbosity
- if [ "$verbosity" = "1" ]; then
- echo "Logging progress to console"
- else
- echo "Logging only important steps"
- fi
- for dir in ${dirs[@]}; do
- sounds=$(find "$dir" -type f -name '*.wav')
- echo Converting soundfont in "${dir}".
- targetpath="Converted_to_Proffie"
- mkdir -p "${targetpath}"
- mkdir -p "${targetpath}/${dir}/bgndrag"
- mkdir -p "${targetpath}/${dir}/bgnlb"
- mkdir -p "${targetpath}/${dir}/bgnlock"
- mkdir -p "${targetpath}/${dir}/bgnmelt"
- #mkdir -p "${targetpath}/${dir}/blst"
- #mkdir -p "${targetpath}/${dir}/boot"
- mkdir -p "${targetpath}/${dir}/clsh"
- mkdir -p "${targetpath}/${dir}/ccchange"
- mkdir -p "${targetpath}/${dir}/drag"
- mkdir -p "${targetpath}/${dir}/enddrag"
- mkdir -p "${targetpath}/${dir}/endlb"
- mkdir -p "${targetpath}/${dir}/endlock"
- mkdir -p "${targetpath}/${dir}/font"
- mkdir -p "${targetpath}/${dir}/force"
- mkdir -p "${targetpath}/${dir}/hum"
- mkdir -p "${targetpath}/${dir}/in"
- mkdir -p "${targetpath}/${dir}/lb"
- mkdir -p "${targetpath}/${dir}/lock"
- mkdir -p "${targetpath}/${dir}/melt"
- mkdir -p "${targetpath}/${dir}/out"
- mkdir -p "${targetpath}/${dir}/preon"
- mkdir -p "${targetpath}/${dir}/pstoff"
- mkdir -p "${targetpath}/${dir}/slsh"
- mkdir -p "${targetpath}/${dir}/spin"
- mkdir -p "${targetpath}/${dir}/stab"
- mkdir -p "${targetpath}/${dir}/swingh"
- mkdir -p "${targetpath}/${dir}/swingl"
- mkdir -p "${targetpath}/${dir}/swng"
- mkdir -p "${targetpath}/${dir}/tracks"
- blastercounter=1
- bootcounter=1
- clashcounter=1
- colorcounter=1
- dragcounter=1
- enddragcounter=1
- endlockcounter=1
- fontcounter=1
- forcecounter=1
- hswingcounter=1
- humcounter=1
- lockupcounter=1
- lswingcounter=1
- poweroffcounter=1
- poweroncounter=1
- preoncounter=1
- spincounter=1
- stabcounter=1
- startdragcounter=1
- startlockcounter=1
- swingcounter=1
- trackcounter=1
- for src in ${sounds[@]}; do
- case "${src##*/}" in
- blaster*([0-9]).wav)
- if [ $blastercounter = 2 ]; then
- mkdir -p "${targetpath}/${dir}/blst"
- mv "${target}" "./${targetpath}/${dir}/blst/${targetfile}"
- echo "Moving ${targetfile} into ${dir}/blst subfolder"
- fi
- if [ "$blastercounter" -lt 10 ]; then
- targetfile=$(printf %q "blst0$blastercounter.wav")
- else
- targetfile=$(printf %q "blst$blastercounter.wav")
- fi
- if [ $blastercounter -ge 2 ]; then
- target="./${targetpath}/${dir}/blst/${targetfile}"
- else
- target="./${targetpath}/${dir}/${targetfile}"
- fi
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- blastercounter=$((blastercounter+1))
- ;;
- boot*([0-9]).wav)
- if [ $bootcounter = 2 ]; then
- mkdir -p "${targetpath}/${dir}/boot"
- mv "${target}" "./${targetpath}/${dir}/boot/${targetfile}"
- echo "Moving ${targetfile} into ${dir}/boot subfolder"
- fi
- if [ "$bootcounter" -lt 10 ]; then
- targetfile=$(printf %q "boot0$bootcounter.wav")
- else
- targetfile=$(printf %q "boot$bootcounter.wav")
- fi
- if [ $bootcounter -ge 2 ]; then
- target="./${targetpath}/${dir}/boot/${targetfile}"
- else
- target="./${targetpath}/${dir}/${targetfile}"
- fi
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- bootcounter=$((bootcounter+1))
- ;;
- boot*([0-9]).wav)
- if [ "$bootcounter" -lt 10 ]; then
- targetfile=$(printf %q "boot0$bootcounter.wav")
- else
- targetfile=$(printf %q "boot$bootcounter.wav")
- fi
- bootcounter=$((bootcounter+1))
- target="./$targetpath/${dir}/boot/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- clash*([0-9]).wav)
- if [ "$clashcounter" -lt 10 ]; then
- targetfile=$(printf %q "clsh0$clashcounter.wav")
- else
- targetfile=$(printf %q "clsh$clashcounter.wav")
- fi
- clashcounter=$((clashcounter+1))
- target="./$targetpath/${dir}/clsh/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- color*([0-9]).wav)
- targetfile=$(printf %q "ccchage$colorcounter.wav")
- colorcounter=$((colorcounter+1))
- target="./$targetpath/${dir}/ccchange/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- drag*([0-9]).wav)
- if [ "$dragcounter" -lt 10 ]; then
- targetfile=$(printf %q "drag0$dragcounter.wav")
- else
- targetfile=$(printf %q "drag$dragcounter.wav")
- fi
- dragcounter=$((dragcounter+1))
- target="./$targetpath/${dir}/drag/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- enddrag*([0-9]).wav)
- targetfile=$(printf %q "enddrag$enddragcounter.wav")
- enddragcounter=$((enddragcounter+1))
- target="./$targetpath/${dir}/enddrag/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- endlock*([0-9]).wav)
- targetfile=$(printf %q "endlock$endlockcounter.wav")
- endlockcounter=$((endlockcounter+1))
- target="./$targetpath/${dir}/endlock/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- font*([0-9]).wav)
- if [ "$fontcounter" -lt 10 ]; then
- targetfile=$(printf %q "font0$fontcounter.wav")
- else
- targetfile=$(printf %q "font$fontcounter.wav")
- fi
- fontcounter=$((fontcounter+1))
- target="./$targetpath/${dir}/font/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- force*|combo*([0-9]).wav)
- if [ "$forcecounter" -lt 10 ]; then
- targetfile=$(printf %q "force0$forcecounter.wav")
- else
- targetfile=$(printf %q "force$forcecounter.wav")
- fi
- forcecounter=$((forcecounter+1))
- target="./$targetpath/${dir}/force/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- hswing*([0-9]).wav)
- if [ "$hswingcounter" -lt 10 ]; then
- targetfile=$(printf %q "swingh0$hswingcounter.wav")
- else
- targetfile=$(printf %q "swingh$hswingcounter.wav")
- fi
- hswingcounter=$((hswingcounter+1))
- target="./$targetpath/${dir}/swingh/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- hum**([0-9]).wav)
- if [ "$humcounter" -lt 10 ]; then
- targetfile=$(printf %q "hum0$humcounter.wav")
- else
- targetfile=$(printf %q "hum$humcounter.wav")
- fi
- humcounter=$((humcounter+1))
- target="./$targetpath/${dir}/hum/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- lswing*([0-9]).wav)
- if [ "$lswingcounter" -lt 10 ]; then
- targetfile=$(printf %q "swingl0$lswingcounter.wav")
- else
- targetfile=$(printf %q "swingl$lswingcounter.wav")
- fi
- lswingcounter=$((lswingcounter+1))
- target="./$targetpath/${dir}/swingl/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- lock**([0-9]).wav)
- if [ "$lockupcounter" -lt 10 ]; then
- targetfile=$(printf %q "lock0$lockupcounter.wav")
- else
- targetfile=$(printf %q "lock$lockupcounter.wav")
- fi
- lockupcounter=$((lockupcounter+1))
- target="./$targetpath/${dir}/lock/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- poweroff*|pwroff*([0-9]).wav)
- if [ "$poweroffcounter" -lt 10 ]; then
- targetfile=$(printf %q "in0$poweroffcounter.wav")
- else
- targetfile=$(printf %q "in$poweroffcounter.wav")
- fi
- poweroffcounter=$((poweroffcounter+1))
- target="./$targetpath/${dir}/in/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- poweron**([0-9]).wav)
- if [ "$poweroncounter" -lt 10 ]; then
- targetfile=$(printf %q "out0$poweroncounter.wav")
- else
- targetfile=$(printf %q "out$poweroncounter.wav")
- fi
- poweroncounter=$((poweroncounter+1))
- target="./$targetpath/${dir}/out/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- preon*([0-9]).wav)
- if [ "$preoncounter" -lt 10 ]; then
- targetfile=$(printf %q "preon0$preoncounter.wav")
- else
- targetfile=$(printf %q "preon$preoncounter.wav")
- fi
- preoncounter=$((preoncounter+1))
- target="./${targetpath}/${dir}/preon/${targetfile}"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- spin*([0-9]).wav)
- if [ "$spincounter" -lt 10 ]; then
- targetfile=$(printf %q "spin0$spincounter.wav")
- else
- targetfile=$(printf %q "spin$spincounter.wav")
- fi
- spincounter=$((spincounter+1))
- target="./$targetpath/${dir}/spin/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- stab*([0-9]).wav)
- if [ "$stabcounter" -lt 10 ]; then
- targetfile=$(printf %q "stab0$stabcounter.wav")
- else
- targetfile=$(printf %q "stab$stabcounter.wav")
- fi
- stabcounter=$((stabcounter+1))
- target="./$targetpath/${dir}/stab/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- startdrag*([0-9]).wav)
- targetfile=$(printf %q "bgndrag$startdragcounter.wav")
- startdragcounter=$((startdragcounter+1))
- target="./$targetpath/${dir}/bgndrag/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- startlock*([0-9]).wav)
- targetfile=$(printf %q "bgnlock$startlockcounter.wav")
- startlockcounter=$((startlockcounter+1))
- target="./$targetpath/${dir}/bgnlock/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- swing*([0-9]).wav)
- if [ "$swingcounter" -lt 10 ]; then
- targetfile=$(printf %q "swng0$swingcounter.wav")
- else
- targetfile=$(printf %q "swng$swingcounter.wav")
- fi
- swingcounter=$((swingcounter+1))
- target="./$targetpath/${dir}/swng/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- track*([0-9]).wav)
- if [ "$trackcounter" -lt 10 ]; then
- targetfile=$(printf %q "track0$trackcounter.wav")
- else
- targetfile=$(printf %q "track$trackcounter.wav")
- fi
- trackcounter=$((trackcounter+1))
- target="./$targetpath/${dir}/tracks/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- *)
- echo "No match found, ignoring file $src"
- esac
- done
- echo Coverted soundfont saved in "${targetpath}"
- done
- echo "Soundfont conversion complete. If you see files with a '~' at the end, this file already existed in the output folder"
- echo "before the conversion and was renamed to avoid accidental overwriting."
- echo " "
- #-------------------------------------------------------------------------------------------------------------------------------------
- elif [ "$boardchoice" = "CtoX" ]; then
- echo "You chose CFX to Xenopixel Soundfont converter."
- echo "Do you wish to convert a single soundfont (enter '1') or a folder containing several soundfonts in subfolders (enter '2')?"
- echo "If you choose 2, Make sure each sub-folder only contains one soundfont. Otherwise the soundfonts will get mixed!"
- read selection
- if [ "$selection" = "1" ]; then
- echo "You chose to convert a single soundfont. Please enter the name of the font folder containting the soundfont files."
- echo "You may need to enter the path if it's a subfolder of where you are (such as 'SoundfontMaker/Font')"
- read input
- dirs=$(find "$input" -maxdepth 0 -type d)
- echo "Found the following soundfont folder:"
- echo $dirs
- echo "Does this folder only contain one soundfont? (y/n)"
- read input2
- if [ "$input2" = "y" ]; then
- echo "Continuing conversion"
- else
- echo "Aborting program"
- exit
- fi
- elif [ "$selection" = "2" ]; then
- echo "You chose to convert several soundfonts. Each soundfont must be in a single subfolder."
- echo "Please enter the name of the folder containing the soundfont folders."
- read input
- dirs=$(find "$input" -mindepth 1 -maxdepth 1 -type d)
- echo "Found the following directories for soundfonts:"
- echo $dirs
- echo "Does each of these folders only contain one soundfont? (y/n)"
- read input2
- if [ "$input2" = "y" ]; then
- echo "Continuing conversion"
- else
- echo "Aborting program"
- exit
- fi
- else
- echo "Your selection is invalid. Aborting program"
- exit
- fi
- echo "Do you wish a detailed conversion progess report ('1') or only the imporant steps ('2')?"
- echo "Warning, the detailed report will produce a lot of console output!"
- read verbosity
- if [ "$verbosity" = "1" ]; then
- echo "Logging progress to console"
- else
- echo "Logging only important steps"
- fi
- for dir in ${dirs[@]}; do
- sounds=$(find "$dir" -type f -name '*.wav')
- echo Converting soundfont in "${dir}".
- targetpath="Converted_to_Xenopixel"
- mkdir -p "${targetpath}"
- mkdir -p "${targetpath}/${dir}/set"
- mkdir -p "${targetpath}/${dir}/tracks"
- blastercounter=1
- bootcounter=1
- clashcounter=1
- # colorcounter=1
- dragcounter=1
- # endlockcounter=1
- fontcounter=1
- forcecounter=1
- hswingcounter=1
- humcounter=1
- lswingcounter=1
- poweroffcounter=1
- poweroncounter=1
- lockcounter=1
- lockupcounter=1
- preoncounter=1
- # spincounter=1
- # stabcounter=1
- # swingcounter=1
- trackcounter=1
- for src in ${sounds[@]}; do
- case "${src##*/}" in
- blaster*([0-9]).wav)
- targetfile="blaster ($blastercounter).wav"
- blastercounter=$((blastercounter+1))
- target="./${targetpath}/${dir}/${targetfile}"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- # boot sounds are converted to 'power on.wav and live in the 'set' folder.
- # If there are more than one converted, the last one will be the resulting file.
- boot*([0-9]).wav)
- targetfile="power on.wav"
- bootcounter=$((bootcounter+1))
- target="./$targetpath/${dir}/set/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- clash*([0-9]).wav)
- targetfile="clash ($clashcounter).wav"
- clashcounter=$((clashcounter+1))
- target="./$targetpath//${dir}/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- # color sounds are currently not supported by Xenopixel and therefore ignored.
- # Uncomment counter above and code here and adapt targetfile if needed later.
- # color*([0-9]).wav)
- # targetfile="color ($colorcounter).wav"
- # colorcounter=$((colorcounter+1))
- # target="./${targetpath}/${dir}/${targetfile}"
- # if [ "$verbosity" = "1" ]; then
- # echo "Converting ${src} to ${target}"
- # fi
- # rsync -ab "${src}" "${target}"
- # ;;
- drag*([0-9]).wav)
- targetfile="drag ($dragcounter).wav"
- dragcounter=$((dragcounter+1))
- target="./$targetpath//${dir}/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- # endlock sounds are currently not supported by Xenopixel and therefore ignored.
- # Uncomment counter above and code here and adapt targetfile if needed later.
- # endlock*([0-9]).wav)
- # targetfile="endlock ($endlockcounter).wav"
- # endlockcounter=$((endlockcounter+1))
- # target="./${targetpath}/${dir}/${targetfile}"
- # if [ "$verbosity" = "1" ]; then
- # echo "Converting ${src} to ${target}"
- # fi
- # rsync -ab "${src}" "${target}"
- # ;;
- font*([0-9]).wav)
- targetfile="font ($fontcounter).wav"
- fontcounter=$((fontcounter+1))
- target="./$targetpath//${dir}/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- force*|combo*([0-9]).wav)
- targetfile="force ($forcecounter).wav"
- forcecounter=$((forcecounter+1))
- target="./$targetpath//${dir}/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- hum*|humM*([0-9]).wav)
- targetfile="hum ($humcounter).wav"
- humcounter=$((humcounter+1))
- target="./$targetpath//${dir}/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- poweroff*|pwroff*([0-9]).wav)
- targetfile="in ($poweroffcounter).wav"
- poweroffcounter=$((poweroffcounter+1))
- target="./$targetpath//${dir}/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- lock**([0-9]).wav)
- targetfile="lock ($lockcounter).wav"
- lockcounter=$((lockcounter+1))
- target="./$targetpath//${dir}/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- poweron**([0-9]).wav)
- targetfile="out ($poweroncounter).wav"
- poweroncounter=$((poweroncounter+1))
- target="./$targetpath//${dir}/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- hswing*([0-9]).wav)
- targetfile="hswing ($hswingcounter).wav"
- hswingcounter=$((hswingcounter+1))
- target="./$targetpath//${dir}/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- lswing*([0-9]).wav)
- targetfile="lswing ($lswingcounter).wav"
- lswingcounter=$((lswingcounter+1))
- target="./$targetpath//${dir}/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- preon*([0-9]).wav)
- targetfile="preon ($preoncounter).wav"
- if [ "$preoncounter" -ge 5 ]; then
- preoncounter=1
- else
- preoncounter=$((preoncounter+1))
- fi
- target="./$targetpath/$targetfile"
- target="./$targetpath/${dir}/set/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- # spin sounds are currently not supported by Xenopixel and therefore ignored.
- # Uncomment counter above and code here and adapt targetfile if needed later.
- # spin*([0-9]).wav)
- # targetfile="spin ($spincounter).wav"
- # spincounter=$((spincounter+1))
- # target="./${targetpath}/${dir}/${targetfile}"
- # if [ "$verbosity" = "1" ]; then
- # echo "Converting ${src} to ${target}"
- # fi
- # rsync -ab "${src}" "${target}"
- # ;;
- # stab sounds are currently not supported by Xenopixel and therefore ignored.
- # Uncomment counter above and code here and adapt targetfile if needed later.
- # stab*([0-9]).wav)
- # targetfile="stab ($stabcounter).wav"
- # stabcounter=$((stabcounter+1))
- # target="./${targetpath}/${dir}/${targetfile}"
- # if [ "$verbosity" = "1" ]; then
- # echo "Converting ${src} to ${target}"
- # fi
- # rsync -ab "${src}" "${target}"
- # ;;
- # Accent Swings are currently not supported by Xenopixel and therefore ignored.
- # Uncomment and adapt targetfile if needed later.
- # swng*([0-9]).wav)
- # targetfile="swing ($swingcounter).wav"
- # swingcounter=$((swingcounter+1))
- # target="./${targetpath}/${dir}/${targetfile}"
- # if [ "$verbosity" = "1" ]; then
- # echo "Converting ${src} to ${target}"
- # fi
- # rsync -ab "${src}" "${target}"
- # ;;
- track*([0-9]).wav)
- targetfile="track ($trackcounter).wav"
- trackcounter=$((trackcounter+1))
- target="./$targetpath/${dir}/tracks/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- *)
- echo "No match found, ignoring file $src"
- esac
- done
- echo Coverted soundfont saved in "${targetpath}"
- done
- echo "Soundfont conversion complete. If you see files with a '~' at the end, this file already existed in the output folder"
- echo "before the conversion and was renamed to avoid accidental overwriting."
- echo " "
- #-------------------------------------------------------------------------------------------------------------------------------------
- elif [ "$boardchoice" = "PtoC" ]; then
- echo "You chose Proffie to CFX Soundfont converter."
- echo "Do you wish to convert a single soundfont (enter '1') or a folder containing several soundfonts in subfolders (enter '2')?"
- echo "If you choose 2, Make sure each sub-folder only contains one soundfont. Otherwise the soundfonts will get mixed!"
- read selection
- if [ "$selection" = "1" ]; then
- echo "You chose to convert a single soundfont. Please enter the name of the font folder containting the soundfont files."
- echo "You may need to enter the path if it's a subfolder of where you are (such as 'SoundfontMaker/Font')"
- read input
- dirs=$(find "$input" -maxdepth 0 -type d)
- echo "Found the following soundfont folder:"
- echo $dirs
- echo "Does this folder only contain one soundfont? (y/n)"
- read input2
- if [ "$input2" = "y" ]; then
- echo "Continuing conversion"
- else
- echo "Aborting program"
- exit
- fi
- elif [ "$selection" = "2" ]; then
- echo "You chose to convert several soundfonts. Each soundfont must be in a single subfolder."
- echo "Please enter the name of the folder containing the soundfont folders."
- read input
- dirs=$(find "$input" -mindepth 1 -maxdepth 1 -type d)
- echo "Found the following directories for soundfonts:"
- echo $dirs
- echo "Does each of these folders only contain one soundfont? (y/n)"
- read input2
- if [ "$input2" = "y" ]; then
- echo "Continuing conversion"
- else
- echo "Aborting program"
- exit
- fi
- else
- echo "Your selection is invalid. Aborting program"
- exit
- fi
- echo "Do you wish a detailed conversion progess report ('1') or only the imporant steps ('2')?"
- echo "Warning, the detailed report will produce a lot of console output!"
- read verbosity
- if [ "$verbosity" = "1" ]; then
- echo "Logging progress to console"
- else
- echo "Logging only important steps"
- fi
- for dir in ${dirs[@]}; do
- sounds=$(find "$dir" -type f -name '*.wav')
- echo Converting soundfont in "${dir}".
- targetpath="Converted_to_CFX/${dir}"
- mkdir -p "${targetpath}"
- bgndragcounter=1
- bgnlockcounter=1
- blstcounter=1
- bootcounter=1
- clshcounter=1
- ccchangecounter=1
- dragcounter=1
- enddragcounter=1
- endlockcounter=1
- fontcounter=1
- forcecounter=1
- humcounter=1
- incounter=1
- lockcounter=1
- outcounter=1
- preoncounter=1
- spincounter=1
- stabcounter=1
- swinghcounter=1
- swinglcounter=1
- swngcounter=1
- trackcounter=1
- for src in ${sounds[@]}; do
- case "${src##*/}" in
- bgndrag*([0-9]).wav)
- targetfile=$(printf %q "startdrag$bgndragcounter.wav")
- bgndragcounter=$((bgndragcounter+1))
- target="./${targetpath}/${targetfile}"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- bgnlock*([0-9]).wav)
- targetfile=$(printf %q "startlock$bgnlockcounter.wav")
- bgnlockcounter=$((bgnlockcounter+1))
- target="./${targetpath}/${targetfile}"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- blst*([0-9]).wav)
- if [ "$blstcounter" -eq 1 ]; then
- targetfile=$(printf %q "blaster.wav")
- else
- targetfile=$(printf %q "blaster$blstcounter.wav")
- fi
- blstcounter=$((blstcounter+1))
- target="./${targetpath}/${targetfile}"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- boot*([0-9]).wav)
- if [ "$bootcounter" -eq 1 ]; then
- targetfile=$(printf %q "boot.wav")
- else
- targetfile=$(printf %q "boot$bootcounter.wav")
- fi
- bootcounter=$((bootcounter+1))
- target="./$targetpath/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- clsh*([0-9]).wav)
- targetfile=$(printf %q "clash$clshcounter.wav")
- clshcounter=$((clshcounter+1))
- target="./$targetpath/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- ccchange*([0-9]).wav)
- if [ "$ccchangecounter" -eq 1 ]; then
- targetfile=$(printf %q "color.wav")
- else
- targetfile=$(printf %q "color$ccchangecounter.wav")
- fi
- ccchangecounter=$((ccchangecounter+1))
- target="./$targetpath/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- drag*([0-9]).wav)
- if [ "$dragcounter" -eq 1 ]; then
- targetfile=$(printf %q "drag.wav")
- else
- targetfile=$(printf %q "drag$dragcounter.wav")
- fi
- dragcounter=$((dragcounter+1))
- target="./$targetpath/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- enddrag*([0-9]).wav)
- targetfile=$(printf %q "enddrag$enddragcounter.wav")
- enddragcounter=$((enddragcounter+1))
- target="./$targetpath/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- endlock*([0-9]).wav)
- targetfile=$(printf %q "endlock$endlockcounter.wav")
- endlockcounter=$((endlockcounter+1))
- target="./$targetpath/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- font*([0-9]).wav)
- if [ "$fontcounter" -eq 1 ]; then
- targetfile=$(printf %q "font.wav")
- else
- targetfile=$(printf %q "font$fontcounter.wav")
- fi
- fontcounter=$((fontcounter+1))
- target="./$targetpath/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- force*|quote*([0-9]).wav)
- if [ "$forcecounter" -eq 1 ]; then
- targetfile=$(printf %q "force.wav")
- else
- targetfile=$(printf %q "force$forcecounter.wav")
- fi
- forcecounter=$((forcecounter+1))
- target="./$targetpath/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- hum*([0-9]).wav)
- targetfile=$(printf %q "humM$humcounter.wav")
- humcounter=$((humcounter+1))
- target="./$targetpath/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- in*([0-9]).wav)
- if [ "$incounter" -eq 1 ]; then
- targetfile=$(printf %q "poweroff.wav")
- elif [ "$incounter" -eq 2 ]; then
- targetfile=$(printf %q "pwroff$incounter.wav")
- elif [ "$incounter" -ge 3 ]; then
- targetfile=$(printf %q "poweroff$((incounter-1)).wav")
- fi
- incounter=$((incounter+1))
- target="./$targetpath/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- lock*([0-9]).wav)
- if [ "$lockcounter" -eq 1 ]; then
- targetfile=$(printf %q "lockup.wav")
- else
- targetfile=$(printf %q "lockup$lockcounter.wav")
- fi
- lockcounter=$((lockcounter+1))
- target="./$targetpath/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- out*([0-9]).wav)
- if [ "$outcounter" -eq 1 ]; then
- targetfile=$(printf %q "poweron.wav")
- else
- targetfile=$(printf %q "poweron$outcounter.wav")
- fi
- outcounter=$((outcounter+1))
- target="./$targetpath/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- preon*([0-9]).wav)
- targetfile=$(printf %q "preon$preoncounter.wav")
- preoncounter=$((preoncounter+1))
- target="./$targetpath/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- spin*([0-9]).wav)
- targetfile=$(printf %q "spin$spincounter.wav")
- spincounter=$((spincounter+1))
- target="./$targetpath/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- stab*([0-9]).wav)
- targetfile=$(printf %q "stab$stabcounter.wav")
- stabcounter=$((stabcounter+1))
- target="./$targetpath/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- swingh*([0-9]).wav)
- targetfile=$(printf %q "hswing$swinghcounter.wav")
- swinghcounter=$((swinghcounter+1))
- target="./$targetpath/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- swingl*([0-9]).wav)
- targetfile=$(printf %q "lswing$swinglcounter.wav")
- swinglcounter=$((swinglcounter+1))
- target="./$targetpath/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- swng*([0-9]).wav)
- targetfile=$(printf %q "swing$swngcounter.wav")
- swngcounter=$((swngcounter+1))
- target="./$targetpath/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- track*([0-9]).wav)
- targetfile=$(printf %q "track$trackcounter.wav")
- trackcounter=$((trackcounter+1))
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- *)
- echo "No match found, ignoring file $src"
- esac
- done
- echo Coverted soundfont saved in "${targetpath}"
- done
- echo "Soundfont conversion complete. If you see files with a '~' at the end, this file already existed in the output folder"
- echo "before the conversion and was renamed to avoid accidental overwriting."
- echo " "
- #-------------------------------------------------------------------------------------------------------------------------------------
- elif [ "$boardchoice" = "PtoX" ]; then
- echo "You chose Proffie to Xenopixel Soundfont converter."
- echo "Do you wish to convert a single soundfont (enter '1') or a folder containing several soundfonts in subfolders (enter '2')?"
- echo "If you choose 2, Make sure each sub-folder only contains one soundfont. Otherwise the soundfonts will get mixed!"
- read selection
- if [ "$selection" = "1" ]; then
- echo "You chose to convert a single soundfont. Please enter the name of the font folder containting the soundfont files."
- echo "You may need to enter the path if it's a subfolder of where you are (such as 'SoundfontMaker/Font')"
- read input
- dirs=$(find "$input" -maxdepth 0 -type d)
- echo "Found the following soundfont folder:"
- echo $dirs
- echo "Does this folder only contain one soundfont? (y/n)"
- read input2
- if [ "$input2" = "y" ]; then
- echo "Continuing conversion"
- else
- echo "Aborting program"
- exit
- fi
- elif [ "$selection" = "2" ]; then
- echo "You chose to convert several soundfonts. Each soundfont must be in a single subfolder."
- echo "Please enter the name of the folder containing the soundfont folders."
- read input
- dirs=$(find "$input" -mindepth 1 -maxdepth 1 -type d)
- echo "Found the following directories for soundfonts:"
- echo $dirs
- echo "Does each of these folders only contain one soundfont? (y/n)"
- read input2
- if [ "$input2" = "y" ]; then
- echo "Continuing conversion"
- else
- echo "Aborting program"
- exit
- fi
- else
- echo "Your selection is invalid. Aborting program"
- exit
- fi
- echo "Do you wish a detailed conversion progess report ('1') or only the imporant steps ('2')?"
- echo "Warning, the detailed report will produce a lot of console output!"
- read verbosity
- if [ "$verbosity" = "1" ]; then
- echo "Logging progress to console"
- else
- echo "Logging only important steps"
- fi
- for dir in ${dirs[@]}; do
- sounds=$(find "$dir" -type f -name '*.wav')
- echo Converting soundfont in "${dir}".
- targetpath="Converted_to_Xenopixel"
- mkdir -p "${targetpath}"
- mkdir -p "${targetpath}/${dir}/set"
- mkdir -p "${targetpath}/${dir}/tracks"
- blstcounter=1
- bootcounter=1
- clshcounter=1
- # colorcounter=1
- dragcounter=1
- # endlockcounter=1
- fontcounter=1
- forcecounter=1
- humcounter=1
- incounter=1
- lockcounter=1
- outcounter=1
- preoncounter=1
- swinghcounter=1
- swinglcounter=1
- # spincounter=1
- # stabcounter=1
- # swngcounter=1
- trackcounter=1
- for src in ${sounds[@]}; do
- case "${src##*/}" in
- blst*([0-9]).wav)
- targetfile="blaster ($blstcounter).wav"
- blstcounter=$((blstcounter+1))
- target="./${targetpath}/${dir}/${targetfile}"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- # boot sounds are converted to 'power on.wav and live in the 'set' folder.
- # If there are more than one converted, the last one will be the resulting file.
- boot*([0-9]).wav)
- targetfile="power on.wav"
- bootcounter=$((bootcounter+1))
- target="./$targetpath/${dir}/set/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- clsh*([0-9]).wav)
- targetfile="clash ($clshcounter).wav"
- clshcounter=$((clshcounter+1))
- target="./${targetpath}/${dir}/${targetfile}"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- # color sounds are currently not supported by Xenopixel and therefore ignored.
- # Uncomment counter above and code here and adapt targetfile if needed later.
- color*([0-9]).wav)
- targetfile="color ($colorcounter).wav"
- colorcounter=$((colorcounter+1))
- target="./${targetpath}/${dir}/${targetfile}"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- drag*([0-9]).wav)
- targetfile="drag ($dragcounter).wav"
- dragcounter=$((dragcounter+1))
- target="./${targetpath}/${dir}/${targetfile}"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- # endlock sounds are currently not supported by Xenopixel and therefore ignored.
- # Uncomment counter above and code here and adapt targetfile if needed later.
- # endlock*([0-9]).wav)
- # targetfile="endlock ($endlockcounter).wav"
- # endlockcounter=$((endlockcounter+1))
- # target="./${targetpath}/${dir}/${targetfile}"
- # if [ "$verbosity" = "1" ]; then
- # echo "Converting ${src} to ${target}"
- # fi
- # rsync -ab "${src}" "${target}"
- # ;;
- font*([0-9]).wav)
- targetfile="font ($fontcounter).wav"
- fontcounter=$((fontcounter+1))
- target="./${targetpath}/${dir}/${targetfile}"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- force*|quote*([0-9]).wav)
- targetfile="force ($forcecounter).wav"
- forcecounter=$((forcecounter+1))
- target="./${targetpath}/${dir}/${targetfile}"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- hum*([0-9]).wav)
- targetfile="hum ($humcounter).wav"
- humcounter=$((humcounter+1))
- target="./${targetpath}/${dir}/${targetfile}"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- in*([0-9]).wav)
- targetfile="in ($incounter).wav"
- incounter=$((incounter+1))
- target="./${targetpath}/${dir}/${targetfile}"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- lock*([0-9]).wav)
- targetfile="lock ($lockcounter).wav"
- lockcounter=$((lockcounter+1))
- target="./${targetpath}/${dir}/${targetfile}"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- out*([0-9]).wav)
- targetfile="out ($outcounter).wav"
- outcounter=$((outcounter+1))
- target="./${targetpath}/${dir}/${targetfile}"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- swingh*([0-9]).wav)
- targetfile="swingh ($swinghcounter).wav"
- swinghcounter=$((swinghcounter+1))
- target="./${targetpath}/${dir}/${targetfile}"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- swingl*([0-9]).wav)
- targetfile="swingl ($swinglcounter).wav"
- swinglcounter=$((swinglcounter+1))
- target="./${targetpath}/${dir}/${targetfile}"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- preon*([0-9]).wav)
- targetfile="preon ($preoncounter).wav"
- if [ "$preoncounter" -ge 5 ]; then
- preoncounter=1
- else
- preoncounter=$((preoncounter+1))
- fi
- target="./$targetpath/$targetfile"
- target="./$targetpath/${dir}/set/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- # spin sounds are currently not supported by Xenopixel and therefore ignored.
- # Uncomment counter above and code here and adapt targetfile if needed later.
- # spin*([0-9]).wav)
- # targetfile="spin ($spincounter).wav"
- # spincounter=$((spincounter+1))
- # target="./${targetpath}/${dir}/${targetfile}"
- # if [ "$verbosity" = "1" ]; then
- # echo "Converting ${src} to ${target}"
- # fi
- # rsync -ab "${src}" "${target}"
- # ;;
- # stab sounds are currently not supported by Xenopixel and therefore ignored.
- # Uncomment counter above and code here and adapt targetfile if needed later.
- # stab*([0-9]).wav)
- # targetfile="stab ($stabcounter).wav"
- # stabcounter=$((stabcounter+1))
- # target="./${targetpath}/${dir}/${targetfile}"
- # if [ "$verbosity" = "1" ]; then
- # echo "Converting ${src} to ${target}"
- # fi
- # rsync -ab "${src}" "${target}"
- # ;;
- # Accent Swings are currently not supported by Xenopixel and therefore ignored.
- # Uncomment and adapt targetfile if needed later.
- # swng*([0-9]).wav)
- # targetfile="swing ($swingcounter).wav"
- # swingcounter=$((swingcounter+1))
- # target="./${targetpath}/${dir}/${targetfile}"
- # if [ "$verbosity" = "1" ]; then
- # echo "Converting ${src} to ${target}"
- # fi
- # rsync -ab "${src}" "${target}"
- # ;;
- track*([0-9]).wav)
- targetfile="track ($trackcounter).wav"
- trackcounter=$((trackcounter+1))
- target="./$targetpath/${dir}/tracks/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- *)
- echo "No match found, ignoring file $src"
- esac
- done
- echo Coverted soundfont saved in "${targetpath}"
- done
- echo "Soundfont conversion complete. If you see files with a '~' at the end, this file already existed in the output folder"
- echo "before the conversion and was renamed to avoid accidental overwriting."
- echo " "
- #-------------------------------------------------------------------------------------------------------------------------------------
- elif [ "$boardchoice" = "XtoC" ]; then
- echo "You chose Xenopixel to CFX Soundfont converter."
- echo "Do you wish to convert a single soundfont (enter '1') or a folder containing several soundfonts in subfolders (enter '2')?"
- echo "If you choose 2, Make sure each sub-folder only contains one soundfont. Otherwise the soundfonts will get mixed!"
- read selection
- if [ "$selection" = "1" ]; then
- echo "You chose to convert a single soundfont. Please enter the name of the font folder containting the soundfont files."
- echo "You may need to enter the path if it's a subfolder of where you are (such as 'SoundfontMaker/Font')"
- read input
- dirs=$(find "$input" -maxdepth 0 -type d)
- echo "Found the following soundfont folder:"
- echo $dirs
- echo "Does this folder only contain one soundfont? (y/n)"
- read input2
- if [ "$input2" = "y" ]; then
- echo "Continuing conversion"
- else
- echo "Aborting program"
- exit
- fi
- elif [ "$selection" = "2" ]; then
- echo "You chose to convert several soundfonts. Each soundfont must be in a single subfolder."
- echo "Please enter the name of the folder containing the soundfont folders."
- read input
- dirs=$(find "$input" -mindepth 1 -maxdepth 1 -type d)
- echo "Found the following directories for soundfonts:"
- echo $dirs
- echo "Does each of these folders only contain one soundfont? (y/n)"
- read input2
- if [ "$input2" = "y" ]; then
- echo "Continuing conversion"
- else
- echo "Aborting program"
- exit
- fi
- else
- echo "Your selection is invalid. Aborting program"
- exit
- fi
- echo "Do you wish a detailed conversion progess report ('1') or only the imporant steps ('2')?"
- echo "Warning, the detailed report will produce a lot of console output!"
- read verbosity
- if [ "$verbosity" = "1" ]; then
- echo "Logging progress to console"
- else
- echo "Logging only important steps"
- fi
- for dir in ${dirs[@]}; do
- sounds=$(find "$dir" -type f -name '*.wav')
- echo Converting soundfont in "${dir}".
- targetpath="Converted_to_CFX/${dir}"
- mkdir -p "${targetpath}"
- blastercounter=1
- # bootcounter=1
- clashcounter=1
- # colorcounter=1
- dragcounter=1
- # endlockcounter=1
- fontcounter=1
- forcecounter=1
- hswingcounter=1
- humcounter=1
- incounter=1
- lockcounter=1
- lswingcounter=1
- outcounter=1
- # preoncounter=1
- # spincounter=1
- # stabcounter=1
- # swingcounter=1
- trackcounter=1
- for src in ${sounds[@]}; do
- case "${src##*/}" in
- blaster**([0-9]).wav)
- if [ "$blastercounter" -eq 1 ]; then
- targetfile=$(printf %q "blaster.wav")
- else
- targetfile=$(printf %q "blaster$blastercounter.wav")
- fi
- blastercounter=$((blastercounter+1))
- target="./${targetpath}/${targetfile}"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- # boot sounds are currently not supported by Xenopixel and therefore ignored.
- # Uncomment counter above and code here and adapt targetfile if needed later.
- # boot**([0-9]).wav)
- # targetfile=$(printf %q "boot$bootcounter.wav")
- # bootcounter=$((bootcounter+1))
- # target="./$targetpath/$targetfile"
- # if [ "$verbosity" = "1" ]; then
- # echo "Converting ${src} to ${target}"
- # fi
- # rsync -ab "${src}" "${target}"
- # ;;
- clash**([0-9]).wav)
- targetfile=$(printf %q "clash$clashcounter.wav")
- clashcounter=$((clashcounter+1))
- target="./$targetpath/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- # color sounds are currently not supported by Xenopixel and therefore ignored.
- # Uncomment counter above and code here and adapt targetfile if needed later.
- # color**([0-9]).wav)
- # targetfile=$(printf %q "color$colorcounter.wav")
- # colorcounter=$((colorcounter+1))
- # target="./$targetpath/$targetfile"
- # if [ "$verbosity" = "1" ]; then
- # echo "Converting ${src} to ${target}"
- # fi
- # rsync -ab "${src}" "${target}"
- # ;;
- drag**([0-9]).wav)
- if [ "$dragcounter" -eq 1 ]; then
- targetfile=$(printf %q "drag.wav")
- else
- targetfile=$(printf %q "drag$dragcounter.wav")
- fi
- dragcounter=$((dragcounter+1))
- target="./$targetpath/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- # endlock sounds are currently not supported by Xenopixel and therefore ignored.
- # Uncomment counter above and code here and adapt targetfile if needed later.
- # endlock*([0-9]).wav)
- # targetfile=$(printf %q "endlock$endlockcounter.wav")
- # endlockcounter=$((endlockcounter+1))
- # target="./$targetpath/$targetfile"
- # if [ "$verbosity" = "1" ]; then
- # echo "Converting ${src} to ${target}"
- # fi
- # rsync -ab "${src}" "${target}"
- # ;;
- font**([0-9]).wav)
- if [ "$fontcounter" -eq 1 ]; then
- targetfile=$(printf %q "font.wav")
- else
- targetfile=$(printf %q "font$fontcounter.wav")
- fi
- fontcounter=$((fontcounter+1))
- target="./$targetpath/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- force**([0-9]).wav)
- if [ "$forcecounter" -eq 1 ]; then
- targetfile=$(printf %q "force.wav")
- else
- targetfile=$(printf %q "force$forcecounter.wav")
- fi
- forcecounter=$((forcecounter+1))
- target="./$targetpath/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- hum**([0-9]).wav)
- targetfile=$(printf %q "humM$humcounter.wav")
- humcounter=$((humcounter+1))
- target="./$targetpath/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- in**([0-9]).wav)
- if [ "$incounter" -eq 1 ]; then
- targetfile=$(printf %q "poweroff.wav")
- elif [ "$incounter" -eq 2 ]; then
- targetfile=$(printf %q "pwroff$incounter.wav")
- elif [ "$incounter" -ge 3 ]; then
- targetfile=$(printf %q "poweroff$((incounter-1)).wav")
- fi
- incounter=$((incounter+1))
- target="./$targetpath/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- lock**([0-9]).wav)
- if [ "$lockcounter" -eq 1 ]; then
- targetfile=$(printf %q "lockup.wav")
- else
- targetfile=$(printf %q "lockup$lockcounter.wav")
- fi
- lockcounter=$((lockcounter+1))
- target="./$targetpath/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- out**([0-9]).wav)
- if [ "$outcounter" -eq 1 ]; then
- targetfile=$(printf %q "poweron.wav")
- else
- targetfile=$(printf %q "poweron$outcounter.wav")
- fi
- outcounter=$((outcounter+1))
- target="./$targetpath/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- hswing**([0-9]).wav)
- targetfile=$(printf %q "hswing$hswingcounter.wav")
- hswingcounter=$((hswingcounter+1))
- target="./$targetpath/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- lswing**([0-9]).wav)
- targetfile=$(printf %q "lswing$lswingcounter.wav")
- lswingcounter=$((lswingcounter+1))
- target="./$targetpath/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- # Accent Swings are currently not supported by Xenopixel and therefore ignored.
- # Uncomment and adapt targetfile if needed later.
- # swng**([0-9]).wav)
- # targetfile=$(printf %q "swing$swingcounter.wav")
- # swingcounter=$((swingcounter+1))
- # target="./$targetpath/$targetfile"
- # if [ "$verbosity" = "1" ]; then
- # echo "Converting ${src} to ${target}"
- # fi
- # rsync -ab "${src}" "${target}"
- # ;;
- track**([0-9]).wav)
- targetfile=$(printf %q "track$trackcounter.wav")
- trackcounter=$((trackcounter+1))
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- *)
- echo "No match found, ignoring file $src"
- esac
- done
- echo Coverted soundfont saved in "${targetpath}"
- done
- echo "Soundfont conversion complete. If you see files with a '~' at the end, this file already existed in the output folder"
- echo "before the conversion and was renamed to avoid accidental overwriting."
- echo " "
- #-------------------------------------------------------------------------------------------------------------------------------------
- elif [ "$boardchoice" = "XtoP" ]; then
- echo "You chose Xenopixel to Proffie Soundfont converter."
- echo "Do you wish to convert a single soundfont (enter '1') or a folder containing several soundfonts in subfolders (enter '2')?"
- echo "If you choose 2, Make sure each sub-folder only contains one soundfont. Otherwise the soundfonts will get mixed!"
- read selection
- if [ "$selection" = "1" ]; then
- echo "You chose to convert a single soundfont. Please enter the name of the font folder containting the soundfont files."
- echo "You may need to enter the path if it's a subfolder of where you are (such as 'SoundfontMaker/Font')"
- read input
- dirs=$(find "$input" -maxdepth 0 -type d)
- echo "Found the following soundfont folder:"
- echo $dirs
- echo "Does this folder only contain one soundfont? (y/n)"
- read input2
- if [ "$input2" = "y" ]; then
- echo "Continuing conversion"
- else
- echo "Aborting program"
- exit
- fi
- elif [ "$selection" = "2" ]; then
- echo "You chose to convert several soundfonts. Each soundfont must be in a single subfolder."
- echo "Please enter the name of the folder containing the soundfont folders."
- read input
- dirs=$(find "$input" -mindepth 1 -maxdepth 1 -type d)
- echo "Found the following directories for soundfonts:"
- echo $dirs
- echo "Does each of these folders only contain one soundfont? (y/n)"
- read input2
- if [ "$input2" = "y" ]; then
- echo "Continuing conversion"
- else
- echo "Aborting program"
- exit
- fi
- else
- echo "Your selection is invalid. Aborting program"
- exit
- fi
- echo "Do you wish a detailed conversion progess report ('1') or only the imporant steps ('2')?"
- echo "Warning, the detailed report will produce a lot of console output!"
- read verbosity
- if [ "$verbosity" = "1" ]; then
- echo "Logging progress to console"
- else
- echo "Logging only important steps"
- fi
- for dir in ${dirs[@]}; do
- sounds=$(find "$dir" -type f -name '*.wav')
- echo Converting soundfont in "${dir}".
- targetpath="Converted_to_Proffie"
- mkdir -p "${targetpath}"
- mkdir -p "${targetpath}/${dir}/bgndrag"
- mkdir -p "${targetpath}/${dir}/bgnlb"
- mkdir -p "${targetpath}/${dir}/bgnlock"
- mkdir -p "${targetpath}/${dir}/bgnmelt"
- mkdir -p "${targetpath}/${dir}/blst"
- mkdir -p "${targetpath}/${dir}/boot"
- mkdir -p "${targetpath}/${dir}/clsh"
- mkdir -p "${targetpath}/${dir}/ccchange"
- mkdir -p "${targetpath}/${dir}/drag"
- mkdir -p "${targetpath}/${dir}/enddrag"
- mkdir -p "${targetpath}/${dir}/endlb"
- mkdir -p "${targetpath}/${dir}/endlock"
- mkdir -p "${targetpath}/${dir}/font"
- mkdir -p "${targetpath}/${dir}/force"
- mkdir -p "${targetpath}/${dir}/hum"
- mkdir -p "${targetpath}/${dir}/in"
- mkdir -p "${targetpath}/${dir}/lb"
- mkdir -p "${targetpath}/${dir}/lock"
- mkdir -p "${targetpath}/${dir}/melt"
- mkdir -p "${targetpath}/${dir}/out"
- mkdir -p "${targetpath}/${dir}/preon"
- mkdir -p "${targetpath}/${dir}/pstoff"
- mkdir -p "${targetpath}/${dir}/slsh"
- mkdir -p "${targetpath}/${dir}/spin"
- mkdir -p "${targetpath}/${dir}/stab"
- mkdir -p "${targetpath}/${dir}/swingh"
- mkdir -p "${targetpath}/${dir}/swingl"
- mkdir -p "${targetpath}/${dir}/swng"
- mkdir -p "${targetpath}/${dir}/tracks"
- blastercounter=1
- # bootcounter=1
- clashcounter=1
- # colorcounter=1
- dragcounter=1
- # endlockcounter=1
- fontcounter=1
- forcecounter=1
- hswingcounter=1
- humcounter=1
- incounter=1
- lockcounter=1
- lswingcounter=1
- outcounter=1
- # preoncounter=1
- # spincounter=1
- # stabcounter=1
- # swingcounter=1
- trackcounter=1
- for src in ${sounds[@]}; do
- case "${src##*/}" in
- blaster**([0-9]).wav)
- if [ "$blastercounter" -lt 10 ]; then
- targetfile=$(printf %q "blst0$blastercounter.wav")
- else
- targetfile=$(printf %q "blst$blastercounter.wav")
- fi
- blastercounter=$((blastercounter+1))
- target="./${targetpath}/${dir}/blst/${targetfile}"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- # boot sounds are currently not supported by Xenopixel and therefore ignored.
- # Uncomment counter above and code here and adapt targetfile if needed later.
- # boot**([0-9]).wav)
- # if [ "$bootcounter" -lt 10 ]; then
- # targetfile=$(printf %q "boot0$bootcounter.wav")
- # else
- # targetfile=$(printf %q "boot$bootcounter.wav")
- # fi
- # bootcounter=$((bootcounter+1))
- # target="./$targetpath/${dir}/boot/$targetfile"
- # if [ "$verbosity" = "1" ]; then
- # echo "Converting ${src} to ${target}"
- # fi
- # rsync -ab "${src}" "${target}"
- # ;;
- clash**([0-9]).wav)
- if [ "$clashcounter" -lt 10 ]; then
- targetfile=$(printf %q "clsh0$clashcounter.wav")
- else
- targetfile=$(printf %q "clsh$clashcounter.wav")
- fi
- clashcounter=$((clashcounter+1))
- target="./$targetpath/${dir}/clsh/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- # color sounds are currently not supported by Xenopixel and therefore ignored.
- # Uncomment counter above and code here and adapt targetfile if needed later.
- # color**([0-9]).wav)
- # targetfile=$(printf %q "ccchage$colorcounter.wav")
- # colorcounter=$((colorcounter+1))
- # target="./$targetpath/${dir}/ccchange/$targetfile"
- # if [ "$verbosity" = "1" ]; then
- # echo "Converting ${src} to ${target}"
- # fi
- # rsync -ab "${src}" "${target}"
- # ;;
- drag**([0-9]).wav)
- if [ "$dragcounter" -lt 10 ]; then
- targetfile=$(printf %q "drag0$dragcounter.wav")
- else
- targetfile=$(printf %q "drag$dragcounter.wav")
- fi
- dragcounter=$((dragcounter+1))
- target="./$targetpath/${dir}/drag/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- # endlock sounds are currently not supported by Xenopixel and therefore ignored.
- # Uncomment counter above and code here and adapt targetfile if needed later.
- # endlock**([0-9]).wav)
- # targetfile=$(printf %q "endlock$endlockcounter.wav")
- # endlockcounter=$((endlockcounter+1))
- # target="./$targetpath/${dir}/endlock/$targetfile"
- # if [ "$verbosity" = "1" ]; then
- # echo "Converting ${src} to ${target}"
- # fi
- # rsync -ab "${src}" "${target}"
- # ;;
- font**([0-9]).wav)
- if [ "$fontcounter" -lt 10 ]; then
- targetfile=$(printf %q "font0$fontcounter.wav")
- else
- targetfile=$(printf %q "font$fontcounter.wav")
- fi
- fontcounter=$((fontcounter+1))
- target="./$targetpath/${dir}/font/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- force**|combo*([0-9]).wav)
- if [ "$forcecounter" -lt 10 ]; then
- targetfile=$(printf %q "force0$forcecounter.wav")
- else
- targetfile=$(printf %q "force$forcecounter.wav")
- fi
- forcecounter=$((forcecounter+1))
- target="./$targetpath/${dir}/force/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- hswing**([0-9]).wav)
- if [ "$hswingcounter" -lt 10 ]; then
- targetfile=$(printf %q "swingh0$hswingcounter.wav")
- else
- targetfile=$(printf %q "swingh$hswingcounter.wav")
- fi
- hswingcounter=$((hswingcounter+1))
- target="./$targetpath/${dir}/swingh/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- hum**([0-9]).wav)
- if [ "$humcounter" -lt 10 ]; then
- targetfile=$(printf %q "hum0$humcounter.wav")
- else
- targetfile=$(printf %q "hum$humcounter.wav")
- fi
- humcounter=$((humcounter+1))
- target="./$targetpath/${dir}/hum/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- lswing**([0-9]).wav)
- if [ "$lswingcounter" -lt 10 ]; then
- targetfile=$(printf %q "swingl0$lswingcounter.wav")
- else
- targetfile=$(printf %q "swingl$lswingcounter.wav")
- fi
- lswingcounter=$((lswingcounter+1))
- target="./$targetpath/${dir}/swingl/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- in**([0-9]).wav)
- if [ "$incounter" -lt 10 ]; then
- targetfile=$(printf %q "in0$incounter.wav")
- else
- targetfile=$(printf %q "in$incounter.wav")
- fi
- incounter=$((incounter+1))
- target="./$targetpath/${dir}/in/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- out**([0-9]).wav)
- if [ "$outcounter" -lt 10 ]; then
- targetfile=$(printf %q "out0$outcounter.wav")
- else
- targetfile=$(printf %q "out$outcounter.wav")
- fi
- outcounter=$((outcounter+1))
- target="./$targetpath/${dir}/out/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- lock**([0-9]).wav)
- if [ "$lockcounter" -lt 10 ]; then
- targetfile=$(printf %q "lock0$lockcounter.wav")
- else
- targetfile=$(printf %q "lock$lockcounter.wav")
- fi
- lockcounter=$((lockcounter+1))
- target="./$targetpath/${dir}/lock/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- # preon sounds are currently not supported by Xenopixel and therefore ignored.
- # Uncomment counter above and code here and adapt targetfile if needed later.
- # preon**([0-9]).wav)
- # if [ "$preoncounter" -lt 10 ]; then
- # targetfile=$(printf %q "preon0$preoncounter.wav")
- # else
- # targetfile=$(printf %q "preon$preoncounter.wav")
- # fi
- # preoncounter=$((preoncounter+1))
- # target="./${targetpath}/${dir}/preon/${targetfile}"
- # if [ "$verbosity" = "1" ]; then
- # echo "Converting ${src} to ${target}"
- # fi
- # rsync -ab "${src}" "${target}"
- # ;;
- # spin sounds are currently not supported by Xenopixel and therefore ignored.
- # Uncomment counter above and code here and adapt targetfile if needed later.
- # spin**([0-9]).wav)
- # if [ "$spincounter" -lt 10 ]; then
- # targetfile=$(printf %q "spin0$spincounter.wav")
- # else
- # targetfile=$(printf %q "spin$spincounter.wav")
- # fi
- # spincounter=$((spincounter+1))
- # target="./$targetpath/${dir}/spin/$targetfile"
- # if [ "$verbosity" = "1" ]; then
- # echo "Converting ${src} to ${target}"
- # fi
- # rsync -ab "${src}" "${target}"
- # ;;
- # stab sounds are currently not supported by Xenopixel and therefore ignored.
- # Uncomment counter above and code here and adapt targetfile if needed later.
- # stab**([0-9]).wav)
- # if [ "$stabcounter" -lt 10 ]; then
- # targetfile=$(printf %q "stab0$stabcounter.wav")
- # else
- # targetfile=$(printf %q "stab$stabcounter.wav")
- # fi
- # stabcounter=$((stabcounter+1))
- # target="./$targetpath/${dir}/stab/$targetfile"
- # if [ "$verbosity" = "1" ]; then
- # echo "Converting ${src} to ${target}"
- # fi
- # rsync -ab "${src}" "${target}"
- # ;;
- # Accent Swing sounds are currently not supported by Xenopixel and therefore ignored.
- # Uncomment counter above and code here and adapt targetfile if needed later.
- # swing**([0-9]).wav)
- # if [ "$swingcounter" -lt 10 ]; then
- # targetfile=$(printf %q "swng0$swingcounter.wav")
- # else
- # targetfile=$(printf %q "swng$swingcounter.wav")
- # fi
- # swingcounter=$((swingcounter+1))
- # target="./$targetpath/${dir}/swng/$targetfile"
- # if [ "$verbosity" = "1" ]; then
- # echo "Converting ${src} to ${target}"
- # fi
- # rsync -ab "${src}" "${target}"
- # ;;
- track**([0-9]).wav)
- if [ "$trackcounter" -lt 10 ]; then
- targetfile=$(printf %q "track0$trackcounter.wav")
- else
- targetfile=$(printf %q "track$trackcounter.wav")
- fi
- trackcounter=$((trackcounter+1))
- target="./$targetpath/${dir}/tracks/$targetfile"
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- ;;
- *)
- echo "No match found, ignoring file $src"
- esac
- done
- echo Coverted soundfont saved in "${targetpath}"
- done
- echo "Soundfont conversion complete. If you see files with a '~' at the end, this file already existed in the output folder"
- echo "before the conversion and was renamed to avoid accidental overwriting."
- echo " "
- #-------------------------------------------------------------------------------------------------------------------------------------
- elif [ "$boardchoice" = "PtoP" ]; then
- echo "You chose Proffie to Proffie Soundfont renaming."
- echo "Do you wish to rename a single soundfont (enter '1') or a folder containing several soundfonts in subfolders (enter '2')?"
- echo "If you choose 2, Make sure each sub-folder only contains one soundfont. Otherwise the soundfonts will get mixed!"
- read selection
- if [ "$selection" = "1" ]; then
- echo "You chose to rename a single soundfont. Please enter the name of the font folder containting the soundfont files."
- echo "You may need to enter the path if it's a subfolder of where you are (such as 'SoundfontMaker/Font')"
- read input
- dirs=$(find "$input" -maxdepth 0 -type d)
- echo "Found the following soundfont folder:"
- echo $dirs
- echo "Does this folder only contain one soundfont? (y/n)"
- read input2
- if [ "$input2" = "y" ]; then
- echo "Continuing renaming"
- else
- echo "Aborting program"
- exit
- fi
- elif [ "$selection" = "2" ]; then
- echo "You chose to rename several soundfonts. Each soundfont must be in a single subfolder."
- echo "Please enter the name of the folder containing the soundfont folders."
- read input
- dirs=$(find "$input" -mindepth 1 -maxdepth 1 -type d)
- echo "Found the following directories for soundfonts:"
- echo $dirs
- echo "Does each of these folders only contain one soundfont? (y/n)"
- read input2
- if [ "$input2" = "y" ]; then
- echo "Continuing renaming"
- else
- echo "Aborting program"
- exit
- fi
- else
- echo "Your selection is invalid. Aborting program"
- exit
- fi
- echo "Do you wish a detailed renaming progess report ('1') or only the imporant steps ('2')?"
- echo "Warning, the detailed report may produce a lot of console output!"
- read verbosity
- if [ "$verbosity" = "1" ]; then
- echo "Logging progress to console"
- else
- echo "Logging only important steps"
- fi
- for dir in ${dirs[@]}; do
- sounds=$(find "$dir" -type f -name '*.wav')
- echo Converting soundfont in "${dir}".
- targetpath="Converted_to_Proffie"
- mkdir -p "${targetpath}/${dir}"
- counter=1
- oldeffect="old"
- for src in ${sounds[@]}; do
- effectfile="${src//[0-9]/}"
- effect="${effectfile##*/}"
- effect="${effect%.*}"
- if [[ "$effect" != "$oldeffect" ]]; then
- counter=1
- fi
- if [ $counter = 2 ]; then
- mkdir -p "${targetpath}/${dir}/${effect}"
- mv "${target}" "./${targetpath}/${dir}/${effect}/${targetfile}"
- echo "Moving ${targetfile} into ${dir}/${effect} subfolder"
- fi
- if [ "${#effect}" -gt 6 ] || [ "$counter" -gt 9 ]; then
- targetfile=$(printf %q "${effect}$counter.wav")
- else
- targetfile=$(printf %q "${effect}0$counter.wav")
- fi
- if [ $counter -ge 2 ]; then
- target="./${targetpath}/${dir}/${effect}/${targetfile}"
- else
- target="./${targetpath}/${dir}/${targetfile}"
- fi
- if [ "$verbosity" = "1" ]; then
- echo "Converting ${src} to ${target}"
- fi
- rsync -ab "${src}" "${target}"
- counter=$((counter+1))
- oldeffect="${effect}"
- done
- echo Coverted soundfont saved in "${targetpath}"
- done
- echo "Soundfont conversion complete. If you see files with a '~' at the end, this file already existed in the output folder"
- echo "before the conversion and was renamed to avoid accidental overwriting."
- echo " "
- else
- echo "Invalid conversion choice, please run the tool again."
- fi
Add Comment
Please, Sign In to add comment