https://github.com/jstrait/clawhammer
Extract *.wav files from the *.hub format used by the Hammerhead drum machine.
https://github.com/jstrait/clawhammer
Last synced: about 1 year ago
JSON representation
Extract *.wav files from the *.hub format used by the Hammerhead drum machine.
- Host: GitHub
- URL: https://github.com/jstrait/clawhammer
- Owner: jstrait
- License: mit
- Created: 2008-12-31T02:49:37.000Z (over 17 years ago)
- Default Branch: master
- Last Pushed: 2018-10-16T18:53:52.000Z (over 7 years ago)
- Last Synced: 2025-04-03T05:51:14.673Z (about 1 year ago)
- Language: Ruby
- Homepage:
- Size: 107 KB
- Stars: 6
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.markdown
- License: MIT-LICENSE
Awesome Lists containing this project
README
What Is It?
===========
[HammerHead](http://www.threechords.com/hammerhead/introduction.shtml) 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](http://github.com/jstrait/fileinspector/tree/master).
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](http://wavefilegem.com/) 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 ).