I just started playing around with Beats, a command-line drum machine installed as a Ruby gem. It accepts YAML and outputs .wav files like it’s 1998.
As I started noodling around with the tutorial, I noticed that the feedback loop could be tighter. I’m used to working with tools like grunt watch at work, and wanted a smoother flow. Rather than getting grunt running, I searched for some command-line solutions. This is what I found.
fswatch -o path/to/beat1.yaml | xargs -n1 beats path/to/beat1.yaml path/to/beat1.wav
On a Mac, brew install fswatch
will add the necessary utility, and the beats
command is installed as part of gem install beats
.
while :; do afplay path/to/beat1.wav; done
afplay
is a utility that ships with OS X. And the rest of this is just some basic bash scripting; stop the infinte loop with the ever-useful ctrl+c
.
For now, you can enjoy (well, that might not be the word) my first go, for which I followed the tutorial and added samples without first listening to them. Can you tell?
And if you have any tips on how to DRY up some YAML, or even thoughts on writing some clean Ruby and outputting a YAML file to convert to beats, please share! Writing XXXXXXXXXXXXX...|XXXXXXXXXXXXX...
again and again is making me sad on my insides.