Difference between revisions of "HERAD"

From Video Game Music Preservation Foundation Wiki
Jump to: navigation, search
m (Instrument Data)
(File structure)
Line 83: Line 83:
 
| <tt>UINT16</tt> || <tt>wSpeed</tt> || Ticks per second (tick = roughly 0.00187 seconds; need more research for exact value)
 
| <tt>UINT16</tt> || <tt>wSpeed</tt> || Ticks per second (tick = roughly 0.00187 seconds; need more research for exact value)
 
|-
 
|-
| <tt>UINT8[32]</tt> || <tt>bUnknown5</tt> || Array of bytes (unknown) seems to be only in '''AGD''' files
+
| <tt>UINT8[32]</tt> || <tt>bUnknown5</tt> || Array of bytes (unknown) seems to be only in '''AGD''' files (most likely panning values for Adlib Gold songs)
 
|-
 
|-
 
| <tt>DATA[]</tt> || <tt>data</tt> || MIDI tracks (each track ends with 0xFF)
 
| <tt>DATA[]</tt> || <tt>data</tt> || MIDI tracks (each track ends with 0xFF)

Revision as of 01:24, 4 April 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 (most likely panning values for Adlib Gold songs)
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 looks like that running status is not supported as all known songs programmed in HERAD never 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

For the Note Off command in version 2 songs, the velocity byte has been removed. The Pitch Bend command has only the MSB byte available. Like the MIDI Standard dictates, 0x40 is the "center" of the pitch bend range. Sending this data byte after the Pitch Bend status byte will result in no change to the pitch. Anything higher than 0x40, the pitch will go up, whereas any value less than 0x40 produces a lower pitch. In the MegaRace music files, Channel Aftertouch only occurs one time in one song (Fractalian Space).

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
Possibly an identifier (0x0 in version 1 songs, 0x1 or 0xFF in version 2 songs)
0x1 1
Unknown
Possibly an identifier
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.
0x1C 1
Modulator Waveform Select
0xE0 (bits 0-1)
0x1D 1
Carrier Waveform Select
0xE0 (bits 0-1)
0x1E 1
Modulator Output Level Macro
Uses the MIDI NoteOn velocity to control the Modulator Output level
(goes from 0 to 4; 0 = no velocity change, 4 = softest velocity change)
0x1F 1
Carrier Output Level Macro
Same as previous macro, only this affects the Carrier operator.
Seems to multiply the velocity value; as a result some notes that are too loud
or quiet will not be affected since the sum will be out of range for the OPL chip.
0x20 1
Feedback?
0xC0 (bits 1-3) This byte seems to be a duplicate control for Feedback, need to do more research.
0x21 1
Pitch Bend Range Flag
Increases pitch bend range (Fine tune = 0, Coarse tune = 1)
0x22 1
Pitch
Normally set at 0x0, 0xC = an octave higher
0x23 1
Pitch Bend Duration
Duration of the pitch bend in ticks
0x24 1
Pitch Bend Range
Setting to 0x18, while the coarse flag is enabled produces semi-tone
intervals, however they start to go out of tune after several notes.
0x25 1
Unknown
0x26 1
Unknown
0x27 1
Unknown

Links