Initial Commit

This commit is contained in:
mollusk 2017-02-01 06:25:33 -07:00
commit 72c1ecbfdb
7 changed files with 190 additions and 0 deletions

62
README.md Normal file
View File

@ -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
```

117
bdk.sh Executable file
View File

@ -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

6
kits/default/config Normal file
View File

@ -0,0 +1,6 @@
#!/bin/bash
KICK=sounds/kick.wav
SNARE=sounds/snare.wav
HIHAT=sounds/hihat.wav

Binary file not shown.

Binary file not shown.

Binary file not shown.

5
todo.txt Normal file
View File

@ -0,0 +1,5 @@
[TODO]
* clean up code
* add more default sounds
* add more kits