aboutsummaryrefslogtreecommitdiff
path: root/make_patfile.sh
diff options
context:
space:
mode:
authorGrissess <grissess@nexusg.org>2016-09-12 11:52:50 -0400
committerGrissess <grissess@nexusg.org>2016-09-12 11:52:50 -0400
commitbab20d4625ddddad7911d548edca12cc0ea93c6b (patch)
tree2a48ef4c45c0578700cdaf7275e5abf74215001c /make_patfile.sh
parent33d49cd847ab06c6912a216cc3b4ff8a549145b1 (diff)
DRUM SUPPORT!
Diffstat (limited to 'make_patfile.sh')
-rwxr-xr-xmake_patfile.sh29
1 files changed, 29 insertions, 0 deletions
diff --git a/make_patfile.sh b/make_patfile.sh
new file mode 100755
index 0000000..b656d2d
--- /dev/null
+++ b/make_patfile.sh
@@ -0,0 +1,29 @@
+# Convert the FreePats Drums_000 directory to ITL Chorus drums.tar.bz2
+# Note: technically, this must be run in a directory with subdirectories
+# starting with a MIDI pitch, and containing a text file with a
+# "convert_to_wav:" command that produces a .wav in that working directory.
+# sox is required to convert the audio. This handles the dirt-old options
+# for sox in the text files explicitly to support the FreePats standard.
+# The current version was checked in from the Drums_000 directory to be
+# found in the TAR at this URL:
+# http://freepats.zenvoid.org/samples/freepats/freepats-raw-samples.tar.bz2
+# Thank you again, FreePats!
+
+rm *.wav .wav *.raw .raw
+
+for i in *; do
+ if [ -d $i ]; then
+ pushd $i
+ eval `grep 'convert_to_wav' *.txt | sed -e 's/convert_to_wav: //' -e 's/-w/-b 16/' -e 's/-s/-e signed/' -e 's/-u/-e unsigned/'`
+ PITCH=`echo "$i" | sed -e 's/^\([0-9]\+\).*$/\1/g'`
+ # From broadcast.py, eval'd in Python for consistent results
+ FRQ=`echo $PITCH | python2 -c "print(int(440.0 * 2**((int(raw_input())-69)/12.0)))"`
+ echo "WRITING $FRQ.wav"
+ [ -z "$FRQ" ] && echo "!!! EMPTY FILENAME?"
+ sox *.wav -r 44100 -c 1 -e signed -b 32 -t raw ../$FRQ.raw
+ popd
+ fi
+done
+
+rm drums.tar.bz2
+tar cjf drums.tar.bz2 *.raw