clawhammer

Created: 2008-12-31 02:49
Updated: 2018-10-16 18:53
License: mit

README.markdown

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.

Usage

ruby clawhammer.rb [path of HUB file]

For example:

ruby clawhammer.rb groove.hub

This will create six output files:

groove-1.wav
groove-2.wav
groove-3.wav
groove-4.wav
groove-5.wav
groove-6.wav

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, i.e. what you would find in the data chunk body of a *.wav file. It doesn't include any of the other chunks specified by the *.wav format such as a fmt chunk - it doesn't need one because HammerHead assumes that samples are 16-bit, 1 channel (mono), with a sample rate of 44100. (For more on the *.wav format, visit http://wavefilegem.com/how_wave_files_work.html).

Cookies help us deliver our services. By using our services, you agree to our use of cookies Learn more