Video for 2015-02-01

PUBLISHED ON FEB 1, 2015 — AUDIO, IMPORTED FROM TUMBLR



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.


To watch for changes to the working YAML file and output an updated .wav file after each save

fswatch -o path/to/beat1.yaml | xargs -n1 beats path/to/beat1.yaml path/to/beat1.wav

src

On a Mac, brew install fswatch will add the necessary utility, and the beats command is installed as part of gem install beats.

To play the .wav file in a loop

while :; do afplay path/to/beat1.wav; done

src

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.