Difference between revisions of "HERAD"

From Video Game Music Preservation Foundation Wiki
Jump to: navigation, search
(Figured out more unknowns)
(Version Compatibility)
Line 93: Line 93:
 
The format has two versions at least, which have major differences. However neither version has any FourCC or data denoting which version it is, so each music file needs to be inspected to detect the proper format version.
 
The format has two versions at least, which have major differences. However neither version has any FourCC or data denoting which version it is, so each music file needs to be inspected to detect the proper format version.
  
The first version was used in [[Dune (DOS)]] and [[KGB (DOS)]], and the second version was used in [[MegaRace (DOS)]].
+
The first version was used in [[Dune (DOS)]] and [[KGB (DOS)]], and the second version was used in [[MegaRace (DOS)]].  There are different ways you can loop a song; you can either loop a short segment or loop the song indefinitely.  Both require specifying the start and end points.  In Dune, in order for music to loop, this data must be in place, but for music playback in MegaRace, the songs will automatically repeat forever even if the <tt>wLoopCount</tt> field specifies if the song should only be played once.  Because the music will automatically loop, several tracks in MegaRace (NewSan, Maeva and Terminal City) have short measure loops that are played back but the music continues to loop the song from beginning to end.  The other remaining tracks from MegaRace (Factory Land, Skyholder and Fractalian Space) have intros to them that are not repeated so their loop points start at the end of the intro and finish when the song is over.  
  
 
For the 1st version <tt>wFileSize</tt> value represents total file size, for the 2nd version it represents file size without instruments data block. Also there are differences in MIDI notation, which described below.
 
For the 1st version <tt>wFileSize</tt> value represents total file size, for the 2nd version it represents file size without instruments data block. Also there are differences in MIDI notation, which described below.

Revision as of 23:56, 27 March 2016

HERAD System
HSQ.png
Developer: Rémi Herbulot
Header: Custom
Content: Notational
Instruments: Optional
Target Output
Output - Digital Audio - No.png Output - MIDI.png Output - FM Synthesis.png Output - PSG - No.png
Released: 1992-??-??
First Game: ?
Extensions
  • *.adl
  • *.agd
  • *.sdb
  • *.m32
  • *.hsq

Herbulot AdLib (HERAD) System was created by Rémi Herbulot, one of Cryo Interactive Entertainment co-founders and lead programmers. Stéphane Picq, Cryo's first music composer also helped design HERAD with Herbulot. There are two versions of HERAD that are known to exist.

Players

(Category)
  • RdosPlay - DOS - only version 1 (OPL2/OPL3 music)

Converters

(Category)

HERAD to ?

? to HERAD

Games

(Category)
Released Title Sample
1992-??-?? Dune (DOS)
1992-??-?? KGB (DOS)
1993-??-?? MegaRace (DOS)

Technical

  • File extensions stands for different sound devices:
  • HSQ are compressed files with Herbulot Sequencer algorithm.
  • The internal music notation is similar to MIDI, except Pitch Bend and Meta events.
  • M32 files usually contain one multi-channel track, while ADL/AGD files may contain multiple tracks.

File structure

All values seems to be in little endian format. The structure identification is incomplete.

Data type Name Description
UINT16 wFileSize Size of uncompressed file (different between versions)
UINT16[21] wOffsets Array of relative offsets to the MIDI tracks (0 = track doesn't exist)
UINT16 wLoopStart Loop starts at this measure (0 = don't loop)
UINT16 wLoopEnd Loop ends at this measure (0 = don't loop)
UINT16 wLoopCount Number of times the selected measures will play (0 = loop forever; >0 - play N times)
UINT16 wSpeed Ticks per second (tick = roughly 0.00187 seconds; need more research for exact value)
UINT8[32] bUnknown5 Array of bytes (unknown) seems to be only in AGD files
DATA[] data MIDI tracks (each track ends with 0xFF)
DATA[] instruments AdLib/Soundblaster instruments (doesn't present in M32)

Version Compatibility

The format has two versions at least, which have major differences. However neither version has any FourCC or data denoting which version it is, so each music file needs to be inspected to detect the proper format version.

The first version was used in Dune (DOS) and KGB (DOS), and the second version was used in MegaRace (DOS). There are different ways you can loop a song; you can either loop a short segment or loop the song indefinitely. Both require specifying the start and end points. In Dune, in order for music to loop, this data must be in place, but for music playback in MegaRace, the songs will automatically repeat forever even if the wLoopCount field specifies if the song should only be played once. Because the music will automatically loop, several tracks in MegaRace (NewSan, Maeva and Terminal City) have short measure loops that are played back but the music continues to loop the song from beginning to end. The other remaining tracks from MegaRace (Factory Land, Skyholder and Fractalian Space) have intros to them that are not repeated so their loop points start at the end of the intro and finish when the song is over.

For the 1st version wFileSize value represents total file size, for the 2nd version it represents file size without instruments data block. Also there are differences in MIDI notation, which described below.

MIDI notation

  • The most of status bytes are compatible with MIDI standard.
  • It's unknown whether running status mode is supported, since the most music files doesn't use it.
MIDI message Description MIDI compatible
8# xx xx Note Off (version 1) Yes
8# xx Note Off (version 2) No
9# xx xx Note On Yes
A# ?? ?? Poly Aftertouch (unused) Unknown
B# ?? ?? Control Change (unused) Unknown
C# xx Program Change (uses internal instruments for AGD and SDB) Yes
D# xx Channel Aftertouch Yes
E# xx Pitch Bend No
FF Track End

Instrument Data

The instrument chunk contains all the OPL register values needed for each instrument, along with some macros that control various parameters of the instrument during playback. Each instrument is 0x28 bytes long.

It seems that the OPL register values are almost in the exact same layout as the BNK format (technical). Thanks to Malvineous for his documentation on the BNK file format.

These offsets are still a work in progress and need more research.

Offset Size Name Description OPL base register Value range
0x0 1
Unknown
0x1 1
Unknown
0x2 1 ksl
Modulator Key scaling level
0x40 (bits 6-7)
0x3 1 multiple
Modulator Frequency multiplier
0x20 (bits 0-3)
0x4 1 feedback
Feedback
0xC0 (bits 1-3)
0x5 1 attack
Modulator Attack
0x60 (upper four bits)
0x6 1 sustain
Modulator Sustain
0x80 (upper four bits)
0x7 1 eg
Modulator Envelope gain
0x20 (bit 5) nonzero value is on
0x8 1 decay
Modulator Delay
0x60 (lower four bits)
0x9 1 releaseRate
Modulator Release
0x80 (lower four bits)
0xA 1 totalLevel
Modulator Output Level
0x40 (bit 0-5) uses all bits; output level can still be modified by output level byte 0x1E
0xB 1 am
Modulator Amplitude modulation (Tremolo)
0x20 (bit 7)
0xC 1 vib
Modulator Frequency Vibrato
0x20 (bit 6)
0xD 1 ksr
Modulator Key scaling/envelope rate
0x20 (bit 4)
0xE 1 con
Connector
0xC0 (bit 0, inverted) 0: OPL bit set to 1
other: OPL bit set to 0
0xF 1 ksl
Carrier Key scaling level
0x40 (bits 6-7)
0x10 1 multiple
Carrier Frequency multiplier
0x20 (bits 0-3)
0x11 1 feedback
Feedback (Ignore)
0xC0 (bits 1-3) This byte seems to have garbage data in it and is not used
0x12 1 attack
Carrier Attack
0x60 (upper four bits)
0x13 1 sustain
Carrier Sustain
0x80 (upper four bits)
0x14 1 eg
Carrier Envelope gain
0x20 (bit 5) nonzero value is on
0x15 1 decay
Carrier Delay
0x60 (lower four bits)
0x16 1 releaseRate
Carrier Release
0x80 (lower four bits)
0x17 1 totalLevel
Carrier Output Level
0x40 (bit 0-5) uses all bits; output level can still be modified by output level byte 0x1F
0x18 1 am
Carrier Amplitude modulation (Tremolo)
0x20 (bit 7)
0x19 1 vib
Carrier Frequency Vibrato
0x20 (bit 6)
0x1A 1 ksr
Carrier Key scaling/envelope rate
0x20 (bit 4)
0x1B 1 con
Connector (Ignore)
0xC0 (bit 0, inverted) So far, this seems to be always set at zero.
0x1E 1
Modulator Output Level
Seems to follow the note velocity (0 = loudest, F = softest)
0x1F 1
Carrier Output Level
Seems to follow the note velocity (0 = loudest, F = softest)
0x20 1
Unknown
Seems to increases Feedback depending on note velocity
0x21 1
Unknown
Increases pitch bend range (seems like it's a flag: Fine tune = 0, Coarse tune = 1)
0x22 1
Pitch
Normally set at 0x0, 0xC = an octave higher
0x23 1
Unknown
Duration of the pitch bend in ticks
0x24 1
Unknown
Pitch bend range
0x25 1
Unknown
0x26 1
Unknown
0x27 1
Unknown

Links