commit 72c1ecbfdbb0ccfa86d8176e06c9e150945f7a8b Author: mollusk Date: Wed Feb 1 06:25:33 2017 -0700 Initial Commit diff --git a/README.md b/README.md new file mode 100644 index 0000000..8dddae1 --- /dev/null +++ b/README.md @@ -0,0 +1,62 @@ +#Bash Drum Kit +###simply play + + + +##Help File + +BDK - BASH DRUM KIT + + ${0} [options] [kit-name] + + + + [options] [Description] + + -k Load drum kit + -l List available kits + + +##Creating Kits + +All kits are just directories within the kits directory. +Each directory has it's own confit with variables which contain file paths to sounds. +These sounds are then carried over to BDK and used with hotkeys. + +##Directory Structures + +bdk + kits (dir) + default (dir) + config (file) + + +##Using Kits + + +Just point bdk to the kit you want to use: + +``` +bdk.sh -k default +``` + + +You can see a list of available kits by typing: + +``` +bdk ls +``` + + +##Example config + +located in: kits/default/config + +``` +#!/bin/bash + + +KICK=sounds/kick.wav +SNARE=sounds/snare.wav +HIHAT=sounds/hihat.wav +``` diff --git a/bdk.sh b/bdk.sh new file mode 100755 index 0000000..6819454 --- /dev/null +++ b/bdk.sh @@ -0,0 +1,117 @@ +#!/bin/bash + +# Directory containing sounds and config file +KIT_DIR="kits" + +#Check for kits and load the config +#load default kit if specified kit not found + +defaultKit(){ + echo "the kit: ${1} was not found" + echo "Loading default kit.." + echo + + KIT="${KIT_DIR}/default" + cd ${KIT} + + if [ -f config ];then + . config + else + echo "Could not load config" + exit 0 + fi + +} + +checkKits(){ + if [ -d kits/${1} ];then + + KIT="${KIT_DIR}/${1}" + cd ${KIT} + + if [ -f config ];then + . config + else + echo "Could not load config" + cd .. && cd .. + defaultKit + fi + + else + defaultKit + + fi +} + +help(){ + printf """ + BDK - BASH DRUM KIT + + ${0} [options] [kit-name] + + + + [options] [Description] + + -k Load drum kit + -l List available kits + + + """ +} + +case $1 in + -k | --kit) + checkKits ${2} + + ;; + + -l | --list) + printf "[ Installed Kits]\n" + if [[ $(ls -A $DIR) ]];then + ls ${KIT_DIR} + exit 0 + else + printf "There are no kits currently installed...\n" + exit 0 + fi + ;; + *) + help + exit 0 + ;; +esac + + +echo "BDK - Bash Drum Kit" +key(){ + echo + echo "[d] = Bass Drum | [s] = Hi-Hat | [enter] = Snare | [h] help | [q] Quit" +} + +key + +echo +while true;do + printf "(*)> " + + read -s -n 1 key + # -s: do not echo input character. -n 1: read only 1 character (separate with space) + + if [[ $key = "d" ]]; then + aplay ${KICK} >/dev/null 2>/dev/null & + echo "[d] Bass Drum" + elif [[ $key == '' ]];then + aplay ${SNARE} >/dev/null 2>/dev/null & + echo "[enter] Snare Drum" + elif [[ $key == "s" ]];then + aplay ${HIHAT} >/dev/null 2>/dev/null & + echo "[s] Hi-hat" + elif [[ $key == "h" ]];then + key + elif [[ $key == "q" ]];then + exit 0; + else + echo "'${key}' does nothing!" + fi +done diff --git a/kits/default/config b/kits/default/config new file mode 100644 index 0000000..8a20022 --- /dev/null +++ b/kits/default/config @@ -0,0 +1,6 @@ +#!/bin/bash + + +KICK=sounds/kick.wav +SNARE=sounds/snare.wav +HIHAT=sounds/hihat.wav diff --git a/kits/default/sounds/hihat.wav b/kits/default/sounds/hihat.wav new file mode 100644 index 0000000..cac9cc8 Binary files /dev/null and b/kits/default/sounds/hihat.wav differ diff --git a/kits/default/sounds/kick.wav b/kits/default/sounds/kick.wav new file mode 100644 index 0000000..b5a9e57 Binary files /dev/null and b/kits/default/sounds/kick.wav differ diff --git a/kits/default/sounds/snare.wav b/kits/default/sounds/snare.wav new file mode 100644 index 0000000..d451d7a Binary files /dev/null and b/kits/default/sounds/snare.wav differ diff --git a/todo.txt b/todo.txt new file mode 100644 index 0000000..83f85bf --- /dev/null +++ b/todo.txt @@ -0,0 +1,5 @@ +[TODO] + +* clean up code +* add more default sounds +* add more kits