A command-line drum machine. Convert a beat notated in YAML into a *.wav file.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Beats Drum Machine

Beats is a command-line drum machine written in pure Ruby. Feed it a song notated in YAML, and it will produce a precision-milled *.wav file of impeccable timing and feel. Here's an example song:

  Tempo: 105
    - Verse:  x4
    - Chorus: x4
    - bass:     house_2_1.wav
    - snare:    roland_tr_909_2.wav
    - hihat:    house_2_5.wav
    - cowbell:  big_beat_5.wav
    - deep:     house_2_2.wav

  - bass:     X..X...X..X.....
  - snare:    ....X.......X...
  - hihat:    ..X...X...X...X.

  - bass:     X..X...X..X.....
  - snare:    ....X.......X...
  - hihat:    XXXXXXXXXXXXX...
  - cowbell:  ....XX.X..X.X...
  - deep:     .............X..

And here's what it sounds like after getting the Beats treatment. What a glorious groove!

For more, check out beatsdrummachine.com


To install the latest stable version (2.1.1) from rubygems.org, run the following from the command line:

gem install beats

Note: if you're installing using the default version of Ruby that comes with macOS, you might get a file permission error. If that happens, use sudo gem install beats instead. If you're using a version manager such as rbenv, chruby, or RVM, plain gem install beats should work fine.

Once installed, you can then run Beats from the command-line using the beats command.

Beats is not very useful unless you have some sounds to use with it. You can download some example sounds from https://beatsdrummachine.com.


Beats runs from the command-line. Run beats -h to see the available options. For more detailed instructions, visit https://github.com/jstrait/beats/wiki/Usage on the Beats Wiki.

Check out this tutorial at beatsdrummachine.com to see an example of how to create a beat from sratch.

What's New in v2.1.1

The latest version of Beats is 2.1.1, released on June 29, 2018. It contains these changes:

  • Several error messages are improved to be more accurate or specific.

  • Bug fix: Songs can now use *.wav files with more than 2 channels. Previously, using a sound with more than 2 channels would cause a fatal Invalid sample data array in AudioUtils.normalize() error.

  • Bug fix: If a sound is defined multiple times in a Kit, the final definition should be used as the winner. However, previously this did not occur if the earlier definition was for a composite sound. For example, with this Kit:

      - sound: [sound1.wav, sound2.wav]
      - sound: sound3.wav

    sound will now be bound to sound3.wav, not [sound1.wav, sound2.wav].

For info about previous releases, visit https://github.com/jstrait/beats/releases.

Local Development

First, install the required dependencies:

bundle install

To run Beats locally, use bundle exec and run bin/beats, to avoid using any installed gem executable. For example:

bundle exec bin/beats -v

To run the tests:

bundle exec rake test

Found a Bug? Have a Suggestion? Want to Contribute?

Contact me (Joel Strait) by sending a GitHub message or opening a GitHub issue.


Beats Drum Machine is released under the MIT license.