Extract *.wav files from the *.hub format used by the Hammerhead drum machine.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


What Is It?

HammerHead is an old drum machine for Windows. One of its features allows you to import new drum sounds using a file format called HUB. clawhammer.rb allows you to extract the sounds out of a HUB file into individual *.wav files. This allows you to use the sounds in modern programs like Logic or GarageBand.

The HUB file format was reverse-engineered using FileInspector.


ruby clawhammer.rb [path of HUB file]

For example:

ruby clawhammer.rb groove.hub

This will create six output files:


Clawhammer uses the WaveFile gem to create the output wave files. Therefore, you'll need to have this gem installed on your machine. To do so, run the following command:

gem install wavefile 

About the HUB Format

The HUB format is very simple. A HUB file contains 6 records, which represent each of the sounds stored in the file. Each record contains a header, followed by actual sample data.

Header for Sound #1
Sound #1 Sample Data
Header for Sound #2
Sound #2 Sample Data
Header for Sound #6
Sound #6 Sample Data

Each header is 36 bytes, and has the following format:

Bytes Description Data Format
0: Length of the HUB title, in bytes. Integer. Signed or unsigned doesn't matter, since the maximum valid value is 30.
1-30: HUB title. If HUB title is less than 30 characters, the extra bytes will be garbage. The title will be identical for each header. 1-byte ASCII characters
31-34: Length of the sound's sample data, in bytes. Unsigned, little-endian
35: Flag for whether sound should be stretched to fill a full measure when played in HammerHead. (For example, a drum loop). Ignored by Clawhammer. 0x01 for true, 0x00 for false

The sample data payload follows the header. The length of the sample data is indicated in bytes 31-34 of the header.

The sample data in each record only includes raw sample data, and not any headers specified by the *.wav format. HammerHead assumes that samples are 16-bit, 1 channel (mono), and with a sample rate of 44100. Therefore, the header for each output *.wav file will be identical, expect for the payload size. (For more on the *.wav format, visit http://ccrma.stanford.edu/courses/422/projects/WaveFormat/).