<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://moddingwiki.shikadi.net/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Binarymaster</id>
	<title>ModdingWiki - User contributions [en-gb]</title>
	<link rel="self" type="application/atom+xml" href="https://moddingwiki.shikadi.net/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Binarymaster"/>
	<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/wiki/Special:Contributions/Binarymaster"/>
	<updated>2026-05-15T03:14:41Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.11</generator>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=Apogee_Sound_System_Timbre_Format&amp;diff=7150</id>
		<title>Apogee Sound System Timbre Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=Apogee_Sound_System_Timbre_Format&amp;diff=7150"/>
		<updated>2017-07-25T07:09:19Z</updated>

		<summary type="html">&lt;p&gt;Binarymaster: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Instrument Infobox&lt;br /&gt;
 | Type = OPL&lt;br /&gt;
 | Type2 = MIDI&lt;br /&gt;
 | Count = 256&lt;br /&gt;
 | Names = No&lt;br /&gt;
 | Games = &lt;br /&gt;
   {{Game|Duke Nukem 3D}}&lt;br /&gt;
   {{Game|Blood}}&lt;br /&gt;
   {{Game|Shadow Warrior}}&lt;br /&gt;
   {{Game|NAM}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;Apogee Sound System Timbre Format&#039;&#039;&#039; is an instrument bank format used by the Apogee Sound System library developed by 3D Realms. The 128 melodic and 128 percussion instrument limit was most likely chosen so that a single TMB file could store all the instruments for a General MIDI song. Files of this format are has &amp;lt;tt&amp;gt;.tmb&amp;lt;/tt&amp;gt; extension.&lt;br /&gt;
&lt;br /&gt;
==File format==&lt;br /&gt;
&lt;br /&gt;
TMB files have no header and signature. The file contains 256 13-byte instrument entries (first 128 are melodic, and next 128 are percussion).&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! OPL base register !! Description&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT8]] || SAVEK[0] ||  0x20 || Modulator characteristic (Mult, KSR, EG, VIB and AM flags)&lt;br /&gt;
|-                                  &lt;br /&gt;
| [[UINT8]] || SAVEK[1] ||  0x23 || Carrier characteristic (Mult, KSR, EG, VIB and AM flags)&lt;br /&gt;
|-                                  &lt;br /&gt;
| [[UINT8]] || Level[0] ||  0x40 || Modulator key scaling/output level&lt;br /&gt;
|-                                  &lt;br /&gt;
| [[UINT8]] || Level[1] ||  0x43 || Carrier key scaling/output level&lt;br /&gt;
|-                                  &lt;br /&gt;
| [[UINT8]] || Env1[0]  ||  0x60 || Modulator attack/decay level&lt;br /&gt;
|-                                  &lt;br /&gt;
| [[UINT8]] || Env1[1]  ||  0x63 || Carrier attack/decay level&lt;br /&gt;
|-                                  &lt;br /&gt;
| [[UINT8]] || Env2[0]  ||  0x80 || Modulator sustain/release level&lt;br /&gt;
|-                                  &lt;br /&gt;
| [[UINT8]] || Env2[1]  ||  0x83 || Carrier sustain/release level&lt;br /&gt;
|-                                  &lt;br /&gt;
| [[UINT8]] || Wave[0]  ||  0xE0 || Modulator wave select&lt;br /&gt;
|-                                  &lt;br /&gt;
| [[UINT8]] || Wave[1]  ||  0xE3 || Carrier wave select&lt;br /&gt;
|-                                  &lt;br /&gt;
| [[UINT8]] || Feedback ||  0xC0 || Feedback/connection&lt;br /&gt;
|-                                  &lt;br /&gt;
| [[INT8]] || Transpose ||  N/A  || Note offset for melodic instruments, and key number for percussion&lt;br /&gt;
|-                                  &lt;br /&gt;
| [[INT8]] || Velocity  ||  N/A  || Velocity offset&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The TMB format is directly based on [[IBK Format]], and has first 12 bytes be same as in the IBK Format. Official &amp;lt;tt&amp;gt;MAKETMB.EXE&amp;lt;/tt&amp;gt; utility (can be found with the source code of 3D Realms games in the Audio Library public folder) generates TMB files from the set of IBK files.&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
{{BeginFileFormatTools|Type=audio}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = &amp;lt;tt&amp;gt;MAKETMB.EXE&amp;lt;/tt&amp;gt;&lt;br /&gt;
| Platform = DOS&lt;br /&gt;
| canPlay = No&lt;br /&gt;
| canCreate = Yes&lt;br /&gt;
| canModify = No&lt;br /&gt;
| canExport = Yes; .tmb&lt;br /&gt;
| canImport = Yes; [[IBK Format|.ibk]]&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = No&lt;br /&gt;
| notes = Part of &#039;&#039;Apogee Sound System&#039;&#039; SDK&lt;br /&gt;
}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = [[OPL3 Bank Editor]]&lt;br /&gt;
| Platform = Linux, Windows, macOS&lt;br /&gt;
| canPlay = Yes&lt;br /&gt;
| canCreate = Yes&lt;br /&gt;
| canModify = Yes&lt;br /&gt;
| canExport = Yes; many&lt;br /&gt;
| canImport = Yes; many&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = Yes&lt;br /&gt;
| notes =&lt;br /&gt;
}}&lt;br /&gt;
{{EndFileFormatTools}}&lt;/div&gt;</summary>
		<author><name>Binarymaster</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=IBK_Format&amp;diff=7149</id>
		<title>IBK Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=IBK_Format&amp;diff=7149"/>
		<updated>2017-07-25T07:08:46Z</updated>

		<summary type="html">&lt;p&gt;Binarymaster: Small fixes&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Instrument Infobox&lt;br /&gt;
 | Type = OPL, MIDI&lt;br /&gt;
 | Count = 128&lt;br /&gt;
 | Names = Yes, 8 chars&lt;br /&gt;
 | Games = &lt;br /&gt;
   {{Game|Drum Blaster}}&lt;br /&gt;
}}&lt;br /&gt;
The &#039;&#039;&#039;IBK (Instrument Bank) Format&#039;&#039;&#039; was created to store up to 128 instruments suitable for playback on a sound card with an OPL2 or OPL3 chip. The 128 instrument limit was most likely chosen so that a single IBK file could store all the instruments for a General MIDI song.&lt;br /&gt;
&lt;br /&gt;
== File format ==&lt;br /&gt;
&lt;br /&gt;
The file is structured as follows:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name!! Description&lt;br /&gt;
|-&lt;br /&gt;
| [[char]][4] || signature || &amp;quot;IBK&amp;quot; followed by 0x1A&lt;br /&gt;
|-&lt;br /&gt;
| [[BYTE]][16][128] || inst || 128 instrument settings, 16 bytes each (see below)&lt;br /&gt;
|-&lt;br /&gt;
| [[char]][9][128] || names || 128 instrument titles (each must be NULL-terminated, giving 8 visible chars max)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Instruments ===&lt;br /&gt;
&lt;br /&gt;
Each instrument is in the following format.  This is identical to the format used for the instrument block in [[CMF Format]] files.  Each individual instrument is the same as in the [[SBI Format]].&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Data type!!Name!!OPL base register!!Description&lt;br /&gt;
|-&lt;br /&gt;
|[[UINT8]]||iModChar||0x20||Modulator characteristic (Mult, KSR, EG, VIB and AM flags)&lt;br /&gt;
|-&lt;br /&gt;
|[[UINT8]]||iCarChar||0x23||Carrier characteristic (Mult, KSR, EG, VIB and AM flags)&lt;br /&gt;
|-&lt;br /&gt;
|[[UINT8]]||iModScale||0x40||Modulator key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|[[UINT8]]||iCarScale||0x43||Carrier key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|[[UINT8]]||iModAttack||0x60||Modulator attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|[[UINT8]]||iCarAttack||0x63||Carrier attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|[[UINT8]]||iModSustain||0x80||Modulator sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|[[UINT8]]||iCarSustain||0x83||Carrier sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|[[UINT8]]||iModWaveSel||0xE0||Modulator wave select&lt;br /&gt;
|-&lt;br /&gt;
|[[UINT8]]||iCarWaveSel||0xE3||Carrier wave select&lt;br /&gt;
|-&lt;br /&gt;
|[[UINT8]]||iFeedback||0xC0||Feedback/connection&lt;br /&gt;
|-&lt;br /&gt;
|[[UINT8]]||iPercVoc||N/A||Percussion voice mode:&amp;lt;br&amp;gt;0 is melodic, 6 - Bass Drum, 7 - Snare, 8 - Tom-Tom, 9 - Cymbal, 10 - HiHat&lt;br /&gt;
|-&lt;br /&gt;
|[[INT8]]||iTranspos||N/A||Number of notes to transpose timbre, signed&lt;br /&gt;
|-&lt;br /&gt;
|[[INT8]]||iDPitch||N/A||Percussion pitch: MIDI Note 0 - 127&lt;br /&gt;
|-&lt;br /&gt;
|[[BYTE]][2]&lt;br /&gt;
|colspan=3|Padding to bring instrument definition up to 16 bytes&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Percussive instruments ====&lt;br /&gt;
&lt;br /&gt;
Percussive instruments are indicated by &amp;lt;tt&amp;gt;iPercVoc&amp;lt;/tt&amp;gt; field. Percussive instruments are using rhythm mode of the OPL2/OPL3 chip.&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
{{BeginFileFormatTools|Type=audio}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = [[SBTimbre]]&lt;br /&gt;
| Platform = DOS&lt;br /&gt;
| canPlay = Yes&lt;br /&gt;
| canCreate = Yes&lt;br /&gt;
| canModify = Yes&lt;br /&gt;
| canExport = Yes; [[IBK Format|.ibk]]&lt;br /&gt;
| canImport = Yes; [[AdLib Instrument Bank Format|.bnk]]&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = Yes&lt;br /&gt;
| notes = Instrument editor using IBK as its primary format&lt;br /&gt;
}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = [[OPL3 Bank Editor]]&lt;br /&gt;
| Platform = Linux, Windows, macOS&lt;br /&gt;
| canPlay = Yes&lt;br /&gt;
| canCreate = Yes&lt;br /&gt;
| canModify = Yes&lt;br /&gt;
| canExport = Yes; many&lt;br /&gt;
| canImport = Yes; many&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = Yes&lt;br /&gt;
| notes =&lt;br /&gt;
}}&lt;br /&gt;
{{EndFileFormatTools}}&lt;/div&gt;</summary>
		<author><name>Binarymaster</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=DSIK_Module_Format&amp;diff=7109</id>
		<title>DSIK Module Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=DSIK_Module_Format&amp;diff=7109"/>
		<updated>2017-06-24T07:50:12Z</updated>

		<summary type="html">&lt;p&gt;Binarymaster: /* Tools */ correct entry&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Music Infobox&lt;br /&gt;
 | Type = Tracked&lt;br /&gt;
 | Instruments = PCM&lt;br /&gt;
 | NumChannels = 16&lt;br /&gt;
 | NumTracks = 1&lt;br /&gt;
 | NumPatterns = 65,535 (only 255 playable)&lt;br /&gt;
 | NumOrders = 128&lt;br /&gt;
 | Tags = Title, instrument names, instrument filenames&lt;br /&gt;
 | Games = &lt;br /&gt;
   {{Game|Trugg}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The [[DSIK Module Format]] is the music format used by the &#039;&#039;Digital Sound Interface Kit&#039;&#039; by Carlos Hasan.  This was a C and Pascal library for game authors to simplify sound card programming.&lt;br /&gt;
&lt;br /&gt;
== File format ==&lt;br /&gt;
&lt;br /&gt;
The file is a &#039;&#039;&#039;non-standard&#039;&#039;&#039; [[Resource Interchange File Format (RIFF)]] structure.  It is exactly the same as a standard RIFF file, except that the padding bytes between chunks have been omitted.  So if the length of a chunk is an odd number, the padding byte should not be included and the following chunk will not start on a word boundary.&lt;br /&gt;
&lt;br /&gt;
The files are composed of the following chunks:&lt;br /&gt;
&lt;br /&gt;
* RIFF (type: DSMF)&lt;br /&gt;
** SONG&lt;br /&gt;
** INST&lt;br /&gt;
** PATT&lt;br /&gt;
&lt;br /&gt;
The data in each chunk is explained below.&lt;br /&gt;
&lt;br /&gt;
=== SONG chunk ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| char[28] || title || Song title, null-terminated&lt;br /&gt;
|-&lt;br /&gt;
| UINT16LE || version || File version&lt;br /&gt;
|-&lt;br /&gt;
| UINT16LE || flags ||&lt;br /&gt;
|-&lt;br /&gt;
| UINT32LE || pad ||&lt;br /&gt;
|-&lt;br /&gt;
| UINT16LE || numOrders || Number of valid entries in &amp;lt;tt&amp;gt;orders&amp;lt;/tt&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| UINT16LE || numSamples ||&lt;br /&gt;
|-&lt;br /&gt;
| UINT16LE || numPatterns ||&lt;br /&gt;
|-&lt;br /&gt;
| UINT16LE || numChannels ||&lt;br /&gt;
|-&lt;br /&gt;
| UINT8 || volGlobal || Global volume&lt;br /&gt;
|-&lt;br /&gt;
| UINT8 || volMaster || Master volume&lt;br /&gt;
|-&lt;br /&gt;
| UINT8 || initialSpeed ||&lt;br /&gt;
|-&lt;br /&gt;
| UINT8 || initialBPM ||&lt;br /&gt;
|-&lt;br /&gt;
| UINT8[16] || channelMap ||&lt;br /&gt;
|-&lt;br /&gt;
| UINT8[128] || orders || Order list.  First value is index of first pattern to play, etc.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== INST chunk ===&lt;br /&gt;
&lt;br /&gt;
This chunk stores all the instruments in the song.  There are multiple &#039;&#039;&#039;INST&#039;&#039;&#039; chunks in the file, one per instrument.  The data in each chunk is as follows:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| char[13] || filename || Instrument filename, null-terminated&lt;br /&gt;
|-&lt;br /&gt;
| UINT16LE || flags || Zero or more of: 1=loop active, 2=signed PCM, 4=packed PCM&lt;br /&gt;
|-&lt;br /&gt;
| UINT8 || volume || Default volume of the sample if not volume is given when a note is played.  The range is from 0 (silent) to 64 (loudest), note this is 65 different values.&lt;br /&gt;
|-&lt;br /&gt;
| UINT32LE || length || Length of the sample data, in bytes.&lt;br /&gt;
|-&lt;br /&gt;
| UINT32LE || loopStart || Position of the loop start point, in bytes, relative to the start of the sample data.&lt;br /&gt;
|-&lt;br /&gt;
| UINT32LE || loopEnd || Position of the loop end point, in bytes, relative to the start of the sample data.&lt;br /&gt;
|-&lt;br /&gt;
| UINT32LE || address_ptr || Used internally for holding in-memory address of sample data, ignore when reading and write as zero.&lt;br /&gt;
|-&lt;br /&gt;
| UINT16LE || midCRate || Default is 8363&lt;br /&gt;
|-&lt;br /&gt;
| UINT16LE || period || Default for middle-C is 428&lt;br /&gt;
|-&lt;br /&gt;
| char[28] || title || Sample name, null-terminated&lt;br /&gt;
|-&lt;br /&gt;
| BYTE[length] || data || Sample data, 8-bit mono PCM&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Sample data must be 8-bit mono PCM, signed or unsigned based on &amp;lt;tt&amp;gt;flags&amp;lt;/tt&amp;gt; {{TODO|Confirm that signed PCM actually works}}.  Other formats are rejected by the DSIK library.  Some samples appear to be truncated .wav files and still have the &#039;data&#039; fourcc visible, however this is not part of the format and these bytes will be played as audio data, causing an audible click at the start of playback.&lt;br /&gt;
&lt;br /&gt;
The period is calculated from a sample rate (in Hertz) as &amp;lt;code&amp;gt;period = 8363 * 428 / Hertz&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== PATT chunk ===&lt;br /&gt;
&lt;br /&gt;
This chunk stores all the patterns in the song.  There are multiple &#039;&#039;&#039;PATT&#039;&#039;&#039; chunks in the file, one per pattern.  The data in each chunk is as follows:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| UINT16LE || length || Length of pattern data, in bytes, including this length field also&lt;br /&gt;
|-&lt;br /&gt;
| UINT8[length - 2] || data || Pattern data, see below&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The pattern data is comprised of a flag byte, followed by a variable number of data bytes depending on the value of the flag.  This is very similar to [[S3M Format]] but the bit fields are different.  The flag byte is broken down as follows:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!width=100| 7 !!width=100| 6 !!width=100| 5 !!width=100| 4 !!width=100| 3 !!width=100| 2 !!width=100| 1 !!width=100| 0&lt;br /&gt;
|-&lt;br /&gt;
| Note present&lt;br /&gt;
| Instrument present&lt;br /&gt;
| Volume present&lt;br /&gt;
| Command present&lt;br /&gt;
|colspan=4 align=center| Channel number&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* If the entire value is zero, the row number is incremented and the next flag is read.  Otherwise:&lt;br /&gt;
* If the flag indicates a note is present, the next byte is the note.   Note numbers are semitones, with note 49 being middle C, note 50 being C#4, note 51 being D4, etc.  Adding 11 to the note number will turn them into standard MIDI note numbers.&lt;br /&gt;
* If an instrument is present, the next byte is the zero-based index of the instrument to use.&lt;br /&gt;
* If a volume is present, the next byte is the volume for this note/channel.  The range is from 0 (silent) to 64 (loudest), note this is 65 different values.&lt;br /&gt;
* If a command is present, the next two bytes are the command and value respectively.  Standard .mod commands appear to be used {{TODO|Confirm}}&lt;br /&gt;
&lt;br /&gt;
After these bytes have been read, the next flag byte is read.  Once 64 rows have been read, the end of the pattern data should have been reached.&lt;br /&gt;
&lt;br /&gt;
If the instrument is read but it is zero, then the previous instrument on that channel should be used instead (same as S3M).&lt;br /&gt;
&lt;br /&gt;
{{TODO|Commands are unknown but are presumed very similar to .mod}}  Effect 0x0F is used to set the tempo in some [[Trugg]] songs.  If the value is small it is a new &#039;&#039;speed&#039;&#039; value, if it is large then it is a new &#039;&#039;tempo&#039;&#039; value.&lt;br /&gt;
&lt;br /&gt;
=== Timing ===&lt;br /&gt;
&lt;br /&gt;
See [[S3M Format#Timing]] for a discussion on timing using the &amp;lt;tt&amp;gt;initialBPM&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;initialSpeed&amp;lt;/tt&amp;gt; values.&lt;br /&gt;
&lt;br /&gt;
=== Design issues ===&lt;br /&gt;
&lt;br /&gt;
The file format suffers from a number of design inconsistencies:&lt;br /&gt;
&lt;br /&gt;
* The &#039;&#039;&#039;DSMF&#039;&#039;&#039; format should have been registered with Microsoft as it is in uppercase, however this does not appear to have been done&lt;br /&gt;
* The &#039;&#039;&#039;INST&#039;&#039;&#039; and &#039;&#039;&#039;PATT&#039;&#039;&#039; chunks should have been placed inside &#039;&#039;&#039;LIST&#039;&#039;&#039; chunks, in the spirit of the RIFF format&lt;br /&gt;
* The instrument chunk includes a length field for the sample data, however this is redundant as the chunk itself already has a length.  The two length fields do make it possible to store additional data between the end of the sample data and the end of the chunk, which would normally be ignored, however it seems simpler to just define a new chunk type if new data needs to be stored without breaking backwards compatibility.&lt;br /&gt;
* The instrument chunk stores an address field even though this is only used during playback and does not need to be stored in the file.&lt;br /&gt;
* The pattern chunk also has an extra field to store the length of the pattern data.  However the value in this field includes the length of the field itself, making the value identical to the RIFF chunk&#039;s length field.  The result is that the identical value is written twice, once as a 32-bit value for the RIFF PATT chunk and then immediately again as a 16-bit value.&lt;br /&gt;
* The number of instruments and patterns is stored in the &#039;&#039;&#039;SONG&#039;&#039;&#039; chunk, however this is redundant as the values can be calculated from the number of &#039;&#039;&#039;INST&#039;&#039;&#039; and &#039;&#039;&#039;PATT&#039;&#039;&#039; chunks respectively.&lt;br /&gt;
* There is a 16-bit value for the number of orders, allowing up to 65,535 orders in the song, yet there is a fixed-length array allowing only 128 orders.&lt;br /&gt;
* The pattern count is 16-bit allowing up to 65,536 patterns in the song, but the order list is made up of 8-bit values, meaning only the first 256 patterns can be played.&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
{{BeginFileFormatTools|Type=audio}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = [[Camoto]]&lt;br /&gt;
| Platform = Linux/Windows&lt;br /&gt;
| canPlay = Yes&lt;br /&gt;
| canCreate = Yes&lt;br /&gt;
| canModify = Yes&lt;br /&gt;
| canExport = Many&lt;br /&gt;
| canImport = Many&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = Yes&lt;br /&gt;
| notes = Minimal support for effects&lt;br /&gt;
}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = Chronos Module Converter&lt;br /&gt;
| Platform = DOS&lt;br /&gt;
| canPlay = No&lt;br /&gt;
| canCreate = No&lt;br /&gt;
| canModify = No&lt;br /&gt;
| canExport = [[MOD Format|.mod]] .stm [[S3M Format|.s3m]] .mtm .dsm .psm&lt;br /&gt;
| canImport = No&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = No&lt;br /&gt;
| notes = Most accurate for converting .dsm to .s3m&lt;br /&gt;
}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = DSIK&#039;s &amp;lt;tt&amp;gt;conv.exe&amp;lt;/tt&amp;gt;&lt;br /&gt;
| Platform = DOS&lt;br /&gt;
| canPlay = No&lt;br /&gt;
| canCreate = Yes&lt;br /&gt;
| canModify = No&lt;br /&gt;
| canExport = No&lt;br /&gt;
| canImport = [[MOD Format|.mod]] .stm [[S3M Format|.s3m]] .669 .mtm&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = Yes&lt;br /&gt;
| notes = Official tool&lt;br /&gt;
}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = ModPlug&lt;br /&gt;
| Platform = Windows&lt;br /&gt;
| canPlay = Yes&lt;br /&gt;
| canCreate = No&lt;br /&gt;
| canModify = No&lt;br /&gt;
| canExport = No&lt;br /&gt;
| canImport = No&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = No&lt;br /&gt;
| notes = Plays at wrong tempo (no support for effect 0x0F)&lt;br /&gt;
}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = OpenMPT&lt;br /&gt;
| Platform = Any&lt;br /&gt;
| canPlay = Yes&lt;br /&gt;
| canCreate = No&lt;br /&gt;
| canModify = No&lt;br /&gt;
| canExport = Many&lt;br /&gt;
| canImport = No&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = No&lt;br /&gt;
}}&lt;br /&gt;
{{EndFileFormatTools}}&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
&lt;br /&gt;
* The original Digital Sound Interface Kit library is available as &amp;lt;tt&amp;gt;dsik_c.zip&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;dsik_pas.zip&amp;lt;/tt&amp;gt; for the C and Pascal versions respectively, from various FTP sites such as [http://ftp.lanet.lv/ftp/mirror/x2ftp/msdos/programming/wgt/ lanet.lv]&lt;br /&gt;
&lt;br /&gt;
== Credits ==&lt;br /&gt;
&lt;br /&gt;
This file format was documented by [[User:Malvineous|Malvineous]] by reading the DSIK sample code, with the pattern data documented from reading the OpenMPT source code.  If you find this information helpful in a project you&#039;re working on, please give credit where credit is due.  (A link back to this wiki would be nice too!)&lt;br /&gt;
&lt;br /&gt;
[[Category:DSIK]]&lt;/div&gt;</summary>
		<author><name>Binarymaster</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=SOP_Format&amp;diff=7034</id>
		<title>SOP Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=SOP_Format&amp;diff=7034"/>
		<updated>2017-02-27T18:07:04Z</updated>

		<summary type="html">&lt;p&gt;Binarymaster: Latest updates&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Music Infobox&lt;br /&gt;
 | Type = Custom&lt;br /&gt;
 | Instruments = OPL&lt;br /&gt;
 | NumChannels = 9 or 11 (OPL2), 18 or 20 (OPL3)&lt;br /&gt;
 | NumTracks = 20&lt;br /&gt;
 | NumPatterns = 1&lt;br /&gt;
 | NumOrders = 0&lt;br /&gt;
 | Tags = File name, Title, Comment, Instrument names&lt;br /&gt;
 | Games = None&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;SOP Format&#039;&#039;&#039; was created by Lee Ho Bum (sopepos) for the &#039;&#039;&#039;Note&#039;&#039;&#039; OPL3 music sequencer.&lt;br /&gt;
&lt;br /&gt;
== File format ==&lt;br /&gt;
&lt;br /&gt;
=== Header ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data Type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[char]][7]&amp;lt;/tt&amp;gt; || signature || Header signature (must be &amp;quot;&amp;lt;tt&amp;gt;sopepos&amp;lt;/tt&amp;gt;&amp;quot;)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT8]]&amp;lt;/tt&amp;gt; || majorVersion || Major version number (normally 0)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || minorVersion || Minor version number (normally 1)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[BYTE]]&amp;lt;/tt&amp;gt; || padding || Unused, must be zero&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[13]&amp;lt;/tt&amp;gt; || fileName || File-name / short-name, null-terminated&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[31]&amp;lt;/tt&amp;gt; || title || Song-title, null-terminated&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || percussive || OPL rhythm mode: 0 = melodic, 1 = percussive&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || padding || Unused, must be zero&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || tickBeat || Number of ticks-per-beat&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || padding || Unused, must be zero&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || beatMeasure || Number of beats-per-measure (normally 4)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || basicTempo || Song-tempo, in beats-per-minute (normally 120)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[13]&amp;lt;/tt&amp;gt; || comment || Comment string, unused&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || nTracks || Number of tracks&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || nInsts || Number of instruments&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || padding || Unused, must be zero&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The only known version of this format is 0.1.&lt;br /&gt;
&lt;br /&gt;
The fields &amp;lt;tt&amp;gt;tickBeat&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;beatMeasure&amp;lt;/tt&amp;gt; are used to convert ticks into beats and measures for drawing a musical staff.&lt;br /&gt;
&lt;br /&gt;
The header has a fixed size of 76 bytes, then it is followed by data-structure.&lt;br /&gt;
&lt;br /&gt;
=== Data structure ===&lt;br /&gt;
&lt;br /&gt;
The data-structure&#039;s size is dynamic, therefore, it varies depending upon the number of tracks and instruments:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data Type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE[nTracks]&amp;lt;/tt&amp;gt; || chanMode || Channel modes&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_INST[nInsts]&amp;lt;/tt&amp;gt; || insts || Instruments&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_STRK[nTracks]&amp;lt;/tt&amp;gt; || tracks || Sequenced tracks&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_CTRK&amp;lt;/tt&amp;gt; || ctrlTrack || Control track&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each section of the data-structure is described below:&lt;br /&gt;
&lt;br /&gt;
=== Channel modes ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Value !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;0x00&amp;lt;/tt&amp;gt; || Unused channel&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;0x01&amp;lt;/tt&amp;gt; || YMF-262M 4OP Mode&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;0x02&amp;lt;/tt&amp;gt; || YM-3812 2OP Mode&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Instruments ===&lt;br /&gt;
The header is followed by the instrument-block. An instrument-structure is repeated &amp;lt;tt&amp;gt;nInsts&amp;lt;/tt&amp;gt; times:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_INST&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data Type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || instType || Instrument type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[8]&amp;lt;/tt&amp;gt; || shortName || Bank instrument-name / short-name&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[19]&amp;lt;/tt&amp;gt; || longName || Long instrument-name&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE[]&amp;lt;/tt&amp;gt; || instData || Instrument data&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
An instrument&#039;s data-size varies depending upon the instrument&#039;s type:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type !! Size !! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 22 || Melody (YMF-262M, 4OP Mode)&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 11 || Melody (YM-3812, 2OP Mode)&lt;br /&gt;
|-&lt;br /&gt;
| 6 || 11 || Bass Drum&lt;br /&gt;
|-&lt;br /&gt;
| 7 || 11 || Snare Drum&lt;br /&gt;
|-&lt;br /&gt;
| 8 || 11 || Tom Tom&lt;br /&gt;
|-&lt;br /&gt;
| 9 || 11 || Cymbal&lt;br /&gt;
|-&lt;br /&gt;
| 10 || 11 || Hi-Hat&lt;br /&gt;
|-&lt;br /&gt;
| 12 || 0 || Unused instrument (comment)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The actual instrument-data is merely just a dump of the OPL registers:&lt;br /&gt;
&lt;br /&gt;
==== 2OP Mode instrument data ====&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Data Type!!Name!!OPL Base Register!!Description&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModChar||0x20||Modulator characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModScale||0x40||Modulator key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModAttack||0x60||Modulator attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModSustain||0x80||Modulator sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModWaveSel||0xE0||Modulator wave-select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iFeedback||0xC0||Feedback/connection&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarChar||0x23||Carrier characteristic (only melody instruments and Bass Drum)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarScale||0x43||Carrier key scaling/output level (only melody instruments)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarAttack||0x63||Carrier attack/decay level (only melody instruments)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarSustain||0x83||Carrier sustain/release level (only melody instruments)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarWaveSel||0xE3||Carrier wave-select (only melody instruments)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== 4OP Mode instrument data ====&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Data Type!!Name!!OPL Base Register!!Description&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Char||0x20||Operator 1 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Scale||0x40||Operator 1 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Attack||0x60||Operator 1 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Sustain||0x80||Operator 1 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1WaveSel||0xE0||Operator 1 wave-select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Feedback||0xC0||Operator 1 feedback/connection&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Char||0x23||Operator 2 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Scale||0x43||Operator 2 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Attack||0x63||Operator 2 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Sustain||0x83||Operator 2 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2WaveSel||0xE3||Operator 2 wave-select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Char||0x28||Operator 3 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Scale||0x48||Operator 3 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Attack||0x68||Operator 3 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Sustain||0x88||Operator 3 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3WaveSel||0xE8||Operator 3 wave-select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Feedback||0xC8||Operator 3 feedback/connection&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Char||0x2B||Operator 4 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Scale||0x4B||Operator 4 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Attack||0x6B||Operator 4 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Sustain||0x8B||Operator 4 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4WaveSel||0xEB||Operator 4 wave-select&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Sequenced tracks ===&lt;br /&gt;
&lt;br /&gt;
The instrument-block is followed by all sequenced tracks, which contain the music&#039;s events:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_STRK&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data Type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || numEvents || Number of events in track&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT32LE]]&amp;lt;/tt&amp;gt; || dataSize || Track&#039;s data-size, in bytes&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_EVNT[numEvents]&amp;lt;/tt&amp;gt; || events || Track events&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_EVNT&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data Type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || ticks || Delta-ticks (change position)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || event || Event code&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_EVAL&amp;lt;/tt&amp;gt; || value || Event structure&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_EVAL&amp;lt;/tt&amp;gt; structure varies depending upon the event-code value:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Event Code !! Description !! Event Structure&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;center&amp;gt;1&amp;lt;/center&amp;gt; || Special Event || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; value&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;center&amp;gt;2&amp;lt;/center&amp;gt; || Note On || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; pitch, &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; length (in ticks)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;center&amp;gt;4&amp;lt;/center&amp;gt; || Change Volume || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; volume&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;center&amp;gt;5&amp;lt;/center&amp;gt; || Change Pitch || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; pitch (&amp;lt;tt&amp;gt;0x64&amp;lt;/tt&amp;gt; (100) is a center value)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;center&amp;gt;6&amp;lt;/center&amp;gt; || Instrument Change || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; number&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;center&amp;gt;7&amp;lt;/center&amp;gt; || Set Panning || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; panning (0 - right, 1 - middle, 2 - left)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Special Event ====&lt;br /&gt;
&lt;br /&gt;
This event has no effect on normal playback.&lt;br /&gt;
&lt;br /&gt;
==== Pitch Change ====&lt;br /&gt;
&lt;br /&gt;
The pitch is a signed char type with a value between -100 and +100. The actual pitch setting is the pitch of the current note plus the frequency of the next note in octave (or previous note, if value is negative). Its combined value can be calculated as a percentage. That is, when the pitch is +50 and the current frequency is 153, and if the next note frequency is 163, then, the actual output frequency can be calculated like this:&lt;br /&gt;
&lt;br /&gt;
 153 + (163-153) * 50/100 = 158&lt;br /&gt;
&lt;br /&gt;
=== Control track ===&lt;br /&gt;
&lt;br /&gt;
The last block in a SOP file is the control-track. It is used to control global playback parameters.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_CTRK&amp;lt;/tt&amp;gt; structure is similar to &amp;lt;tt&amp;gt;SOP_STRK&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data Type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || numEvents || Number of control-events in track&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT32LE]]&amp;lt;/tt&amp;gt; || dataSize || Control-track data-size, in bytes&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_CEVT[numEvents]&amp;lt;/tt&amp;gt; || events || Control-track events&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_CEVT&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data Type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || ticks || Delta-ticks (change position)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || event || Control-event code&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_CVAL&amp;lt;/tt&amp;gt; || value || Control-event structure&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_CVAL&amp;lt;/tt&amp;gt; structure varies depending upon the control-event code value:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Event Code !! Description !! Event Structure&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;center&amp;gt;3&amp;lt;/center&amp;gt; || Change Tempo || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; bpm&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;center&amp;gt;8&amp;lt;/center&amp;gt; || Global Volume || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; volume&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Change Tempo ====&lt;br /&gt;
&lt;br /&gt;
This event updates the tempo value. If it was not set before, then, it defaults to the &amp;lt;tt&amp;gt;basicTempo&amp;lt;/tt&amp;gt; value, however, the official Note editor overrides that default value with 120.&lt;br /&gt;
&lt;br /&gt;
The frequency is calculated with this formula:&lt;br /&gt;
&lt;br /&gt;
 frequency = bpm * tickBeat / 60&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
{{BeginFileFormatTools|Type=audio}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = Note&lt;br /&gt;
| Platform = DOS&lt;br /&gt;
| canPlay = Yes&lt;br /&gt;
| canCreate = Yes&lt;br /&gt;
| canModify = Yes&lt;br /&gt;
| canExport = No&lt;br /&gt;
| canImport = Yes; [[IMS Format|.ims]]&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = Yes&lt;br /&gt;
| notes = Official player and editor&lt;br /&gt;
}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = SOP Play&lt;br /&gt;
| Platform = Windows 9x&lt;br /&gt;
| canPlay = Yes&lt;br /&gt;
| canCreate = No&lt;br /&gt;
| canModify = No&lt;br /&gt;
| canExport = No&lt;br /&gt;
| canImport = No&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = No&lt;br /&gt;
| notes = Uses direct output to OPL chip&lt;br /&gt;
}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = Testing SOP&lt;br /&gt;
| Platform = DOS&lt;br /&gt;
| canPlay = Yes&lt;br /&gt;
| canCreate = No&lt;br /&gt;
| canModify = No&lt;br /&gt;
| canExport = No&lt;br /&gt;
| canImport = No&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = No&lt;br /&gt;
| notes = Open-source player&lt;br /&gt;
}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = Grassman software IMS/ROL/SOP Player&lt;br /&gt;
| Platform = Windows/Winamp&lt;br /&gt;
| canPlay = Yes&lt;br /&gt;
| canCreate = No&lt;br /&gt;
| canModify = No&lt;br /&gt;
| canExport = No&lt;br /&gt;
| canImport = No&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = No&lt;br /&gt;
| notes = Uses emulated output&lt;br /&gt;
}}&lt;br /&gt;
{{EndFileFormatTools}}&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* http://www.vogons.org/viewtopic.php?f=5&amp;amp;t=37849 - topic on VOGONS&lt;br /&gt;
* https://adplug.github.io/library/entry/Note10b2.html - AdPlug Library entry&lt;br /&gt;
* [[ROL Format]] - similar format&lt;br /&gt;
&lt;br /&gt;
== Credits ==&lt;br /&gt;
&lt;br /&gt;
This file format was described by Park Jeenhong in 1996 and then adapted and supplemented by [[User:binarymaster|binarymaster]].  If you find this information helpful in a project you&#039;re working on, please give credit where credit is due.  (A link back to this wiki would be nice too!)&lt;/div&gt;</summary>
		<author><name>Binarymaster</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=SOP_Format&amp;diff=7031</id>
		<title>SOP Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=SOP_Format&amp;diff=7031"/>
		<updated>2017-01-28T12:52:38Z</updated>

		<summary type="html">&lt;p&gt;Binarymaster: Grammar fixes&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NeedMoreInfo}}&lt;br /&gt;
{{Music Infobox&lt;br /&gt;
 | Type = Custom&lt;br /&gt;
 | Instruments = OPL&lt;br /&gt;
 | NumChannels = 9 or 11 (OPL2), 18 or 20 (OPL3)&lt;br /&gt;
 | NumTracks = 20&lt;br /&gt;
 | NumPatterns = 1&lt;br /&gt;
 | NumOrders = 0&lt;br /&gt;
 | Tags = File name, Title, Comment, Instrument names&lt;br /&gt;
 | Games = None&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;SOP Format&#039;&#039;&#039; was created by Lee Ho Bum (sopepos) for the &#039;&#039;&#039;Note&#039;&#039;&#039; OPL3 music sequencer.&lt;br /&gt;
&lt;br /&gt;
== File format ==&lt;br /&gt;
&lt;br /&gt;
=== Header ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data Type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[char]][7]&amp;lt;/tt&amp;gt; || signature || Header signature (must be &amp;quot;&amp;lt;tt&amp;gt;sopepos&amp;lt;/tt&amp;gt;&amp;quot;)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT8]]&amp;lt;/tt&amp;gt; || majorVersion || Major version number (normally 0)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || minorVersion || Minor version number (normally 1)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[BYTE]]&amp;lt;/tt&amp;gt; || padding || Unused, must be zero&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[13]&amp;lt;/tt&amp;gt; || fileName || File-name / short-name, null-terminated&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[31]&amp;lt;/tt&amp;gt; || title || Song-title, null-terminated&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || percussive || OPL rhythm mode: 0 = melodic, 1 = percussive&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || padding || Unused, must be zero&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || tickBeat || Number of ticks-per-beat&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || padding || Unused, must be zero&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || beatMeasure || Number of beats-per-measure (normally 4)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || basicTempo || Song-tempo, in beats-per-minute (normally 120)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[13]&amp;lt;/tt&amp;gt; || comment || Comment string, unused&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || nTracks || Number of tracks&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || nInsts || Number of instruments&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || padding || Unused, must be zero&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The only known version of this format is 0.1.&lt;br /&gt;
&lt;br /&gt;
The fields &amp;lt;tt&amp;gt;tickBeat&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;beatMeasure&amp;lt;/tt&amp;gt; are used to convert ticks into beats and measures for drawing a musical staff.&lt;br /&gt;
&lt;br /&gt;
The header has a fixed size of 76 bytes, then it is followed by data-structure.&lt;br /&gt;
&lt;br /&gt;
=== Data structure ===&lt;br /&gt;
&lt;br /&gt;
The data-structure&#039;s size is dynamic, therefore, it varies depending upon the number of tracks and instruments:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data Type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE[nTracks]&amp;lt;/tt&amp;gt; || chanMode || Channel modes&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_INST[nInsts]&amp;lt;/tt&amp;gt; || insts || Instruments&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_STRK[nTracks]&amp;lt;/tt&amp;gt; || tracks || Sequenced tracks&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_CTRK&amp;lt;/tt&amp;gt; || ctrlTrack || Control track&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each section of the data-structure is described below:&lt;br /&gt;
&lt;br /&gt;
=== Channel modes ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Value !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;0x00&amp;lt;/tt&amp;gt; || Unused channel&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;0x01&amp;lt;/tt&amp;gt; || YMF-262M 4OP Mode&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;0x02&amp;lt;/tt&amp;gt; || YM-3812 2OP Mode&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Instruments ===&lt;br /&gt;
The header is followed by the instrument-block. An instrument-structure is repeated &amp;lt;tt&amp;gt;nInsts&amp;lt;/tt&amp;gt; times:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_INST&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data Type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || instType || Instrument type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[8]&amp;lt;/tt&amp;gt; || shortName || Bank instrument-name / short-name&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[19]&amp;lt;/tt&amp;gt; || longName || Long instrument-name&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE[]&amp;lt;/tt&amp;gt; || instData || Instrument data&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
An instrument&#039;s data-size varies depending upon the instrument&#039;s type:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type !! Size !! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 22 || Melody (YMF-262M, 4OP Mode)&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 11 || Melody (YM-3812, 2OP Mode)&lt;br /&gt;
|-&lt;br /&gt;
| 6 || 11 || Bass Drum&lt;br /&gt;
|-&lt;br /&gt;
| 7 || 11 || Snare Drum&lt;br /&gt;
|-&lt;br /&gt;
| 8 || 11 || Tom Tom&lt;br /&gt;
|-&lt;br /&gt;
| 9 || 11 || Cymbal&lt;br /&gt;
|-&lt;br /&gt;
| 10 || 11 || Hi-Hat&lt;br /&gt;
|-&lt;br /&gt;
| 12 || 0 || Unused instrument (comment)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The actual instrument-data is merely just a dump of the OPL registers:&lt;br /&gt;
&lt;br /&gt;
==== 2OP Mode instrument data ====&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Data Type!!Name!!OPL Base Register!!Description&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModChar||0x20||Modulator characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModScale||0x40||Modulator key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModAttack||0x60||Modulator attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModSustain||0x80||Modulator sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModWaveSel||0xE0||Modulator wave-select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iFeedback||0xC0||Feedback/connection&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarChar||0x23||Carrier characteristic (only melody instruments and Bass Drum)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarScale||0x43||Carrier key scaling/output level (only melody instruments)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarAttack||0x63||Carrier attack/decay level (only melody instruments)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarSustain||0x83||Carrier sustain/release level (only melody instruments)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarWaveSel||0xE3||Carrier wave-select (only melody instruments)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== 4OP Mode instrument data ====&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Data Type!!Name!!OPL Base Register!!Description&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Char||0x20||Operator 1 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Scale||0x40||Operator 1 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Attack||0x60||Operator 1 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Sustain||0x80||Operator 1 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1WaveSel||0xE0||Operator 1 wave-select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Feedback||0xC0||Operator 1 feedback/connection&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Char||0x23||Operator 2 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Scale||0x43||Operator 2 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Attack||0x63||Operator 2 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Sustain||0x83||Operator 2 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2WaveSel||0xE3||Operator 2 wave-select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Char||0x28||Operator 3 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Scale||0x48||Operator 3 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Attack||0x68||Operator 3 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Sustain||0x88||Operator 3 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3WaveSel||0xE8||Operator 3 wave-select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Feedback||0xC8||Operator 3 feedback/connection&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Char||0x2B||Operator 4 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Scale||0x4B||Operator 4 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Attack||0x6B||Operator 4 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Sustain||0x8B||Operator 4 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4WaveSel||0xEB||Operator 4 wave-select&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Sequenced tracks ===&lt;br /&gt;
&lt;br /&gt;
The instrument-block is followed by all sequenced tracks, which contain the music&#039;s events:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_STRK&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data Type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || numEvents || Number of events in track&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT32LE]]&amp;lt;/tt&amp;gt; || dataSize || Track&#039;s data-size, in bytes&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_EVNT[numEvents]&amp;lt;/tt&amp;gt; || events || Track events&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_EVNT&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data Type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || ticks || Delta-ticks (change position)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || event || Event code&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_EVAL&amp;lt;/tt&amp;gt; || value || Event structure&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_EVAL&amp;lt;/tt&amp;gt; structure varies depending upon the event-code value:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Event Code !! Description !! Event Structure&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;center&amp;gt;1&amp;lt;/center&amp;gt; || Special Event || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; value&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;center&amp;gt;2&amp;lt;/center&amp;gt; || Note On || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; pitch, &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; length (in ticks)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;center&amp;gt;4&amp;lt;/center&amp;gt; || Change Volume || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; volume&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;center&amp;gt;5&amp;lt;/center&amp;gt; || Change Pitch || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; pitch (&amp;lt;tt&amp;gt;0x64&amp;lt;/tt&amp;gt; (100) is a center value)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;center&amp;gt;6&amp;lt;/center&amp;gt; || Instrument Change || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; number&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;center&amp;gt;7&amp;lt;/center&amp;gt; || Set Panning || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; panning (0 - right, 1 - middle, 2 - left)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Special Event ====&lt;br /&gt;
&lt;br /&gt;
This event has no effect on normal playback.&lt;br /&gt;
&lt;br /&gt;
==== Pitch Change ====&lt;br /&gt;
&lt;br /&gt;
The pitch is a signed char type with a value between -100 and +100. The actual pitch setting is the pitch of the current sound plus the frequency of the pending sound. Its combined value can be calculated as a percentage. That is, when the pitch is +50 and the current frequency is 153, and if the pending frequency is 163, then, the actual output frequency can be calculated like this:&lt;br /&gt;
&lt;br /&gt;
 153 + (163-153) * 50/100 = 158&lt;br /&gt;
&lt;br /&gt;
=== Control track ===&lt;br /&gt;
&lt;br /&gt;
The last block in a SOP file is the control-track. It is used to control global playback parameters.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_CTRK&amp;lt;/tt&amp;gt; structure is similar to &amp;lt;tt&amp;gt;SOP_STRK&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data Type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || numEvents || Number of control-events in track&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT32LE]]&amp;lt;/tt&amp;gt; || dataSize || Control-track data-size, in bytes&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_CEVT[numEvents]&amp;lt;/tt&amp;gt; || events || Control-track events&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_CEVT&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data Type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || ticks || Delta-ticks (change position)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || event || Control-event code&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_CVAL&amp;lt;/tt&amp;gt; || value || Control-event structure&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_CVAL&amp;lt;/tt&amp;gt; structure varies depending upon the control-event code value:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Event Code !! Description !! Event Structure&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;center&amp;gt;3&amp;lt;/center&amp;gt; || Change Tempo || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; tempo&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;center&amp;gt;8&amp;lt;/center&amp;gt; || Global Volume || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; volume&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Change Tempo ====&lt;br /&gt;
&lt;br /&gt;
This event updates the tempo value. If it was not set before, then, it defaults to the &amp;lt;tt&amp;gt;basicTempo&amp;lt;/tt&amp;gt; value, however, the official Note editor overrides that default value with 120.&lt;br /&gt;
&lt;br /&gt;
The frequency is calculated with this formula {{TODO|check it later}}:&lt;br /&gt;
&lt;br /&gt;
 frequency = tempo * tickBeat&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
{{BeginFileFormatTools|Type=audio}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = Note&lt;br /&gt;
| Platform = DOS&lt;br /&gt;
| canPlay = Yes&lt;br /&gt;
| canCreate = Yes&lt;br /&gt;
| canModify = Yes&lt;br /&gt;
| canExport = No&lt;br /&gt;
| canImport = Yes; [[IMS Format|.ims]]&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = Yes&lt;br /&gt;
| notes = Official player and editor&lt;br /&gt;
}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = SOP Play&lt;br /&gt;
| Platform = Windows 9x&lt;br /&gt;
| canPlay = Yes&lt;br /&gt;
| canCreate = No&lt;br /&gt;
| canModify = No&lt;br /&gt;
| canExport = No&lt;br /&gt;
| canImport = No&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = No&lt;br /&gt;
| notes = Uses direct output to OPL chip&lt;br /&gt;
}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = Testing SOP&lt;br /&gt;
| Platform = DOS&lt;br /&gt;
| canPlay = Yes&lt;br /&gt;
| canCreate = No&lt;br /&gt;
| canModify = No&lt;br /&gt;
| canExport = No&lt;br /&gt;
| canImport = No&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = No&lt;br /&gt;
| notes = Open-source player&lt;br /&gt;
}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = Grassman software IMS/ROL/SOP Player&lt;br /&gt;
| Platform = Windows/Winamp&lt;br /&gt;
| canPlay = Yes&lt;br /&gt;
| canCreate = No&lt;br /&gt;
| canModify = No&lt;br /&gt;
| canExport = No&lt;br /&gt;
| canImport = No&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = No&lt;br /&gt;
| notes = Uses emulated output&lt;br /&gt;
}}&lt;br /&gt;
{{EndFileFormatTools}}&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* http://www.vogons.org/viewtopic.php?f=5&amp;amp;t=37849 - topic on VOGONS&lt;br /&gt;
* https://adplug.github.io/library/entry/Note10b2.html - AdPlug Library entry&lt;br /&gt;
* [[ROL Format]] - similar format&lt;br /&gt;
&lt;br /&gt;
== Credits ==&lt;br /&gt;
&lt;br /&gt;
This file format was described by Park Jeenhong in 1996 and then adapted and supplemented by [[User:binarymaster|binarymaster]].  If you find this information helpful in a project you&#039;re working on, please give credit where credit is due.  (A link back to this wiki would be nice too!)&lt;/div&gt;</summary>
		<author><name>Binarymaster</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=SOP_Format&amp;diff=7030</id>
		<title>SOP Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=SOP_Format&amp;diff=7030"/>
		<updated>2017-01-13T22:21:28Z</updated>

		<summary type="html">&lt;p&gt;Binarymaster: /* Header */ update nInsts&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NeedMoreInfo}}&lt;br /&gt;
{{Music Infobox&lt;br /&gt;
 | Type = Custom&lt;br /&gt;
 | Instruments = OPL&lt;br /&gt;
 | NumChannels = 9 or 11 (OPL2), 18 or 20 (OPL3)&lt;br /&gt;
 | NumTracks = 20&lt;br /&gt;
 | NumPatterns = 1&lt;br /&gt;
 | NumOrders = 0&lt;br /&gt;
 | Tags = File name, Title, Comment, Instrument names&lt;br /&gt;
 | Games = None&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;SOP Format&#039;&#039;&#039; is created by Lee Ho Bum (sopepos) for the &#039;&#039;&#039;Note&#039;&#039;&#039; OPL3 music sequencer.&lt;br /&gt;
&lt;br /&gt;
== File format ==&lt;br /&gt;
&lt;br /&gt;
=== Header ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[char]][7]&amp;lt;/tt&amp;gt; || signature || Header signature (must be &amp;quot;&amp;lt;tt&amp;gt;sopepos&amp;lt;/tt&amp;gt;&amp;quot;)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT8]]&amp;lt;/tt&amp;gt; || majorVersion || Major version number (usually 0)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || minorVersion || Minor version number (usually 1)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[BYTE]]&amp;lt;/tt&amp;gt; || padding || Unused, must be zero&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[13]&amp;lt;/tt&amp;gt; || fileName || File name / short name, null terminated&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[31]&amp;lt;/tt&amp;gt; || title || Song title, null terminated&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || percussive || OPL rhythm mode: 0 = melodic, 1 = percussive&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || padding || Unused, must be zero&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || tickBeat || Number of ticks per beat&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || padding || Unused, must be zero&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || beatMeasure || Number of beats per measure (usually 4)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || basicTempo || Song tempo, in beats-per-minute (usually 120)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[13]&amp;lt;/tt&amp;gt; || comment || Comment string, unused&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || nTracks || Number of tracks&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || nInsts || Number of instruments&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || padding || Unused, must be zero&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The only known version of this format is 0.1.&lt;br /&gt;
&lt;br /&gt;
The fields &amp;lt;tt&amp;gt;tickBeat&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;beatMeasure&amp;lt;/tt&amp;gt; are used to convert ticks into beats and measures for drawing a musical staff.&lt;br /&gt;
&lt;br /&gt;
Header have fixed size of 76 bytes. Then it&#039;s followed by data structure.&lt;br /&gt;
&lt;br /&gt;
=== Data structure ===&lt;br /&gt;
&lt;br /&gt;
Data structure size is dynamic and depending on number of tracks and instruments.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE[nTracks]&amp;lt;/tt&amp;gt; || chanMode || Channel modes&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_INST[nInsts]&amp;lt;/tt&amp;gt; || insts || Instruments&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_STRK[nTracks]&amp;lt;/tt&amp;gt; || tracks || Sequenced tracks&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_CTRK&amp;lt;/tt&amp;gt; || ctrlTrack || Control track&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each section of data structure is described below.&lt;br /&gt;
&lt;br /&gt;
=== Channel modes ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Value !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;0x00&amp;lt;/tt&amp;gt; || Unused channel&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;0x01&amp;lt;/tt&amp;gt; || YMF-262M 4OP Mode&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;0x02&amp;lt;/tt&amp;gt; || YM-3812 2OP Mode&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Instruments ===&lt;br /&gt;
Header is followed by instruments block. Instrument structures are repeated &amp;lt;tt&amp;gt;nInsts&amp;lt;/tt&amp;gt; times.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_INST&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || instType || Instrument type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[8]&amp;lt;/tt&amp;gt; || shortName || Bank instrument name / short name&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[19]&amp;lt;/tt&amp;gt; || longName || Long instrument name&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE[]&amp;lt;/tt&amp;gt; || instData || Instrument data&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Instrument data size depends on instrument type:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type !! Size !! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 22 || Melody (YMF-262M, 4OP Mode)&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 11 || Melody (YM-3812, 2OP Mode)&lt;br /&gt;
|-&lt;br /&gt;
| 6 || 11 || Bass Drum&lt;br /&gt;
|-&lt;br /&gt;
| 7 || 11 || Snare Drum&lt;br /&gt;
|-&lt;br /&gt;
| 8 || 11 || Tom Tom&lt;br /&gt;
|-&lt;br /&gt;
| 9 || 11 || Cymbal&lt;br /&gt;
|-&lt;br /&gt;
| 10 || 11 || Hi-Hat&lt;br /&gt;
|-&lt;br /&gt;
| 12 || 0 || Unused instrument (comment)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Actual instrument data is just OPL registers dump.&lt;br /&gt;
&lt;br /&gt;
==== 2OP Mode instrument data ====&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Data type!!Name!!OPL base register!!Description&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModChar||0x20||Modulator characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModScale||0x40||Modulator key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModAttack||0x60||Modulator attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModSustain||0x80||Modulator sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModWaveSel||0xE0||Modulator wave select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iFeedback||0xC0||Feedback/connection&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarChar||0x23||Carrier characteristic (only melody instruments and bass drum)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarScale||0x43||Carrier key scaling/output level (only melody instruments)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarAttack||0x63||Carrier attack/decay level (only melody instruments)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarSustain||0x83||Carrier sustain/release level (only melody instruments)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarWaveSel||0xE3||Carrier wave select (only melody instruments)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== 4OP Mode instrument data ====&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Data type!!Name!!OPL base register!!Description&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Char||0x20||Operator 1 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Scale||0x40||Operator 1 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Attack||0x60||Operator 1 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Sustain||0x80||Operator 1 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1WaveSel||0xE0||Operator 1 wave select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Feedback||0xC0||Operator 1 feedback/connection&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Char||0x23||Operator 2 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Scale||0x43||Operator 2 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Attack||0x63||Operator 2 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Sustain||0x83||Operator 2 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2WaveSel||0xE3||Operator 2 wave select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Char||0x28||Operator 3 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Scale||0x48||Operator 3 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Attack||0x68||Operator 3 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Sustain||0x88||Operator 3 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3WaveSel||0xE8||Operator 3 wave select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Feedback||0xC8||Operator 3 feedback/connection&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Char||0x2B||Operator 4 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Scale||0x4B||Operator 4 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Attack||0x6B||Operator 4 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Sustain||0x8B||Operator 4 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4WaveSel||0xEB||Operator 4 wave select&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Sequenced tracks ===&lt;br /&gt;
&lt;br /&gt;
Instrument block is followed by sequenced tracks, containing the music events.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_STRK&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || numEvents || Number of events in track&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT32LE]]&amp;lt;/tt&amp;gt; || dataSize || Track data size in bytes&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_EVNT[numEvents]&amp;lt;/tt&amp;gt; || events || Track events&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_EVNT&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || ticks || Delta ticks (change position)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || event || Event code&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_EVAL&amp;lt;/tt&amp;gt; || value || Event structure&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_EVAL&amp;lt;/tt&amp;gt; structure is depending on event code:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Event code !! Description !! Event structure&lt;br /&gt;
|-&lt;br /&gt;
| 1 || Special Event || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; value&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Note On || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; pitch, &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; length (in ticks)&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Change Volume || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; volume&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Change Pitch || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; pitch (&amp;lt;tt&amp;gt;0x64&amp;lt;/tt&amp;gt; (100) is a center value)&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Instrument Change || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; number&lt;br /&gt;
|-&lt;br /&gt;
| 7 || Set Panning || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; panning (0 - right, 1 - middle, 2 - left)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Special Event ====&lt;br /&gt;
&lt;br /&gt;
This event is meaningless in normal playback.&lt;br /&gt;
&lt;br /&gt;
==== Pitch Change ====&lt;br /&gt;
&lt;br /&gt;
The pitch is a signed char type with a value between -100 and +100. The actual pitch setting is the pitch of the current sound plus the frequency of the next sound - the value can be calculated as a percentage. That is, when the pitch is +50 and the current frequency is 153, if the next frequency is 163, then actual output frequency is calculated like this:&lt;br /&gt;
&lt;br /&gt;
 153 + (163-153) * 50/100 = 158&lt;br /&gt;
&lt;br /&gt;
=== Control track ===&lt;br /&gt;
&lt;br /&gt;
The last block in the file is control track, it used to control global playback parameters.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_CTRK&amp;lt;/tt&amp;gt; structure is similar to &amp;lt;tt&amp;gt;SOP_STRK&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || numEvents || Number of control events in track&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT32LE]]&amp;lt;/tt&amp;gt; || dataSize || Control track data size in bytes&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_CEVT[numEvents]&amp;lt;/tt&amp;gt; || events || Control track events&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_CEVT&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || ticks || Delta ticks (change position)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || event || Control event code&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_CVAL&amp;lt;/tt&amp;gt; || value || Control event structure&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_CVAL&amp;lt;/tt&amp;gt; structure is depending on control event code:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Event code !! Description !! Event structure&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Change Tempo || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; tempo&lt;br /&gt;
|-&lt;br /&gt;
| 8 || Global Volume || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; volume&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Change Tempo ====&lt;br /&gt;
&lt;br /&gt;
This event updates the tempo value. If it wasn&#039;t set before, it comes from &amp;lt;tt&amp;gt;basicTempo&amp;lt;/tt&amp;gt; value, however official Note editor overrides the default value to 120.&lt;br /&gt;
&lt;br /&gt;
The frequency is calculated with this formula {{TODO|check it later}}:&lt;br /&gt;
&lt;br /&gt;
 frequency = tempo * tickBeat&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
{{BeginFileFormatTools|Type=audio}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = Note&lt;br /&gt;
| Platform = DOS&lt;br /&gt;
| canPlay = Yes&lt;br /&gt;
| canCreate = Yes&lt;br /&gt;
| canModify = Yes&lt;br /&gt;
| canExport = No&lt;br /&gt;
| canImport = Yes; [[IMS Format|.ims]]&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = Yes&lt;br /&gt;
| notes = Official player and editor&lt;br /&gt;
}}&lt;br /&gt;
{{EndFileFormatTools}}&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* http://www.vogons.org/viewtopic.php?f=5&amp;amp;t=37849 - topic on VOGONS&lt;br /&gt;
* https://adplug.github.io/library/entry/Note10b2.html - AdPlug Library entry&lt;br /&gt;
* [[ROL Format]] - similar format&lt;br /&gt;
&lt;br /&gt;
== Credits ==&lt;br /&gt;
&lt;br /&gt;
This file format was described by Park Jeenhong in 1996 and then adapted and supplemented by [[User:binarymaster|binarymaster]].  If you find this information helpful in a project you&#039;re working on, please give credit where credit is due.  (A link back to this wiki would be nice too!)&lt;/div&gt;</summary>
		<author><name>Binarymaster</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=SOP_Format&amp;diff=7029</id>
		<title>SOP Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=SOP_Format&amp;diff=7029"/>
		<updated>2017-01-11T18:42:09Z</updated>

		<summary type="html">&lt;p&gt;Binarymaster: /* Header */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NeedMoreInfo}}&lt;br /&gt;
{{Music Infobox&lt;br /&gt;
 | Type = Custom&lt;br /&gt;
 | Instruments = OPL&lt;br /&gt;
 | NumChannels = 9 or 11 (OPL2), 18 or 20 (OPL3)&lt;br /&gt;
 | NumTracks = 20&lt;br /&gt;
 | NumPatterns = 1&lt;br /&gt;
 | NumOrders = 0&lt;br /&gt;
 | Tags = File name, Title, Comment, Instrument names&lt;br /&gt;
 | Games = None&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;SOP Format&#039;&#039;&#039; is created by Lee Ho Bum (sopepos) for the &#039;&#039;&#039;Note&#039;&#039;&#039; OPL3 music sequencer.&lt;br /&gt;
&lt;br /&gt;
== File format ==&lt;br /&gt;
&lt;br /&gt;
=== Header ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[char]][7]&amp;lt;/tt&amp;gt; || signature || Header signature (must be &amp;quot;&amp;lt;tt&amp;gt;sopepos&amp;lt;/tt&amp;gt;&amp;quot;)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT8]]&amp;lt;/tt&amp;gt; || majorVersion || Major version number (usually 0)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || minorVersion || Minor version number (usually 1)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[BYTE]]&amp;lt;/tt&amp;gt; || padding || Unused, must be zero&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[13]&amp;lt;/tt&amp;gt; || fileName || File name / short name, null terminated&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[31]&amp;lt;/tt&amp;gt; || title || Song title, null terminated&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || percussive || OPL rhythm mode: 0 = melodic, 1 = percussive&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || padding || Unused, must be zero&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || tickBeat || Number of ticks per beat&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || padding || Unused, must be zero&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || beatMeasure || Number of beats per measure (usually 4)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || basicTempo || Song tempo, in beats-per-minute (usually 120)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[13]&amp;lt;/tt&amp;gt; || comment || Comment string, unused&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || nTracks || Number of tracks&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT16LE]]&amp;lt;/tt&amp;gt; || nInsts || Number of instruments&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The only known version of this format is 0.1.&lt;br /&gt;
&lt;br /&gt;
The fields &amp;lt;tt&amp;gt;tickBeat&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;beatMeasure&amp;lt;/tt&amp;gt; are used to convert ticks into beats and measures for drawing a musical staff.&lt;br /&gt;
&lt;br /&gt;
Header have fixed size of 76 bytes. Then it&#039;s followed by data structure.&lt;br /&gt;
&lt;br /&gt;
=== Data structure ===&lt;br /&gt;
&lt;br /&gt;
Data structure size is dynamic and depending on number of tracks and instruments.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE[nTracks]&amp;lt;/tt&amp;gt; || chanMode || Channel modes&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_INST[nInsts]&amp;lt;/tt&amp;gt; || insts || Instruments&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_STRK[nTracks]&amp;lt;/tt&amp;gt; || tracks || Sequenced tracks&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_CTRK&amp;lt;/tt&amp;gt; || ctrlTrack || Control track&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each section of data structure is described below.&lt;br /&gt;
&lt;br /&gt;
=== Channel modes ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Value !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;0x00&amp;lt;/tt&amp;gt; || Unused channel&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;0x01&amp;lt;/tt&amp;gt; || YMF-262M 4OP Mode&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;0x02&amp;lt;/tt&amp;gt; || YM-3812 2OP Mode&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Instruments ===&lt;br /&gt;
Header is followed by instruments block. Instrument structures are repeated &amp;lt;tt&amp;gt;nInsts&amp;lt;/tt&amp;gt; times.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_INST&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || instType || Instrument type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[8]&amp;lt;/tt&amp;gt; || shortName || Bank instrument name / short name&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[19]&amp;lt;/tt&amp;gt; || longName || Long instrument name&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE[]&amp;lt;/tt&amp;gt; || instData || Instrument data&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Instrument data size depends on instrument type:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type !! Size !! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 22 || Melody (YMF-262M, 4OP Mode)&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 11 || Melody (YM-3812, 2OP Mode)&lt;br /&gt;
|-&lt;br /&gt;
| 6 || 11 || Bass Drum&lt;br /&gt;
|-&lt;br /&gt;
| 7 || 11 || Snare Drum&lt;br /&gt;
|-&lt;br /&gt;
| 8 || 11 || Tom Tom&lt;br /&gt;
|-&lt;br /&gt;
| 9 || 11 || Cymbal&lt;br /&gt;
|-&lt;br /&gt;
| 10 || 11 || Hi-Hat&lt;br /&gt;
|-&lt;br /&gt;
| 12 || 0 || Unused instrument (comment)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Actual instrument data is just OPL registers dump.&lt;br /&gt;
&lt;br /&gt;
==== 2OP Mode instrument data ====&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Data type!!Name!!OPL base register!!Description&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModChar||0x20||Modulator characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModScale||0x40||Modulator key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModAttack||0x60||Modulator attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModSustain||0x80||Modulator sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModWaveSel||0xE0||Modulator wave select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iFeedback||0xC0||Feedback/connection&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarChar||0x23||Carrier characteristic (only melody instruments and bass drum)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarScale||0x43||Carrier key scaling/output level (only melody instruments)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarAttack||0x63||Carrier attack/decay level (only melody instruments)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarSustain||0x83||Carrier sustain/release level (only melody instruments)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarWaveSel||0xE3||Carrier wave select (only melody instruments)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== 4OP Mode instrument data ====&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Data type!!Name!!OPL base register!!Description&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Char||0x20||Operator 1 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Scale||0x40||Operator 1 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Attack||0x60||Operator 1 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Sustain||0x80||Operator 1 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1WaveSel||0xE0||Operator 1 wave select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Feedback||0xC0||Operator 1 feedback/connection&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Char||0x23||Operator 2 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Scale||0x43||Operator 2 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Attack||0x63||Operator 2 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Sustain||0x83||Operator 2 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2WaveSel||0xE3||Operator 2 wave select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Char||0x28||Operator 3 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Scale||0x48||Operator 3 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Attack||0x68||Operator 3 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Sustain||0x88||Operator 3 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3WaveSel||0xE8||Operator 3 wave select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Feedback||0xC8||Operator 3 feedback/connection&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Char||0x2B||Operator 4 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Scale||0x4B||Operator 4 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Attack||0x6B||Operator 4 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Sustain||0x8B||Operator 4 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4WaveSel||0xEB||Operator 4 wave select&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Sequenced tracks ===&lt;br /&gt;
&lt;br /&gt;
Instrument block is followed by sequenced tracks, containing the music events.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_STRK&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || numEvents || Number of events in track&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT32LE]]&amp;lt;/tt&amp;gt; || dataSize || Track data size in bytes&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_EVNT[numEvents]&amp;lt;/tt&amp;gt; || events || Track events&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_EVNT&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || ticks || Delta ticks (change position)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || event || Event code&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_EVAL&amp;lt;/tt&amp;gt; || value || Event structure&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_EVAL&amp;lt;/tt&amp;gt; structure is depending on event code:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Event code !! Description !! Event structure&lt;br /&gt;
|-&lt;br /&gt;
| 1 || Special Event || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; value&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Note On || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; pitch, &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; length (in ticks)&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Change Volume || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; volume&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Change Pitch || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; pitch (&amp;lt;tt&amp;gt;0x64&amp;lt;/tt&amp;gt; (100) is a center value)&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Instrument Change || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; number&lt;br /&gt;
|-&lt;br /&gt;
| 7 || Set Panning || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; panning (0 - right, 1 - middle, 2 - left)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Special Event ====&lt;br /&gt;
&lt;br /&gt;
This event is meaningless in normal playback.&lt;br /&gt;
&lt;br /&gt;
==== Pitch Change ====&lt;br /&gt;
&lt;br /&gt;
The pitch is a signed char type with a value between -100 and +100. The actual pitch setting is the pitch of the current sound plus the frequency of the next sound - the value can be calculated as a percentage. That is, when the pitch is +50 and the current frequency is 153, if the next frequency is 163, then actual output frequency is calculated like this:&lt;br /&gt;
&lt;br /&gt;
 153 + (163-153) * 50/100 = 158&lt;br /&gt;
&lt;br /&gt;
=== Control track ===&lt;br /&gt;
&lt;br /&gt;
The last block in the file is control track, it used to control global playback parameters.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_CTRK&amp;lt;/tt&amp;gt; structure is similar to &amp;lt;tt&amp;gt;SOP_STRK&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || numEvents || Number of control events in track&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT32LE]]&amp;lt;/tt&amp;gt; || dataSize || Control track data size in bytes&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_CEVT[numEvents]&amp;lt;/tt&amp;gt; || events || Control track events&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_CEVT&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || ticks || Delta ticks (change position)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || event || Control event code&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_CVAL&amp;lt;/tt&amp;gt; || value || Control event structure&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_CVAL&amp;lt;/tt&amp;gt; structure is depending on control event code:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Event code !! Description !! Event structure&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Change Tempo || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; tempo&lt;br /&gt;
|-&lt;br /&gt;
| 8 || Global Volume || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; volume&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Change Tempo ====&lt;br /&gt;
&lt;br /&gt;
This event updates the tempo value. If it wasn&#039;t set before, it comes from &amp;lt;tt&amp;gt;basicTempo&amp;lt;/tt&amp;gt; value, however official Note editor overrides the default value to 120.&lt;br /&gt;
&lt;br /&gt;
The frequency is calculated with this formula {{TODO|check it later}}:&lt;br /&gt;
&lt;br /&gt;
 frequency = tempo * tickBeat&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
{{BeginFileFormatTools|Type=audio}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = Note&lt;br /&gt;
| Platform = DOS&lt;br /&gt;
| canPlay = Yes&lt;br /&gt;
| canCreate = Yes&lt;br /&gt;
| canModify = Yes&lt;br /&gt;
| canExport = No&lt;br /&gt;
| canImport = Yes; [[IMS Format|.ims]]&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = Yes&lt;br /&gt;
| notes = Official player and editor&lt;br /&gt;
}}&lt;br /&gt;
{{EndFileFormatTools}}&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* http://www.vogons.org/viewtopic.php?f=5&amp;amp;t=37849 - topic on VOGONS&lt;br /&gt;
* https://adplug.github.io/library/entry/Note10b2.html - AdPlug Library entry&lt;br /&gt;
* [[ROL Format]] - similar format&lt;br /&gt;
&lt;br /&gt;
== Credits ==&lt;br /&gt;
&lt;br /&gt;
This file format was described by Park Jeenhong in 1996 and then adapted and supplemented by [[User:binarymaster|binarymaster]].  If you find this information helpful in a project you&#039;re working on, please give credit where credit is due.  (A link back to this wiki would be nice too!)&lt;/div&gt;</summary>
		<author><name>Binarymaster</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=SOP_Format&amp;diff=7028</id>
		<title>SOP Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=SOP_Format&amp;diff=7028"/>
		<updated>2017-01-11T18:26:23Z</updated>

		<summary type="html">&lt;p&gt;Binarymaster: /* Header */ comment string&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NeedMoreInfo}}&lt;br /&gt;
{{Music Infobox&lt;br /&gt;
 | Type = Custom&lt;br /&gt;
 | Instruments = OPL&lt;br /&gt;
 | NumChannels = 9 or 11 (OPL2), 18 or 20 (OPL3)&lt;br /&gt;
 | NumTracks = 20&lt;br /&gt;
 | NumPatterns = 1&lt;br /&gt;
 | NumOrders = 0&lt;br /&gt;
 | Tags = File name, Title, Comment, Instrument names&lt;br /&gt;
 | Games = None&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;SOP Format&#039;&#039;&#039; is created by Lee Ho Bum (sopepos) for the &#039;&#039;&#039;Note&#039;&#039;&#039; OPL3 music sequencer.&lt;br /&gt;
&lt;br /&gt;
== File format ==&lt;br /&gt;
&lt;br /&gt;
=== Header ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[char]][7]&amp;lt;/tt&amp;gt; || signature || Header signature (must be &amp;quot;&amp;lt;tt&amp;gt;sopepos&amp;lt;/tt&amp;gt;&amp;quot;)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT8]]&amp;lt;/tt&amp;gt; || majorVersion || Major version number (usually 0)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || minorVersion || Minor version number (usually 1)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[BYTE]]&amp;lt;/tt&amp;gt; || padding || Unused, must be zero&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[13]&amp;lt;/tt&amp;gt; || fileName || File name / short name, null terminated&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[31]&amp;lt;/tt&amp;gt; || title || Song title, null terminated&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT16LE]]&amp;lt;/tt&amp;gt; || percussive || OPL rhythm mode: 0 = melodic, 1 = percussive&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || tickBeat || Number of ticks per beat&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || padding || Unused, must be zero&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || beatMeasure || Number of beats per measure (usually 4)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || basicTempo || Song tempo, in beats-per-minute (usually 120)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[13]&amp;lt;/tt&amp;gt; || comment || Comment string, unused&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || nTracks || Number of tracks&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || nInsts || Number of instruments&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The only known version of this format is 0.1.&lt;br /&gt;
&lt;br /&gt;
The fields &amp;lt;tt&amp;gt;tickBeat&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;beatMeasure&amp;lt;/tt&amp;gt; are used to convert ticks into beats and measures for drawing a musical staff.&lt;br /&gt;
&lt;br /&gt;
Header have fixed size of 76 bytes. Then it&#039;s followed by data structure.&lt;br /&gt;
&lt;br /&gt;
=== Data structure ===&lt;br /&gt;
&lt;br /&gt;
Data structure size is dynamic and depending on number of tracks and instruments.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE[nTracks]&amp;lt;/tt&amp;gt; || chanMode || Channel modes&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_INST[nInsts]&amp;lt;/tt&amp;gt; || insts || Instruments&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_STRK[nTracks]&amp;lt;/tt&amp;gt; || tracks || Sequenced tracks&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_CTRK&amp;lt;/tt&amp;gt; || ctrlTrack || Control track&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each section of data structure is described below.&lt;br /&gt;
&lt;br /&gt;
=== Channel modes ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Value !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;0x00&amp;lt;/tt&amp;gt; || Unused channel&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;0x01&amp;lt;/tt&amp;gt; || YMF-262M 4OP Mode&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;0x02&amp;lt;/tt&amp;gt; || YM-3812 2OP Mode&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Instruments ===&lt;br /&gt;
Header is followed by instruments block. Instrument structures are repeated &amp;lt;tt&amp;gt;nInsts&amp;lt;/tt&amp;gt; times.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_INST&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || instType || Instrument type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[8]&amp;lt;/tt&amp;gt; || shortName || Bank instrument name / short name&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[19]&amp;lt;/tt&amp;gt; || longName || Long instrument name&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE[]&amp;lt;/tt&amp;gt; || instData || Instrument data&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Instrument data size depends on instrument type:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type !! Size !! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 22 || Melody (YMF-262M, 4OP Mode)&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 11 || Melody (YM-3812, 2OP Mode)&lt;br /&gt;
|-&lt;br /&gt;
| 6 || 11 || Bass Drum&lt;br /&gt;
|-&lt;br /&gt;
| 7 || 11 || Snare Drum&lt;br /&gt;
|-&lt;br /&gt;
| 8 || 11 || Tom Tom&lt;br /&gt;
|-&lt;br /&gt;
| 9 || 11 || Cymbal&lt;br /&gt;
|-&lt;br /&gt;
| 10 || 11 || Hi-Hat&lt;br /&gt;
|-&lt;br /&gt;
| 12 || 0 || Unused instrument (comment)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Actual instrument data is just OPL registers dump.&lt;br /&gt;
&lt;br /&gt;
==== 2OP Mode instrument data ====&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Data type!!Name!!OPL base register!!Description&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModChar||0x20||Modulator characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModScale||0x40||Modulator key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModAttack||0x60||Modulator attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModSustain||0x80||Modulator sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModWaveSel||0xE0||Modulator wave select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iFeedback||0xC0||Feedback/connection&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarChar||0x23||Carrier characteristic (only melody instruments and bass drum)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarScale||0x43||Carrier key scaling/output level (only melody instruments)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarAttack||0x63||Carrier attack/decay level (only melody instruments)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarSustain||0x83||Carrier sustain/release level (only melody instruments)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarWaveSel||0xE3||Carrier wave select (only melody instruments)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== 4OP Mode instrument data ====&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Data type!!Name!!OPL base register!!Description&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Char||0x20||Operator 1 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Scale||0x40||Operator 1 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Attack||0x60||Operator 1 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Sustain||0x80||Operator 1 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1WaveSel||0xE0||Operator 1 wave select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Feedback||0xC0||Operator 1 feedback/connection&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Char||0x23||Operator 2 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Scale||0x43||Operator 2 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Attack||0x63||Operator 2 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Sustain||0x83||Operator 2 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2WaveSel||0xE3||Operator 2 wave select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Char||0x28||Operator 3 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Scale||0x48||Operator 3 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Attack||0x68||Operator 3 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Sustain||0x88||Operator 3 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3WaveSel||0xE8||Operator 3 wave select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Feedback||0xC8||Operator 3 feedback/connection&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Char||0x2B||Operator 4 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Scale||0x4B||Operator 4 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Attack||0x6B||Operator 4 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Sustain||0x8B||Operator 4 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4WaveSel||0xEB||Operator 4 wave select&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Sequenced tracks ===&lt;br /&gt;
&lt;br /&gt;
Instrument block is followed by sequenced tracks, containing the music events.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_STRK&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || numEvents || Number of events in track&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT32LE]]&amp;lt;/tt&amp;gt; || dataSize || Track data size in bytes&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_EVNT[numEvents]&amp;lt;/tt&amp;gt; || events || Track events&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_EVNT&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || ticks || Delta ticks (change position)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || event || Event code&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_EVAL&amp;lt;/tt&amp;gt; || value || Event structure&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_EVAL&amp;lt;/tt&amp;gt; structure is depending on event code:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Event code !! Description !! Event structure&lt;br /&gt;
|-&lt;br /&gt;
| 1 || Special Event || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; value&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Note On || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; pitch, &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; length (in ticks)&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Change Volume || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; volume&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Change Pitch || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; pitch (&amp;lt;tt&amp;gt;0x64&amp;lt;/tt&amp;gt; (100) is a center value)&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Instrument Change || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; number&lt;br /&gt;
|-&lt;br /&gt;
| 7 || Set Panning || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; panning (0 - right, 1 - middle, 2 - left)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Special Event ====&lt;br /&gt;
&lt;br /&gt;
This event is meaningless in normal playback.&lt;br /&gt;
&lt;br /&gt;
==== Pitch Change ====&lt;br /&gt;
&lt;br /&gt;
The pitch is a signed char type with a value between -100 and +100. The actual pitch setting is the pitch of the current sound plus the frequency of the next sound - the value can be calculated as a percentage. That is, when the pitch is +50 and the current frequency is 153, if the next frequency is 163, then actual output frequency is calculated like this:&lt;br /&gt;
&lt;br /&gt;
 153 + (163-153) * 50/100 = 158&lt;br /&gt;
&lt;br /&gt;
=== Control track ===&lt;br /&gt;
&lt;br /&gt;
The last block in the file is control track, it used to control global playback parameters.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_CTRK&amp;lt;/tt&amp;gt; structure is similar to &amp;lt;tt&amp;gt;SOP_STRK&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || numEvents || Number of control events in track&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT32LE]]&amp;lt;/tt&amp;gt; || dataSize || Control track data size in bytes&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_CEVT[numEvents]&amp;lt;/tt&amp;gt; || events || Control track events&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_CEVT&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || ticks || Delta ticks (change position)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || event || Control event code&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_CVAL&amp;lt;/tt&amp;gt; || value || Control event structure&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_CVAL&amp;lt;/tt&amp;gt; structure is depending on control event code:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Event code !! Description !! Event structure&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Change Tempo || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; tempo&lt;br /&gt;
|-&lt;br /&gt;
| 8 || Global Volume || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; volume&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Change Tempo ====&lt;br /&gt;
&lt;br /&gt;
This event updates the tempo value. If it wasn&#039;t set before, it comes from &amp;lt;tt&amp;gt;basicTempo&amp;lt;/tt&amp;gt; value, however official Note editor overrides the default value to 120.&lt;br /&gt;
&lt;br /&gt;
The frequency is calculated with this formula {{TODO|check it later}}:&lt;br /&gt;
&lt;br /&gt;
 frequency = tempo * tickBeat&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
{{BeginFileFormatTools|Type=audio}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = Note&lt;br /&gt;
| Platform = DOS&lt;br /&gt;
| canPlay = Yes&lt;br /&gt;
| canCreate = Yes&lt;br /&gt;
| canModify = Yes&lt;br /&gt;
| canExport = No&lt;br /&gt;
| canImport = Yes; [[IMS Format|.ims]]&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = Yes&lt;br /&gt;
| notes = Official player and editor&lt;br /&gt;
}}&lt;br /&gt;
{{EndFileFormatTools}}&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* http://www.vogons.org/viewtopic.php?f=5&amp;amp;t=37849 - topic on VOGONS&lt;br /&gt;
* https://adplug.github.io/library/entry/Note10b2.html - AdPlug Library entry&lt;br /&gt;
* [[ROL Format]] - similar format&lt;br /&gt;
&lt;br /&gt;
== Credits ==&lt;br /&gt;
&lt;br /&gt;
This file format was described by Park Jeenhong in 1996 and then adapted and supplemented by [[User:binarymaster|binarymaster]].  If you find this information helpful in a project you&#039;re working on, please give credit where credit is due.  (A link back to this wiki would be nice too!)&lt;/div&gt;</summary>
		<author><name>Binarymaster</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=SOP_Format&amp;diff=7027</id>
		<title>SOP Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=SOP_Format&amp;diff=7027"/>
		<updated>2017-01-11T13:04:01Z</updated>

		<summary type="html">&lt;p&gt;Binarymaster: /* Header */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NeedMoreInfo}}&lt;br /&gt;
{{Music Infobox&lt;br /&gt;
 | Type = Custom&lt;br /&gt;
 | Instruments = OPL&lt;br /&gt;
 | NumChannels = 9 or 11 (OPL2), 18 or 20 (OPL3)&lt;br /&gt;
 | NumTracks = 20&lt;br /&gt;
 | NumPatterns = 1&lt;br /&gt;
 | NumOrders = 0&lt;br /&gt;
 | Tags = File name, Title, Instrument names&lt;br /&gt;
 | Games = None&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;SOP Format&#039;&#039;&#039; is created by Lee Ho Bum (sopepos) for the &#039;&#039;&#039;Note&#039;&#039;&#039; OPL3 music sequencer.&lt;br /&gt;
&lt;br /&gt;
== File format ==&lt;br /&gt;
&lt;br /&gt;
=== Header ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[char]][7]&amp;lt;/tt&amp;gt; || signature || Header signature (must be &amp;quot;&amp;lt;tt&amp;gt;sopepos&amp;lt;/tt&amp;gt;&amp;quot;)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT8]]&amp;lt;/tt&amp;gt; || majorVersion || Major version number (usually 0)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || minorVersion || Minor version number (usually 1)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[BYTE]]&amp;lt;/tt&amp;gt; || padding || Unused, must be zero&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[13]&amp;lt;/tt&amp;gt; || fileName || File name / short name, null terminated&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[31]&amp;lt;/tt&amp;gt; || title || Song title, null terminated&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT16LE]]&amp;lt;/tt&amp;gt; || percussive || OPL rhythm mode: 0 = melodic, 1 = percussive&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || tickBeat || Number of ticks per beat&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || beatMeasure || Number of beats per measure (usually 4)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || basicTempo || Song tempo, in beats-per-minute (usually 120)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE[12]&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown values}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || nTracks || Number of tracks&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || nInsts || Number of instruments&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The only known version of this format is 0.1.&lt;br /&gt;
&lt;br /&gt;
The fields &amp;lt;tt&amp;gt;tickBeat&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;beatMeasure&amp;lt;/tt&amp;gt; are used to convert ticks into beats and measures for drawing a musical staff.&lt;br /&gt;
&lt;br /&gt;
Header have fixed size of 76 bytes. Then it&#039;s followed by data structure.&lt;br /&gt;
&lt;br /&gt;
=== Data structure ===&lt;br /&gt;
&lt;br /&gt;
Data structure size is dynamic and depending on number of tracks and instruments.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE[nTracks]&amp;lt;/tt&amp;gt; || chanMode || Channel modes&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_INST[nInsts]&amp;lt;/tt&amp;gt; || insts || Instruments&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_STRK[nTracks]&amp;lt;/tt&amp;gt; || tracks || Sequenced tracks&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_CTRK&amp;lt;/tt&amp;gt; || ctrlTrack || Control track&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each section of data structure is described below.&lt;br /&gt;
&lt;br /&gt;
=== Channel modes ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Value !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;0x00&amp;lt;/tt&amp;gt; || Unused channel&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;0x01&amp;lt;/tt&amp;gt; || YMF-262M 4OP Mode&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;0x02&amp;lt;/tt&amp;gt; || YM-3812 2OP Mode&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Instruments ===&lt;br /&gt;
Header is followed by instruments block. Instrument structures are repeated &amp;lt;tt&amp;gt;nInsts&amp;lt;/tt&amp;gt; times.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_INST&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || instType || Instrument type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[8]&amp;lt;/tt&amp;gt; || shortName || Bank instrument name / short name&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[19]&amp;lt;/tt&amp;gt; || longName || Long instrument name&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE[]&amp;lt;/tt&amp;gt; || instData || Instrument data&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Instrument data size depends on instrument type:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type !! Size !! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 22 || Melody (YMF-262M, 4OP Mode)&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 11 || Melody (YM-3812, 2OP Mode)&lt;br /&gt;
|-&lt;br /&gt;
| 6 || 11 || Bass Drum&lt;br /&gt;
|-&lt;br /&gt;
| 7 || 11 || Snare Drum&lt;br /&gt;
|-&lt;br /&gt;
| 8 || 11 || Tom Tom&lt;br /&gt;
|-&lt;br /&gt;
| 9 || 11 || Cymbal&lt;br /&gt;
|-&lt;br /&gt;
| 10 || 11 || Hi-Hat&lt;br /&gt;
|-&lt;br /&gt;
| 12 || 0 || Unused instrument (comment)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Actual instrument data is just OPL registers dump.&lt;br /&gt;
&lt;br /&gt;
==== 2OP Mode instrument data ====&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Data type!!Name!!OPL base register!!Description&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModChar||0x20||Modulator characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModScale||0x40||Modulator key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModAttack||0x60||Modulator attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModSustain||0x80||Modulator sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModWaveSel||0xE0||Modulator wave select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iFeedback||0xC0||Feedback/connection&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarChar||0x23||Carrier characteristic (only melody instruments and bass drum)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarScale||0x43||Carrier key scaling/output level (only melody instruments)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarAttack||0x63||Carrier attack/decay level (only melody instruments)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarSustain||0x83||Carrier sustain/release level (only melody instruments)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarWaveSel||0xE3||Carrier wave select (only melody instruments)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== 4OP Mode instrument data ====&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Data type!!Name!!OPL base register!!Description&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Char||0x20||Operator 1 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Scale||0x40||Operator 1 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Attack||0x60||Operator 1 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Sustain||0x80||Operator 1 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1WaveSel||0xE0||Operator 1 wave select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Feedback||0xC0||Operator 1 feedback/connection&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Char||0x23||Operator 2 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Scale||0x43||Operator 2 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Attack||0x63||Operator 2 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Sustain||0x83||Operator 2 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2WaveSel||0xE3||Operator 2 wave select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Char||0x28||Operator 3 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Scale||0x48||Operator 3 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Attack||0x68||Operator 3 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Sustain||0x88||Operator 3 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3WaveSel||0xE8||Operator 3 wave select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Feedback||0xC8||Operator 3 feedback/connection&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Char||0x2B||Operator 4 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Scale||0x4B||Operator 4 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Attack||0x6B||Operator 4 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Sustain||0x8B||Operator 4 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4WaveSel||0xEB||Operator 4 wave select&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Sequenced tracks ===&lt;br /&gt;
&lt;br /&gt;
Instrument block is followed by sequenced tracks, containing the music events.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_STRK&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || numEvents || Number of events in track&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT32LE]]&amp;lt;/tt&amp;gt; || dataSize || Track data size in bytes&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_EVNT[numEvents]&amp;lt;/tt&amp;gt; || events || Track events&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_EVNT&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || ticks || Delta ticks (change position)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || event || Event code&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_EVAL&amp;lt;/tt&amp;gt; || value || Event structure&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_EVAL&amp;lt;/tt&amp;gt; structure is depending on event code:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Event code !! Description !! Event structure&lt;br /&gt;
|-&lt;br /&gt;
| 1 || Special Event || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; value&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Note On || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; pitch, &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; length (in ticks)&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Change Volume || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; volume&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Change Pitch || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; pitch (&amp;lt;tt&amp;gt;0x64&amp;lt;/tt&amp;gt; (100) is a center value)&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Instrument Change || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; number&lt;br /&gt;
|-&lt;br /&gt;
| 7 || Set Panning || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; panning (0 - right, 1 - middle, 2 - left)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Special Event ====&lt;br /&gt;
&lt;br /&gt;
This event is meaningless in normal playback.&lt;br /&gt;
&lt;br /&gt;
==== Pitch Change ====&lt;br /&gt;
&lt;br /&gt;
The pitch is a signed char type with a value between -100 and +100. The actual pitch setting is the pitch of the current sound plus the frequency of the next sound - the value can be calculated as a percentage. That is, when the pitch is +50 and the current frequency is 153, if the next frequency is 163, then actual output frequency is calculated like this:&lt;br /&gt;
&lt;br /&gt;
 153 + (163-153) * 50/100 = 158&lt;br /&gt;
&lt;br /&gt;
=== Control track ===&lt;br /&gt;
&lt;br /&gt;
The last block in the file is control track, it used to control global playback parameters.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_CTRK&amp;lt;/tt&amp;gt; structure is similar to &amp;lt;tt&amp;gt;SOP_STRK&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || numEvents || Number of control events in track&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT32LE]]&amp;lt;/tt&amp;gt; || dataSize || Control track data size in bytes&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_CEVT[numEvents]&amp;lt;/tt&amp;gt; || events || Control track events&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_CEVT&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || ticks || Delta ticks (change position)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || event || Control event code&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_CVAL&amp;lt;/tt&amp;gt; || value || Control event structure&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_CVAL&amp;lt;/tt&amp;gt; structure is depending on control event code:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Event code !! Description !! Event structure&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Change Tempo || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; tempo&lt;br /&gt;
|-&lt;br /&gt;
| 8 || Global Volume || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; volume&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Change Tempo ====&lt;br /&gt;
&lt;br /&gt;
This event updates the tempo value. If it wasn&#039;t set before, it comes from &amp;lt;tt&amp;gt;basicTempo&amp;lt;/tt&amp;gt; value, however official Note editor overrides the default value to 120.&lt;br /&gt;
&lt;br /&gt;
The frequency is calculated with this formula {{TODO|check it later}}:&lt;br /&gt;
&lt;br /&gt;
 frequency = tempo * tickBeat&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
{{BeginFileFormatTools|Type=audio}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = Note&lt;br /&gt;
| Platform = DOS&lt;br /&gt;
| canPlay = Yes&lt;br /&gt;
| canCreate = Yes&lt;br /&gt;
| canModify = Yes&lt;br /&gt;
| canExport = No&lt;br /&gt;
| canImport = Yes; [[IMS Format|.ims]]&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = Yes&lt;br /&gt;
| notes = Official player and editor&lt;br /&gt;
}}&lt;br /&gt;
{{EndFileFormatTools}}&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* http://www.vogons.org/viewtopic.php?f=5&amp;amp;t=37849 - topic on VOGONS&lt;br /&gt;
* https://adplug.github.io/library/entry/Note10b2.html - AdPlug Library entry&lt;br /&gt;
* [[ROL Format]] - similar format&lt;br /&gt;
&lt;br /&gt;
== Credits ==&lt;br /&gt;
&lt;br /&gt;
This file format was described by Park Jeenhong in 1996 and then adapted and supplemented by [[User:binarymaster|binarymaster]].  If you find this information helpful in a project you&#039;re working on, please give credit where credit is due.  (A link back to this wiki would be nice too!)&lt;/div&gt;</summary>
		<author><name>Binarymaster</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=SOP_Format&amp;diff=7026</id>
		<title>SOP Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=SOP_Format&amp;diff=7026"/>
		<updated>2017-01-11T11:24:44Z</updated>

		<summary type="html">&lt;p&gt;Binarymaster: /* Change Tempo */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NeedMoreInfo}}&lt;br /&gt;
{{Music Infobox&lt;br /&gt;
 | Type = Custom&lt;br /&gt;
 | Instruments = OPL&lt;br /&gt;
 | NumChannels = 9 or 11 (OPL2), 18 or 20 (OPL3)&lt;br /&gt;
 | NumTracks = 20&lt;br /&gt;
 | NumPatterns = 1&lt;br /&gt;
 | NumOrders = 0&lt;br /&gt;
 | Tags = File name, Title, Instrument names&lt;br /&gt;
 | Games = None&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;SOP Format&#039;&#039;&#039; is created by Lee Ho Bum (sopepos) for the &#039;&#039;&#039;Note&#039;&#039;&#039; OPL3 music sequencer.&lt;br /&gt;
&lt;br /&gt;
== File format ==&lt;br /&gt;
&lt;br /&gt;
=== Header ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[char]][7]&amp;lt;/tt&amp;gt; || signature || Header signature (must be &amp;quot;&amp;lt;tt&amp;gt;sopepos&amp;lt;/tt&amp;gt;&amp;quot;)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT8]]&amp;lt;/tt&amp;gt; || majorVersion || Major version number (usually 0)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || minorVersion || Minor version number (usually 1)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[BYTE]]&amp;lt;/tt&amp;gt; || padding || Unused, must be zero&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[13]&amp;lt;/tt&amp;gt; || fileName || File name / short name, null terminated&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[31]&amp;lt;/tt&amp;gt; || title || Song title, null terminated&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT16LE]]&amp;lt;/tt&amp;gt; || percussive || OPL rhythm mode: 0 = melodic, 1 = percussive&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || tickBeat || Number of ticks per beat&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || beatMeasure || Number of beats per measure (usually 4)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || basicTempo || Song tempo, in beats-per-minute (usually 120)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || nTracks || Number of tracks&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || nInsts || Number of instruments&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The only known version of this format is 0.1.&lt;br /&gt;
&lt;br /&gt;
The fields &amp;lt;tt&amp;gt;tickBeat&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;beatMeasure&amp;lt;/tt&amp;gt; are used to convert ticks into beats and measures for drawing a musical staff.&lt;br /&gt;
&lt;br /&gt;
Header have fixed size of 76 bytes. Then it&#039;s followed by data structure.&lt;br /&gt;
&lt;br /&gt;
=== Data structure ===&lt;br /&gt;
&lt;br /&gt;
Data structure size is dynamic and depending on number of tracks and instruments.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE[nTracks]&amp;lt;/tt&amp;gt; || chanMode || Channel modes&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_INST[nInsts]&amp;lt;/tt&amp;gt; || insts || Instruments&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_STRK[nTracks]&amp;lt;/tt&amp;gt; || tracks || Sequenced tracks&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_CTRK&amp;lt;/tt&amp;gt; || ctrlTrack || Control track&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each section of data structure is described below.&lt;br /&gt;
&lt;br /&gt;
=== Channel modes ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Value !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;0x00&amp;lt;/tt&amp;gt; || Unused channel&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;0x01&amp;lt;/tt&amp;gt; || YMF-262M 4OP Mode&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;0x02&amp;lt;/tt&amp;gt; || YM-3812 2OP Mode&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Instruments ===&lt;br /&gt;
Header is followed by instruments block. Instrument structures are repeated &amp;lt;tt&amp;gt;nInsts&amp;lt;/tt&amp;gt; times.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_INST&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || instType || Instrument type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[8]&amp;lt;/tt&amp;gt; || shortName || Bank instrument name / short name&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[19]&amp;lt;/tt&amp;gt; || longName || Long instrument name&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE[]&amp;lt;/tt&amp;gt; || instData || Instrument data&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Instrument data size depends on instrument type:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type !! Size !! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 22 || Melody (YMF-262M, 4OP Mode)&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 11 || Melody (YM-3812, 2OP Mode)&lt;br /&gt;
|-&lt;br /&gt;
| 6 || 11 || Bass Drum&lt;br /&gt;
|-&lt;br /&gt;
| 7 || 11 || Snare Drum&lt;br /&gt;
|-&lt;br /&gt;
| 8 || 11 || Tom Tom&lt;br /&gt;
|-&lt;br /&gt;
| 9 || 11 || Cymbal&lt;br /&gt;
|-&lt;br /&gt;
| 10 || 11 || Hi-Hat&lt;br /&gt;
|-&lt;br /&gt;
| 12 || 0 || Unused instrument (comment)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Actual instrument data is just OPL registers dump.&lt;br /&gt;
&lt;br /&gt;
==== 2OP Mode instrument data ====&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Data type!!Name!!OPL base register!!Description&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModChar||0x20||Modulator characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModScale||0x40||Modulator key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModAttack||0x60||Modulator attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModSustain||0x80||Modulator sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModWaveSel||0xE0||Modulator wave select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iFeedback||0xC0||Feedback/connection&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarChar||0x23||Carrier characteristic (only melody instruments and bass drum)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarScale||0x43||Carrier key scaling/output level (only melody instruments)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarAttack||0x63||Carrier attack/decay level (only melody instruments)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarSustain||0x83||Carrier sustain/release level (only melody instruments)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarWaveSel||0xE3||Carrier wave select (only melody instruments)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== 4OP Mode instrument data ====&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Data type!!Name!!OPL base register!!Description&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Char||0x20||Operator 1 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Scale||0x40||Operator 1 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Attack||0x60||Operator 1 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Sustain||0x80||Operator 1 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1WaveSel||0xE0||Operator 1 wave select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Feedback||0xC0||Operator 1 feedback/connection&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Char||0x23||Operator 2 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Scale||0x43||Operator 2 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Attack||0x63||Operator 2 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Sustain||0x83||Operator 2 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2WaveSel||0xE3||Operator 2 wave select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Char||0x28||Operator 3 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Scale||0x48||Operator 3 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Attack||0x68||Operator 3 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Sustain||0x88||Operator 3 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3WaveSel||0xE8||Operator 3 wave select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Feedback||0xC8||Operator 3 feedback/connection&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Char||0x2B||Operator 4 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Scale||0x4B||Operator 4 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Attack||0x6B||Operator 4 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Sustain||0x8B||Operator 4 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4WaveSel||0xEB||Operator 4 wave select&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Sequenced tracks ===&lt;br /&gt;
&lt;br /&gt;
Instrument block is followed by sequenced tracks, containing the music events.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_STRK&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || numEvents || Number of events in track&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT32LE]]&amp;lt;/tt&amp;gt; || dataSize || Track data size in bytes&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_EVNT[numEvents]&amp;lt;/tt&amp;gt; || events || Track events&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_EVNT&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || ticks || Delta ticks (change position)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || event || Event code&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_EVAL&amp;lt;/tt&amp;gt; || value || Event structure&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_EVAL&amp;lt;/tt&amp;gt; structure is depending on event code:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Event code !! Description !! Event structure&lt;br /&gt;
|-&lt;br /&gt;
| 1 || Special Event || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; value&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Note On || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; pitch, &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; length (in ticks)&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Change Volume || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; volume&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Change Pitch || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; pitch (&amp;lt;tt&amp;gt;0x64&amp;lt;/tt&amp;gt; (100) is a center value)&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Instrument Change || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; number&lt;br /&gt;
|-&lt;br /&gt;
| 7 || Set Panning || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; panning (0 - right, 1 - middle, 2 - left)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Special Event ====&lt;br /&gt;
&lt;br /&gt;
This event is meaningless in normal playback.&lt;br /&gt;
&lt;br /&gt;
==== Pitch Change ====&lt;br /&gt;
&lt;br /&gt;
The pitch is a signed char type with a value between -100 and +100. The actual pitch setting is the pitch of the current sound plus the frequency of the next sound - the value can be calculated as a percentage. That is, when the pitch is +50 and the current frequency is 153, if the next frequency is 163, then actual output frequency is calculated like this:&lt;br /&gt;
&lt;br /&gt;
 153 + (163-153) * 50/100 = 158&lt;br /&gt;
&lt;br /&gt;
=== Control track ===&lt;br /&gt;
&lt;br /&gt;
The last block in the file is control track, it used to control global playback parameters.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_CTRK&amp;lt;/tt&amp;gt; structure is similar to &amp;lt;tt&amp;gt;SOP_STRK&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || numEvents || Number of control events in track&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT32LE]]&amp;lt;/tt&amp;gt; || dataSize || Control track data size in bytes&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_CEVT[numEvents]&amp;lt;/tt&amp;gt; || events || Control track events&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_CEVT&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || ticks || Delta ticks (change position)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || event || Control event code&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_CVAL&amp;lt;/tt&amp;gt; || value || Control event structure&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_CVAL&amp;lt;/tt&amp;gt; structure is depending on control event code:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Event code !! Description !! Event structure&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Change Tempo || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; tempo&lt;br /&gt;
|-&lt;br /&gt;
| 8 || Global Volume || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; volume&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Change Tempo ====&lt;br /&gt;
&lt;br /&gt;
This event updates the tempo value. If it wasn&#039;t set before, it comes from &amp;lt;tt&amp;gt;basicTempo&amp;lt;/tt&amp;gt; value, however official Note editor overrides the default value to 120.&lt;br /&gt;
&lt;br /&gt;
The frequency is calculated with this formula {{TODO|check it later}}:&lt;br /&gt;
&lt;br /&gt;
 frequency = tempo * tickBeat&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
{{BeginFileFormatTools|Type=audio}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = Note&lt;br /&gt;
| Platform = DOS&lt;br /&gt;
| canPlay = Yes&lt;br /&gt;
| canCreate = Yes&lt;br /&gt;
| canModify = Yes&lt;br /&gt;
| canExport = No&lt;br /&gt;
| canImport = Yes; [[IMS Format|.ims]]&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = Yes&lt;br /&gt;
| notes = Official player and editor&lt;br /&gt;
}}&lt;br /&gt;
{{EndFileFormatTools}}&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* http://www.vogons.org/viewtopic.php?f=5&amp;amp;t=37849 - topic on VOGONS&lt;br /&gt;
* https://adplug.github.io/library/entry/Note10b2.html - AdPlug Library entry&lt;br /&gt;
* [[ROL Format]] - similar format&lt;br /&gt;
&lt;br /&gt;
== Credits ==&lt;br /&gt;
&lt;br /&gt;
This file format was described by Park Jeenhong in 1996 and then adapted and supplemented by [[User:binarymaster|binarymaster]].  If you find this information helpful in a project you&#039;re working on, please give credit where credit is due.  (A link back to this wiki would be nice too!)&lt;/div&gt;</summary>
		<author><name>Binarymaster</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=SOP_Format&amp;diff=7025</id>
		<title>SOP Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=SOP_Format&amp;diff=7025"/>
		<updated>2017-01-11T11:23:18Z</updated>

		<summary type="html">&lt;p&gt;Binarymaster: /* Change Tempo */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NeedMoreInfo}}&lt;br /&gt;
{{Music Infobox&lt;br /&gt;
 | Type = Custom&lt;br /&gt;
 | Instruments = OPL&lt;br /&gt;
 | NumChannels = 9 or 11 (OPL2), 18 or 20 (OPL3)&lt;br /&gt;
 | NumTracks = 20&lt;br /&gt;
 | NumPatterns = 1&lt;br /&gt;
 | NumOrders = 0&lt;br /&gt;
 | Tags = File name, Title, Instrument names&lt;br /&gt;
 | Games = None&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;SOP Format&#039;&#039;&#039; is created by Lee Ho Bum (sopepos) for the &#039;&#039;&#039;Note&#039;&#039;&#039; OPL3 music sequencer.&lt;br /&gt;
&lt;br /&gt;
== File format ==&lt;br /&gt;
&lt;br /&gt;
=== Header ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[char]][7]&amp;lt;/tt&amp;gt; || signature || Header signature (must be &amp;quot;&amp;lt;tt&amp;gt;sopepos&amp;lt;/tt&amp;gt;&amp;quot;)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT8]]&amp;lt;/tt&amp;gt; || majorVersion || Major version number (usually 0)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || minorVersion || Minor version number (usually 1)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[BYTE]]&amp;lt;/tt&amp;gt; || padding || Unused, must be zero&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[13]&amp;lt;/tt&amp;gt; || fileName || File name / short name, null terminated&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[31]&amp;lt;/tt&amp;gt; || title || Song title, null terminated&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT16LE]]&amp;lt;/tt&amp;gt; || percussive || OPL rhythm mode: 0 = melodic, 1 = percussive&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || tickBeat || Number of ticks per beat&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || beatMeasure || Number of beats per measure (usually 4)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || basicTempo || Song tempo, in beats-per-minute (usually 120)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || nTracks || Number of tracks&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || nInsts || Number of instruments&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The only known version of this format is 0.1.&lt;br /&gt;
&lt;br /&gt;
The fields &amp;lt;tt&amp;gt;tickBeat&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;beatMeasure&amp;lt;/tt&amp;gt; are used to convert ticks into beats and measures for drawing a musical staff.&lt;br /&gt;
&lt;br /&gt;
Header have fixed size of 76 bytes. Then it&#039;s followed by data structure.&lt;br /&gt;
&lt;br /&gt;
=== Data structure ===&lt;br /&gt;
&lt;br /&gt;
Data structure size is dynamic and depending on number of tracks and instruments.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE[nTracks]&amp;lt;/tt&amp;gt; || chanMode || Channel modes&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_INST[nInsts]&amp;lt;/tt&amp;gt; || insts || Instruments&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_STRK[nTracks]&amp;lt;/tt&amp;gt; || tracks || Sequenced tracks&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_CTRK&amp;lt;/tt&amp;gt; || ctrlTrack || Control track&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each section of data structure is described below.&lt;br /&gt;
&lt;br /&gt;
=== Channel modes ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Value !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;0x00&amp;lt;/tt&amp;gt; || Unused channel&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;0x01&amp;lt;/tt&amp;gt; || YMF-262M 4OP Mode&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;0x02&amp;lt;/tt&amp;gt; || YM-3812 2OP Mode&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Instruments ===&lt;br /&gt;
Header is followed by instruments block. Instrument structures are repeated &amp;lt;tt&amp;gt;nInsts&amp;lt;/tt&amp;gt; times.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_INST&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || instType || Instrument type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[8]&amp;lt;/tt&amp;gt; || shortName || Bank instrument name / short name&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[19]&amp;lt;/tt&amp;gt; || longName || Long instrument name&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE[]&amp;lt;/tt&amp;gt; || instData || Instrument data&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Instrument data size depends on instrument type:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type !! Size !! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 22 || Melody (YMF-262M, 4OP Mode)&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 11 || Melody (YM-3812, 2OP Mode)&lt;br /&gt;
|-&lt;br /&gt;
| 6 || 11 || Bass Drum&lt;br /&gt;
|-&lt;br /&gt;
| 7 || 11 || Snare Drum&lt;br /&gt;
|-&lt;br /&gt;
| 8 || 11 || Tom Tom&lt;br /&gt;
|-&lt;br /&gt;
| 9 || 11 || Cymbal&lt;br /&gt;
|-&lt;br /&gt;
| 10 || 11 || Hi-Hat&lt;br /&gt;
|-&lt;br /&gt;
| 12 || 0 || Unused instrument (comment)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Actual instrument data is just OPL registers dump.&lt;br /&gt;
&lt;br /&gt;
==== 2OP Mode instrument data ====&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Data type!!Name!!OPL base register!!Description&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModChar||0x20||Modulator characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModScale||0x40||Modulator key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModAttack||0x60||Modulator attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModSustain||0x80||Modulator sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModWaveSel||0xE0||Modulator wave select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iFeedback||0xC0||Feedback/connection&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarChar||0x23||Carrier characteristic (only melody instruments and bass drum)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarScale||0x43||Carrier key scaling/output level (only melody instruments)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarAttack||0x63||Carrier attack/decay level (only melody instruments)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarSustain||0x83||Carrier sustain/release level (only melody instruments)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarWaveSel||0xE3||Carrier wave select (only melody instruments)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== 4OP Mode instrument data ====&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Data type!!Name!!OPL base register!!Description&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Char||0x20||Operator 1 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Scale||0x40||Operator 1 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Attack||0x60||Operator 1 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Sustain||0x80||Operator 1 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1WaveSel||0xE0||Operator 1 wave select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Feedback||0xC0||Operator 1 feedback/connection&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Char||0x23||Operator 2 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Scale||0x43||Operator 2 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Attack||0x63||Operator 2 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Sustain||0x83||Operator 2 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2WaveSel||0xE3||Operator 2 wave select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Char||0x28||Operator 3 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Scale||0x48||Operator 3 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Attack||0x68||Operator 3 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Sustain||0x88||Operator 3 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3WaveSel||0xE8||Operator 3 wave select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Feedback||0xC8||Operator 3 feedback/connection&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Char||0x2B||Operator 4 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Scale||0x4B||Operator 4 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Attack||0x6B||Operator 4 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Sustain||0x8B||Operator 4 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4WaveSel||0xEB||Operator 4 wave select&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Sequenced tracks ===&lt;br /&gt;
&lt;br /&gt;
Instrument block is followed by sequenced tracks, containing the music events.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_STRK&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || numEvents || Number of events in track&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT32LE]]&amp;lt;/tt&amp;gt; || dataSize || Track data size in bytes&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_EVNT[numEvents]&amp;lt;/tt&amp;gt; || events || Track events&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_EVNT&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || ticks || Delta ticks (change position)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || event || Event code&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_EVAL&amp;lt;/tt&amp;gt; || value || Event structure&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_EVAL&amp;lt;/tt&amp;gt; structure is depending on event code:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Event code !! Description !! Event structure&lt;br /&gt;
|-&lt;br /&gt;
| 1 || Special Event || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; value&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Note On || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; pitch, &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; length (in ticks)&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Change Volume || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; volume&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Change Pitch || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; pitch (&amp;lt;tt&amp;gt;0x64&amp;lt;/tt&amp;gt; (100) is a center value)&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Instrument Change || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; number&lt;br /&gt;
|-&lt;br /&gt;
| 7 || Set Panning || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; panning (0 - right, 1 - middle, 2 - left)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Special Event ====&lt;br /&gt;
&lt;br /&gt;
This event is meaningless in normal playback.&lt;br /&gt;
&lt;br /&gt;
==== Pitch Change ====&lt;br /&gt;
&lt;br /&gt;
The pitch is a signed char type with a value between -100 and +100. The actual pitch setting is the pitch of the current sound plus the frequency of the next sound - the value can be calculated as a percentage. That is, when the pitch is +50 and the current frequency is 153, if the next frequency is 163, then actual output frequency is calculated like this:&lt;br /&gt;
&lt;br /&gt;
 153 + (163-153) * 50/100 = 158&lt;br /&gt;
&lt;br /&gt;
=== Control track ===&lt;br /&gt;
&lt;br /&gt;
The last block in the file is control track, it used to control global playback parameters.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_CTRK&amp;lt;/tt&amp;gt; structure is similar to &amp;lt;tt&amp;gt;SOP_STRK&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || numEvents || Number of control events in track&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT32LE]]&amp;lt;/tt&amp;gt; || dataSize || Control track data size in bytes&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_CEVT[numEvents]&amp;lt;/tt&amp;gt; || events || Control track events&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_CEVT&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || ticks || Delta ticks (change position)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || event || Control event code&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_CVAL&amp;lt;/tt&amp;gt; || value || Control event structure&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_CVAL&amp;lt;/tt&amp;gt; structure is depending on control event code:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Event code !! Description !! Event structure&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Change Tempo || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; tempo&lt;br /&gt;
|-&lt;br /&gt;
| 8 || Global Volume || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; volume&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Change Tempo ====&lt;br /&gt;
&lt;br /&gt;
This event updates the tempo value. If it wasn&#039;t set before, it comes from &amp;lt;tt&amp;gt;basicTempo&amp;lt;/tt&amp;gt; value, however Note editor overrides the default value to 120.&lt;br /&gt;
&lt;br /&gt;
The frequency is calculated with this formula {{TODO|check it later}}:&lt;br /&gt;
&lt;br /&gt;
 frequency = basicTempo * tickBeat&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
{{BeginFileFormatTools|Type=audio}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = Note&lt;br /&gt;
| Platform = DOS&lt;br /&gt;
| canPlay = Yes&lt;br /&gt;
| canCreate = Yes&lt;br /&gt;
| canModify = Yes&lt;br /&gt;
| canExport = No&lt;br /&gt;
| canImport = Yes; [[IMS Format|.ims]]&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = Yes&lt;br /&gt;
| notes = Official player and editor&lt;br /&gt;
}}&lt;br /&gt;
{{EndFileFormatTools}}&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* http://www.vogons.org/viewtopic.php?f=5&amp;amp;t=37849 - topic on VOGONS&lt;br /&gt;
* https://adplug.github.io/library/entry/Note10b2.html - AdPlug Library entry&lt;br /&gt;
* [[ROL Format]] - similar format&lt;br /&gt;
&lt;br /&gt;
== Credits ==&lt;br /&gt;
&lt;br /&gt;
This file format was described by Park Jeenhong in 1996 and then adapted and supplemented by [[User:binarymaster|binarymaster]].  If you find this information helpful in a project you&#039;re working on, please give credit where credit is due.  (A link back to this wiki would be nice too!)&lt;/div&gt;</summary>
		<author><name>Binarymaster</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=SOP_Format&amp;diff=7024</id>
		<title>SOP Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=SOP_Format&amp;diff=7024"/>
		<updated>2017-01-11T11:18:01Z</updated>

		<summary type="html">&lt;p&gt;Binarymaster: /* Change Tempo */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NeedMoreInfo}}&lt;br /&gt;
{{Music Infobox&lt;br /&gt;
 | Type = Custom&lt;br /&gt;
 | Instruments = OPL&lt;br /&gt;
 | NumChannels = 9 or 11 (OPL2), 18 or 20 (OPL3)&lt;br /&gt;
 | NumTracks = 20&lt;br /&gt;
 | NumPatterns = 1&lt;br /&gt;
 | NumOrders = 0&lt;br /&gt;
 | Tags = File name, Title, Instrument names&lt;br /&gt;
 | Games = None&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;SOP Format&#039;&#039;&#039; is created by Lee Ho Bum (sopepos) for the &#039;&#039;&#039;Note&#039;&#039;&#039; OPL3 music sequencer.&lt;br /&gt;
&lt;br /&gt;
== File format ==&lt;br /&gt;
&lt;br /&gt;
=== Header ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[char]][7]&amp;lt;/tt&amp;gt; || signature || Header signature (must be &amp;quot;&amp;lt;tt&amp;gt;sopepos&amp;lt;/tt&amp;gt;&amp;quot;)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT8]]&amp;lt;/tt&amp;gt; || majorVersion || Major version number (usually 0)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || minorVersion || Minor version number (usually 1)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[BYTE]]&amp;lt;/tt&amp;gt; || padding || Unused, must be zero&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[13]&amp;lt;/tt&amp;gt; || fileName || File name / short name, null terminated&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[31]&amp;lt;/tt&amp;gt; || title || Song title, null terminated&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT16LE]]&amp;lt;/tt&amp;gt; || percussive || OPL rhythm mode: 0 = melodic, 1 = percussive&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || tickBeat || Number of ticks per beat&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || beatMeasure || Number of beats per measure (usually 4)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || basicTempo || Song tempo, in beats-per-minute (usually 120)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || nTracks || Number of tracks&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || nInsts || Number of instruments&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The only known version of this format is 0.1.&lt;br /&gt;
&lt;br /&gt;
The fields &amp;lt;tt&amp;gt;tickBeat&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;beatMeasure&amp;lt;/tt&amp;gt; are used to convert ticks into beats and measures for drawing a musical staff.&lt;br /&gt;
&lt;br /&gt;
Header have fixed size of 76 bytes. Then it&#039;s followed by data structure.&lt;br /&gt;
&lt;br /&gt;
=== Data structure ===&lt;br /&gt;
&lt;br /&gt;
Data structure size is dynamic and depending on number of tracks and instruments.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE[nTracks]&amp;lt;/tt&amp;gt; || chanMode || Channel modes&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_INST[nInsts]&amp;lt;/tt&amp;gt; || insts || Instruments&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_STRK[nTracks]&amp;lt;/tt&amp;gt; || tracks || Sequenced tracks&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_CTRK&amp;lt;/tt&amp;gt; || ctrlTrack || Control track&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each section of data structure is described below.&lt;br /&gt;
&lt;br /&gt;
=== Channel modes ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Value !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;0x00&amp;lt;/tt&amp;gt; || Unused channel&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;0x01&amp;lt;/tt&amp;gt; || YMF-262M 4OP Mode&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;0x02&amp;lt;/tt&amp;gt; || YM-3812 2OP Mode&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Instruments ===&lt;br /&gt;
Header is followed by instruments block. Instrument structures are repeated &amp;lt;tt&amp;gt;nInsts&amp;lt;/tt&amp;gt; times.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_INST&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || instType || Instrument type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[8]&amp;lt;/tt&amp;gt; || shortName || Bank instrument name / short name&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[19]&amp;lt;/tt&amp;gt; || longName || Long instrument name&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE[]&amp;lt;/tt&amp;gt; || instData || Instrument data&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Instrument data size depends on instrument type:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type !! Size !! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 22 || Melody (YMF-262M, 4OP Mode)&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 11 || Melody (YM-3812, 2OP Mode)&lt;br /&gt;
|-&lt;br /&gt;
| 6 || 11 || Bass Drum&lt;br /&gt;
|-&lt;br /&gt;
| 7 || 11 || Snare Drum&lt;br /&gt;
|-&lt;br /&gt;
| 8 || 11 || Tom Tom&lt;br /&gt;
|-&lt;br /&gt;
| 9 || 11 || Cymbal&lt;br /&gt;
|-&lt;br /&gt;
| 10 || 11 || Hi-Hat&lt;br /&gt;
|-&lt;br /&gt;
| 12 || 0 || Unused instrument (comment)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Actual instrument data is just OPL registers dump.&lt;br /&gt;
&lt;br /&gt;
==== 2OP Mode instrument data ====&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Data type!!Name!!OPL base register!!Description&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModChar||0x20||Modulator characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModScale||0x40||Modulator key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModAttack||0x60||Modulator attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModSustain||0x80||Modulator sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModWaveSel||0xE0||Modulator wave select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iFeedback||0xC0||Feedback/connection&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarChar||0x23||Carrier characteristic (only melody instruments and bass drum)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarScale||0x43||Carrier key scaling/output level (only melody instruments)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarAttack||0x63||Carrier attack/decay level (only melody instruments)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarSustain||0x83||Carrier sustain/release level (only melody instruments)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarWaveSel||0xE3||Carrier wave select (only melody instruments)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== 4OP Mode instrument data ====&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Data type!!Name!!OPL base register!!Description&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Char||0x20||Operator 1 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Scale||0x40||Operator 1 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Attack||0x60||Operator 1 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Sustain||0x80||Operator 1 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1WaveSel||0xE0||Operator 1 wave select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Feedback||0xC0||Operator 1 feedback/connection&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Char||0x23||Operator 2 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Scale||0x43||Operator 2 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Attack||0x63||Operator 2 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Sustain||0x83||Operator 2 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2WaveSel||0xE3||Operator 2 wave select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Char||0x28||Operator 3 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Scale||0x48||Operator 3 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Attack||0x68||Operator 3 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Sustain||0x88||Operator 3 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3WaveSel||0xE8||Operator 3 wave select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Feedback||0xC8||Operator 3 feedback/connection&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Char||0x2B||Operator 4 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Scale||0x4B||Operator 4 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Attack||0x6B||Operator 4 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Sustain||0x8B||Operator 4 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4WaveSel||0xEB||Operator 4 wave select&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Sequenced tracks ===&lt;br /&gt;
&lt;br /&gt;
Instrument block is followed by sequenced tracks, containing the music events.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_STRK&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || numEvents || Number of events in track&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT32LE]]&amp;lt;/tt&amp;gt; || dataSize || Track data size in bytes&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_EVNT[numEvents]&amp;lt;/tt&amp;gt; || events || Track events&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_EVNT&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || ticks || Delta ticks (change position)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || event || Event code&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_EVAL&amp;lt;/tt&amp;gt; || value || Event structure&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_EVAL&amp;lt;/tt&amp;gt; structure is depending on event code:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Event code !! Description !! Event structure&lt;br /&gt;
|-&lt;br /&gt;
| 1 || Special Event || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; value&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Note On || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; pitch, &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; length (in ticks)&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Change Volume || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; volume&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Change Pitch || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; pitch (&amp;lt;tt&amp;gt;0x64&amp;lt;/tt&amp;gt; (100) is a center value)&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Instrument Change || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; number&lt;br /&gt;
|-&lt;br /&gt;
| 7 || Set Panning || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; panning (0 - right, 1 - middle, 2 - left)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Special Event ====&lt;br /&gt;
&lt;br /&gt;
This event is meaningless in normal playback.&lt;br /&gt;
&lt;br /&gt;
==== Pitch Change ====&lt;br /&gt;
&lt;br /&gt;
The pitch is a signed char type with a value between -100 and +100. The actual pitch setting is the pitch of the current sound plus the frequency of the next sound - the value can be calculated as a percentage. That is, when the pitch is +50 and the current frequency is 153, if the next frequency is 163, then actual output frequency is calculated like this:&lt;br /&gt;
&lt;br /&gt;
 153 + (163-153) * 50/100 = 158&lt;br /&gt;
&lt;br /&gt;
=== Control track ===&lt;br /&gt;
&lt;br /&gt;
The last block in the file is control track, it used to control global playback parameters.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_CTRK&amp;lt;/tt&amp;gt; structure is similar to &amp;lt;tt&amp;gt;SOP_STRK&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || numEvents || Number of control events in track&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT32LE]]&amp;lt;/tt&amp;gt; || dataSize || Control track data size in bytes&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_CEVT[numEvents]&amp;lt;/tt&amp;gt; || events || Control track events&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_CEVT&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || ticks || Delta ticks (change position)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || event || Control event code&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_CVAL&amp;lt;/tt&amp;gt; || value || Control event structure&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_CVAL&amp;lt;/tt&amp;gt; structure is depending on control event code:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Event code !! Description !! Event structure&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Change Tempo || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; tempo&lt;br /&gt;
|-&lt;br /&gt;
| 8 || Global Volume || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; volume&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Change Tempo ====&lt;br /&gt;
&lt;br /&gt;
The default tempo comes from &amp;lt;tt&amp;gt;basicTempo&amp;lt;/tt&amp;gt; value, but the Note editor overrides it to 120. The frequency is calculated with this formula {{TODO|check it later}}:&lt;br /&gt;
&lt;br /&gt;
 frequency = basicTempo * tickBeat&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
{{BeginFileFormatTools|Type=audio}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = Note&lt;br /&gt;
| Platform = DOS&lt;br /&gt;
| canPlay = Yes&lt;br /&gt;
| canCreate = Yes&lt;br /&gt;
| canModify = Yes&lt;br /&gt;
| canExport = No&lt;br /&gt;
| canImport = Yes; [[IMS Format|.ims]]&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = Yes&lt;br /&gt;
| notes = Official player and editor&lt;br /&gt;
}}&lt;br /&gt;
{{EndFileFormatTools}}&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* http://www.vogons.org/viewtopic.php?f=5&amp;amp;t=37849 - topic on VOGONS&lt;br /&gt;
* https://adplug.github.io/library/entry/Note10b2.html - AdPlug Library entry&lt;br /&gt;
* [[ROL Format]] - similar format&lt;br /&gt;
&lt;br /&gt;
== Credits ==&lt;br /&gt;
&lt;br /&gt;
This file format was described by Park Jeenhong in 1996 and then adapted and supplemented by [[User:binarymaster|binarymaster]].  If you find this information helpful in a project you&#039;re working on, please give credit where credit is due.  (A link back to this wiki would be nice too!)&lt;/div&gt;</summary>
		<author><name>Binarymaster</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=SOP_Format&amp;diff=7023</id>
		<title>SOP Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=SOP_Format&amp;diff=7023"/>
		<updated>2017-01-11T10:56:36Z</updated>

		<summary type="html">&lt;p&gt;Binarymaster: /* Change Tempo */ update from research&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NeedMoreInfo}}&lt;br /&gt;
{{Music Infobox&lt;br /&gt;
 | Type = Custom&lt;br /&gt;
 | Instruments = OPL&lt;br /&gt;
 | NumChannels = 9 or 11 (OPL2), 18 or 20 (OPL3)&lt;br /&gt;
 | NumTracks = 20&lt;br /&gt;
 | NumPatterns = 1&lt;br /&gt;
 | NumOrders = 0&lt;br /&gt;
 | Tags = File name, Title, Instrument names&lt;br /&gt;
 | Games = None&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;SOP Format&#039;&#039;&#039; is created by Lee Ho Bum (sopepos) for the &#039;&#039;&#039;Note&#039;&#039;&#039; OPL3 music sequencer.&lt;br /&gt;
&lt;br /&gt;
== File format ==&lt;br /&gt;
&lt;br /&gt;
=== Header ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[char]][7]&amp;lt;/tt&amp;gt; || signature || Header signature (must be &amp;quot;&amp;lt;tt&amp;gt;sopepos&amp;lt;/tt&amp;gt;&amp;quot;)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT8]]&amp;lt;/tt&amp;gt; || majorVersion || Major version number (usually 0)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || minorVersion || Minor version number (usually 1)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[BYTE]]&amp;lt;/tt&amp;gt; || padding || Unused, must be zero&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[13]&amp;lt;/tt&amp;gt; || fileName || File name / short name, null terminated&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[31]&amp;lt;/tt&amp;gt; || title || Song title, null terminated&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT16LE]]&amp;lt;/tt&amp;gt; || percussive || OPL rhythm mode: 0 = melodic, 1 = percussive&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || tickBeat || Number of ticks per beat&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || beatMeasure || Number of beats per measure (usually 4)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || pageKey || Page key value / control view (usually 120)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || nTracks || Number of tracks&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || nInsts || Number of instruments&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The only known version of this format is 0.1.&lt;br /&gt;
&lt;br /&gt;
The fields &amp;lt;tt&amp;gt;tickBeat&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;beatMeasure&amp;lt;/tt&amp;gt; are used to convert ticks into beats and measures for drawing a musical staff.&lt;br /&gt;
&lt;br /&gt;
Header have fixed size of 76 bytes. Then it&#039;s followed by data structure.&lt;br /&gt;
&lt;br /&gt;
=== Data structure ===&lt;br /&gt;
&lt;br /&gt;
Data structure size is dynamic and depending on number of tracks and instruments.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE[nTracks]&amp;lt;/tt&amp;gt; || chanMode || Channel modes&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_INST[nInsts]&amp;lt;/tt&amp;gt; || insts || Instruments&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_STRK[nTracks]&amp;lt;/tt&amp;gt; || tracks || Sequenced tracks&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_CTRK&amp;lt;/tt&amp;gt; || ctrlTrack || Control track&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each section of data structure is described below.&lt;br /&gt;
&lt;br /&gt;
=== Channel modes ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Value !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;0x00&amp;lt;/tt&amp;gt; || Unused channel&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;0x01&amp;lt;/tt&amp;gt; || YMF-262M 4OP Mode&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;0x02&amp;lt;/tt&amp;gt; || YM-3812 2OP Mode&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Instruments ===&lt;br /&gt;
Header is followed by instruments block. Instrument structures are repeated &amp;lt;tt&amp;gt;nInsts&amp;lt;/tt&amp;gt; times.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_INST&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || instType || Instrument type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[8]&amp;lt;/tt&amp;gt; || shortName || Bank instrument name / short name&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[19]&amp;lt;/tt&amp;gt; || longName || Long instrument name&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE[]&amp;lt;/tt&amp;gt; || instData || Instrument data&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Instrument data size depends on instrument type:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type !! Size !! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 22 || Melody (YMF-262M, 4OP Mode)&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 11 || Melody (YM-3812, 2OP Mode)&lt;br /&gt;
|-&lt;br /&gt;
| 6 || 11 || Bass Drum&lt;br /&gt;
|-&lt;br /&gt;
| 7 || 11 || Snare Drum&lt;br /&gt;
|-&lt;br /&gt;
| 8 || 11 || Tom Tom&lt;br /&gt;
|-&lt;br /&gt;
| 9 || 11 || Cymbal&lt;br /&gt;
|-&lt;br /&gt;
| 10 || 11 || Hi-Hat&lt;br /&gt;
|-&lt;br /&gt;
| 12 || 0 || Unused instrument (comment)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Actual instrument data is just OPL registers dump.&lt;br /&gt;
&lt;br /&gt;
==== 2OP Mode instrument data ====&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Data type!!Name!!OPL base register!!Description&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModChar||0x20||Modulator characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModScale||0x40||Modulator key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModAttack||0x60||Modulator attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModSustain||0x80||Modulator sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModWaveSel||0xE0||Modulator wave select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iFeedback||0xC0||Feedback/connection&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarChar||0x23||Carrier characteristic (only melody instruments and bass drum)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarScale||0x43||Carrier key scaling/output level (only melody instruments)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarAttack||0x63||Carrier attack/decay level (only melody instruments)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarSustain||0x83||Carrier sustain/release level (only melody instruments)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarWaveSel||0xE3||Carrier wave select (only melody instruments)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== 4OP Mode instrument data ====&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Data type!!Name!!OPL base register!!Description&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Char||0x20||Operator 1 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Scale||0x40||Operator 1 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Attack||0x60||Operator 1 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Sustain||0x80||Operator 1 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1WaveSel||0xE0||Operator 1 wave select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Feedback||0xC0||Operator 1 feedback/connection&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Char||0x23||Operator 2 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Scale||0x43||Operator 2 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Attack||0x63||Operator 2 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Sustain||0x83||Operator 2 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2WaveSel||0xE3||Operator 2 wave select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Char||0x28||Operator 3 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Scale||0x48||Operator 3 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Attack||0x68||Operator 3 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Sustain||0x88||Operator 3 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3WaveSel||0xE8||Operator 3 wave select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Feedback||0xC8||Operator 3 feedback/connection&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Char||0x2B||Operator 4 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Scale||0x4B||Operator 4 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Attack||0x6B||Operator 4 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Sustain||0x8B||Operator 4 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4WaveSel||0xEB||Operator 4 wave select&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Sequenced tracks ===&lt;br /&gt;
&lt;br /&gt;
Instrument block is followed by sequenced tracks, containing the music events.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_STRK&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || numEvents || Number of events in track&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT32LE]]&amp;lt;/tt&amp;gt; || dataSize || Track data size in bytes&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_EVNT[numEvents]&amp;lt;/tt&amp;gt; || events || Track events&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_EVNT&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || ticks || Delta ticks (change position)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || event || Event code&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_EVAL&amp;lt;/tt&amp;gt; || value || Event structure&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_EVAL&amp;lt;/tt&amp;gt; structure is depending on event code:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Event code !! Description !! Event structure&lt;br /&gt;
|-&lt;br /&gt;
| 1 || Special Event || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; value&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Note On || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; pitch, &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; length (in ticks)&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Change Volume || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; volume&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Change Pitch || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; pitch (&amp;lt;tt&amp;gt;0x64&amp;lt;/tt&amp;gt; (100) is a center value)&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Instrument Change || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; number&lt;br /&gt;
|-&lt;br /&gt;
| 7 || Set Panning || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; panning (0 - right, 1 - middle, 2 - left)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Special Event ====&lt;br /&gt;
&lt;br /&gt;
This event is meaningless in normal playback.&lt;br /&gt;
&lt;br /&gt;
==== Pitch Change ====&lt;br /&gt;
&lt;br /&gt;
The pitch is a signed char type with a value between -100 and +100. The actual pitch setting is the pitch of the current sound plus the frequency of the next sound - the value can be calculated as a percentage. That is, when the pitch is +50 and the current frequency is 153, if the next frequency is 163, then actual output frequency is calculated like this:&lt;br /&gt;
&lt;br /&gt;
 153 + (163-153) * 50/100 = 158&lt;br /&gt;
&lt;br /&gt;
=== Control track ===&lt;br /&gt;
&lt;br /&gt;
The last block in the file is control track, it used to control global playback parameters.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_CTRK&amp;lt;/tt&amp;gt; structure is similar to &amp;lt;tt&amp;gt;SOP_STRK&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || numEvents || Number of control events in track&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT32LE]]&amp;lt;/tt&amp;gt; || dataSize || Control track data size in bytes&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_CEVT[numEvents]&amp;lt;/tt&amp;gt; || events || Control track events&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_CEVT&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || ticks || Delta ticks (change position)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || event || Control event code&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_CVAL&amp;lt;/tt&amp;gt; || value || Control event structure&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_CVAL&amp;lt;/tt&amp;gt; structure is depending on control event code:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Event code !! Description !! Event structure&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Change Tempo || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; tempo&lt;br /&gt;
|-&lt;br /&gt;
| 8 || Global Volume || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; volume&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Change Tempo ====&lt;br /&gt;
&lt;br /&gt;
The default tempo value is 120. The frequency is calculated with this formula {{TODO|check it later}}:&lt;br /&gt;
&lt;br /&gt;
 frequency = basicTempo * tickBeat&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
{{BeginFileFormatTools|Type=audio}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = Note&lt;br /&gt;
| Platform = DOS&lt;br /&gt;
| canPlay = Yes&lt;br /&gt;
| canCreate = Yes&lt;br /&gt;
| canModify = Yes&lt;br /&gt;
| canExport = No&lt;br /&gt;
| canImport = Yes; [[IMS Format|.ims]]&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = Yes&lt;br /&gt;
| notes = Official player and editor&lt;br /&gt;
}}&lt;br /&gt;
{{EndFileFormatTools}}&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* http://www.vogons.org/viewtopic.php?f=5&amp;amp;t=37849 - topic on VOGONS&lt;br /&gt;
* https://adplug.github.io/library/entry/Note10b2.html - AdPlug Library entry&lt;br /&gt;
* [[ROL Format]] - similar format&lt;br /&gt;
&lt;br /&gt;
== Credits ==&lt;br /&gt;
&lt;br /&gt;
This file format was described by Park Jeenhong in 1996 and then adapted and supplemented by [[User:binarymaster|binarymaster]].  If you find this information helpful in a project you&#039;re working on, please give credit where credit is due.  (A link back to this wiki would be nice too!)&lt;/div&gt;</summary>
		<author><name>Binarymaster</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=SOP_Format&amp;diff=7022</id>
		<title>SOP Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=SOP_Format&amp;diff=7022"/>
		<updated>2017-01-11T10:40:18Z</updated>

		<summary type="html">&lt;p&gt;Binarymaster: /* Header */ reveal more values&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NeedMoreInfo}}&lt;br /&gt;
{{Music Infobox&lt;br /&gt;
 | Type = Custom&lt;br /&gt;
 | Instruments = OPL&lt;br /&gt;
 | NumChannels = 9 or 11 (OPL2), 18 or 20 (OPL3)&lt;br /&gt;
 | NumTracks = 20&lt;br /&gt;
 | NumPatterns = 1&lt;br /&gt;
 | NumOrders = 0&lt;br /&gt;
 | Tags = File name, Title, Instrument names&lt;br /&gt;
 | Games = None&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;SOP Format&#039;&#039;&#039; is created by Lee Ho Bum (sopepos) for the &#039;&#039;&#039;Note&#039;&#039;&#039; OPL3 music sequencer.&lt;br /&gt;
&lt;br /&gt;
== File format ==&lt;br /&gt;
&lt;br /&gt;
=== Header ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[char]][7]&amp;lt;/tt&amp;gt; || signature || Header signature (must be &amp;quot;&amp;lt;tt&amp;gt;sopepos&amp;lt;/tt&amp;gt;&amp;quot;)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT8]]&amp;lt;/tt&amp;gt; || majorVersion || Major version number (usually 0)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || minorVersion || Minor version number (usually 1)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[BYTE]]&amp;lt;/tt&amp;gt; || padding || Unused, must be zero&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[13]&amp;lt;/tt&amp;gt; || fileName || File name / short name, null terminated&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[31]&amp;lt;/tt&amp;gt; || title || Song title, null terminated&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT16LE]]&amp;lt;/tt&amp;gt; || percussive || OPL rhythm mode: 0 = melodic, 1 = percussive&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || tickBeat || Number of ticks per beat&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || beatMeasure || Number of beats per measure (usually 4)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || pageKey || Page key value / control view (usually 120)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || nTracks || Number of tracks&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || nInsts || Number of instruments&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The only known version of this format is 0.1.&lt;br /&gt;
&lt;br /&gt;
The fields &amp;lt;tt&amp;gt;tickBeat&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;beatMeasure&amp;lt;/tt&amp;gt; are used to convert ticks into beats and measures for drawing a musical staff.&lt;br /&gt;
&lt;br /&gt;
Header have fixed size of 76 bytes. Then it&#039;s followed by data structure.&lt;br /&gt;
&lt;br /&gt;
=== Data structure ===&lt;br /&gt;
&lt;br /&gt;
Data structure size is dynamic and depending on number of tracks and instruments.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE[nTracks]&amp;lt;/tt&amp;gt; || chanMode || Channel modes&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_INST[nInsts]&amp;lt;/tt&amp;gt; || insts || Instruments&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_STRK[nTracks]&amp;lt;/tt&amp;gt; || tracks || Sequenced tracks&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_CTRK&amp;lt;/tt&amp;gt; || ctrlTrack || Control track&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each section of data structure is described below.&lt;br /&gt;
&lt;br /&gt;
=== Channel modes ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Value !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;0x00&amp;lt;/tt&amp;gt; || Unused channel&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;0x01&amp;lt;/tt&amp;gt; || YMF-262M 4OP Mode&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;0x02&amp;lt;/tt&amp;gt; || YM-3812 2OP Mode&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Instruments ===&lt;br /&gt;
Header is followed by instruments block. Instrument structures are repeated &amp;lt;tt&amp;gt;nInsts&amp;lt;/tt&amp;gt; times.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_INST&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || instType || Instrument type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[8]&amp;lt;/tt&amp;gt; || shortName || Bank instrument name / short name&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[19]&amp;lt;/tt&amp;gt; || longName || Long instrument name&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE[]&amp;lt;/tt&amp;gt; || instData || Instrument data&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Instrument data size depends on instrument type:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type !! Size !! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 22 || Melody (YMF-262M, 4OP Mode)&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 11 || Melody (YM-3812, 2OP Mode)&lt;br /&gt;
|-&lt;br /&gt;
| 6 || 11 || Bass Drum&lt;br /&gt;
|-&lt;br /&gt;
| 7 || 11 || Snare Drum&lt;br /&gt;
|-&lt;br /&gt;
| 8 || 11 || Tom Tom&lt;br /&gt;
|-&lt;br /&gt;
| 9 || 11 || Cymbal&lt;br /&gt;
|-&lt;br /&gt;
| 10 || 11 || Hi-Hat&lt;br /&gt;
|-&lt;br /&gt;
| 12 || 0 || Unused instrument (comment)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Actual instrument data is just OPL registers dump.&lt;br /&gt;
&lt;br /&gt;
==== 2OP Mode instrument data ====&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Data type!!Name!!OPL base register!!Description&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModChar||0x20||Modulator characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModScale||0x40||Modulator key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModAttack||0x60||Modulator attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModSustain||0x80||Modulator sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModWaveSel||0xE0||Modulator wave select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iFeedback||0xC0||Feedback/connection&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarChar||0x23||Carrier characteristic (only melody instruments and bass drum)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarScale||0x43||Carrier key scaling/output level (only melody instruments)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarAttack||0x63||Carrier attack/decay level (only melody instruments)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarSustain||0x83||Carrier sustain/release level (only melody instruments)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarWaveSel||0xE3||Carrier wave select (only melody instruments)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== 4OP Mode instrument data ====&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Data type!!Name!!OPL base register!!Description&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Char||0x20||Operator 1 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Scale||0x40||Operator 1 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Attack||0x60||Operator 1 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Sustain||0x80||Operator 1 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1WaveSel||0xE0||Operator 1 wave select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Feedback||0xC0||Operator 1 feedback/connection&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Char||0x23||Operator 2 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Scale||0x43||Operator 2 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Attack||0x63||Operator 2 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Sustain||0x83||Operator 2 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2WaveSel||0xE3||Operator 2 wave select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Char||0x28||Operator 3 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Scale||0x48||Operator 3 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Attack||0x68||Operator 3 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Sustain||0x88||Operator 3 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3WaveSel||0xE8||Operator 3 wave select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Feedback||0xC8||Operator 3 feedback/connection&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Char||0x2B||Operator 4 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Scale||0x4B||Operator 4 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Attack||0x6B||Operator 4 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Sustain||0x8B||Operator 4 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4WaveSel||0xEB||Operator 4 wave select&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Sequenced tracks ===&lt;br /&gt;
&lt;br /&gt;
Instrument block is followed by sequenced tracks, containing the music events.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_STRK&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || numEvents || Number of events in track&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT32LE]]&amp;lt;/tt&amp;gt; || dataSize || Track data size in bytes&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_EVNT[numEvents]&amp;lt;/tt&amp;gt; || events || Track events&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_EVNT&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || ticks || Delta ticks (change position)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || event || Event code&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_EVAL&amp;lt;/tt&amp;gt; || value || Event structure&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_EVAL&amp;lt;/tt&amp;gt; structure is depending on event code:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Event code !! Description !! Event structure&lt;br /&gt;
|-&lt;br /&gt;
| 1 || Special Event || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; value&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Note On || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; pitch, &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; length (in ticks)&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Change Volume || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; volume&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Change Pitch || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; pitch (&amp;lt;tt&amp;gt;0x64&amp;lt;/tt&amp;gt; (100) is a center value)&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Instrument Change || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; number&lt;br /&gt;
|-&lt;br /&gt;
| 7 || Set Panning || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; panning (0 - right, 1 - middle, 2 - left)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Special Event ====&lt;br /&gt;
&lt;br /&gt;
This event is meaningless in normal playback.&lt;br /&gt;
&lt;br /&gt;
==== Pitch Change ====&lt;br /&gt;
&lt;br /&gt;
The pitch is a signed char type with a value between -100 and +100. The actual pitch setting is the pitch of the current sound plus the frequency of the next sound - the value can be calculated as a percentage. That is, when the pitch is +50 and the current frequency is 153, if the next frequency is 163, then actual output frequency is calculated like this:&lt;br /&gt;
&lt;br /&gt;
 153 + (163-153) * 50/100 = 158&lt;br /&gt;
&lt;br /&gt;
=== Control track ===&lt;br /&gt;
&lt;br /&gt;
The last block in the file is control track, it used to control global playback parameters.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_CTRK&amp;lt;/tt&amp;gt; structure is similar to &amp;lt;tt&amp;gt;SOP_STRK&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || numEvents || Number of control events in track&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT32LE]]&amp;lt;/tt&amp;gt; || dataSize || Control track data size in bytes&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_CEVT[numEvents]&amp;lt;/tt&amp;gt; || events || Control track events&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_CEVT&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || ticks || Delta ticks (change position)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || event || Control event code&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_CVAL&amp;lt;/tt&amp;gt; || value || Control event structure&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_CVAL&amp;lt;/tt&amp;gt; structure is depending on control event code:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Event code !! Description !! Event structure&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Change Tempo || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; tempo&lt;br /&gt;
|-&lt;br /&gt;
| 8 || Global Volume || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; volume&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Change Tempo ====&lt;br /&gt;
&lt;br /&gt;
The default tempo value is 255. The frequency is calculated with this formula:&lt;br /&gt;
&lt;br /&gt;
 freq = 298295 / (tempo / 100)&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
{{BeginFileFormatTools|Type=audio}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = Note&lt;br /&gt;
| Platform = DOS&lt;br /&gt;
| canPlay = Yes&lt;br /&gt;
| canCreate = Yes&lt;br /&gt;
| canModify = Yes&lt;br /&gt;
| canExport = No&lt;br /&gt;
| canImport = Yes; [[IMS Format|.ims]]&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = Yes&lt;br /&gt;
| notes = Official player and editor&lt;br /&gt;
}}&lt;br /&gt;
{{EndFileFormatTools}}&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* http://www.vogons.org/viewtopic.php?f=5&amp;amp;t=37849 - topic on VOGONS&lt;br /&gt;
* https://adplug.github.io/library/entry/Note10b2.html - AdPlug Library entry&lt;br /&gt;
* [[ROL Format]] - similar format&lt;br /&gt;
&lt;br /&gt;
== Credits ==&lt;br /&gt;
&lt;br /&gt;
This file format was described by Park Jeenhong in 1996 and then adapted and supplemented by [[User:binarymaster|binarymaster]].  If you find this information helpful in a project you&#039;re working on, please give credit where credit is due.  (A link back to this wiki would be nice too!)&lt;/div&gt;</summary>
		<author><name>Binarymaster</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=SOP_Format&amp;diff=7021</id>
		<title>SOP Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=SOP_Format&amp;diff=7021"/>
		<updated>2017-01-11T10:23:30Z</updated>

		<summary type="html">&lt;p&gt;Binarymaster: /* File format */ update header&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NeedMoreInfo}}&lt;br /&gt;
{{Music Infobox&lt;br /&gt;
 | Type = Custom&lt;br /&gt;
 | Instruments = OPL&lt;br /&gt;
 | NumChannels = 9 or 11 (OPL2), 18 or 20 (OPL3)&lt;br /&gt;
 | NumTracks = 20&lt;br /&gt;
 | NumPatterns = 1&lt;br /&gt;
 | NumOrders = 0&lt;br /&gt;
 | Tags = File name, Title, Instrument names&lt;br /&gt;
 | Games = None&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;SOP Format&#039;&#039;&#039; is created by Lee Ho Bum (sopepos) for the &#039;&#039;&#039;Note&#039;&#039;&#039; OPL3 music sequencer.&lt;br /&gt;
&lt;br /&gt;
== File format ==&lt;br /&gt;
&lt;br /&gt;
=== Header ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[char]][7]&amp;lt;/tt&amp;gt; || signature || Header signature (must be &amp;quot;&amp;lt;tt&amp;gt;sopepos&amp;lt;/tt&amp;gt;&amp;quot;)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT8]]&amp;lt;/tt&amp;gt; || majorVersion || Major version number (usually 0)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || minorVersion || Minor version number (usually 1)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[BYTE]]&amp;lt;/tt&amp;gt; || padding || Unused, must be zero&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[13]&amp;lt;/tt&amp;gt; || fileName || File name / short name, null terminated&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[31]&amp;lt;/tt&amp;gt; || title || Song title, null terminated&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT16LE]]&amp;lt;/tt&amp;gt; || percussive || OPL rhythm mode: 0 = melodic, 1 = percussive&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || tickBeat || Number of ticks per beat&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}} (usually 4)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}} (usually 120)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}} (usually 0)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || beatMeasure || Number of beats per measure&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || nTracks || Number of tracks&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || nInsts || Number of instruments&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The only known version of this format is 0.1.&lt;br /&gt;
&lt;br /&gt;
The fields &amp;lt;tt&amp;gt;tickBeat&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;beatMeasure&amp;lt;/tt&amp;gt; are used to convert ticks into beats and measures for drawing a musical staff.&lt;br /&gt;
&lt;br /&gt;
Header have fixed size of 76 bytes. Then it&#039;s followed by data structure.&lt;br /&gt;
&lt;br /&gt;
=== Data structure ===&lt;br /&gt;
&lt;br /&gt;
Data structure size is dynamic and depending on number of tracks and instruments.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE[nTracks]&amp;lt;/tt&amp;gt; || chanMode || Channel modes&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_INST[nInsts]&amp;lt;/tt&amp;gt; || insts || Instruments&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_STRK[nTracks]&amp;lt;/tt&amp;gt; || tracks || Sequenced tracks&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_CTRK&amp;lt;/tt&amp;gt; || ctrlTrack || Control track&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each section of data structure is described below.&lt;br /&gt;
&lt;br /&gt;
=== Channel modes ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Value !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;0x00&amp;lt;/tt&amp;gt; || Unused channel&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;0x01&amp;lt;/tt&amp;gt; || YMF-262M 4OP Mode&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;0x02&amp;lt;/tt&amp;gt; || YM-3812 2OP Mode&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Instruments ===&lt;br /&gt;
Header is followed by instruments block. Instrument structures are repeated &amp;lt;tt&amp;gt;nInsts&amp;lt;/tt&amp;gt; times.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_INST&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || instType || Instrument type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[8]&amp;lt;/tt&amp;gt; || shortName || Bank instrument name / short name&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[19]&amp;lt;/tt&amp;gt; || longName || Long instrument name&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE[]&amp;lt;/tt&amp;gt; || instData || Instrument data&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Instrument data size depends on instrument type:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type !! Size !! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 22 || Melody (YMF-262M, 4OP Mode)&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 11 || Melody (YM-3812, 2OP Mode)&lt;br /&gt;
|-&lt;br /&gt;
| 6 || 11 || Bass Drum&lt;br /&gt;
|-&lt;br /&gt;
| 7 || 11 || Snare Drum&lt;br /&gt;
|-&lt;br /&gt;
| 8 || 11 || Tom Tom&lt;br /&gt;
|-&lt;br /&gt;
| 9 || 11 || Cymbal&lt;br /&gt;
|-&lt;br /&gt;
| 10 || 11 || Hi-Hat&lt;br /&gt;
|-&lt;br /&gt;
| 12 || 0 || Unused instrument (comment)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Actual instrument data is just OPL registers dump.&lt;br /&gt;
&lt;br /&gt;
==== 2OP Mode instrument data ====&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Data type!!Name!!OPL base register!!Description&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModChar||0x20||Modulator characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModScale||0x40||Modulator key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModAttack||0x60||Modulator attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModSustain||0x80||Modulator sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModWaveSel||0xE0||Modulator wave select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iFeedback||0xC0||Feedback/connection&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarChar||0x23||Carrier characteristic (only melody instruments and bass drum)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarScale||0x43||Carrier key scaling/output level (only melody instruments)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarAttack||0x63||Carrier attack/decay level (only melody instruments)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarSustain||0x83||Carrier sustain/release level (only melody instruments)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarWaveSel||0xE3||Carrier wave select (only melody instruments)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== 4OP Mode instrument data ====&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Data type!!Name!!OPL base register!!Description&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Char||0x20||Operator 1 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Scale||0x40||Operator 1 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Attack||0x60||Operator 1 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Sustain||0x80||Operator 1 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1WaveSel||0xE0||Operator 1 wave select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Feedback||0xC0||Operator 1 feedback/connection&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Char||0x23||Operator 2 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Scale||0x43||Operator 2 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Attack||0x63||Operator 2 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Sustain||0x83||Operator 2 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2WaveSel||0xE3||Operator 2 wave select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Char||0x28||Operator 3 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Scale||0x48||Operator 3 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Attack||0x68||Operator 3 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Sustain||0x88||Operator 3 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3WaveSel||0xE8||Operator 3 wave select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Feedback||0xC8||Operator 3 feedback/connection&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Char||0x2B||Operator 4 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Scale||0x4B||Operator 4 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Attack||0x6B||Operator 4 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Sustain||0x8B||Operator 4 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4WaveSel||0xEB||Operator 4 wave select&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Sequenced tracks ===&lt;br /&gt;
&lt;br /&gt;
Instrument block is followed by sequenced tracks, containing the music events.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_STRK&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || numEvents || Number of events in track&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT32LE]]&amp;lt;/tt&amp;gt; || dataSize || Track data size in bytes&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_EVNT[numEvents]&amp;lt;/tt&amp;gt; || events || Track events&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_EVNT&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || ticks || Delta ticks (change position)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || event || Event code&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_EVAL&amp;lt;/tt&amp;gt; || value || Event structure&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_EVAL&amp;lt;/tt&amp;gt; structure is depending on event code:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Event code !! Description !! Event structure&lt;br /&gt;
|-&lt;br /&gt;
| 1 || Special Event || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; value&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Note On || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; pitch, &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; length (in ticks)&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Change Volume || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; volume&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Change Pitch || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; pitch (&amp;lt;tt&amp;gt;0x64&amp;lt;/tt&amp;gt; (100) is a center value)&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Instrument Change || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; number&lt;br /&gt;
|-&lt;br /&gt;
| 7 || Set Panning || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; panning (0 - right, 1 - middle, 2 - left)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Special Event ====&lt;br /&gt;
&lt;br /&gt;
This event is meaningless in normal playback.&lt;br /&gt;
&lt;br /&gt;
==== Pitch Change ====&lt;br /&gt;
&lt;br /&gt;
The pitch is a signed char type with a value between -100 and +100. The actual pitch setting is the pitch of the current sound plus the frequency of the next sound - the value can be calculated as a percentage. That is, when the pitch is +50 and the current frequency is 153, if the next frequency is 163, then actual output frequency is calculated like this:&lt;br /&gt;
&lt;br /&gt;
 153 + (163-153) * 50/100 = 158&lt;br /&gt;
&lt;br /&gt;
=== Control track ===&lt;br /&gt;
&lt;br /&gt;
The last block in the file is control track, it used to control global playback parameters.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_CTRK&amp;lt;/tt&amp;gt; structure is similar to &amp;lt;tt&amp;gt;SOP_STRK&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || numEvents || Number of control events in track&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT32LE]]&amp;lt;/tt&amp;gt; || dataSize || Control track data size in bytes&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_CEVT[numEvents]&amp;lt;/tt&amp;gt; || events || Control track events&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_CEVT&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || ticks || Delta ticks (change position)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || event || Control event code&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_CVAL&amp;lt;/tt&amp;gt; || value || Control event structure&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_CVAL&amp;lt;/tt&amp;gt; structure is depending on control event code:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Event code !! Description !! Event structure&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Change Tempo || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; tempo&lt;br /&gt;
|-&lt;br /&gt;
| 8 || Global Volume || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; volume&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Change Tempo ====&lt;br /&gt;
&lt;br /&gt;
The default tempo value is 255. The frequency is calculated with this formula:&lt;br /&gt;
&lt;br /&gt;
 freq = 298295 / (tempo / 100)&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
{{BeginFileFormatTools|Type=audio}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = Note&lt;br /&gt;
| Platform = DOS&lt;br /&gt;
| canPlay = Yes&lt;br /&gt;
| canCreate = Yes&lt;br /&gt;
| canModify = Yes&lt;br /&gt;
| canExport = No&lt;br /&gt;
| canImport = Yes; [[IMS Format|.ims]]&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = Yes&lt;br /&gt;
| notes = Official player and editor&lt;br /&gt;
}}&lt;br /&gt;
{{EndFileFormatTools}}&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* http://www.vogons.org/viewtopic.php?f=5&amp;amp;t=37849 - topic on VOGONS&lt;br /&gt;
* https://adplug.github.io/library/entry/Note10b2.html - AdPlug Library entry&lt;br /&gt;
* [[ROL Format]] - similar format&lt;br /&gt;
&lt;br /&gt;
== Credits ==&lt;br /&gt;
&lt;br /&gt;
This file format was described by Park Jeenhong in 1996 and then adapted and supplemented by [[User:binarymaster|binarymaster]].  If you find this information helpful in a project you&#039;re working on, please give credit where credit is due.  (A link back to this wiki would be nice too!)&lt;/div&gt;</summary>
		<author><name>Binarymaster</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=SOP_Format&amp;diff=7020</id>
		<title>SOP Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=SOP_Format&amp;diff=7020"/>
		<updated>2017-01-11T09:24:56Z</updated>

		<summary type="html">&lt;p&gt;Binarymaster: Update structure names&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NeedMoreInfo}}&lt;br /&gt;
{{Music Infobox&lt;br /&gt;
 | Type = Custom&lt;br /&gt;
 | Instruments = OPL&lt;br /&gt;
 | NumChannels = 9 or 11 (OPL2), 18 or 20 (OPL3)&lt;br /&gt;
 | NumTracks = 20&lt;br /&gt;
 | NumPatterns = 1&lt;br /&gt;
 | NumOrders = 0&lt;br /&gt;
 | Tags = File name, Title, Instrument names&lt;br /&gt;
 | Games = None&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;SOP Format&#039;&#039;&#039; is created by Lee Ho Bum (sopepos) for the &#039;&#039;&#039;Note&#039;&#039;&#039; OPL3 music sequencer.&lt;br /&gt;
&lt;br /&gt;
== File format ==&lt;br /&gt;
&lt;br /&gt;
=== Header ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[char]][7]&amp;lt;/tt&amp;gt; || signature || Header signature (must be &amp;quot;&amp;lt;tt&amp;gt;sopepos&amp;lt;/tt&amp;gt;&amp;quot;)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT8]]&amp;lt;/tt&amp;gt; || majorVersion || Major version number (usually 0)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || minorVersion || Minor version number (usually 1)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[BYTE]]&amp;lt;/tt&amp;gt; || padding || Unused, must be zero&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[13]&amp;lt;/tt&amp;gt; || fileName || File name / short name, null terminated&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[31]&amp;lt;/tt&amp;gt; || title || Song title, null terminated&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT16LE]]&amp;lt;/tt&amp;gt; || percussive || OPL rhythm mode: 0 = melodic, 1 = percussive&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || tickBeat || Number of ticks per beat&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}} (usually 4)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}} (usually 120)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}} (usually 0)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || beatMeasure || Number of beats per measure&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || nTracks || Number of tracks&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || nInsts || Number of instruments&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE[nTracks]&amp;lt;/tt&amp;gt; || chanMode || Channel modes (see below)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_INST[nInsts]&amp;lt;/tt&amp;gt; || insts || Instruments&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_STRK[nTracks]&amp;lt;/tt&amp;gt; || tracks || Sequenced tracks&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_CTRK&amp;lt;/tt&amp;gt; || ctrlTrack || Control track&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The only known version of this format is 0.1.&lt;br /&gt;
&lt;br /&gt;
The fields &amp;lt;tt&amp;gt;tickBeat&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;beatMeasure&amp;lt;/tt&amp;gt; are used to convert ticks into beats and measures for drawing a musical staff.&lt;br /&gt;
&lt;br /&gt;
=== Channel modes ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Value !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;0x00&amp;lt;/tt&amp;gt; || Unused channel&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;0x01&amp;lt;/tt&amp;gt; || YMF-262M 4OP Mode&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;0x02&amp;lt;/tt&amp;gt; || YM-3812 2OP Mode&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Instruments ===&lt;br /&gt;
Header is followed by instruments block. Instrument structures are repeated &amp;lt;tt&amp;gt;nInsts&amp;lt;/tt&amp;gt; times.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_INST&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || instType || Instrument type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[8]&amp;lt;/tt&amp;gt; || shortName || Bank instrument name / short name&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[19]&amp;lt;/tt&amp;gt; || longName || Long instrument name&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE[]&amp;lt;/tt&amp;gt; || instData || Instrument data&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Instrument data size depends on instrument type:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type !! Size !! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 22 || Melody (YMF-262M, 4OP Mode)&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 11 || Melody (YM-3812, 2OP Mode)&lt;br /&gt;
|-&lt;br /&gt;
| 6 || 11 || Bass Drum&lt;br /&gt;
|-&lt;br /&gt;
| 7 || 11 || Snare Drum&lt;br /&gt;
|-&lt;br /&gt;
| 8 || 11 || Tom Tom&lt;br /&gt;
|-&lt;br /&gt;
| 9 || 11 || Cymbal&lt;br /&gt;
|-&lt;br /&gt;
| 10 || 11 || Hi-Hat&lt;br /&gt;
|-&lt;br /&gt;
| 12 || 0 || Unused instrument (comment)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Actual instrument data is just OPL registers dump.&lt;br /&gt;
&lt;br /&gt;
==== 2OP Mode instrument data ====&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Data type!!Name!!OPL base register!!Description&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModChar||0x20||Modulator characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModScale||0x40||Modulator key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModAttack||0x60||Modulator attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModSustain||0x80||Modulator sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModWaveSel||0xE0||Modulator wave select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iFeedback||0xC0||Feedback/connection&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarChar||0x23||Carrier characteristic (only melody instruments and bass drum)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarScale||0x43||Carrier key scaling/output level (only melody instruments)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarAttack||0x63||Carrier attack/decay level (only melody instruments)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarSustain||0x83||Carrier sustain/release level (only melody instruments)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarWaveSel||0xE3||Carrier wave select (only melody instruments)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== 4OP Mode instrument data ====&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Data type!!Name!!OPL base register!!Description&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Char||0x20||Operator 1 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Scale||0x40||Operator 1 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Attack||0x60||Operator 1 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Sustain||0x80||Operator 1 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1WaveSel||0xE0||Operator 1 wave select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Feedback||0xC0||Operator 1 feedback/connection&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Char||0x23||Operator 2 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Scale||0x43||Operator 2 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Attack||0x63||Operator 2 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Sustain||0x83||Operator 2 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2WaveSel||0xE3||Operator 2 wave select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Char||0x28||Operator 3 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Scale||0x48||Operator 3 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Attack||0x68||Operator 3 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Sustain||0x88||Operator 3 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3WaveSel||0xE8||Operator 3 wave select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Feedback||0xC8||Operator 3 feedback/connection&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Char||0x2B||Operator 4 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Scale||0x4B||Operator 4 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Attack||0x6B||Operator 4 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Sustain||0x8B||Operator 4 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4WaveSel||0xEB||Operator 4 wave select&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Sequenced tracks ===&lt;br /&gt;
&lt;br /&gt;
Instrument block is followed by sequenced tracks, containing the music events.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_STRK&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || numEvents || Number of events in track&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT32LE]]&amp;lt;/tt&amp;gt; || dataSize || Track data size in bytes&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_EVNT[numEvents]&amp;lt;/tt&amp;gt; || events || Track events&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_EVNT&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || ticks || Delta ticks (change position)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || event || Event code&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_EVAL&amp;lt;/tt&amp;gt; || value || Event structure&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_EVAL&amp;lt;/tt&amp;gt; structure is depending on event code:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Event code !! Description !! Event structure&lt;br /&gt;
|-&lt;br /&gt;
| 1 || Special Event || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; value&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Note On || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; pitch, &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; length (in ticks)&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Change Volume || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; volume&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Change Pitch || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; pitch (&amp;lt;tt&amp;gt;0x64&amp;lt;/tt&amp;gt; (100) is a center value)&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Instrument Change || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; number&lt;br /&gt;
|-&lt;br /&gt;
| 7 || Set Panning || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; panning (0 - right, 1 - middle, 2 - left)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Special Event ====&lt;br /&gt;
&lt;br /&gt;
This event is meaningless in normal playback.&lt;br /&gt;
&lt;br /&gt;
==== Pitch Change ====&lt;br /&gt;
&lt;br /&gt;
The pitch is a signed char type with a value between -100 and +100. The actual pitch setting is the pitch of the current sound plus the frequency of the next sound - the value can be calculated as a percentage. That is, when the pitch is +50 and the current frequency is 153, if the next frequency is 163, then actual output frequency is calculated like this:&lt;br /&gt;
&lt;br /&gt;
 153 + (163-153) * 50/100 = 158&lt;br /&gt;
&lt;br /&gt;
=== Control track ===&lt;br /&gt;
&lt;br /&gt;
The last block in the file is control track, it used to control global playback parameters.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_CTRK&amp;lt;/tt&amp;gt; structure is similar to &amp;lt;tt&amp;gt;SOP_STRK&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || numEvents || Number of control events in track&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT32LE]]&amp;lt;/tt&amp;gt; || dataSize || Control track data size in bytes&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_CEVT[numEvents]&amp;lt;/tt&amp;gt; || events || Control track events&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_CEVT&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || ticks || Delta ticks (change position)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || event || Control event code&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_CVAL&amp;lt;/tt&amp;gt; || value || Control event structure&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_CVAL&amp;lt;/tt&amp;gt; structure is depending on control event code:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Event code !! Description !! Event structure&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Change Tempo || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; tempo&lt;br /&gt;
|-&lt;br /&gt;
| 8 || Global Volume || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; volume&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Change Tempo ====&lt;br /&gt;
&lt;br /&gt;
The default tempo value is 255. The frequency is calculated with this formula:&lt;br /&gt;
&lt;br /&gt;
 freq = 298295 / (tempo / 100)&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
{{BeginFileFormatTools|Type=audio}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = Note&lt;br /&gt;
| Platform = DOS&lt;br /&gt;
| canPlay = Yes&lt;br /&gt;
| canCreate = Yes&lt;br /&gt;
| canModify = Yes&lt;br /&gt;
| canExport = No&lt;br /&gt;
| canImport = Yes; [[IMS Format|.ims]]&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = Yes&lt;br /&gt;
| notes = Official player and editor&lt;br /&gt;
}}&lt;br /&gt;
{{EndFileFormatTools}}&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* http://www.vogons.org/viewtopic.php?f=5&amp;amp;t=37849 - topic on VOGONS&lt;br /&gt;
* https://adplug.github.io/library/entry/Note10b2.html - AdPlug Library entry&lt;br /&gt;
* [[ROL Format]] - similar format&lt;br /&gt;
&lt;br /&gt;
== Credits ==&lt;br /&gt;
&lt;br /&gt;
This file format was described by Park Jeenhong in 1996 and then adapted and supplemented by [[User:binarymaster|binarymaster]].  If you find this information helpful in a project you&#039;re working on, please give credit where credit is due.  (A link back to this wiki would be nice too!)&lt;/div&gt;</summary>
		<author><name>Binarymaster</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=SOP_Format&amp;diff=7019</id>
		<title>SOP Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=SOP_Format&amp;diff=7019"/>
		<updated>2017-01-11T09:19:28Z</updated>

		<summary type="html">&lt;p&gt;Binarymaster: /* Header */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NeedMoreInfo}}&lt;br /&gt;
{{Music Infobox&lt;br /&gt;
 | Type = Custom&lt;br /&gt;
 | Instruments = OPL&lt;br /&gt;
 | NumChannels = 9 or 11 (OPL2), 18 or 20 (OPL3)&lt;br /&gt;
 | NumTracks = 20&lt;br /&gt;
 | NumPatterns = 1&lt;br /&gt;
 | NumOrders = 0&lt;br /&gt;
 | Tags = File name, Title, Instrument names&lt;br /&gt;
 | Games = None&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;SOP Format&#039;&#039;&#039; is created by Lee Ho Bum (sopepos) for the &#039;&#039;&#039;Note&#039;&#039;&#039; OPL3 music sequencer.&lt;br /&gt;
&lt;br /&gt;
== File format ==&lt;br /&gt;
&lt;br /&gt;
=== Header ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[char]][7]&amp;lt;/tt&amp;gt; || signature || Header signature (must be &amp;quot;&amp;lt;tt&amp;gt;sopepos&amp;lt;/tt&amp;gt;&amp;quot;)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT8]]&amp;lt;/tt&amp;gt; || majorVersion || Major version number (usually 0)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || minorVersion || Minor version number (usually 1)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[BYTE]]&amp;lt;/tt&amp;gt; || padding || Unused, must be zero&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[13]&amp;lt;/tt&amp;gt; || fileName || File name / short name, null terminated&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[31]&amp;lt;/tt&amp;gt; || title || Song title, null terminated&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT16LE]]&amp;lt;/tt&amp;gt; || percussive || OPL rhythm mode: 0 = melodic, 1 = percussive&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || tickBeat || Number of ticks per beat&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}} (usually 4)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}} (usually 120)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}} (usually 0)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || beatMeasure || Number of beats per measure&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || {{TODO|Unknown value}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || nTracks || Number of tracks&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || nInsts || Number of instruments&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE[nTracks]&amp;lt;/tt&amp;gt; || chanMode || Channel modes (see below)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_INST[nInsts]&amp;lt;/tt&amp;gt; || insts || Instruments&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_TRK[nTracks]&amp;lt;/tt&amp;gt; || tracks || Sequenced tracks&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_CTRL&amp;lt;/tt&amp;gt; || ctrlTrack || Control track&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The only known version of this format is 0.1.&lt;br /&gt;
&lt;br /&gt;
The fields &amp;lt;tt&amp;gt;tickBeat&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;beatMeasure&amp;lt;/tt&amp;gt; are used to convert ticks into beats and measures for drawing a musical staff.&lt;br /&gt;
&lt;br /&gt;
=== Channel modes ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Value !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;0x00&amp;lt;/tt&amp;gt; || Unused channel&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;0x01&amp;lt;/tt&amp;gt; || YMF-262M 4OP Mode&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;0x02&amp;lt;/tt&amp;gt; || YM-3812 2OP Mode&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Instruments ===&lt;br /&gt;
Header is followed by instruments block. Instrument structures are repeated &amp;lt;tt&amp;gt;nInsts&amp;lt;/tt&amp;gt; times.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_INST&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || instType || Instrument type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[8]&amp;lt;/tt&amp;gt; || shortName || Bank instrument name / short name&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[19]&amp;lt;/tt&amp;gt; || longName || Long instrument name&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE[]&amp;lt;/tt&amp;gt; || instData || Instrument data&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Instrument data size depends on instrument type:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type !! Size !! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 22 || Melody (YMF-262M, 4OP Mode)&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 11 || Melody (YM-3812, 2OP Mode)&lt;br /&gt;
|-&lt;br /&gt;
| 6 || 11 || Bass Drum&lt;br /&gt;
|-&lt;br /&gt;
| 7 || 11 || Snare Drum&lt;br /&gt;
|-&lt;br /&gt;
| 8 || 11 || Tom Tom&lt;br /&gt;
|-&lt;br /&gt;
| 9 || 11 || Cymbal&lt;br /&gt;
|-&lt;br /&gt;
| 10 || 11 || Hi-Hat&lt;br /&gt;
|-&lt;br /&gt;
| 12 || 0 || Unused instrument (comment)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Actual instrument data is just OPL registers dump.&lt;br /&gt;
&lt;br /&gt;
==== 2OP Mode instrument data ====&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Data type!!Name!!OPL base register!!Description&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModChar||0x20||Modulator characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModScale||0x40||Modulator key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModAttack||0x60||Modulator attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModSustain||0x80||Modulator sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModWaveSel||0xE0||Modulator wave select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iFeedback||0xC0||Feedback/connection&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarChar||0x23||Carrier characteristic (only melody instruments and bass drum)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarScale||0x43||Carrier key scaling/output level (only melody instruments)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarAttack||0x63||Carrier attack/decay level (only melody instruments)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarSustain||0x83||Carrier sustain/release level (only melody instruments)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarWaveSel||0xE3||Carrier wave select (only melody instruments)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== 4OP Mode instrument data ====&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Data type!!Name!!OPL base register!!Description&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Char||0x20||Operator 1 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Scale||0x40||Operator 1 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Attack||0x60||Operator 1 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Sustain||0x80||Operator 1 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1WaveSel||0xE0||Operator 1 wave select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Feedback||0xC0||Operator 1 feedback/connection&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Char||0x23||Operator 2 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Scale||0x43||Operator 2 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Attack||0x63||Operator 2 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Sustain||0x83||Operator 2 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2WaveSel||0xE3||Operator 2 wave select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Char||0x28||Operator 3 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Scale||0x48||Operator 3 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Attack||0x68||Operator 3 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Sustain||0x88||Operator 3 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3WaveSel||0xE8||Operator 3 wave select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Feedback||0xC8||Operator 3 feedback/connection&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Char||0x2B||Operator 4 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Scale||0x4B||Operator 4 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Attack||0x6B||Operator 4 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Sustain||0x8B||Operator 4 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4WaveSel||0xEB||Operator 4 wave select&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Sequenced tracks ===&lt;br /&gt;
&lt;br /&gt;
Instrument block is followed by sequenced tracks, containing the music events.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_TRK&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || numEvents || Number of events in track&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT32LE]]&amp;lt;/tt&amp;gt; || dataSize || Track data size in bytes&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_EVENT[numEvents]&amp;lt;/tt&amp;gt; || events || Track events&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_EVENT&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || ticks || Delta ticks (change position)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || event || Event code&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_EVAL&amp;lt;/tt&amp;gt; || value || Event structure&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_EVAL&amp;lt;/tt&amp;gt; structure is depending on event code:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Event code !! Description !! Event structure&lt;br /&gt;
|-&lt;br /&gt;
| 1 || Special Event || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; value&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Note On || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; pitch, &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; length (in ticks)&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Change Volume || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; volume&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Change Pitch || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; pitch (&amp;lt;tt&amp;gt;0x64&amp;lt;/tt&amp;gt; (100) is a center value)&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Instrument Change || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; number&lt;br /&gt;
|-&lt;br /&gt;
| 7 || Set Panning || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; panning (0 - right, 1 - middle, 2 - left)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Special Event ====&lt;br /&gt;
&lt;br /&gt;
This event is meaningless in normal playback.&lt;br /&gt;
&lt;br /&gt;
==== Pitch Change ====&lt;br /&gt;
&lt;br /&gt;
The pitch is a signed char type with a value between -100 and +100. The actual pitch setting is the pitch of the current sound plus the frequency of the next sound - the value can be calculated as a percentage. That is, when the pitch is +50 and the current frequency is 153, if the next frequency is 163, then actual output frequency is calculated like this:&lt;br /&gt;
&lt;br /&gt;
 153 + (163-153) * 50/100 = 158&lt;br /&gt;
&lt;br /&gt;
=== Control track ===&lt;br /&gt;
&lt;br /&gt;
The last block in the file is control track, it used to control global playback parameters.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_CTRL&amp;lt;/tt&amp;gt; structure is similar to &amp;lt;tt&amp;gt;SOP_TRK&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || numEvents || Number of control events in track&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT32LE]]&amp;lt;/tt&amp;gt; || dataSize || Control track data size in bytes&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_CTEV[numEvents]&amp;lt;/tt&amp;gt; || events || Control track events&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_CTEV&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || ticks || Delta ticks (change position)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || event || Control event code&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_CVAL&amp;lt;/tt&amp;gt; || value || Control event structure&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_CVAL&amp;lt;/tt&amp;gt; structure is depending on control event code:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Event code !! Description !! Event structure&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Change Tempo || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; tempo&lt;br /&gt;
|-&lt;br /&gt;
| 8 || Global Volume || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; volume&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Change Tempo ====&lt;br /&gt;
&lt;br /&gt;
The default tempo value is 255. The frequency is calculated with this formula:&lt;br /&gt;
&lt;br /&gt;
 freq = 298295 / (tempo / 100)&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
{{BeginFileFormatTools|Type=audio}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = Note&lt;br /&gt;
| Platform = DOS&lt;br /&gt;
| canPlay = Yes&lt;br /&gt;
| canCreate = Yes&lt;br /&gt;
| canModify = Yes&lt;br /&gt;
| canExport = No&lt;br /&gt;
| canImport = Yes; [[IMS Format|.ims]]&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = Yes&lt;br /&gt;
| notes = Official player and editor&lt;br /&gt;
}}&lt;br /&gt;
{{EndFileFormatTools}}&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* http://www.vogons.org/viewtopic.php?f=5&amp;amp;t=37849 - topic on VOGONS&lt;br /&gt;
* https://adplug.github.io/library/entry/Note10b2.html - AdPlug Library entry&lt;br /&gt;
* [[ROL Format]] - similar format&lt;br /&gt;
&lt;br /&gt;
== Credits ==&lt;br /&gt;
&lt;br /&gt;
This file format was described by Park Jeenhong in 1996 and then adapted and supplemented by [[User:binarymaster|binarymaster]].  If you find this information helpful in a project you&#039;re working on, please give credit where credit is due.  (A link back to this wiki would be nice too!)&lt;/div&gt;</summary>
		<author><name>Binarymaster</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=SOP_Format&amp;diff=7018</id>
		<title>SOP Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=SOP_Format&amp;diff=7018"/>
		<updated>2017-01-09T23:57:11Z</updated>

		<summary type="html">&lt;p&gt;Binarymaster: /* Control track */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NeedMoreInfo}}&lt;br /&gt;
{{Music Infobox&lt;br /&gt;
 | Type = Custom&lt;br /&gt;
 | Instruments = OPL&lt;br /&gt;
 | NumChannels = 9 or 11 (OPL2), 18 or 20 (OPL3)&lt;br /&gt;
 | NumTracks = 20&lt;br /&gt;
 | NumPatterns = 1&lt;br /&gt;
 | NumOrders = 0&lt;br /&gt;
 | Tags = File name, Title, Instrument names&lt;br /&gt;
 | Games = None&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;SOP Format&#039;&#039;&#039; is created by Lee Ho Bum (sopepos) for the &#039;&#039;&#039;Note&#039;&#039;&#039; OPL3 music sequencer.&lt;br /&gt;
&lt;br /&gt;
== File format ==&lt;br /&gt;
&lt;br /&gt;
=== Header ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[char]][7]&amp;lt;/tt&amp;gt; || signature || Header signature (must be &amp;quot;&amp;lt;tt&amp;gt;sopepos&amp;lt;/tt&amp;gt;&amp;quot;)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT8]]&amp;lt;/tt&amp;gt; || majorVersion || Major version number (usually 0)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || minorVersion || Minor version number (usually 1)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[BYTE]]&amp;lt;/tt&amp;gt; || padding || Unused, must be zero&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[13]&amp;lt;/tt&amp;gt; || fileName || File name / short name, null terminated&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[31]&amp;lt;/tt&amp;gt; || title || Song title, null terminated&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT16LE]]&amp;lt;/tt&amp;gt; || percussive || OPL rhythm mode: 0 = melodic, 1 = percussive&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || tickBeat || Number of ticks per beat&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || Unknown value (usually 4)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || Unknown value (usually 120)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || Unknown value (usually 0)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE[3]&amp;lt;/tt&amp;gt; || unknown || Unknown value&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || beatMeasure || Number of beats per measure&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE[8]&amp;lt;/tt&amp;gt; || unknown || Unknown values&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || nTracks || Number of tracks&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || nInsts || Number of instruments&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE[nTracks]&amp;lt;/tt&amp;gt; || chanMode || Channel modes&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_INST[nInsts]&amp;lt;/tt&amp;gt; || insts || Instruments&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_TRK[nTracks]&amp;lt;/tt&amp;gt; || tracks || Sequenced tracks&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_CTRL&amp;lt;/tt&amp;gt; || ctrlTrack || Control track&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The only known version of this format is 0.1.&lt;br /&gt;
&lt;br /&gt;
The fields &amp;lt;tt&amp;gt;tickBeat&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;beatMeasure&amp;lt;/tt&amp;gt; are used to convert ticks into beats and measures for drawing a musical staff.&lt;br /&gt;
&lt;br /&gt;
=== Channel modes ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Value !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;0x00&amp;lt;/tt&amp;gt; || Unused channel&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;0x01&amp;lt;/tt&amp;gt; || YMF-262M 4OP Mode&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;0x02&amp;lt;/tt&amp;gt; || YM-3812 2OP Mode&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Instruments ===&lt;br /&gt;
Header is followed by instruments block. Instrument structures are repeated &amp;lt;tt&amp;gt;nInsts&amp;lt;/tt&amp;gt; times.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_INST&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || instType || Instrument type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[8]&amp;lt;/tt&amp;gt; || shortName || Bank instrument name / short name&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[19]&amp;lt;/tt&amp;gt; || longName || Long instrument name&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE[]&amp;lt;/tt&amp;gt; || instData || Instrument data&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Instrument data size depends on instrument type:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type !! Size !! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 22 || Melody (YMF-262M, 4OP Mode)&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 11 || Melody (YM-3812, 2OP Mode)&lt;br /&gt;
|-&lt;br /&gt;
| 6 || 11 || Bass Drum&lt;br /&gt;
|-&lt;br /&gt;
| 7 || 11 || Snare Drum&lt;br /&gt;
|-&lt;br /&gt;
| 8 || 11 || Tom Tom&lt;br /&gt;
|-&lt;br /&gt;
| 9 || 11 || Cymbal&lt;br /&gt;
|-&lt;br /&gt;
| 10 || 11 || Hi-Hat&lt;br /&gt;
|-&lt;br /&gt;
| 12 || 0 || Unused instrument (comment)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Actual instrument data is just OPL registers dump.&lt;br /&gt;
&lt;br /&gt;
==== 2OP Mode instrument data ====&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Data type!!Name!!OPL base register!!Description&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModChar||0x20||Modulator characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModScale||0x40||Modulator key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModAttack||0x60||Modulator attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModSustain||0x80||Modulator sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModWaveSel||0xE0||Modulator wave select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iFeedback||0xC0||Feedback/connection&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarChar||0x23||Carrier characteristic (only melody instruments and bass drum)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarScale||0x43||Carrier key scaling/output level (only melody instruments)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarAttack||0x63||Carrier attack/decay level (only melody instruments)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarSustain||0x83||Carrier sustain/release level (only melody instruments)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarWaveSel||0xE3||Carrier wave select (only melody instruments)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== 4OP Mode instrument data ====&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Data type!!Name!!OPL base register!!Description&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Char||0x20||Operator 1 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Scale||0x40||Operator 1 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Attack||0x60||Operator 1 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Sustain||0x80||Operator 1 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1WaveSel||0xE0||Operator 1 wave select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Feedback||0xC0||Operator 1 feedback/connection&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Char||0x23||Operator 2 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Scale||0x43||Operator 2 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Attack||0x63||Operator 2 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Sustain||0x83||Operator 2 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2WaveSel||0xE3||Operator 2 wave select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Char||0x28||Operator 3 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Scale||0x48||Operator 3 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Attack||0x68||Operator 3 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Sustain||0x88||Operator 3 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3WaveSel||0xE8||Operator 3 wave select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Feedback||0xC8||Operator 3 feedback/connection&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Char||0x2B||Operator 4 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Scale||0x4B||Operator 4 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Attack||0x6B||Operator 4 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Sustain||0x8B||Operator 4 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4WaveSel||0xEB||Operator 4 wave select&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Sequenced tracks ===&lt;br /&gt;
&lt;br /&gt;
Instrument block is followed by sequenced tracks, containing the music events.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_TRK&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || numEvents || Number of events in track&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT32LE]]&amp;lt;/tt&amp;gt; || dataSize || Track data size in bytes&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_EVENT[numEvents]&amp;lt;/tt&amp;gt; || events || Track events&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_EVENT&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || ticks || Delta ticks (change position)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || event || Event code&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_EVAL&amp;lt;/tt&amp;gt; || value || Event structure&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_EVAL&amp;lt;/tt&amp;gt; structure is depending on event code:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Event code !! Description !! Event structure&lt;br /&gt;
|-&lt;br /&gt;
| 1 || Special Event || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; value&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Note On || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; pitch, &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; length (in ticks)&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Change Volume || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; volume&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Change Pitch || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; pitch (&amp;lt;tt&amp;gt;0x64&amp;lt;/tt&amp;gt; (100) is a center value)&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Instrument Change || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; number&lt;br /&gt;
|-&lt;br /&gt;
| 7 || Set Panning || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; panning (0 - right, 1 - middle, 2 - left)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Special Event ====&lt;br /&gt;
&lt;br /&gt;
This event is meaningless in normal playback.&lt;br /&gt;
&lt;br /&gt;
==== Pitch Change ====&lt;br /&gt;
&lt;br /&gt;
The pitch is a signed char type with a value between -100 and +100. The actual pitch setting is the pitch of the current sound plus the frequency of the next sound - the value can be calculated as a percentage. That is, when the pitch is +50 and the current frequency is 153, if the next frequency is 163, then actual output frequency is calculated like this:&lt;br /&gt;
&lt;br /&gt;
 153 + (163-153) * 50/100 = 158&lt;br /&gt;
&lt;br /&gt;
=== Control track ===&lt;br /&gt;
&lt;br /&gt;
The last block in the file is control track, it used to control global playback parameters.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_CTRL&amp;lt;/tt&amp;gt; structure is similar to &amp;lt;tt&amp;gt;SOP_TRK&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || numEvents || Number of control events in track&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT32LE]]&amp;lt;/tt&amp;gt; || dataSize || Control track data size in bytes&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_CTEV[numEvents]&amp;lt;/tt&amp;gt; || events || Control track events&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_CTEV&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || ticks || Delta ticks (change position)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || event || Control event code&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_CVAL&amp;lt;/tt&amp;gt; || value || Control event structure&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_CVAL&amp;lt;/tt&amp;gt; structure is depending on control event code:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Event code !! Description !! Event structure&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Change Tempo || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; tempo&lt;br /&gt;
|-&lt;br /&gt;
| 8 || Global Volume || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; volume&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Change Tempo ====&lt;br /&gt;
&lt;br /&gt;
The default tempo value is 255. The frequency is calculated with this formula:&lt;br /&gt;
&lt;br /&gt;
 freq = 298295 / (tempo / 100)&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
{{BeginFileFormatTools|Type=audio}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = Note&lt;br /&gt;
| Platform = DOS&lt;br /&gt;
| canPlay = Yes&lt;br /&gt;
| canCreate = Yes&lt;br /&gt;
| canModify = Yes&lt;br /&gt;
| canExport = No&lt;br /&gt;
| canImport = Yes; [[IMS Format|.ims]]&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = Yes&lt;br /&gt;
| notes = Official player and editor&lt;br /&gt;
}}&lt;br /&gt;
{{EndFileFormatTools}}&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* http://www.vogons.org/viewtopic.php?f=5&amp;amp;t=37849 - topic on VOGONS&lt;br /&gt;
* https://adplug.github.io/library/entry/Note10b2.html - AdPlug Library entry&lt;br /&gt;
* [[ROL Format]] - similar format&lt;br /&gt;
&lt;br /&gt;
== Credits ==&lt;br /&gt;
&lt;br /&gt;
This file format was described by Park Jeenhong in 1996 and then adapted and supplemented by [[User:binarymaster|binarymaster]].  If you find this information helpful in a project you&#039;re working on, please give credit where credit is due.  (A link back to this wiki would be nice too!)&lt;/div&gt;</summary>
		<author><name>Binarymaster</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=SOP_Format&amp;diff=7017</id>
		<title>SOP Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=SOP_Format&amp;diff=7017"/>
		<updated>2017-01-09T23:26:42Z</updated>

		<summary type="html">&lt;p&gt;Binarymaster: /* Sequenced tracks */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NeedMoreInfo}}&lt;br /&gt;
{{Music Infobox&lt;br /&gt;
 | Type = Custom&lt;br /&gt;
 | Instruments = OPL&lt;br /&gt;
 | NumChannels = 9 or 11 (OPL2), 18 or 20 (OPL3)&lt;br /&gt;
 | NumTracks = 20&lt;br /&gt;
 | NumPatterns = 1&lt;br /&gt;
 | NumOrders = 0&lt;br /&gt;
 | Tags = File name, Title, Instrument names&lt;br /&gt;
 | Games = None&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;SOP Format&#039;&#039;&#039; is created by Lee Ho Bum (sopepos) for the &#039;&#039;&#039;Note&#039;&#039;&#039; OPL3 music sequencer.&lt;br /&gt;
&lt;br /&gt;
== File format ==&lt;br /&gt;
&lt;br /&gt;
=== Header ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[char]][7]&amp;lt;/tt&amp;gt; || signature || Header signature (must be &amp;quot;&amp;lt;tt&amp;gt;sopepos&amp;lt;/tt&amp;gt;&amp;quot;)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT8]]&amp;lt;/tt&amp;gt; || majorVersion || Major version number (usually 0)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || minorVersion || Minor version number (usually 1)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[BYTE]]&amp;lt;/tt&amp;gt; || padding || Unused, must be zero&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[13]&amp;lt;/tt&amp;gt; || fileName || File name / short name, null terminated&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[31]&amp;lt;/tt&amp;gt; || title || Song title, null terminated&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT16LE]]&amp;lt;/tt&amp;gt; || percussive || OPL rhythm mode: 0 = melodic, 1 = percussive&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || tickBeat || Number of ticks per beat&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || Unknown value (usually 4)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || Unknown value (usually 120)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || Unknown value (usually 0)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE[3]&amp;lt;/tt&amp;gt; || unknown || Unknown value&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || beatMeasure || Number of beats per measure&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE[8]&amp;lt;/tt&amp;gt; || unknown || Unknown values&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || nTracks || Number of tracks&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || nInsts || Number of instruments&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE[nTracks]&amp;lt;/tt&amp;gt; || chanMode || Channel modes&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_INST[nInsts]&amp;lt;/tt&amp;gt; || insts || Instruments&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_TRK[nTracks]&amp;lt;/tt&amp;gt; || tracks || Sequenced tracks&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The only known version of this format is 0.1.&lt;br /&gt;
&lt;br /&gt;
The fields &amp;lt;tt&amp;gt;tickBeat&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;beatMeasure&amp;lt;/tt&amp;gt; are used to convert ticks into beats and measures for drawing a musical staff.&lt;br /&gt;
&lt;br /&gt;
=== Channel modes ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Value !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;0x00&amp;lt;/tt&amp;gt; || Unused channel&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;0x01&amp;lt;/tt&amp;gt; || YMF-262M 4OP Mode&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;0x02&amp;lt;/tt&amp;gt; || YM-3812 2OP Mode&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Instruments ===&lt;br /&gt;
Header is followed by instruments block. Instrument structures are repeated &amp;lt;tt&amp;gt;nInsts&amp;lt;/tt&amp;gt; times.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_INST&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || instType || Instrument type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[8]&amp;lt;/tt&amp;gt; || shortName || Bank instrument name / short name&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[19]&amp;lt;/tt&amp;gt; || longName || Long instrument name&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE[]&amp;lt;/tt&amp;gt; || instData || Instrument data&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Instrument data size depends on instrument type:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type !! Size !! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 22 || Melody (YMF-262M, 4OP Mode)&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 11 || Melody (YM-3812, 2OP Mode)&lt;br /&gt;
|-&lt;br /&gt;
| 6 || 11 || Bass Drum&lt;br /&gt;
|-&lt;br /&gt;
| 7 || 11 || Snare Drum&lt;br /&gt;
|-&lt;br /&gt;
| 8 || 11 || Tom Tom&lt;br /&gt;
|-&lt;br /&gt;
| 9 || 11 || Cymbal&lt;br /&gt;
|-&lt;br /&gt;
| 10 || 11 || Hi-Hat&lt;br /&gt;
|-&lt;br /&gt;
| 12 || 0 || Unused instrument (comment)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Actual instrument data is just OPL registers dump.&lt;br /&gt;
&lt;br /&gt;
==== 2OP Mode instrument data ====&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Data type!!Name!!OPL base register!!Description&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModChar||0x20||Modulator characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModScale||0x40||Modulator key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModAttack||0x60||Modulator attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModSustain||0x80||Modulator sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModWaveSel||0xE0||Modulator wave select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iFeedback||0xC0||Feedback/connection&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarChar||0x23||Carrier characteristic (only melody instruments and bass drum)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarScale||0x43||Carrier key scaling/output level (only melody instruments)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarAttack||0x63||Carrier attack/decay level (only melody instruments)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarSustain||0x83||Carrier sustain/release level (only melody instruments)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarWaveSel||0xE3||Carrier wave select (only melody instruments)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== 4OP Mode instrument data ====&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Data type!!Name!!OPL base register!!Description&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Char||0x20||Operator 1 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Scale||0x40||Operator 1 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Attack||0x60||Operator 1 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Sustain||0x80||Operator 1 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1WaveSel||0xE0||Operator 1 wave select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Feedback||0xC0||Operator 1 feedback/connection&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Char||0x23||Operator 2 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Scale||0x43||Operator 2 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Attack||0x63||Operator 2 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Sustain||0x83||Operator 2 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2WaveSel||0xE3||Operator 2 wave select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Char||0x28||Operator 3 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Scale||0x48||Operator 3 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Attack||0x68||Operator 3 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Sustain||0x88||Operator 3 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3WaveSel||0xE8||Operator 3 wave select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Feedback||0xC8||Operator 3 feedback/connection&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Char||0x2B||Operator 4 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Scale||0x4B||Operator 4 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Attack||0x6B||Operator 4 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Sustain||0x8B||Operator 4 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4WaveSel||0xEB||Operator 4 wave select&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Sequenced tracks ===&lt;br /&gt;
&lt;br /&gt;
Instrument block is followed by sequenced tracks, containing the music events.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_TRK&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || numEvents || Number of events in track&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT32LE]]&amp;lt;/tt&amp;gt; || dataSize || Track data size in bytes&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_EVENT[numEvents]&amp;lt;/tt&amp;gt; || events || Track events&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_EVENT&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || ticks || Delta ticks (change position)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || event || Event code&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_EVAL&amp;lt;/tt&amp;gt; || value || Event structure&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_EVAL&amp;lt;/tt&amp;gt; structure is depending on event code:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Event code !! Description !! Event structure&lt;br /&gt;
|-&lt;br /&gt;
| 1 || Special Event || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; value&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Note On || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; pitch, &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; length (in ticks)&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Change Volume || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; volume&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Change Pitch || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; pitch (64 is center value)&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Instrument Change || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; number&lt;br /&gt;
|-&lt;br /&gt;
| 7 || Set Panning || &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; panning (0 - right, 1 - middle, 2 - left)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
{{BeginFileFormatTools|Type=audio}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = Note&lt;br /&gt;
| Platform = DOS&lt;br /&gt;
| canPlay = Yes&lt;br /&gt;
| canCreate = Yes&lt;br /&gt;
| canModify = Yes&lt;br /&gt;
| canExport = No&lt;br /&gt;
| canImport = Yes; [[IMS Format|.ims]]&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = Yes&lt;br /&gt;
| notes = Official player and editor&lt;br /&gt;
}}&lt;br /&gt;
{{EndFileFormatTools}}&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* http://www.vogons.org/viewtopic.php?f=5&amp;amp;t=37849 - topic on VOGONS&lt;br /&gt;
* https://adplug.github.io/library/entry/Note10b2.html - AdPlug Library entry&lt;br /&gt;
* [[ROL Format]] - similar format&lt;br /&gt;
&lt;br /&gt;
== Credits ==&lt;br /&gt;
&lt;br /&gt;
This file format was described by Park Jeenhong in 1996 and then adapted and supplemented by [[User:binarymaster|binarymaster]].  If you find this information helpful in a project you&#039;re working on, please give credit where credit is due.  (A link back to this wiki would be nice too!)&lt;/div&gt;</summary>
		<author><name>Binarymaster</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=SOP_Format&amp;diff=7016</id>
		<title>SOP Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=SOP_Format&amp;diff=7016"/>
		<updated>2017-01-09T22:49:23Z</updated>

		<summary type="html">&lt;p&gt;Binarymaster: /* 2OP Mode instrument data */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NeedMoreInfo}}&lt;br /&gt;
{{Music Infobox&lt;br /&gt;
 | Type = Custom&lt;br /&gt;
 | Instruments = OPL&lt;br /&gt;
 | NumChannels = 9 or 11 (OPL2), 18 or 20 (OPL3)&lt;br /&gt;
 | NumTracks = 20&lt;br /&gt;
 | NumPatterns = 1&lt;br /&gt;
 | NumOrders = 0&lt;br /&gt;
 | Tags = File name, Title, Instrument names&lt;br /&gt;
 | Games = None&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;SOP Format&#039;&#039;&#039; is created by Lee Ho Bum (sopepos) for the &#039;&#039;&#039;Note&#039;&#039;&#039; OPL3 music sequencer.&lt;br /&gt;
&lt;br /&gt;
== File format ==&lt;br /&gt;
&lt;br /&gt;
=== Header ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[char]][7]&amp;lt;/tt&amp;gt; || signature || Header signature (must be &amp;quot;&amp;lt;tt&amp;gt;sopepos&amp;lt;/tt&amp;gt;&amp;quot;)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT8]]&amp;lt;/tt&amp;gt; || majorVersion || Major version number (usually 0)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || minorVersion || Minor version number (usually 1)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[BYTE]]&amp;lt;/tt&amp;gt; || padding || Unused, must be zero&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[13]&amp;lt;/tt&amp;gt; || fileName || File name / short name, null terminated&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[31]&amp;lt;/tt&amp;gt; || title || Song title, null terminated&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT16LE]]&amp;lt;/tt&amp;gt; || percussive || OPL rhythm mode: 0 = melodic, 1 = percussive&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || tickBeat || Number of ticks per beat&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || Unknown value (usually 4)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || Unknown value (usually 120)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || Unknown value (usually 0)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE[3]&amp;lt;/tt&amp;gt; || unknown || Unknown value&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || beatMeasure || Number of beats per measure&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE[8]&amp;lt;/tt&amp;gt; || unknown || Unknown values&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || nTracks || Number of tracks&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || nInsts || Number of instruments&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE[nTracks]&amp;lt;/tt&amp;gt; || chanMode || Channel modes&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_INST[nInsts]&amp;lt;/tt&amp;gt; || insts || Instruments&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The only known version of this format is 0.1.&lt;br /&gt;
&lt;br /&gt;
The fields &amp;lt;tt&amp;gt;tickBeat&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;beatMeasure&amp;lt;/tt&amp;gt; are used to convert ticks into beats and measures for drawing a musical staff.&lt;br /&gt;
&lt;br /&gt;
=== Channel modes ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Value !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;0x00&amp;lt;/tt&amp;gt; || Unused channel&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;0x01&amp;lt;/tt&amp;gt; || YMF-262M 4OP Mode&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;0x02&amp;lt;/tt&amp;gt; || YM-3812 2OP Mode&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Instruments ===&lt;br /&gt;
Header is followed by instruments block. Instrument structures are repeated &amp;lt;tt&amp;gt;nInsts&amp;lt;/tt&amp;gt; times.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_INST&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || instType || Instrument type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[8]&amp;lt;/tt&amp;gt; || shortName || Bank instrument name / short name&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[19]&amp;lt;/tt&amp;gt; || longName || Long instrument name&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE[]&amp;lt;/tt&amp;gt; || instData || Instrument data&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Instrument data size depends on instrument type:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type !! Size !! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 22 || Melody (YMF-262M, 4OP Mode)&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 11 || Melody (YM-3812, 2OP Mode)&lt;br /&gt;
|-&lt;br /&gt;
| 6 || 11 || Bass Drum&lt;br /&gt;
|-&lt;br /&gt;
| 7 || 11 || Snare Drum&lt;br /&gt;
|-&lt;br /&gt;
| 8 || 11 || Tom Tom&lt;br /&gt;
|-&lt;br /&gt;
| 9 || 11 || Cymbal&lt;br /&gt;
|-&lt;br /&gt;
| 10 || 11 || Hi-Hat&lt;br /&gt;
|-&lt;br /&gt;
| 12 || 0 || Unused instrument (comment)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Actual instrument data is just OPL registers dump.&lt;br /&gt;
&lt;br /&gt;
==== 2OP Mode instrument data ====&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Data type!!Name!!OPL base register!!Description&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModChar||0x20||Modulator characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModScale||0x40||Modulator key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModAttack||0x60||Modulator attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModSustain||0x80||Modulator sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModWaveSel||0xE0||Modulator wave select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iFeedback||0xC0||Feedback/connection&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarChar||0x23||Carrier characteristic (only melody instruments and bass drum)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarScale||0x43||Carrier key scaling/output level (only melody instruments)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarAttack||0x63||Carrier attack/decay level (only melody instruments)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarSustain||0x83||Carrier sustain/release level (only melody instruments)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarWaveSel||0xE3||Carrier wave select (only melody instruments)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== 4OP Mode instrument data ====&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Data type!!Name!!OPL base register!!Description&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Char||0x20||Operator 1 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Scale||0x40||Operator 1 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Attack||0x60||Operator 1 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Sustain||0x80||Operator 1 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1WaveSel||0xE0||Operator 1 wave select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Feedback||0xC0||Operator 1 feedback/connection&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Char||0x23||Operator 2 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Scale||0x43||Operator 2 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Attack||0x63||Operator 2 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Sustain||0x83||Operator 2 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2WaveSel||0xE3||Operator 2 wave select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Char||0x28||Operator 3 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Scale||0x48||Operator 3 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Attack||0x68||Operator 3 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Sustain||0x88||Operator 3 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3WaveSel||0xE8||Operator 3 wave select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Feedback||0xC8||Operator 3 feedback/connection&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Char||0x2B||Operator 4 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Scale||0x4B||Operator 4 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Attack||0x6B||Operator 4 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Sustain||0x8B||Operator 4 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4WaveSel||0xEB||Operator 4 wave select&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
{{BeginFileFormatTools|Type=audio}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = Note&lt;br /&gt;
| Platform = DOS&lt;br /&gt;
| canPlay = Yes&lt;br /&gt;
| canCreate = Yes&lt;br /&gt;
| canModify = Yes&lt;br /&gt;
| canExport = No&lt;br /&gt;
| canImport = Yes; [[IMS Format|.ims]]&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = Yes&lt;br /&gt;
| notes = Official player and editor&lt;br /&gt;
}}&lt;br /&gt;
{{EndFileFormatTools}}&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* http://www.vogons.org/viewtopic.php?f=5&amp;amp;t=37849 - topic on VOGONS&lt;br /&gt;
* https://adplug.github.io/library/entry/Note10b2.html - AdPlug Library entry&lt;br /&gt;
* [[ROL Format]] - similar format&lt;br /&gt;
&lt;br /&gt;
== Credits ==&lt;br /&gt;
&lt;br /&gt;
This file format was described by Park Jeenhong in 1996 and then adapted and supplemented by [[User:binarymaster|binarymaster]].  If you find this information helpful in a project you&#039;re working on, please give credit where credit is due.  (A link back to this wiki would be nice too!)&lt;/div&gt;</summary>
		<author><name>Binarymaster</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=SOP_Format&amp;diff=7015</id>
		<title>SOP Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=SOP_Format&amp;diff=7015"/>
		<updated>2017-01-09T22:32:19Z</updated>

		<summary type="html">&lt;p&gt;Binarymaster: /* 4OP Mode instrument data */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NeedMoreInfo}}&lt;br /&gt;
{{Music Infobox&lt;br /&gt;
 | Type = Custom&lt;br /&gt;
 | Instruments = OPL&lt;br /&gt;
 | NumChannels = 9 or 11 (OPL2), 18 or 20 (OPL3)&lt;br /&gt;
 | NumTracks = 20&lt;br /&gt;
 | NumPatterns = 1&lt;br /&gt;
 | NumOrders = 0&lt;br /&gt;
 | Tags = File name, Title, Instrument names&lt;br /&gt;
 | Games = None&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;SOP Format&#039;&#039;&#039; is created by Lee Ho Bum (sopepos) for the &#039;&#039;&#039;Note&#039;&#039;&#039; OPL3 music sequencer.&lt;br /&gt;
&lt;br /&gt;
== File format ==&lt;br /&gt;
&lt;br /&gt;
=== Header ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[char]][7]&amp;lt;/tt&amp;gt; || signature || Header signature (must be &amp;quot;&amp;lt;tt&amp;gt;sopepos&amp;lt;/tt&amp;gt;&amp;quot;)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT8]]&amp;lt;/tt&amp;gt; || majorVersion || Major version number (usually 0)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || minorVersion || Minor version number (usually 1)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[BYTE]]&amp;lt;/tt&amp;gt; || padding || Unused, must be zero&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[13]&amp;lt;/tt&amp;gt; || fileName || File name / short name, null terminated&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[31]&amp;lt;/tt&amp;gt; || title || Song title, null terminated&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT16LE]]&amp;lt;/tt&amp;gt; || percussive || OPL rhythm mode: 0 = melodic, 1 = percussive&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || tickBeat || Number of ticks per beat&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || Unknown value (usually 4)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || Unknown value (usually 120)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || Unknown value (usually 0)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE[3]&amp;lt;/tt&amp;gt; || unknown || Unknown value&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || beatMeasure || Number of beats per measure&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE[8]&amp;lt;/tt&amp;gt; || unknown || Unknown values&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || nTracks || Number of tracks&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || nInsts || Number of instruments&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE[nTracks]&amp;lt;/tt&amp;gt; || chanMode || Channel modes&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_INST[nInsts]&amp;lt;/tt&amp;gt; || insts || Instruments&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The only known version of this format is 0.1.&lt;br /&gt;
&lt;br /&gt;
The fields &amp;lt;tt&amp;gt;tickBeat&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;beatMeasure&amp;lt;/tt&amp;gt; are used to convert ticks into beats and measures for drawing a musical staff.&lt;br /&gt;
&lt;br /&gt;
=== Channel modes ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Value !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;0x00&amp;lt;/tt&amp;gt; || Unused channel&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;0x01&amp;lt;/tt&amp;gt; || YMF-262M 4OP Mode&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;0x02&amp;lt;/tt&amp;gt; || YM-3812 2OP Mode&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Instruments ===&lt;br /&gt;
Header is followed by instruments block. Instrument structures are repeated &amp;lt;tt&amp;gt;nInsts&amp;lt;/tt&amp;gt; times.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_INST&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || instType || Instrument type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[8]&amp;lt;/tt&amp;gt; || shortName || Bank instrument name / short name&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[19]&amp;lt;/tt&amp;gt; || longName || Long instrument name&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE[]&amp;lt;/tt&amp;gt; || instData || Instrument data&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Instrument data size depends on instrument type:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type !! Size !! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 22 || Melody (YMF-262M, 4OP Mode)&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 11 || Melody (YM-3812, 2OP Mode)&lt;br /&gt;
|-&lt;br /&gt;
| 6 || 11 || Bass Drum&lt;br /&gt;
|-&lt;br /&gt;
| 7 || 11 || Snare Drum&lt;br /&gt;
|-&lt;br /&gt;
| 8 || 11 || Tom Tom&lt;br /&gt;
|-&lt;br /&gt;
| 9 || 11 || Cymbal&lt;br /&gt;
|-&lt;br /&gt;
| 10 || 11 || Hi-Hat&lt;br /&gt;
|-&lt;br /&gt;
| 12 || 0 || Unused instrument (comment)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Actual instrument data is just OPL registers dump.&lt;br /&gt;
&lt;br /&gt;
==== 2OP Mode instrument data ====&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Data type!!Name!!OPL base register!!Description&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModChar||0x20||Modulator characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModScale||0x40||Modulator key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModAttack||0x60||Modulator attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModSustain||0x80||Modulator sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModWaveSel||0xE0||Modulator wave select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iFeedback||0xC0||Feedback/connection&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarChar||0x23||Carrier characteristic (only melody instruments, {{TODO|check it}})&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarScale||0x43||Carrier key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarAttack||0x63||Carrier attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarSustain||0x83||Carrier sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarWaveSel||0xE3||Carrier wave select&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== 4OP Mode instrument data ====&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Data type!!Name!!OPL base register!!Description&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Char||0x20||Operator 1 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Scale||0x40||Operator 1 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Attack||0x60||Operator 1 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Sustain||0x80||Operator 1 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1WaveSel||0xE0||Operator 1 wave select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp1Feedback||0xC0||Operator 1 feedback/connection&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Char||0x23||Operator 2 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Scale||0x43||Operator 2 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Attack||0x63||Operator 2 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2Sustain||0x83||Operator 2 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp2WaveSel||0xE3||Operator 2 wave select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Char||0x28||Operator 3 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Scale||0x48||Operator 3 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Attack||0x68||Operator 3 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Sustain||0x88||Operator 3 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3WaveSel||0xE8||Operator 3 wave select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp3Feedback||0xC8||Operator 3 feedback/connection&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Char||0x2B||Operator 4 characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Scale||0x4B||Operator 4 key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Attack||0x6B||Operator 4 attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4Sustain||0x8B||Operator 4 sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iOp4WaveSel||0xEB||Operator 4 wave select&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
{{BeginFileFormatTools|Type=audio}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = Note&lt;br /&gt;
| Platform = DOS&lt;br /&gt;
| canPlay = Yes&lt;br /&gt;
| canCreate = Yes&lt;br /&gt;
| canModify = Yes&lt;br /&gt;
| canExport = No&lt;br /&gt;
| canImport = Yes; [[IMS Format|.ims]]&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = Yes&lt;br /&gt;
| notes = Official player and editor&lt;br /&gt;
}}&lt;br /&gt;
{{EndFileFormatTools}}&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* http://www.vogons.org/viewtopic.php?f=5&amp;amp;t=37849 - topic on VOGONS&lt;br /&gt;
* https://adplug.github.io/library/entry/Note10b2.html - AdPlug Library entry&lt;br /&gt;
* [[ROL Format]] - similar format&lt;br /&gt;
&lt;br /&gt;
== Credits ==&lt;br /&gt;
&lt;br /&gt;
This file format was described by Park Jeenhong in 1996 and then adapted and supplemented by [[User:binarymaster|binarymaster]].  If you find this information helpful in a project you&#039;re working on, please give credit where credit is due.  (A link back to this wiki would be nice too!)&lt;/div&gt;</summary>
		<author><name>Binarymaster</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=SOP_Format&amp;diff=7014</id>
		<title>SOP Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=SOP_Format&amp;diff=7014"/>
		<updated>2017-01-09T22:09:47Z</updated>

		<summary type="html">&lt;p&gt;Binarymaster: Created page with &amp;quot;{{NeedMoreInfo}} {{Music Infobox  | Type = Custom  | Instruments = OPL  | NumChannels = 9 or 11 (OPL2), 18 or 20 (OPL3)  | NumTracks = 20  | NumPatterns = 1  | NumOrders = 0...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NeedMoreInfo}}&lt;br /&gt;
{{Music Infobox&lt;br /&gt;
 | Type = Custom&lt;br /&gt;
 | Instruments = OPL&lt;br /&gt;
 | NumChannels = 9 or 11 (OPL2), 18 or 20 (OPL3)&lt;br /&gt;
 | NumTracks = 20&lt;br /&gt;
 | NumPatterns = 1&lt;br /&gt;
 | NumOrders = 0&lt;br /&gt;
 | Tags = File name, Title, Instrument names&lt;br /&gt;
 | Games = None&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;SOP Format&#039;&#039;&#039; is created by Lee Ho Bum (sopepos) for the &#039;&#039;&#039;Note&#039;&#039;&#039; OPL3 music sequencer.&lt;br /&gt;
&lt;br /&gt;
== File format ==&lt;br /&gt;
&lt;br /&gt;
=== Header ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[char]][7]&amp;lt;/tt&amp;gt; || signature || Header signature (must be &amp;quot;&amp;lt;tt&amp;gt;sopepos&amp;lt;/tt&amp;gt;&amp;quot;)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT8]]&amp;lt;/tt&amp;gt; || majorVersion || Major version number (usually 0)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || minorVersion || Minor version number (usually 1)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[BYTE]]&amp;lt;/tt&amp;gt; || padding || Unused, must be zero&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[13]&amp;lt;/tt&amp;gt; || fileName || File name / short name, null terminated&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[31]&amp;lt;/tt&amp;gt; || title || Song title, null terminated&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT16LE]]&amp;lt;/tt&amp;gt; || percussive || OPL rhythm mode: 0 = melodic, 1 = percussive&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || tickBeat || Number of ticks per beat&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || Unknown value (usually 4)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || Unknown value (usually 120)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || unknown || Unknown value (usually 0)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE[3]&amp;lt;/tt&amp;gt; || unknown || Unknown value&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || beatMeasure || Number of beats per measure&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE[8]&amp;lt;/tt&amp;gt; || unknown || Unknown values&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || nTracks || Number of tracks&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || nInsts || Number of instruments&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE[nTracks]&amp;lt;/tt&amp;gt; || chanMode || Channel modes&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SOP_INST[nInsts]&amp;lt;/tt&amp;gt; || insts || Instruments&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The only known version of this format is 0.1.&lt;br /&gt;
&lt;br /&gt;
The fields &amp;lt;tt&amp;gt;tickBeat&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;beatMeasure&amp;lt;/tt&amp;gt; are used to convert ticks into beats and measures for drawing a musical staff.&lt;br /&gt;
&lt;br /&gt;
=== Channel modes ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Value !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;0x00&amp;lt;/tt&amp;gt; || Unused channel&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;0x01&amp;lt;/tt&amp;gt; || YMF-262M 4OP Mode&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;0x02&amp;lt;/tt&amp;gt; || YM-3812 2OP Mode&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Instruments ===&lt;br /&gt;
Header is followed by instruments block. Instrument structures are repeated &amp;lt;tt&amp;gt;nInsts&amp;lt;/tt&amp;gt; times.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SOP_INST&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || instType || Instrument type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[8]&amp;lt;/tt&amp;gt; || shortName || Bank instrument name / short name&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[19]&amp;lt;/tt&amp;gt; || longName || Long instrument name&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE[]&amp;lt;/tt&amp;gt; || instData || Instrument data&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Instrument data size depends on instrument type:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type !! Size !! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 22 || Melody (YMF-262M, 4OP Mode)&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 11 || Melody (YM-3812, 2OP Mode)&lt;br /&gt;
|-&lt;br /&gt;
| 6 || 11 || Bass Drum&lt;br /&gt;
|-&lt;br /&gt;
| 7 || 11 || Snare Drum&lt;br /&gt;
|-&lt;br /&gt;
| 8 || 11 || Tom Tom&lt;br /&gt;
|-&lt;br /&gt;
| 9 || 11 || Cymbal&lt;br /&gt;
|-&lt;br /&gt;
| 10 || 11 || Hi-Hat&lt;br /&gt;
|-&lt;br /&gt;
| 12 || 0 || Unused instrument (comment)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Actual instrument data is just OPL registers dump.&lt;br /&gt;
&lt;br /&gt;
==== 2OP Mode instrument data ====&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Data type!!Name!!OPL base register!!Description&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModChar||0x20||Modulator characteristic&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModScale||0x40||Modulator key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModAttack||0x60||Modulator attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModSustain||0x80||Modulator sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iModWaveSel||0xE0||Modulator wave select&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iFeedback||0xC0||Feedback/connection&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarChar||0x23||Carrier characteristic (only melody instruments, {{TODO|check it}})&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarScale||0x43||Carrier key scaling/output level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarAttack||0x63||Carrier attack/decay level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarSustain||0x83||Carrier sustain/release level&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||iCarWaveSel||0xE3||Carrier wave select&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== 4OP Mode instrument data ====&lt;br /&gt;
&lt;br /&gt;
{{TODO|This is not documented yet, investigate the source codes.}}&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
{{BeginFileFormatTools|Type=audio}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = Note&lt;br /&gt;
| Platform = DOS&lt;br /&gt;
| canPlay = Yes&lt;br /&gt;
| canCreate = Yes&lt;br /&gt;
| canModify = Yes&lt;br /&gt;
| canExport = No&lt;br /&gt;
| canImport = Yes; [[IMS Format|.ims]]&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = Yes&lt;br /&gt;
| notes = Official player and editor&lt;br /&gt;
}}&lt;br /&gt;
{{EndFileFormatTools}}&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* http://www.vogons.org/viewtopic.php?f=5&amp;amp;t=37849 - topic on VOGONS&lt;br /&gt;
* https://adplug.github.io/library/entry/Note10b2.html - AdPlug Library entry&lt;br /&gt;
* [[ROL Format]] - similar format&lt;br /&gt;
&lt;br /&gt;
== Credits ==&lt;br /&gt;
&lt;br /&gt;
This file format was described by Park Jeenhong in 1996 and then adapted and supplemented by [[User:binarymaster|binarymaster]].  If you find this information helpful in a project you&#039;re working on, please give credit where credit is due.  (A link back to this wiki would be nice too!)&lt;/div&gt;</summary>
		<author><name>Binarymaster</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=IMF_Format&amp;diff=6998</id>
		<title>IMF Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=IMF_Format&amp;diff=6998"/>
		<updated>2016-10-24T09:48:07Z</updated>

		<summary type="html">&lt;p&gt;Binarymaster: Fix typo&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Music Infobox&lt;br /&gt;
 | Type = OPL&lt;br /&gt;
 | Instruments = OPL&lt;br /&gt;
 | NumChannels = 9 or 11&lt;br /&gt;
 | NumTracks = 1&lt;br /&gt;
 | Tags = Unofficial: Title, Composer, Remarks, Program name&lt;br /&gt;
 | Games = &lt;br /&gt;
   {{Game|Bio Menace}}&lt;br /&gt;
   {{Game|Blake Stone}}&lt;br /&gt;
   {{Game|Catacomb 3-D}}&lt;br /&gt;
   {{Game|Commander Keen 4-6}}&lt;br /&gt;
   {{Game|Corridor 7 Alien Invasion}}&lt;br /&gt;
   {{Game|Cosmo&#039;s Cosmic Adventures}}&lt;br /&gt;
   {{Game|Duke Nukem II}}&lt;br /&gt;
   {{Game|Hocus Pocus}}&lt;br /&gt;
   {{Game|Major Stryker}}&lt;br /&gt;
   {{Game|Monster Bash}}&lt;br /&gt;
   {{Game|Operation Body Count}}&lt;br /&gt;
   {{Game|Realms of Chaos}}&lt;br /&gt;
   {{Game|Wolfenstein 3-D}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;b&amp;gt;&amp;lt;u&amp;gt;i&amp;lt;/u&amp;gt;d Software &amp;lt;u&amp;gt;M&amp;lt;/u&amp;gt;usic &amp;lt;u&amp;gt;F&amp;lt;/u&amp;gt;ormat (IMF)&amp;lt;/b&amp;gt; is a raw music format that stores the actual bytes sent to the Adlib&#039;s [[OPL2]] chip.  For this reason it is a very simple format to process.&lt;br /&gt;
&lt;br /&gt;
== File format ==&lt;br /&gt;
&lt;br /&gt;
There are two versions of the IMF format: &amp;lt;b&amp;gt;Type-0&amp;lt;/b&amp;gt; format and &amp;lt;b&amp;gt;Type-1&amp;lt;/b&amp;gt; format.  In a Type-0 file, the whole file is Adlib data that is played until the end of the file is reached.  Type-1 files are actually ripped chunks from an [[AudioT Format]] file. No game ever actually used Type-1 IMFs that were not stored inside an AudioT file. The two initial bytes contain the size of the Adlib data (not including the two bytes themselves), so only this much data is played.  This means it&#039;s possible to store arbitrary data in a Type-1 IMF file after the song data (see [[#Tag Data]] below.)&lt;br /&gt;
&lt;br /&gt;
As a matter of luck, the first two data bytes in a Type-0 files are almost always 0x00 0x00, so this can be used to detect the file format version.  If the first two bytes match the length of the file it is likely Type-1, but be aware that trailing data will mean this is not always true.  Otherwise the only other way is to parse all the register/value pairs in the file and ensure the register is [[OPL chip#Register Map|within range]] (e.g. registers 0xA0 to 0xA9 are valid, but 0xAA to 0xAF should never be used.)  Note that 0x00 is actually an invalid register, but must be treated as valid since the files usually begin by writing 0x00 to register 0x00.&lt;br /&gt;
&lt;br /&gt;
Another way to detect the type of an IMF file is to examine the first few instructions in the IMF file. The idea is that the first few IMF commands set up the AdLib registers and therefore should have no delay. Even if there is a delay, it would normally be relatively low compared to the combined 16-bit value of the (register, value) pair.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
UINT16 ReadInt16LE(FILE* in)&lt;br /&gt;
{&lt;br /&gt;
	UINT8 buf[2];&lt;br /&gt;
	fread(buf, 1, 2, in);&lt;br /&gt;
	return (buf[0] | (buf[1] &amp;lt;&amp;lt; 8));&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
int IMF_IsChunk(FILE* in)&lt;br /&gt;
{&lt;br /&gt;
	UINT16 chunksize, buff, i=42;&lt;br /&gt;
	UINT32 sum1=0, sum2=0;&lt;br /&gt;
&lt;br /&gt;
	if(!in)&lt;br /&gt;
		return 0;&lt;br /&gt;
&lt;br /&gt;
	if (!feof(in))&lt;br /&gt;
	{&lt;br /&gt;
		chunksize = ReadInt16LE(in);&lt;br /&gt;
		if ((chunksize == 0) || (chunksize &amp;amp; 3))&lt;br /&gt;
			return 0;&lt;br /&gt;
&lt;br /&gt;
		while(!feof(in) &amp;amp;&amp;amp; i)&lt;br /&gt;
		{&lt;br /&gt;
			buff = ReadInt16LE(in);&lt;br /&gt;
			sum1 += buff;&lt;br /&gt;
			buff = ReadInt16LE(in);&lt;br /&gt;
			sum2 += buff;&lt;br /&gt;
			i--;&lt;br /&gt;
		}&lt;br /&gt;
		fseek(in, 0, SEEK_SET);&lt;br /&gt;
		return (sum1 &amp;gt; sum2);&lt;br /&gt;
	}&lt;br /&gt;
	return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the code given above, if the file is a chunk (Type-1), then &amp;lt;tt&amp;gt;sum1&amp;lt;/tt&amp;gt; contains the sum of all (register, value) pairs and &amp;lt;tt&amp;gt;sum2&amp;lt;/tt&amp;gt; contains the sum of all delays. If it&#039;s a plain IMF file (Type-0), the sums are swapped.&lt;br /&gt;
&lt;br /&gt;
The only case in which this detection would fail is IMF data that writes a bunch of zeroes to register zero (which would be pointless since that register is undefined) and/or has very large delays (which would be pointless because it would lead to delays of up to a minute before the next IMF command would be processed, resulting in multiple minutes of silence before the song actually starts playing notes).&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Data type!!Name!!Description&lt;br /&gt;
|-&lt;br /&gt;
|[[UINT16LE]]||iLength||Song data length in bytes (Type-1 format only)&lt;br /&gt;
|-&lt;br /&gt;
|[[BYTE]][iLength]||cAdlibData||Song data (see below) - &amp;lt;code&amp;gt;iLength&amp;lt;/code&amp;gt; bytes long if Type-1, or until EOF if Type-0&lt;br /&gt;
|-&lt;br /&gt;
|[[BYTE]][]||cExtraData||Arbitrary data/tags (Type-1 format only, see [[#Tag Data]] below)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The earliest version of the IMF data in the [[AudioT Format]] actually starts with a [[UINT32LE]] length value. The Commander Keen 4 Demo uses that early version. Just extracting the IMF chunk from the &amp;lt;tt&amp;gt;AUDIOT.CK4&amp;lt;/tt&amp;gt; file will most likely confuse programs, since the file does not start with two 0&#039;s. Programs that only check the first two bytes will assume that the file is a ripped chunk, but will swap the delays and register/data pairs because of the length value being stored in the first four bytes instead of just the first two. That means the song will not play the intended notes. Programs that use the detection code given above will identify the file as plain IMF data and treat the length value as an IMF command. That means the song will play correctly at first, but any trailing data present in the file will also be interpreted as IMF data, most likely leading to long delays at the end of the song.&lt;br /&gt;
&lt;br /&gt;
Note that for Type-1 files, the initial two bytes (the &amp;quot;song data length&amp;quot;) are likely to be the filesize minus two, as the two initial bytes aren&#039;t counted.  The obvious exception to this is if there is trailing data at the end of the OPL data, such as an info tag.&lt;br /&gt;
&lt;br /&gt;
The song data is composed of four-byte &amp;quot;units&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Data type!!Description&lt;br /&gt;
|-&lt;br /&gt;
|[[BYTE]]||Adlib register&lt;br /&gt;
|-&lt;br /&gt;
|[[BYTE]]||Adlib data&lt;br /&gt;
|-&lt;br /&gt;
|[[UINT16LE]]||Delay&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The data byte is sent to the specified register on the Adlib card, followed by a delay for the specified number of cycles.  For a 560Hz IMF file, there are 560 cycles in one second (see [[#Timing]] below), so a delay of 560 would result in one second of silence (and likewise in a 700Hz IMF the delay value would need to be 700 to produce one second of silence.)  A delay of 1 would wait for a single cycle, and a delay of zero means the next register/data pair should be sent immediately (so in a single &#039;cycle&#039;, data would be sent continuously until the next non-zero delay value is reached.)&lt;br /&gt;
&lt;br /&gt;
=== Timing ===&lt;br /&gt;
&lt;br /&gt;
IMF files exist at three known speeds.  Unfortunately this is determined by the game, not the IMF file, so tempo cannot be determined from the music files alone. Extracted IMFs can be compared to discern their speeds.  The known speeds are:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Speed!!Game&lt;br /&gt;
|-&lt;br /&gt;
|280Hz||[[Duke Nukem II]]&lt;br /&gt;
|-&lt;br /&gt;
|560Hz||[[Bio Menace]], [[Commander Keen]], [[Cosmo&#039;s Cosmic Adventures]], [[Monster Bash]]&lt;br /&gt;
|-&lt;br /&gt;
|700Hz||[[Blake Stone]], [[Major Stryker]], [[Operation Body Count]], [[Wolfenstein 3-D]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The easiest method to tell the files apart is to treat all files with a .WLF extension as 700Hz and all .IMF files as 560Hz.  Since Duke II is the odd one out, it is usually ignored since doubling the value of all the delay bytes conveniently turns it into a 560Hz .IMF.&lt;br /&gt;
&lt;br /&gt;
=== Restrictions ===&lt;br /&gt;
&lt;br /&gt;
As IMF files contain Adlib music for games that may also have Adlib sound effects, care must be taken to ensure that IMF music and any sound effects can share the OPL chip without conflict.  This is done by reserving the OPL&#039;s first channel for sound effects, leaving eight remaining channels available for use in IMF files.  This has been confirmed by automated inspection of the IMF files from the following games, all of which have no data on OPL channel #0 beyond 2-3 initialisation commands: [[Bio Menace]], [[Blake Stone]], [[Commander Keen 4-6]], [[Cosmo&#039;s Cosmic Adventures]], [[Duke Nukem II]], [[Major Stryker]], [[Monster Bash]], [[Operation Body Count]], [[Wolfenstein 3-D]].&lt;br /&gt;
&lt;br /&gt;
In situations where channel #0 is not reserved and is used by the IMF file, when it is placed back into the game it interferes with the sound effects causing distortion, transposition, and otherwise resulting in broken sound effects.  This can happen when an IMF file is created using a utility that does not take into account the fact that channel #0 must be left unused.  See the end of this page for a list of utilities that can create IMF files and whether they treat channel #0 correctly.&lt;br /&gt;
&lt;br /&gt;
It is worth noting that channel #0 is unused even in games such as Cosmo and Monster Bash, which do not use Adlib sound effects (Cosmo has PC speaker effects only and Monster Bash has PC speaker and digitised PCM audio.)  It is also worth mentioning that some IMF songs from [[Monster Bash]] make use of the OPL&#039;s rhythm-mode, which trades three note-producing channels for five percussion channels. The IMF songs from the Keen 4 Demo also use rhythm-mode.&lt;br /&gt;
&lt;br /&gt;
=== Tag Data ===&lt;br /&gt;
&lt;br /&gt;
In a Type-1 IMF file it&#039;s possible to store data after the end of a song (as per the length given in the first two bytes of the file.)  There are a few uses for this - some games store additional (unused) data there generated when the files were added to the game&#039;s group file, and others have repurposed this area to store information about the song itself (title, artist, etc.)&lt;br /&gt;
&lt;br /&gt;
The tag data was originally written to the AudioT files by Id Software&#039;s tool [[Muse]] and was probably only processed by that tool. The [[Wolfenstein 3-D]] source code reads the entire chunk from the [[AudioT Format|AudioT]] file (including any tag data), but it only ever uses the song length and the song data.&lt;br /&gt;
&lt;br /&gt;
==== Official data ====&lt;br /&gt;
For those files which were distributed with additional data in this area, it is not entirely clear what the purpose of this data is.  It was apparently added when the source IMF files were compiled into a group audio file by [[Muse]]. (They appear not to be part of the source IMF files as there are occurrences where a file consists solely of tag data.) The format appears to be the same in all games that use it (such as Bio Menace or Wolfenstein 3-D) but it is not supported by any IMF players.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Data type!!Name!!Description&lt;br /&gt;
|-&lt;br /&gt;
|[[UINT16LE]]||Unknown||&lt;br /&gt;
|-&lt;br /&gt;
|[[char]][16]||strTitle||Song title&lt;br /&gt;
|-&lt;br /&gt;
|[[char]][64]||strRemarks||Song comment/message, usually source file name.&lt;br /&gt;
|-&lt;br /&gt;
|[[char]][6]||cProg||Data from the compiler?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Unofficial uses ====&lt;br /&gt;
It is also possible to store tags there, and this simple format is supported by most IMF players:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Data type!!Name!!Description&lt;br /&gt;
|-&lt;br /&gt;
|[[BYTE]]||cSignature||0x1A&lt;br /&gt;
|-&lt;br /&gt;
|[[char]][256]||strTitle||Song title&lt;br /&gt;
|-&lt;br /&gt;
|[[char]][256]||strComposer||Song composer&lt;br /&gt;
|-&lt;br /&gt;
|[[char]][256]||strRemarks||Song comment/message&lt;br /&gt;
|-&lt;br /&gt;
|[[char]][9]||cProg||Name of the first program that added these tags (eight bytes + terminating NULL, pad out with NULLs if necessary.)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note that the char[256] strings are variable-length NULL-terminated strings.  Their maximum length is 256 bytes *including* the terminating NULL, meaning the string will only ever contain 255 characters or less, plus the terminating-NULL.  Of course the string will normally be much shorter, and an empty string will consist of a single 0x00 byte.&lt;br /&gt;
&lt;br /&gt;
This tag format is supported by AdPlug when playing IMFs.  The tag format can also be used with .raw files, but no players officially support it yet.&lt;br /&gt;
&lt;br /&gt;
Note that the tags should begin directly after the IMF data, so in other words reading in the first two bytes of the file (the &amp;quot;song length&amp;quot;) and then seeking forward that many bytes, should put the file pointer at the start of the tag block (so the next byte that will be read in should be 0x1A, if the tags are present.)&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
{{BeginFileFormatTools|Type=audio}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = [http://adplug.sourceforge.net AdPlug]&lt;br /&gt;
| Platform = All&lt;br /&gt;
| canPlay = Yes&lt;br /&gt;
| canCreate = No&lt;br /&gt;
| canModify = No&lt;br /&gt;
| canExport = Yes; [[RAW Format (Adlib)|.raw]]&lt;br /&gt;
| canImport = No&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = No&lt;br /&gt;
}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = [[Camoto]]&lt;br /&gt;
| Platform = Linux/Win&lt;br /&gt;
| canPlay = Yes&lt;br /&gt;
| canCreate = No&lt;br /&gt;
| canModify = No&lt;br /&gt;
| canExport = Yes; many&lt;br /&gt;
| canImport = Yes; many&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = Yes&lt;br /&gt;
}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = [http://www.shikadi.net/utils/cmf2imf CMF2IMF]&lt;br /&gt;
| Platform = Linux/Win&lt;br /&gt;
| canPlay = No&lt;br /&gt;
| canCreate = No&lt;br /&gt;
| canModify = No&lt;br /&gt;
| canExport = No&lt;br /&gt;
| canImport = Yes; [[CMF Format|.cmf]]&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = No&lt;br /&gt;
| notes = Doesn&#039;t leave channel 0 clear for SFX&lt;br /&gt;
}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = [http://www.shikadi.net/utils/dro2imf DRO2IMF]&lt;br /&gt;
| Platform = Linux/Win&lt;br /&gt;
| canPlay = No&lt;br /&gt;
| canCreate = No&lt;br /&gt;
| canModify = No&lt;br /&gt;
| canExport = No&lt;br /&gt;
| canImport = Yes; [[DRO Format|.dro]]&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = No&lt;br /&gt;
| notes = Doesn&#039;t leave channel 0 clear for SFX&lt;br /&gt;
}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = [[DRO2MIDI]]&lt;br /&gt;
| Platform = Linux/Win&lt;br /&gt;
| canPlay = No&lt;br /&gt;
| canCreate = No&lt;br /&gt;
| canModify = No&lt;br /&gt;
| canExport = Yes; [[MID Format|.mid]]&lt;br /&gt;
| canImport = No&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = No&lt;br /&gt;
}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = [http://winwolf3d.dugtrio17.com/download/IMFCreator IMFCreator]&lt;br /&gt;
| Platform = Windows&lt;br /&gt;
| canPlay = No&lt;br /&gt;
| canCreate = No&lt;br /&gt;
| canModify = No&lt;br /&gt;
| canExport = No&lt;br /&gt;
| canImport = Yes; [[MID Format|.mid]]&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = No&lt;br /&gt;
}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = MUS2IMF&lt;br /&gt;
| Platform = DOS?&lt;br /&gt;
| canPlay = No&lt;br /&gt;
| canCreate = No&lt;br /&gt;
| canModify = No&lt;br /&gt;
| canExport = No&lt;br /&gt;
| canImport = Yes; [[MUS Format|.mus]]&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = No&lt;br /&gt;
}}&lt;br /&gt;
{{EndFileFormatTools}}&lt;/div&gt;</summary>
		<author><name>Binarymaster</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=MDI_Format&amp;diff=6956</id>
		<title>MDI Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=MDI_Format&amp;diff=6956"/>
		<updated>2016-09-04T05:24:01Z</updated>

		<summary type="html">&lt;p&gt;Binarymaster: /* See also */ replace link directly to zip archive&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Music Infobox&lt;br /&gt;
 | Type = MIDI&lt;br /&gt;
 | Instruments = OPL&lt;br /&gt;
 | NumChannels = 9 or 11&lt;br /&gt;
 | NumTracks = 65535&lt;br /&gt;
 | NumPatterns = 1&lt;br /&gt;
 | NumOrders = 0&lt;br /&gt;
 | Tags = Text events&lt;br /&gt;
 | Games = &lt;br /&gt;
   {{Game|Dark Ages}}&lt;br /&gt;
   {{Game|Galactix}}&lt;br /&gt;
   {{Game|Prehistorik}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;MDI Format&#039;&#039;&#039; is derived from [[ROL Format]] and have compatible specification for playback. It uses a [[MID Format|standard MIDI file]] structure (MIDI Type 0) that contains MIDI meta events for setting OPL instrument settings.  It is a way of storing FM/OPL instruments inside a standard MIDI file, with the file being a standard, fully compatible .mid file.  Players that are not aware of the FM/OPL commands will simply ignore them and play the file without instruments.&lt;br /&gt;
&lt;br /&gt;
Typically standard MIDI files use the &amp;lt;tt&amp;gt;.mid&amp;lt;/tt&amp;gt; filename extension, while files that use the FM/OPL commands are given the &amp;lt;tt&amp;gt;.mdi&amp;lt;/tt&amp;gt; extension.&lt;br /&gt;
&lt;br /&gt;
== Differences to standard MIDI ==&lt;br /&gt;
&lt;br /&gt;
=== Manufacturer-specific events ===&lt;br /&gt;
&lt;br /&gt;
To be compatible with standard MIDI container specification, the format uses sequencer specific events to change instrument patches, control AdLib rhythm mode, and set pitch bend range.&lt;br /&gt;
&lt;br /&gt;
These meta events begins with 0xFF byte, followed by 0x7F parameter, indicating &amp;quot;sequencer specific&amp;quot; event. Then it&#039;s followed by variable length value and the data blob.&lt;br /&gt;
&lt;br /&gt;
The first data byte is a manufacturer ID.  If it is 0x00, then the following [[UINT16BE]] is the actual manufacturer ID.  This means either one or three bytes total will be read to obtain the manufacturer ID.&lt;br /&gt;
&lt;br /&gt;
If the manufacturer ID is 0x3F then it is an Ad Lib, Inc. event.  In this case, read another UINT16BE to obtain the opcode, then the data following the opcode is arranged as:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Opcode !! Purpose !! Description&lt;br /&gt;
|-&lt;br /&gt;
| 1 || Instrument change || 29 data bytes follow:&amp;lt;table class=&amp;quot;wikitable&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Name&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Description&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;[[UINT8]]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;voice&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;MIDI channel number to assign instrument to&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;BNK_ENTRY&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;patch&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;OPL register settings&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Sound mode || One data byte.  0=melodic/rhythm-off, 1=percussive/rhythm-on&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Pitch bend range || One data byte, value in range 1-12 inclusive. {{TODO|Explain how this works}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;BNK_ENTRY&amp;lt;/tt&amp;gt; is defined as follows: (note this is identical to the layout of an instrument inside a [[AdLib Instrument Bank Format]] .bnk file.  See that article for the explanation of the &amp;lt;tt&amp;gt;OPLREGS&amp;lt;/tt&amp;gt; structure.)&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| [[AdLib Instrument Bank Format|OPLREGS]] || oplModulator || Register values for the Modulator operator (op 0)&lt;br /&gt;
|-&lt;br /&gt;
| [[AdLib Instrument Bank Format|OPLREGS]] || oplCarrier || Register values for the Carrier operator (op 1)&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT8]] || iModWaveSel || Modulator wave select (OPL base register 0xE0)&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT8]] || iCarWaveSel || Carrier wave select (OPL base register 0xE0)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Channel aftertouch event ===&lt;br /&gt;
&lt;br /&gt;
Event 0xD# is used to control channel volume. It mostly used for dynamic volume control of currently played note (for example: fade in, fade out, or tremolo effects).&lt;br /&gt;
&lt;br /&gt;
=== Velocity parameter ===&lt;br /&gt;
&lt;br /&gt;
This parameter goes with Note On and Note Off events. Since the format is inherited from ROL, it doesn&#039;t have note velocity specification.&lt;br /&gt;
&lt;br /&gt;
It also changes current channel volume, same as event previously described.&lt;br /&gt;
&lt;br /&gt;
Some &amp;quot;Note Off&amp;quot; events may have note parameter equal to 0.  This event just stops last played note on specified channel.  If there is no played note on channel, it obviously used to set channel volume.&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
{{BeginFileFormatTools|Type=audio}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = AdLib &amp;lt;tt&amp;gt;midiplay.exe&amp;lt;/tt&amp;gt;&lt;br /&gt;
| Platform = DOS&lt;br /&gt;
| canPlay = Yes&lt;br /&gt;
| canCreate = No&lt;br /&gt;
| canModify = No&lt;br /&gt;
| canExport = No&lt;br /&gt;
| canImport = No&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = No&lt;br /&gt;
| notes = Part of AdLib Programmer&#039;s Guide&lt;br /&gt;
}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = AdLib &amp;lt;tt&amp;gt;rol2midi.exe&amp;lt;/tt&amp;gt;&lt;br /&gt;
| Platform = DOS&lt;br /&gt;
| canPlay = No&lt;br /&gt;
| canCreate = No&lt;br /&gt;
| canModify = No&lt;br /&gt;
| canExport = No&lt;br /&gt;
| canImport = Yes; [[ROL Format|.rol]]&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = No&lt;br /&gt;
| notes = Part of AdLib Programmer&#039;s Guide&lt;br /&gt;
}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = [[Camoto]]&lt;br /&gt;
| Platform = Linux/Win&lt;br /&gt;
| canPlay = Yes&lt;br /&gt;
| canCreate = No&lt;br /&gt;
| canModify = No&lt;br /&gt;
| canExport = Yes; many&lt;br /&gt;
| canImport = No&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = Yes&lt;br /&gt;
}}&lt;br /&gt;
{{EndFileFormatTools}}&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[MID Format]] - the container format&lt;br /&gt;
* [[AdLib Instrument Bank Format]] - format with the same instrument definition structure&lt;br /&gt;
* http://cd.textfiles.com/soundsensations/MISCPROG/ZIPFILES/AD-PROG.ZIP - AdLib Programmer&#039;s Guide, including source code for playing and converting files in this format&lt;/div&gt;</summary>
		<author><name>Binarymaster</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=God_of_Thunder_Music_Format&amp;diff=6944</id>
		<title>God of Thunder Music Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=God_of_Thunder_Music_Format&amp;diff=6944"/>
		<updated>2016-08-12T20:39:50Z</updated>

		<summary type="html">&lt;p&gt;Binarymaster: /* Timing */ Update information about timing&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NeedMoreInfo}}&lt;br /&gt;
{{Music Infobox&lt;br /&gt;
 | Type = OPL&lt;br /&gt;
 | Instruments = OPL&lt;br /&gt;
 | NumChannels = 9 or 11&lt;br /&gt;
 | NumTracks = 1&lt;br /&gt;
 | NumPatterns = 1&lt;br /&gt;
 | NumOrders = 0&lt;br /&gt;
 | Tags = None&lt;br /&gt;
 | Games = &lt;br /&gt;
   {{Game|God of Thunder}}&lt;br /&gt;
}}&lt;br /&gt;
[[God of Thunder]] stores its music in this format.  It is a raw Adlib format, containing the exact register and data pairs to send to the OPL chip.&lt;br /&gt;
&lt;br /&gt;
== File format ==&lt;br /&gt;
&lt;br /&gt;
The file begins with a header of unknown purpose.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT16LE]] header || Always 0x0001&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This is then immediately followed by a variable number of three byte chunks.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| [[BYTE]] delay || Number of ticks to wait *after* the data has been sent&lt;br /&gt;
|-&lt;br /&gt;
| [[BYTE]] reg || OPL register to write to&lt;br /&gt;
|-&lt;br /&gt;
| [[BYTE]] val || Value to write&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The very last chunk has all values set to zero, plus a final 0x00 byte.&lt;br /&gt;
&lt;br /&gt;
=== Timing ===&lt;br /&gt;
&lt;br /&gt;
Songs are played at a different tempo (i.e. each delay tick lasts a different length of time): &amp;lt;tt&amp;gt;menu.got&amp;lt;/tt&amp;gt; plays at 140 Hz, all other songs plays at 120 Hz.&lt;br /&gt;
Known song lengths (based on Teppic&#039;s PCM recordings of in-game Adlib playback) are:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Song !! Length !! Notes&lt;br /&gt;
|-&lt;br /&gt;
| menu     || 1:15,759 || in got.exe, not in gotres.dat&lt;br /&gt;
|-&lt;br /&gt;
| song11   || 1:41,457 ||&lt;br /&gt;
|-&lt;br /&gt;
| song12   || 2:07,676 ||&lt;br /&gt;
|-&lt;br /&gt;
| song13   || 1:07,647 ||&lt;br /&gt;
|-&lt;br /&gt;
| song14   || 0:59,884 ||&lt;br /&gt;
|-&lt;br /&gt;
| song21   || 1:19,258 ||&lt;br /&gt;
|-&lt;br /&gt;
| song22   || 1:27,120 ||&lt;br /&gt;
|-&lt;br /&gt;
| song23   || 0:34,845 ||&lt;br /&gt;
|-&lt;br /&gt;
| song24   || 1:06,350 ||&lt;br /&gt;
|-&lt;br /&gt;
| song25   || 1:39,959 ||&lt;br /&gt;
|-&lt;br /&gt;
| song31   || 0:55,890 ||&lt;br /&gt;
|-&lt;br /&gt;
| song32   || 0:58,659 ||&lt;br /&gt;
|-&lt;br /&gt;
| opensong || 1:19,821 || Story song - slow version of song33&lt;br /&gt;
|-&lt;br /&gt;
| song33   || 1:13,730 || in-game version of the story song&lt;br /&gt;
|-&lt;br /&gt;
| song34   || 1:11,795 ||&lt;br /&gt;
|-&lt;br /&gt;
| song35   || 1:19,315 ||&lt;br /&gt;
|-&lt;br /&gt;
| song36   || 0:47,887 ||&lt;br /&gt;
|-&lt;br /&gt;
| winsong  || 0:32,918 ||&lt;br /&gt;
|-&lt;br /&gt;
| bosssong || 0:26,169 ||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
When some songs are converted to this format (e.g. Keen 6 aliens.imf), the tempo speeds up considerably towards the end of the file, so it would seem there is some way of adjusting the song tempo during playback. {{TODO|Check whether it&#039;s a conversion bug.}}&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
{{BeginFileFormatTools|Type=audio}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = [[Camoto]]&lt;br /&gt;
| Platform = Linux/Win&lt;br /&gt;
| canPlay = Yes&lt;br /&gt;
| canCreate = No&lt;br /&gt;
| canModify = No&lt;br /&gt;
| canExport = Yes; many&lt;br /&gt;
| canImport = Yes; many&lt;br /&gt;
| editHidden = N/A&lt;br /&gt;
| editMetadata = N/A&lt;br /&gt;
| notes =  Incorrect tempo&lt;br /&gt;
}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = [http://grompe.org.ru/ GromPE&#039;s GoT unpacker]&lt;br /&gt;
| Platform = Windows&lt;br /&gt;
| canPlay = No&lt;br /&gt;
| canCreate = No&lt;br /&gt;
| canModify = No&lt;br /&gt;
| canExport = Yes; [[IMF Format|.imf]]&lt;br /&gt;
| canImport = No&lt;br /&gt;
| editHidden = N/A&lt;br /&gt;
| editMetadata = N/A&lt;br /&gt;
| notes =  Incorrect tempo&lt;br /&gt;
}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = [http://grompe.org.ru/ GromPE&#039;s OPL2WAV]&lt;br /&gt;
| Platform = Windows&lt;br /&gt;
| canPlay = No&lt;br /&gt;
| canCreate = No&lt;br /&gt;
| canModify = No&lt;br /&gt;
| canExport = Yes; [[WAV Format|.wav]]&lt;br /&gt;
| canImport = No&lt;br /&gt;
| editHidden = N/A&lt;br /&gt;
| editMetadata = N/A&lt;br /&gt;
| notes =  Incorrect tempo&lt;br /&gt;
}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = [[Wombat]]&lt;br /&gt;
| Platform = Windows&lt;br /&gt;
| canPlay = No&lt;br /&gt;
| canCreate = No&lt;br /&gt;
| canModify = No&lt;br /&gt;
| canExport = Yes; [[IMF Format|.imf]]&lt;br /&gt;
| canImport = No&lt;br /&gt;
| editHidden = N/A&lt;br /&gt;
| editMetadata = N/A&lt;br /&gt;
| notes =  Incorrect tempo&lt;br /&gt;
}}&lt;br /&gt;
{{EndFileFormatTools}}&lt;br /&gt;
&lt;br /&gt;
== Credits ==&lt;br /&gt;
&lt;br /&gt;
This file format was reverse engineered by [[User:Malvineous|Malvineous]].  If you find this information helpful in a project you&#039;re working on, please give credit where credit is due.  (A link back to this wiki would be nice too!)&lt;/div&gt;</summary>
		<author><name>Binarymaster</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=God_of_Thunder_Music_Format&amp;diff=6943</id>
		<title>God of Thunder Music Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=God_of_Thunder_Music_Format&amp;diff=6943"/>
		<updated>2016-08-12T19:59:08Z</updated>

		<summary type="html">&lt;p&gt;Binarymaster: /* Timing */ correct file names&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NeedMoreInfo}}&lt;br /&gt;
{{Music Infobox&lt;br /&gt;
 | Type = OPL&lt;br /&gt;
 | Instruments = OPL&lt;br /&gt;
 | NumChannels = 9 or 11&lt;br /&gt;
 | NumTracks = 1&lt;br /&gt;
 | NumPatterns = 1&lt;br /&gt;
 | NumOrders = 0&lt;br /&gt;
 | Tags = None&lt;br /&gt;
 | Games = &lt;br /&gt;
   {{Game|God of Thunder}}&lt;br /&gt;
}}&lt;br /&gt;
[[God of Thunder]] stores its music in this format.  It is a raw Adlib format, containing the exact register and data pairs to send to the OPL chip.&lt;br /&gt;
&lt;br /&gt;
== File format ==&lt;br /&gt;
&lt;br /&gt;
The file begins with a header of unknown purpose.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT16LE]] header || Always 0x0001&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This is then immediately followed by a variable number of three byte chunks.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| [[BYTE]] delay || Number of ticks to wait *after* the data has been sent&lt;br /&gt;
|-&lt;br /&gt;
| [[BYTE]] reg || OPL register to write to&lt;br /&gt;
|-&lt;br /&gt;
| [[BYTE]] val || Value to write&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The very last chunk has all values set to zero, plus a final 0x00 byte.&lt;br /&gt;
&lt;br /&gt;
=== Timing ===&lt;br /&gt;
&lt;br /&gt;
Each song is played at a different tempo (i.e. each delay tick lasts a different length of time) however {{TODO|it is not currently known how to obtain the correct tempo for a given song.}}&lt;br /&gt;
&lt;br /&gt;
Known song lengths (based on Teppic&#039;s PCM recordings of in-game Adlib playback) are:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Song !! Length !! Notes&lt;br /&gt;
|-&lt;br /&gt;
| menu     || 1:15,759 || in got.exe, not in gotres.dat&lt;br /&gt;
|-&lt;br /&gt;
| song11   || 1:41,457 ||&lt;br /&gt;
|-&lt;br /&gt;
| song12   || 2:07,676 ||&lt;br /&gt;
|-&lt;br /&gt;
| song13   || 1:07,647 ||&lt;br /&gt;
|-&lt;br /&gt;
| song14   || 0:59,884 ||&lt;br /&gt;
|-&lt;br /&gt;
| song21   || 1:19,258 ||&lt;br /&gt;
|-&lt;br /&gt;
| song22   || 1:27,120 ||&lt;br /&gt;
|-&lt;br /&gt;
| song23   || 0:34,845 ||&lt;br /&gt;
|-&lt;br /&gt;
| song24   || 1:06,350 ||&lt;br /&gt;
|-&lt;br /&gt;
| song25   || 1:39,959 ||&lt;br /&gt;
|-&lt;br /&gt;
| song31   || 0:55,890 ||&lt;br /&gt;
|-&lt;br /&gt;
| song32   || 0:58,659 ||&lt;br /&gt;
|-&lt;br /&gt;
| opensong || 1:19,821 || Story song - slow version of song33&lt;br /&gt;
|-&lt;br /&gt;
| song33   || 1:13,730 || in-game version of the story song&lt;br /&gt;
|-&lt;br /&gt;
| song34   || 1:11,795 ||&lt;br /&gt;
|-&lt;br /&gt;
| song35   || 1:19,315 ||&lt;br /&gt;
|-&lt;br /&gt;
| song36   || 0:47,887 ||&lt;br /&gt;
|-&lt;br /&gt;
| winsong  || 0:32,918 ||&lt;br /&gt;
|-&lt;br /&gt;
| bosssong || 0:26,169 ||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
When some songs are converted to this format (e.g. Keen 6 aliens.imf), the tempo speeds up considerably towards the end of the file, so it would seem there is some way of adjusting the song tempo during playback.&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
{{BeginFileFormatTools|Type=audio}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = [[Camoto]]&lt;br /&gt;
| Platform = Linux/Win&lt;br /&gt;
| canPlay = Yes&lt;br /&gt;
| canCreate = No&lt;br /&gt;
| canModify = No&lt;br /&gt;
| canExport = Yes; many&lt;br /&gt;
| canImport = Yes; many&lt;br /&gt;
| editHidden = N/A&lt;br /&gt;
| editMetadata = N/A&lt;br /&gt;
| notes =  Incorrect tempo&lt;br /&gt;
}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = [http://grompe.org.ru/ GromPE&#039;s GoT unpacker]&lt;br /&gt;
| Platform = Windows&lt;br /&gt;
| canPlay = No&lt;br /&gt;
| canCreate = No&lt;br /&gt;
| canModify = No&lt;br /&gt;
| canExport = Yes; [[IMF Format|.imf]]&lt;br /&gt;
| canImport = No&lt;br /&gt;
| editHidden = N/A&lt;br /&gt;
| editMetadata = N/A&lt;br /&gt;
| notes =  Incorrect tempo&lt;br /&gt;
}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = [http://grompe.org.ru/ GromPE&#039;s OPL2WAV]&lt;br /&gt;
| Platform = Windows&lt;br /&gt;
| canPlay = No&lt;br /&gt;
| canCreate = No&lt;br /&gt;
| canModify = No&lt;br /&gt;
| canExport = Yes; [[WAV Format|.wav]]&lt;br /&gt;
| canImport = No&lt;br /&gt;
| editHidden = N/A&lt;br /&gt;
| editMetadata = N/A&lt;br /&gt;
| notes =  Incorrect tempo&lt;br /&gt;
}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = [[Wombat]]&lt;br /&gt;
| Platform = Windows&lt;br /&gt;
| canPlay = No&lt;br /&gt;
| canCreate = No&lt;br /&gt;
| canModify = No&lt;br /&gt;
| canExport = Yes; [[IMF Format|.imf]]&lt;br /&gt;
| canImport = No&lt;br /&gt;
| editHidden = N/A&lt;br /&gt;
| editMetadata = N/A&lt;br /&gt;
| notes =  Incorrect tempo&lt;br /&gt;
}}&lt;br /&gt;
{{EndFileFormatTools}}&lt;br /&gt;
&lt;br /&gt;
== Credits ==&lt;br /&gt;
&lt;br /&gt;
This file format was reverse engineered by [[User:Malvineous|Malvineous]].  If you find this information helpful in a project you&#039;re working on, please give credit where credit is due.  (A link back to this wiki would be nice too!)&lt;/div&gt;</summary>
		<author><name>Binarymaster</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=ROL_Format&amp;diff=6935</id>
		<title>ROL Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=ROL_Format&amp;diff=6935"/>
		<updated>2016-07-31T17:48:46Z</updated>

		<summary type="html">&lt;p&gt;Binarymaster: Document a new format&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Music Infobox&lt;br /&gt;
 | Type = Custom&lt;br /&gt;
 | Instruments = OPL&lt;br /&gt;
 | NumChannels = 9 or 11&lt;br /&gt;
 | NumTracks = 45&lt;br /&gt;
 | NumPatterns = 1&lt;br /&gt;
 | NumOrders = 0&lt;br /&gt;
 | Tags = None&lt;br /&gt;
 | Games = &lt;br /&gt;
   {{Game|Pee and Gity}}&lt;br /&gt;
   {{Game|Hi Octane}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;ROL Format&#039;&#039;&#039; is created by Ad Lib, Inc. for AdLib Visual Composer program.  Some games use it for the background music.&lt;br /&gt;
&lt;br /&gt;
Earlier ROL files goes with [[AdLib Instrument Format|instrument]] files, but later they were superseded by single [[AdLib Instrument Bank Format|instrument bank]] file.&lt;br /&gt;
&lt;br /&gt;
== File format ==&lt;br /&gt;
&lt;br /&gt;
=== Header ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT16LE]]&amp;lt;/tt&amp;gt; || majorVersion || Major version number (usually 0)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || minorVersion || Minor version number (usually 4)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[char]][40]&amp;lt;/tt&amp;gt; || signature || Signature, null terminated (usually &amp;quot;&amp;lt;tt&amp;gt;\roll\default&amp;lt;/tt&amp;gt;&amp;quot;)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || tickBeat || Number of ticks per beat&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || beatMeasure || Number of beats per measure&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || scaleY || Editing scale (Y axis)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || scaleX || Editing scale (X axis)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[BYTE]]&amp;lt;/tt&amp;gt; || reserved || Unused, set to zero&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT8&amp;lt;/tt&amp;gt; || isMelodic || OPL rhythm mode: 0 = percussive, 1 = melodic&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE[45]&amp;lt;/tt&amp;gt; || counters || Counter values for each track ([[#Counter values|see below]])&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE[38]&amp;lt;/tt&amp;gt; || filler || Padding, set to zero&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The most known version of this format is 0.4.&lt;br /&gt;
&lt;br /&gt;
The fields &amp;lt;tt&amp;gt;tickBeat&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;beatMeasure&amp;lt;/tt&amp;gt; are used to convert ticks into beats and measures for drawing a musical staff in AdLib Visual Composer.&lt;br /&gt;
&lt;br /&gt;
=== Tracks ===&lt;br /&gt;
&lt;br /&gt;
Header is followed by 45 tracks of different type. The first is always a tempo track. Then it&#039;s followed by Voice, Timbre, Volume, and Pitch tracks, repeated 11 times for each possible AdLib voice.&lt;br /&gt;
&lt;br /&gt;
This resulting in actual track count:&lt;br /&gt;
&lt;br /&gt;
 1 + 4 * 11 = 45&lt;br /&gt;
&lt;br /&gt;
ROL files always contain 45 tracks even if 9-voice melodic mode is used.&lt;br /&gt;
&lt;br /&gt;
==== Tempo track ====&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[15]&amp;lt;/tt&amp;gt; || trackName || Track name, null terminated (usually &amp;quot;&amp;lt;tt&amp;gt;Tempo&amp;lt;/tt&amp;gt;&amp;quot;)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[Single]]&amp;lt;/tt&amp;gt; || basicTempo || Song tempo, in beats-per-minute&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || nEvents || Number of events&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;E_TEMPO[nEvents]&amp;lt;/tt&amp;gt; || tempoEvents || Array of tempo events&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;E_TEMPO&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || atTick || Time of event, in ticks (absolute)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;Single&amp;lt;/tt&amp;gt; || multiplier || Tempo multiplier (in range 0.01 - 10.0)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;basicTempo&amp;lt;/tt&amp;gt; field controls the song playback speed and is measured in beats per minute.  The playback frequency can be calculated as follows:&lt;br /&gt;
&lt;br /&gt;
 frequency = (basicTempo / 60) * tickBeat&lt;br /&gt;
&lt;br /&gt;
For a song that plays at 120BPM and with 10 ticks per beat, this works out as:&lt;br /&gt;
&lt;br /&gt;
  frequency = (120 / 60) * 10&lt;br /&gt;
            = 20 Hz&lt;br /&gt;
&lt;br /&gt;
Therefore playback should happen at 20 ticks per second to be at the correct tempo.&lt;br /&gt;
&lt;br /&gt;
Tempo multiplier allows to change song speed during playback, so the actual frequency is calculated like this:&lt;br /&gt;
&lt;br /&gt;
 frequency = (basicTempo / 60) * tickBeat * multiplier&lt;br /&gt;
&lt;br /&gt;
==== Voice track ====&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[15]&amp;lt;/tt&amp;gt; || trackName || Track name, null terminated (usually &amp;quot;&amp;lt;tt&amp;gt;Voix ##&amp;lt;/tt&amp;gt;&amp;quot;, # - voice number from 0)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || nTicks || Total ticks for current track&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;E_NOTE[]&amp;lt;/tt&amp;gt; || noteEvents || Array of note events&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;E_NOTE&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || note || Note number (0: note off, 12..107: note on)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || duration || Note duration, in ticks&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This structure is repeated while the sum of &amp;lt;tt&amp;gt;duration&amp;lt;/tt&amp;gt; values is less than &amp;lt;tt&amp;gt;nTicks&amp;lt;/tt&amp;gt; value.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;note&amp;lt;/tt&amp;gt; value is compatible with MIDI standard (48 is middle-C).&lt;br /&gt;
&lt;br /&gt;
==== Timbre track ====&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[15]&amp;lt;/tt&amp;gt; || trackName || Track name, null terminated (usually &amp;quot;&amp;lt;tt&amp;gt;Timbre ##&amp;lt;/tt&amp;gt;&amp;quot;, # - voice number from 0)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || nEvents || Number of events&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;E_TIMBRE[nEvents]&amp;lt;/tt&amp;gt; || timbreEvents || Array of timbre events&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;E_TIMBRE&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || atTick || Time of event, in ticks (absolute)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[9]&amp;lt;/tt&amp;gt; || instName || Instrument name, null terminated&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;BYTE&amp;lt;/tt&amp;gt; || filler || Padding, set to zero&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || unknown || Unknown value, sometimes equal to instrument index&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
These events set the instrument to be played on specified channel.&lt;br /&gt;
&lt;br /&gt;
Instrument name is a reference to [[AdLib Instrument Format|&amp;lt;tt&amp;gt;INSTNAME.INS&amp;lt;/tt&amp;gt;]] file, or an instrument name inside [[AdLib Instrument Bank Format|&amp;lt;tt&amp;gt;STANDARD.BNK&amp;lt;/tt&amp;gt;]] file.&lt;br /&gt;
&lt;br /&gt;
==== Volume track ====&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[15]&amp;lt;/tt&amp;gt; || trackName || Track name, null terminated (usually &amp;quot;&amp;lt;tt&amp;gt;Volume ##&amp;lt;/tt&amp;gt;&amp;quot;, # - voice number from 0)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || nEvents || Number of events&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;E_VOLUME[nEvents]&amp;lt;/tt&amp;gt; || volumeEvents || Array of volume events&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;E_VOLUME&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || atTick || Time of event, in ticks (absolute)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;Single&amp;lt;/tt&amp;gt; || volume || Volume multiplier (in range 0.0 - 1.0)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
These events set the volume for specified channel.&lt;br /&gt;
&lt;br /&gt;
==== Pitch track ====&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;char[15]&amp;lt;/tt&amp;gt; || trackName || Track name, null terminated (usually &amp;quot;&amp;lt;tt&amp;gt;Pitch ##&amp;lt;/tt&amp;gt;&amp;quot;, # - voice number from 0)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || nEvents || Number of events&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;E_PITCH[nEvents]&amp;lt;/tt&amp;gt; || pitchEvents || Array of pitch events&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;E_PITCH&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;UINT16LE&amp;lt;/tt&amp;gt; || atTick || Time of event, in ticks (absolute)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;Single&amp;lt;/tt&amp;gt; || pitch || Pitch variation (in range 0.0 - 2.0)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
These events works the same as Pitch Bend events. Nominal &amp;lt;tt&amp;gt;pitch&amp;lt;/tt&amp;gt; value is 1.0.&lt;br /&gt;
&lt;br /&gt;
=== Counter values ===&lt;br /&gt;
&lt;br /&gt;
There are 45 counter values for each track.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT16LE]][11]&amp;lt;/tt&amp;gt; || cTicks || Total ticks for each voice track&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT16LE]][11]&amp;lt;/tt&amp;gt; || cTimbreEvents || Number of events for each timbre track&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT16LE]][11]&amp;lt;/tt&amp;gt; || cVolumeEvents || Number of events for each volume track&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT16LE]][11]&amp;lt;/tt&amp;gt; || cPitchEvents || Number of events for each pitch track&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;[[UINT16LE]]&amp;lt;/tt&amp;gt; || cTempoEvents || Number of events in the tempo track&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Rhythm mode ==&lt;br /&gt;
&lt;br /&gt;
If &amp;lt;tt&amp;gt;isMelodic&amp;lt;/tt&amp;gt; is 1, then rhythm mode is off.  Valid channels are 0 to 8 inclusive.&lt;br /&gt;
&lt;br /&gt;
When &amp;lt;tt&amp;gt;isMelodic&amp;lt;/tt&amp;gt; is 0, then rhythm mode is on.  Valid channels are 0 to 10, with 0 to 5 being melodic and 6 to 10 being percussive (see table below).&lt;br /&gt;
&lt;br /&gt;
Both the top cymbal and the snare drum only use the OPL carrier registers, but the values for these registers are actually stored in the file&#039;s modulator fields.  The carrier fields for these instruments appear to be unused.  In other words, percussive instruments always have their settings loaded from the instrument&#039;s modulator fields, even when the values are loaded into the OPL chip&#039;s carrier registers.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Channel !! Percussive instrument !! Operator used in file !! OPL cell&lt;br /&gt;
|-&lt;br /&gt;
| 0-5 || Melodic || Modulator&amp;lt;br/&amp;gt;Carrier || Modulator&amp;lt;br/&amp;gt;Carrier&lt;br /&gt;
|-&lt;br /&gt;
| 6  || Bass drum || Modulator&amp;lt;br/&amp;gt;Carrier || 13 - Channel 7 Modulator&amp;lt;br/&amp;gt;16 - Channel 7 Carrier&lt;br /&gt;
|-&lt;br /&gt;
| 7  || Snare drum || Modulator || 17 - Channel 8 Carrier&lt;br /&gt;
|-&lt;br /&gt;
| 8  || Tom tom || Modulator || 15 - Channel 9 Modulator&lt;br /&gt;
|-&lt;br /&gt;
| 9  || Top cymbal || Modulator || 18 - Channel 9 Carrier&lt;br /&gt;
|-&lt;br /&gt;
| 10  || Hi-hat || Modulator || 14 - Channel 8 Modulator&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
BNK files have an indicator whether a patch is percussive or melodic, however it is not used by official ROL player.  It&#039;s controlled entirely by which channel it is used on.  It is possible to use the same patch for both percussive and melodic channels.&lt;br /&gt;
&lt;br /&gt;
In percussive mode, the pitch of the single-operator percussive instruments is handled specially (that is, the snare drum, tom tom, top cymbal and hi-hat.  The bass drum is not considered here.)  When a note is played on channel 8 (tom-tom), the pitch on the other instruments is changed also.  The changes are:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Channel !! Percussive instrument !! Note pitch&lt;br /&gt;
|-&lt;br /&gt;
| 7  || Snare drum || 7 semitones higher than the last tom-tom note on channel 8&lt;br /&gt;
|-&lt;br /&gt;
| 8  || Tom tom || Use pitch as indicated in the note-on event&lt;br /&gt;
|-&lt;br /&gt;
| 9  || Top cymbal || Use pitch from last tom-tom note on channel 8&lt;br /&gt;
|-&lt;br /&gt;
| 10  || Hi-hat || 7 semitones higher than the last tom-tom note on channel 8&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The initial frequency for the tom-tom is supposed to be two octaves below middle-C according to comments in the official &amp;lt;tt&amp;gt;adlib.c&amp;lt;/tt&amp;gt;, however {{TODO|this doesn&#039;t seem to be the case.}}&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
{{BeginFileFormatTools|Type=audio}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = &amp;lt;tt&amp;gt;playrol.exe&amp;lt;/tt&amp;gt;&lt;br /&gt;
| Platform = DOS&lt;br /&gt;
| canPlay = Yes&lt;br /&gt;
| canCreate = No&lt;br /&gt;
| canModify = No&lt;br /&gt;
| canExport = No&lt;br /&gt;
| canImport = No&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = No&lt;br /&gt;
| notes = Included with AdLib Visual Composer&lt;br /&gt;
}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = AdLib &amp;lt;tt&amp;gt;convert.exe&amp;lt;/tt&amp;gt;&lt;br /&gt;
| Platform = DOS&lt;br /&gt;
| canPlay = No&lt;br /&gt;
| canCreate = No&lt;br /&gt;
| canModify = No&lt;br /&gt;
| canExport = Yes; [[AdLib MIDI Format|.mus]]&lt;br /&gt;
| canImport = No&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = No&lt;br /&gt;
| notes = Part of AdLib Programmer&#039;s Guide&lt;br /&gt;
}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = AdLib &amp;lt;tt&amp;gt;rol2midi.exe&amp;lt;/tt&amp;gt;&lt;br /&gt;
| Platform = DOS&lt;br /&gt;
| canPlay = No&lt;br /&gt;
| canCreate = No&lt;br /&gt;
| canModify = No&lt;br /&gt;
| canExport = Yes; [[MDI Format|.mdi]]&lt;br /&gt;
| canImport = No&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = No&lt;br /&gt;
| notes = Part of AdLib Programmer&#039;s Guide&lt;br /&gt;
}}&lt;br /&gt;
{{EndFileFormatTools}}&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[AdLib Instrument Format]] - first time companion format for storing instruments for songs in this format&lt;br /&gt;
* [[AdLib Instrument Bank Format]] - second time companion format for storing instruments for songs in this format&lt;br /&gt;
* http://hwiegman.home.xs4all.nl/fileformats/rol/Rol-form.txt - format described by Chris Holmes&lt;br /&gt;
* [[AdLib MIDI Format]], [[IMS Format]], [[MDI Format]] - derived formats&lt;br /&gt;
&lt;br /&gt;
== Credits ==&lt;br /&gt;
&lt;br /&gt;
This file format was described by Chris Holmes in 1992 and then adapted and supplemented by [[User:binarymaster|binarymaster]].  If you find this information helpful in a project you&#039;re working on, please give credit where credit is due.  (A link back to this wiki would be nice too!)&lt;/div&gt;</summary>
		<author><name>Binarymaster</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=Double&amp;diff=6934</id>
		<title>Double</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=Double&amp;diff=6934"/>
		<updated>2016-07-31T14:36:48Z</updated>

		<summary type="html">&lt;p&gt;Binarymaster: Redirected page to File format data types&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[File format data types]]&lt;/div&gt;</summary>
		<author><name>Binarymaster</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=Single&amp;diff=6933</id>
		<title>Single</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=Single&amp;diff=6933"/>
		<updated>2016-07-31T14:36:43Z</updated>

		<summary type="html">&lt;p&gt;Binarymaster: Redirected page to File format data types&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[File format data types]]&lt;/div&gt;</summary>
		<author><name>Binarymaster</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=File_format_data_types&amp;diff=6932</id>
		<title>File format data types</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=File_format_data_types&amp;diff=6932"/>
		<updated>2016-07-31T14:35:10Z</updated>

		<summary type="html">&lt;p&gt;Binarymaster: /* Type list */ add floating point values&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a list of all the data types used in the file format descriptions on the wiki.  They are loosely based on common C/C++ data types, and should be used throughout the wiki for consistency.&lt;br /&gt;
&lt;br /&gt;
== Type list ==&lt;br /&gt;
&lt;br /&gt;
==== Numeric values ====&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Data type!!Description&lt;br /&gt;
|-&lt;br /&gt;
|UINT8||Unsigned 8-bit integer&lt;br /&gt;
|-&lt;br /&gt;
|UINT16LE||Unsigned 16-bit integer in little-endian format&lt;br /&gt;
|-&lt;br /&gt;
|UINT16BE||Unsigned 16-bit integer in big-endian format&lt;br /&gt;
|-&lt;br /&gt;
|UINT32LE||Unsigned 32-bit integer in little-endian format&lt;br /&gt;
|-&lt;br /&gt;
|UINT32BE||Unsigned 32-bit integer in big-endian format&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Signed equivalents are the same without the leading U, i.e. &amp;lt;tt&amp;gt;INT8&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;INT16LE&amp;lt;/tt&amp;gt;, etc.  Unless otherwise stated, the format is in [[wikipedia:Two&#039;s complement|two&#039;s complement]] (where a UINT8 value of 255 is -1 as an INT8, for example.)&lt;br /&gt;
&lt;br /&gt;
==== Floating point values ====&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Data type!!Description&lt;br /&gt;
|-&lt;br /&gt;
|Single||32-bit float (IEEE-754)&lt;br /&gt;
|-&lt;br /&gt;
|[[Turbo Pascal Real|Real]]||48-bit float (Pascal specific)&lt;br /&gt;
|-&lt;br /&gt;
|Double||64-bit float (IEEE-754)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
All floating point values are signed. They usually contain a sign bit, exponent, and mantissa.&lt;br /&gt;
&lt;br /&gt;
==== Character strings ====&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Data type!!Description&lt;br /&gt;
|-&lt;br /&gt;
|char[x]||String &#039;&#039;x&#039;&#039; characters long&lt;br /&gt;
|-&lt;br /&gt;
|char||Single 8-bit character&lt;br /&gt;
|-&lt;br /&gt;
|ASCIIZ||A C-style string (variable-length, terminated with a single NULL/0x00 value)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Misc data types ====&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Data type!!Description&lt;br /&gt;
|-&lt;br /&gt;
|BYTE||Same as UINT8 but conceptually for generic data rather than numeric values (e.g. UINT8 would be used for a number, while a BYTE would be used for a bitfield)&lt;br /&gt;
|-&lt;br /&gt;
|BYTE[x]||Block of data &#039;&#039;x&#039;&#039; bytes long&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Big endian vs little endian ==&lt;br /&gt;
&lt;br /&gt;
For numeric values larger than a single byte, the endianness specifies how the values are split over multiple bytes.  For example a hex value of 0x1234AABB when written to a file will take up two bytes, as follows:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Endian!!Bytes in file&lt;br /&gt;
|-&lt;br /&gt;
|Big||&amp;lt;code&amp;gt;12 34 AA BB&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|Little||&amp;lt;code&amp;gt;BB AA 34 12&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
For those languages that allow direct memory access such as C/C++, converting an integer value to a byte array will reveal the value stored in-memory in the same order as the table above.&lt;br /&gt;
&lt;br /&gt;
Normally when reading or writing a variable to a file a programmer will simply pass the memory address of the variable, resulting in the file mirroring the byte order in memory.  This is no problem when reading the variable back in on the same system, as the byte order will match.  However when reading data from a different system (for example using an Intel PC to read files from a PowerPC Mac) the byte order will be opposite to what the system expects and the programmer must convert the values manually.&lt;br /&gt;
&lt;br /&gt;
=== Conversion examples ===&lt;br /&gt;
&lt;br /&gt;
If a value is being read on the same system (little to little or big to big) then no action is required.  If the systems are different, then the values must be swapped.  The following sections list examples for different programming languages.&lt;br /&gt;
&lt;br /&gt;
==== C/C++ ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
// 16-bit&lt;br /&gt;
int in = 0x1234;&lt;br /&gt;
int out = ((in &amp;amp; 0xFF) &amp;lt;&amp;lt; 8) | (in &amp;gt;&amp;gt; 8);&lt;br /&gt;
// out should now be 0x3412&lt;br /&gt;
&lt;br /&gt;
// 32-bit&lt;br /&gt;
int in = 0x1234AABB;&lt;br /&gt;
int out =&lt;br /&gt;
  ((in &amp;amp; 0xFF) &amp;lt;&amp;lt; 24) |&lt;br /&gt;
  ((in &amp;amp; 0xFF00) &amp;lt;&amp;lt; 8) |&lt;br /&gt;
  ((in &amp;amp; 0xFF0000) &amp;gt;&amp;gt; 8) |&lt;br /&gt;
  (in &amp;gt;&amp;gt; 24);&lt;br /&gt;
// out should now be 0xBBAA3412&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== C# .NET ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
Int16 ByteSwap16(Int16 inValue)&lt;br /&gt;
{&lt;br /&gt;
  return (Int16)(&lt;br /&gt;
    ((inValue &amp;amp; 0xFF) &amp;lt;&amp;lt; 8) |&lt;br /&gt;
    ((inValue &amp;gt;&amp;gt; 8) &amp;amp; 0xFF)&lt;br /&gt;
    );&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Int32 ByteSwap32(Int32 inValue)&lt;br /&gt;
{&lt;br /&gt;
  return (Int32)(&lt;br /&gt;
    ((inValue &amp;amp; 0xFF) &amp;lt;&amp;lt; 24) |&lt;br /&gt;
    ((inValue &amp;amp; 0xFF00) &amp;lt;&amp;lt; 8) |&lt;br /&gt;
    ((inValue &amp;amp; 0xFF0000) &amp;gt;&amp;gt; 8) |&lt;br /&gt;
    ((inValue &amp;gt;&amp;gt; 24) &amp;amp; 0xFF)&lt;br /&gt;
    );&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Visual Basic .NET ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;vbnet&amp;quot;&amp;gt;&lt;br /&gt;
Function ByteSwap16(ByVal InValue as Int16) as Int16&lt;br /&gt;
  Return ((InValue And &amp;amp;HFF) &amp;lt;&amp;lt; 8) Or ((InValue &amp;gt;&amp;gt; 8) And &amp;amp;HFF)&lt;br /&gt;
End Function&lt;br /&gt;
&lt;br /&gt;
Function ByteSwap32(ByVal InValue as Int32) as Int32&lt;br /&gt;
  Return ((InValue And &amp;amp;HFF) &amp;lt;&amp;lt; 24) Or _&lt;br /&gt;
         ((InValue And &amp;amp;HFF00) &amp;lt;&amp;lt; 8) Or _&lt;br /&gt;
         ((InValue And &amp;amp;HFF0000) &amp;gt;&amp;gt; 8) Or _&lt;br /&gt;
         ((InValue &amp;gt;&amp;gt; 24) And &amp;amp;HFF)&lt;br /&gt;
End Function&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:File Formats]]&lt;/div&gt;</summary>
		<author><name>Binarymaster</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=MID_Format&amp;diff=6931</id>
		<title>MID Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=MID_Format&amp;diff=6931"/>
		<updated>2016-07-31T14:01:28Z</updated>

		<summary type="html">&lt;p&gt;Binarymaster: Link to MDI Format&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Music Infobox&lt;br /&gt;
 | Type = MIDI&lt;br /&gt;
 | Instruments = MIDI&lt;br /&gt;
 | NumChannels = 16&lt;br /&gt;
 | NumTracks = 65535&lt;br /&gt;
 | NumPatterns = 1&lt;br /&gt;
 | NumOrders = 0&lt;br /&gt;
 | Tags = Text events&lt;br /&gt;
 | Games = &lt;br /&gt;
   {{Game|Blood}}&lt;br /&gt;
   {{Game|Boppin&#039;}}&lt;br /&gt;
   {{Game|Duke Nukem 3D}}&lt;br /&gt;
   {{Game|Hi Octane}}&lt;br /&gt;
   {{Game|Hocus Pocus}}&lt;br /&gt;
   {{Game|Magic Pockets}}&lt;br /&gt;
   {{Game|Prince of Persia}}&lt;br /&gt;
   {{Game|Rise of the Triad}}&lt;br /&gt;
   {{Game|Sango Fighter}}&lt;br /&gt;
   {{Game|Shadow Warrior}}&lt;br /&gt;
   {{Game|SimCity 2000}}&lt;br /&gt;
   {{Game|Wacky Wheels}}&lt;br /&gt;
   {{Game|Where In the World Is Carmen Sandiego?}}&lt;br /&gt;
}}&lt;br /&gt;
The &amp;lt;b&amp;gt;&amp;lt;u&amp;gt;M&amp;lt;/u&amp;gt;usical &amp;lt;u&amp;gt;I&amp;lt;/u&amp;gt;nstrument &amp;lt;u&amp;gt;D&amp;lt;/u&amp;gt;igital &amp;lt;u&amp;gt;I&amp;lt;/u&amp;gt;nterface (MIDI) file format&amp;lt;/b&amp;gt; is used for storing the notes required to accurately reproduce a song.  Commercial instruments are available that &amp;quot;speak&amp;quot; the MIDI protocol, and a MIDI file (.mid) simply stores the data sent over the wire, with a few headers on the front.&lt;br /&gt;
&lt;br /&gt;
== File format ==&lt;br /&gt;
&lt;br /&gt;
A MIDI file starts with an overall &#039;&#039;MThd&#039;&#039; header, followed by one or more &#039;&#039;MTrk&#039;&#039; headers for each &amp;quot;track&amp;quot; (a track is normally created for each instrument, for simplicity when the song is being composed.)&lt;br /&gt;
&lt;br /&gt;
=== MThd Header ===&lt;br /&gt;
The file begins with a header:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Data type!!Name!!Description&lt;br /&gt;
|-&lt;br /&gt;
|BYTE[4]||cSignature||&amp;quot;MThd&amp;quot; (not NULL-terminated)&lt;br /&gt;
|-&lt;br /&gt;
|UINT32BE||iLength||Length of MThd block (usually 6)&lt;br /&gt;
|-&lt;br /&gt;
|UINT16BE||iType||0, 1 or 2 (for format-0, 1 or 2)&lt;br /&gt;
|-&lt;br /&gt;
|UINT16BE||iNumTracks||Number of tracks (will be 1 for format-0)&lt;br /&gt;
|-&lt;br /&gt;
|UINT16BE||iTicksPerQuarterNote||Number of MIDI delay ticks in a quarter-note&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
If the high bit in &amp;lt;tt&amp;gt;iTicksPerQuarterNote&amp;lt;/tt&amp;gt; is set (0x8000) then the file uses SMPTE timing instead, which is rare and not covered here.&lt;br /&gt;
&lt;br /&gt;
=== MTrk block ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;MTrk&#039;&#039; block is repeated once for each track in the song (the &#039;&#039;&#039;iNumTracks&#039;&#039;&#039; field in the MThd header.)&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Data type!!Name!!Description&lt;br /&gt;
|-&lt;br /&gt;
|BYTE[4]||cSignature||&amp;quot;MTrk&amp;quot; (not NULL-terminated)&lt;br /&gt;
|-&lt;br /&gt;
|UINT32BE||iLength||Length of block&lt;br /&gt;
|-&lt;br /&gt;
|BYTE[iLength]||cData||MIDI data&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== MIDI data ===&lt;br /&gt;
&lt;br /&gt;
The MIDI data consists of a delay value (in MIDI variable-length integer notation), followed by a MIDI event byte (see [[#MIDI events]] below.)  The event data follows, and will be different depending on the event.  It then starts again with the delay value for the next event.&lt;br /&gt;
&lt;br /&gt;
==== MIDI lengths ====&lt;br /&gt;
&lt;br /&gt;
MIDI lengths are stored as variable length integers, between one and four bytes long.  Each byte only uses the lower 7-bits, with the MSB set if there is another length byte following.  The bytes are in big endian order.  Some examples of these length bytes are:&lt;br /&gt;
&lt;br /&gt;
  50      // Hex value 0x50&lt;br /&gt;
  81 50   // Hex value 0xD0 ((0x81 &amp;amp; 0x7F) &amp;gt;&amp;gt; 1) | (0x50 &amp;amp; 0x7F)&lt;br /&gt;
&lt;br /&gt;
Here is some C code to read these values:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
const char *midi_data = &amp;quot;\x81\x50&amp;quot;;&lt;br /&gt;
unsigned long val = 0;&lt;br /&gt;
&lt;br /&gt;
for (int i = 0; i &amp;lt; 4; i++) {&lt;br /&gt;
&lt;br /&gt;
	// Include the lower 7-bits of this byte into the value&lt;br /&gt;
	val |= midi_data[i] &amp;amp; 0x7F;&lt;br /&gt;
&lt;br /&gt;
	// If the high bit is set, shift the value up&lt;br /&gt;
	// seven bits to make room for the next value&lt;br /&gt;
	if (midi_data[i] &amp;amp; 0x80) val &amp;lt;&amp;lt;= 7;&lt;br /&gt;
	else break; // High bit unset means end of value&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
printf(&amp;quot;Value is %lu\n&amp;quot;, val);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Generally speaking, MIDI data that can be sent over the wire uses these values (e.g. delays), whereas data only used to write .mid files on disk (e.g. MTrk lengths in bytes) use normal big-endian fixed-length values.&lt;br /&gt;
&lt;br /&gt;
==== MIDI events ====&lt;br /&gt;
&lt;br /&gt;
This table lists the different MIDI events that can occur in a song.  The events are listed as channel zero (e.g. 0x80, which would become 0x85 for channel five.)  Removing the high bit (&amp;lt;code&amp;gt;(byte &amp;amp; 0x7F) &amp;gt;&amp;gt; 4&amp;lt;/code&amp;gt;) will give the &#039;event number&#039;.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Register value!!Event number!!Data size!!Purpose&lt;br /&gt;
|-&lt;br /&gt;
|0x80||0||2||Note off&lt;br /&gt;
|-&lt;br /&gt;
|0x90||1||2||Note on&lt;br /&gt;
|-&lt;br /&gt;
|0xA0||2||2||Polyphonic key pressure&lt;br /&gt;
|-&lt;br /&gt;
|0xB0||3||2||Controller&lt;br /&gt;
|-&lt;br /&gt;
|0xC0||4||1||Instrument change&lt;br /&gt;
|-&lt;br /&gt;
|0xD0||5||1||Channel pressure&lt;br /&gt;
|-&lt;br /&gt;
|0xE0||6||2||Pitch bend&lt;br /&gt;
|-&lt;br /&gt;
|0xF0||7||Any||Sysex&lt;br /&gt;
|-&lt;br /&gt;
|0xFF||N/A||Any||Meta-event&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The data bytes for each event are described in the sections below.&lt;br /&gt;
&lt;br /&gt;
Each event is preceded by a delay (as a MIDILEN variable-length integer, see [[#MIDI lengths]] above) which specifies the number of MIDI ticks until the event should be actioned.&lt;br /&gt;
&lt;br /&gt;
To convert the number of MIDI ticks into a usable time value, the &amp;lt;tt&amp;gt;iTicksPerQuarterNote&amp;lt;/tt&amp;gt; field from the header will allow the tick count to be converted into a fractional number of quarter notes, then the song&#039;s tempo (in microseconds per quarter note) will allow this fractional number of quarter notes to be converted into microseconds.&lt;br /&gt;
&lt;br /&gt;
The default tempo of 500,000 microseconds per quarter note applies until overridden by a [[#0x51: Set tempo|set-tempo]] event.&lt;br /&gt;
&lt;br /&gt;
===== Running-status =====&lt;br /&gt;
&lt;br /&gt;
Any event values without the high-bit set (i.e. less than 0x80) are so-called &amp;quot;running status&amp;quot; values.  If one of these bytes is encountered as a MIDI event, it is actually the first data byte of the event instead.  The actual event is the same as the previous one.  For example, these two lines are equivalent: (delay bytes omitted for clarity)&lt;br /&gt;
&lt;br /&gt;
 90 40 7F   91 44 7F   91 47 7F   81 44 7F  (full syntax)&lt;br /&gt;
 90 40 7F   91 44 7F      47 7F      44 00  (with running status)&lt;br /&gt;
&lt;br /&gt;
This means:&lt;br /&gt;
* 90 40 7F: Turn note 0x40 on channel 0 at maximum velocity&lt;br /&gt;
* 91 44 7F: Then turn note 0x44 on channel 1 at maximum velocity&lt;br /&gt;
* 47 7F: Turn note 0x47 on the same channel (running status means use event 0x91 from before)&lt;br /&gt;
* 44 00: Turn note 0x44 off on the same channel (running status uses event 0x91 again, and takes advantage of note-on at zero velocity being the same as note-off)&lt;br /&gt;
&lt;br /&gt;
Meta-events do not affect running status, so any event from 0xF0 to 0xFF can appear in the middle of data without affecting the running status.  For example the following line is equivalent to the two lines above:&lt;br /&gt;
&lt;br /&gt;
 90 40 7F   91 44 7F   FF 01 02 AA BB   47 7F   F0 02 AA F7   44 00&lt;br /&gt;
&lt;br /&gt;
===== 0x80: Note off =====&lt;br /&gt;
Stops the specified note from sounding on this channel.  Does not affect any other notes currently being played on the same channel.  A note-on event with a velocity of zero is the same as a note-off event.&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Data bytes!!Purpose&lt;br /&gt;
|-&lt;br /&gt;
|UINT8 iNote||MIDI note number to key-off (0-127)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8 iVelocity||How hard to release the note (0-127)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== 0x90: Note on =====&lt;br /&gt;
Plays the specified note on the given channel.  Multiple notes can be sounding at the same time on the same channel.  A velocity of zero is the same as a note-off event (this is often used with running status to minimise the amount of data used.)&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Data bytes!!Purpose&lt;br /&gt;
|-&lt;br /&gt;
|UINT8 iNote||MIDI note number to key-on (0-127)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8 iVelocity||How hard to press the note (0-127)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== 0xA0: Polyphonic key pressure =====&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Data bytes!!Purpose&lt;br /&gt;
|-&lt;br /&gt;
|UINT8 iPressure||Pressure value (0-127)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8 iNote||MIDI note number to affect (0-127)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== 0xB0: Controller =====&lt;br /&gt;
Set a MIDI controller to the specified value.  TODO: List of standard controllers&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Data bytes!!Purpose&lt;br /&gt;
|-&lt;br /&gt;
|UINT8 iController||Controller index (0-127)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8 iValue||Value to set (0-127)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== 0xC0: Instrument change =====&lt;br /&gt;
Set the channel to the specified instrument.&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Data bytes!!Purpose&lt;br /&gt;
|-&lt;br /&gt;
|UINT8 iInstrument||Instrument number (0-127)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== 0xD0: Channel pressure =====&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Data bytes!!Purpose&lt;br /&gt;
|-&lt;br /&gt;
|UINT8 iPressure||Pressure value (0-127)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== 0xE0: Pitch bend =====&lt;br /&gt;
Bend all notes on the channel up or down by the specified amount.  The value is between 0 and 16384.  The value 8192 is in the middle and means no bend, thus 8192 can be subtracted from this the value to create a signed integer between -8192 and +8191, with zero meaning &amp;quot;no bend.&amp;quot;  The actual pitch resulting from the bend depends on the range, which is set (usually at the start of the song) by a MIDI controller message.&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Data bytes!!Purpose&lt;br /&gt;
|-&lt;br /&gt;
|UINT8 iLSB||Least significant byte (0-127)&lt;br /&gt;
|-&lt;br /&gt;
|UINT8 iMSB||Most significant byte (0-127)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The value is calculated by combining the lower seven bits from each of the two bytes into a single 14-bit value: &amp;lt;code&amp;gt;value = (iMSB &amp;lt;&amp;lt; 7) | iLSB&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== 0xF0: System exclusive =====&lt;br /&gt;
These messages are used to send proprietary commands to various MIDI devices.  They are essentially a list of raw bytes to send.  The channel is not used, so 0xF0 through 0xFF are different &amp;quot;sysex&amp;quot; messages.  Since 0xFF is used as a reset it would have no use in a .mid file on disk, so this event is used for meta-events described below.&lt;br /&gt;
&lt;br /&gt;
The event type (0xF0 to 0xFE) is followed by this structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Data bytes!!Purpose&lt;br /&gt;
|-&lt;br /&gt;
|MIDILEN iLength||Length of data&lt;br /&gt;
|-&lt;br /&gt;
|UINT8 cData[iLength]||Block of data, iLength bytes long&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Event 0xFF has a different structure and is covered below.  The event types are defined as follows:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Event type!!Purpose&lt;br /&gt;
|-&lt;br /&gt;
|0xF0||Start system exclusive event&lt;br /&gt;
|-&lt;br /&gt;
|0xF1||MIDI time code&lt;br /&gt;
|-&lt;br /&gt;
|0xF2||Song position pointer&lt;br /&gt;
|-&lt;br /&gt;
|0xF3||Song select&lt;br /&gt;
|-&lt;br /&gt;
|0xF4||(Unused)&lt;br /&gt;
|-&lt;br /&gt;
|0xF5||(Unused)&lt;br /&gt;
|-&lt;br /&gt;
|0xF6||Tune request&lt;br /&gt;
|-&lt;br /&gt;
|0xF7||End system exclusive event (EOX)&lt;br /&gt;
|-&lt;br /&gt;
|0xF8||Timing clock&lt;br /&gt;
|-&lt;br /&gt;
|0xF9||(Unused)&lt;br /&gt;
|-&lt;br /&gt;
|0xFA||Start playback&lt;br /&gt;
|-&lt;br /&gt;
|0xFB||Continue playback&lt;br /&gt;
|-&lt;br /&gt;
|0xFC||Stop playback&lt;br /&gt;
|-&lt;br /&gt;
|0xFD||(Unused)&lt;br /&gt;
|-&lt;br /&gt;
|0xFE||Active sensing&lt;br /&gt;
|-&lt;br /&gt;
|0xFF||System reset (used for meta-event in a MIDI file)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Meta events ====&lt;br /&gt;
&lt;br /&gt;
Meta events are events specific to MIDI files themselves.  They are not transmitted to MIDI devices.  A meta event is signalled by the 0xFF system exclusive event.  The following table lists the format of the bytes following the 0xFF.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Data bytes!!Purpose&lt;br /&gt;
|-&lt;br /&gt;
|UINT8 iType||Meta-event type&lt;br /&gt;
|-&lt;br /&gt;
|MIDILEN iLength||Length of event data&lt;br /&gt;
|-&lt;br /&gt;
|UINT8 cData[iLength]||Event data&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The following section lists the meaning of various values of &amp;lt;tt&amp;gt;iType&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===== 0x01 - 0x0F: Text =====&lt;br /&gt;
These events set various types of text.  The event data is the text to set.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Event type!!Text use&lt;br /&gt;
|-&lt;br /&gt;
|0x01||Generic text event.  Often the first text event in a song is used as its title.&lt;br /&gt;
|-&lt;br /&gt;
|0x02||Copyright notice&lt;br /&gt;
|-&lt;br /&gt;
|0x03||Track name.  Often the first event (format-0) or the first track (format-1) is the song title.&lt;br /&gt;
|-&lt;br /&gt;
|0x04||Instrument name&lt;br /&gt;
|-&lt;br /&gt;
|0x05||Lyric&lt;br /&gt;
|-&lt;br /&gt;
|0x06||Marker&lt;br /&gt;
|-&lt;br /&gt;
|0x07||Cue point (e.g. stage instructions)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== 0x2F: End of track =====&lt;br /&gt;
Mandatory event at the end of each MTrk track.  The length field is always zero, so there are no bytes of event data.&lt;br /&gt;
&lt;br /&gt;
===== 0x51: Set tempo =====&lt;br /&gt;
This event should always have a length of three.  The event data is a big-endian integer (&#039;&#039;&#039;not&#039;&#039;&#039; in MIDI variable-length notation) indicating the number of microseconds in a quarter note.  Together with the &amp;lt;tt&amp;gt;iTicksPerQuarterNote&amp;lt;/tt&amp;gt; value from the header, this allows MIDI ticks to be converted into microseconds for correct playback speed of the MIDI file.&lt;br /&gt;
&lt;br /&gt;
Unless overridden by this event, the number of microseconds in a quarter note defaults to 500,000.&lt;br /&gt;
&lt;br /&gt;
===== 0x7F: Manufacturer-specific =====&lt;br /&gt;
The first data byte of this event is a manufacturer ID.  If it is 0x00, then the following [[UINT16BE]] is the actual manufacturer ID.  This means either one or three bytes total will be read to obtain the manufacturer ID.&lt;br /&gt;
&lt;br /&gt;
If the manufacturer ID is 0x3F then it is an Ad Lib, Inc. event, and the file format is technically &amp;lt;tt&amp;gt;.mdi&amp;lt;/tt&amp;gt; (an Ad Lib MIDI file with embedded OPL instruments), see [[MDI Format]] for details.&lt;br /&gt;
&lt;br /&gt;
===== Additional meta-events =====&lt;br /&gt;
&lt;br /&gt;
Other meta-events (not so important for playing back game music) are listed on various web sites:&lt;br /&gt;
&lt;br /&gt;
* http://www.omega-art.com/midi/mfiles.html#meta&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
* [[DRO2MIDI]] - converts .dro files into [[MID Format|.mid files]]&lt;br /&gt;
&lt;br /&gt;
== Similar formats ==&lt;br /&gt;
* [[MDI Format|MDI files]] have the same container format, but with different event specification.&lt;br /&gt;
* [[CMF Format|CMF files]] store their song data in MIDI format.&lt;br /&gt;
* [[MUS Format|MUS files]] are single-track MIDI files made by id Software.&lt;br /&gt;
* [[XMI Format|XMI files]] are Extended MIDI files.&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
* https://web.archive.org/web/20070104033706/http://www.cybermuff.cz/music/MIDIspec.htm - great reference for the MIDI spec&lt;br /&gt;
&lt;br /&gt;
[[Category:Build engine]]&lt;/div&gt;</summary>
		<author><name>Binarymaster</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=MDI_Format&amp;diff=6930</id>
		<title>MDI Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=MDI_Format&amp;diff=6930"/>
		<updated>2016-07-31T13:55:10Z</updated>

		<summary type="html">&lt;p&gt;Binarymaster: Update format specification from latest research&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Music Infobox&lt;br /&gt;
 | Type = MIDI&lt;br /&gt;
 | Instruments = OPL&lt;br /&gt;
 | NumChannels = 9 or 11&lt;br /&gt;
 | NumTracks = 65535&lt;br /&gt;
 | NumPatterns = 1&lt;br /&gt;
 | NumOrders = 0&lt;br /&gt;
 | Tags = Text events&lt;br /&gt;
 | Games = &lt;br /&gt;
   {{Game|Dark Ages}}&lt;br /&gt;
   {{Game|Galactix}}&lt;br /&gt;
   {{Game|Prehistorik}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;MDI Format&#039;&#039;&#039; is derived from [[ROL Format]] and have compatible specification for playback. It uses a [[MID Format|standard MIDI file]] structure (MIDI Type 0) that contains MIDI meta events for setting OPL instrument settings.  It is a way of storing FM/OPL instruments inside a standard MIDI file, with the file being a standard, fully compatible .mid file.  Players that are not aware of the FM/OPL commands will simply ignore them and play the file without instruments.&lt;br /&gt;
&lt;br /&gt;
Typically standard MIDI files use the &amp;lt;tt&amp;gt;.mid&amp;lt;/tt&amp;gt; filename extension, while files that use the FM/OPL commands are given the &amp;lt;tt&amp;gt;.mdi&amp;lt;/tt&amp;gt; extension.&lt;br /&gt;
&lt;br /&gt;
== Differences to standard MIDI ==&lt;br /&gt;
&lt;br /&gt;
=== Manufacturer-specific events ===&lt;br /&gt;
&lt;br /&gt;
To be compatible with standard MIDI container specification, the format uses sequencer specific events to change instrument patches, control AdLib rhythm mode, and set pitch bend range.&lt;br /&gt;
&lt;br /&gt;
These meta events begins with 0xFF byte, followed by 0x7F parameter, indicating &amp;quot;sequencer specific&amp;quot; event. Then it&#039;s followed by variable length value and the data blob.&lt;br /&gt;
&lt;br /&gt;
The first data byte is a manufacturer ID.  If it is 0x00, then the following [[UINT16BE]] is the actual manufacturer ID.  This means either one or three bytes total will be read to obtain the manufacturer ID.&lt;br /&gt;
&lt;br /&gt;
If the manufacturer ID is 0x3F then it is an Ad Lib, Inc. event.  In this case, read another UINT16BE to obtain the opcode, then the data following the opcode is arranged as:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Opcode !! Purpose !! Description&lt;br /&gt;
|-&lt;br /&gt;
| 1 || Instrument change || 29 data bytes follow:&amp;lt;table class=&amp;quot;wikitable&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Name&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Description&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;[[UINT8]]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;voice&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;MIDI channel number to assign instrument to&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;BNK_ENTRY&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;patch&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;OPL register settings&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Sound mode || One data byte.  0=melodic/rhythm-off, 1=percussive/rhythm-on&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Pitch bend range || One data byte, value in range 1-12 inclusive. {{TODO|Explain how this works}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;BNK_ENTRY&amp;lt;/tt&amp;gt; is defined as follows: (note this is identical to the layout of an instrument inside a [[AdLib Instrument Bank Format]] .bnk file.  See that article for the explanation of the &amp;lt;tt&amp;gt;OPLREGS&amp;lt;/tt&amp;gt; structure.)&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| [[AdLib Instrument Bank Format|OPLREGS]] || oplModulator || Register values for the Modulator operator (op 0)&lt;br /&gt;
|-&lt;br /&gt;
| [[AdLib Instrument Bank Format|OPLREGS]] || oplCarrier || Register values for the Carrier operator (op 1)&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT8]] || iModWaveSel || Modulator wave select (OPL base register 0xE0)&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT8]] || iCarWaveSel || Carrier wave select (OPL base register 0xE0)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Channel aftertouch event ===&lt;br /&gt;
&lt;br /&gt;
Event 0xD# is used to control channel volume. It mostly used for dynamic volume control of currently played note (for example: fade in, fade out, or tremolo effects).&lt;br /&gt;
&lt;br /&gt;
=== Velocity parameter ===&lt;br /&gt;
&lt;br /&gt;
This parameter goes with Note On and Note Off events. Since the format is inherited from ROL, it doesn&#039;t have note velocity specification.&lt;br /&gt;
&lt;br /&gt;
It also changes current channel volume, same as event previously described.&lt;br /&gt;
&lt;br /&gt;
Some &amp;quot;Note Off&amp;quot; events may have note parameter equal to 0.  This event just stops last played note on specified channel.  If there is no played note on channel, it obviously used to set channel volume.&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
{{BeginFileFormatTools|Type=audio}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = AdLib &amp;lt;tt&amp;gt;midiplay.exe&amp;lt;/tt&amp;gt;&lt;br /&gt;
| Platform = DOS&lt;br /&gt;
| canPlay = Yes&lt;br /&gt;
| canCreate = No&lt;br /&gt;
| canModify = No&lt;br /&gt;
| canExport = No&lt;br /&gt;
| canImport = No&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = No&lt;br /&gt;
| notes = Part of AdLib Programmer&#039;s Guide&lt;br /&gt;
}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = AdLib &amp;lt;tt&amp;gt;rol2midi.exe&amp;lt;/tt&amp;gt;&lt;br /&gt;
| Platform = DOS&lt;br /&gt;
| canPlay = No&lt;br /&gt;
| canCreate = No&lt;br /&gt;
| canModify = No&lt;br /&gt;
| canExport = No&lt;br /&gt;
| canImport = Yes; [[ROL Format|.rol]]&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = No&lt;br /&gt;
| notes = Part of AdLib Programmer&#039;s Guide&lt;br /&gt;
}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = [[Camoto]]&lt;br /&gt;
| Platform = Linux/Win&lt;br /&gt;
| canPlay = Yes&lt;br /&gt;
| canCreate = No&lt;br /&gt;
| canModify = No&lt;br /&gt;
| canExport = Yes; many&lt;br /&gt;
| canImport = No&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = Yes&lt;br /&gt;
}}&lt;br /&gt;
{{EndFileFormatTools}}&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[MID Format]] - the container format&lt;br /&gt;
* [[AdLib Instrument Bank Format]] - format with the same instrument definition structure&lt;br /&gt;
* http://cd.textfiles.com/soundsensations/MISCPROG/AD-PROG/ - AdLib Programmer&#039;s Guide, including source code for playing and converting files in this format&lt;/div&gt;</summary>
		<author><name>Binarymaster</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=AdLib_MIDI_Format&amp;diff=6929</id>
		<title>AdLib MIDI Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=AdLib_MIDI_Format&amp;diff=6929"/>
		<updated>2016-07-31T13:09:15Z</updated>

		<summary type="html">&lt;p&gt;Binarymaster: /* Timing */ Overflow bytes&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Music Infobox&lt;br /&gt;
 | Type = MIDI&lt;br /&gt;
 | Instruments = OPL&lt;br /&gt;
 | NumChannels = 9 or 11&lt;br /&gt;
 | NumTracks = 1&lt;br /&gt;
 | NumPatterns = 1&lt;br /&gt;
 | NumOrders = 0&lt;br /&gt;
 | Tags = Title&lt;br /&gt;
 | Games = &lt;br /&gt;
   {{Game|Kung Fu Louie Vs. The Martial Art Posse}}&lt;br /&gt;
   {{Game|Weird Dreams}}&lt;br /&gt;
   {{Game|DragonStrike}}&lt;br /&gt;
   {{Game|Vinyl Goddess From Mars}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;AdLib MIDI Format&#039;&#039;&#039; is an Ad Lib music format, based on the standard MIDI format.  It is derived from [[ROL Format]] and have compatible specification for playback.  The format has a custom header, but the actual music data mostly in standard MIDI notation.  Despite this, it appears that it was never intended to be played on a MIDI device, as the patch numbers refer to indices into a companion OPL instrument bank in [[AdLib Timbre Bank Format]].&lt;br /&gt;
&lt;br /&gt;
In this respect it is similar to the [[CMF Format]], which also stores OPL music in MIDI notation, but unlike CMF this format keeps the instruments in a separate file.&lt;br /&gt;
&lt;br /&gt;
== File format ==&lt;br /&gt;
&lt;br /&gt;
The file is arranged like this:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| UINT8 || majorVersion || Major version number (usually 1)&lt;br /&gt;
|-&lt;br /&gt;
| UINT8 || minorVersion || Minor version number (usually 0)&lt;br /&gt;
|-&lt;br /&gt;
| INT32LE || tuneId || Song identification number&lt;br /&gt;
|-&lt;br /&gt;
| char[30] || tuneName || Song title, null terminated&lt;br /&gt;
|-&lt;br /&gt;
| UINT8 || tickBeat || Number of ticks per beat&lt;br /&gt;
|-&lt;br /&gt;
| UINT8 || beatMeasure || Number of beats per measure&lt;br /&gt;
|-&lt;br /&gt;
| INT32LE || totalTick || Length of song, in ticks&lt;br /&gt;
|-&lt;br /&gt;
| INT32LE || dataSize || Length of MIDI data block, in bytes&lt;br /&gt;
|-&lt;br /&gt;
| INT32LE || nrCommand || Total number of MIDI events in song, including final 0xFC &amp;quot;stop&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| BYTE[8] || filler || Padding, set to zero&lt;br /&gt;
|-&lt;br /&gt;
| UINT8 || soundMode || OPL rhythm mode: 0=melodic (off), 1=percussive (on)&lt;br /&gt;
|-&lt;br /&gt;
| UINT8 || pitchBRange || Pitchbend range (1-12)&lt;br /&gt;
|-&lt;br /&gt;
| UINT16 || basicTempo || Song tempo, in beats-per-minute.&lt;br /&gt;
|-&lt;br /&gt;
| BYTE[8] || filler2 || Padding, set to zero&lt;br /&gt;
|-&lt;br /&gt;
| BYTE[dataSize] || data || Song data in standard MIDI format (same content as a MIDI MTrk block, almost)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The only known version of this format is 1.0.&lt;br /&gt;
&lt;br /&gt;
=== Timing ===&lt;br /&gt;
&lt;br /&gt;
The MIDI delay bytes in the song data are in units of &amp;quot;ticks&amp;quot;, as per normal.  Timing bytes vary from 0 to 0xFE and precede every command.  A timing byte of 0xF8 means timing overflow with a value of 240.  An overflow byte is always followed by another overflow byte or timing byte.&lt;br /&gt;
&lt;br /&gt;
The fields &amp;lt;tt&amp;gt;tickBeat&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;beatMeasure&amp;lt;/tt&amp;gt; can be used to convert ticks into beats and measures if desired, for example when drawing a musical staff.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;basicTempo&amp;lt;/tt&amp;gt; field controls the song playback speed and is measured in beats per minute.  The playback frequency can be calculated as follows:&lt;br /&gt;
&lt;br /&gt;
 frequency = (basicTempo / 60) * tickBeat&lt;br /&gt;
&lt;br /&gt;
For a song that plays at 120BPM and with 10 ticks per beat, this works out as:&lt;br /&gt;
&lt;br /&gt;
  frequency = (120 / 60) * 10&lt;br /&gt;
            = 20 Hz&lt;br /&gt;
&lt;br /&gt;
Therefore playback should happen at 20 ticks per second to be at the correct tempo.&lt;br /&gt;
&lt;br /&gt;
Also the song speed can be controlled during playback, see [[#Tempo multiplier]] event.&lt;br /&gt;
&lt;br /&gt;
=== Rhythm mode ===&lt;br /&gt;
&lt;br /&gt;
If &amp;lt;tt&amp;gt;soundMode&amp;lt;/tt&amp;gt; is 0, then rhythm mode is off.  Valid MIDI channels are 0 to 8 inclusive.&lt;br /&gt;
&lt;br /&gt;
When &amp;lt;tt&amp;gt;soundMode&amp;lt;/tt&amp;gt; is 1, then rhythm mode is on.  Valid MIDI channels are 0 to 10, with 0 to 5 being melodic and 6 to 10 being percussive (see table below.)  The official code actually treats any nonzero value as enabling rhythm mode, however only the values 0 and 1 should be used.&lt;br /&gt;
&lt;br /&gt;
Both the top cymbal and the snare drum only use the OPL carrier registers, but the values for these registers are actually stored in the file&#039;s modulator fields.  The carrier fields for these instruments appear to be unused.  In other words, percussive instruments always have their settings loaded from the instrument&#039;s modulator fields, even when the values are loaded into the OPL chip&#039;s carrier registers.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! MIDI channel !! Percussive instrument !! Operator used in file !! OPL cell&lt;br /&gt;
|-&lt;br /&gt;
| 0-5 || Melodic || Modulator&amp;lt;br/&amp;gt;Carrier || Modulator&amp;lt;br/&amp;gt;Carrier&lt;br /&gt;
|-&lt;br /&gt;
| 6  || Bass drum || Modulator&amp;lt;br/&amp;gt;Carrier || 13 - Channel 7 Modulator&amp;lt;br/&amp;gt;16 - Channel 7 Carrier&lt;br /&gt;
|-&lt;br /&gt;
| 7  || Snare drum || Modulator || 17 - Channel 8 Carrier&lt;br /&gt;
|-&lt;br /&gt;
| 8  || Tom tom || Modulator || 15 - Channel 9 Modulator&lt;br /&gt;
|-&lt;br /&gt;
| 9  || Top cymbal || Modulator || 18 - Channel 9 Carrier&lt;br /&gt;
|-&lt;br /&gt;
| 10  || Hi-hat || Modulator || 14 - Channel 8 Modulator&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
There is no indicator whether a patch is percussive or melodic, so this is controlled entirely by which MIDI channel it is used on.  It is possible to use the same patch for both percussive and melodic channels.&lt;br /&gt;
&lt;br /&gt;
In percussive mode, the pitch of the single-operator percussive instruments is handled specially (that is, the snare drum, tom tom, top cymbal and hi-hat.  The bass drum is not considered here.)  When a note is played on MIDI channel 8 (tom-tom), the pitch on the other instruments is changed also.  The changes are:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! MIDI channel !! Percussive instrument !! Note pitch&lt;br /&gt;
|-&lt;br /&gt;
| 7  || Snare drum || 7 semitones higher than the last tom-tom note on MIDI channel 8&lt;br /&gt;
|-&lt;br /&gt;
| 8  || Tom tom || Use pitch as indicated in the MIDI note-on event&lt;br /&gt;
|-&lt;br /&gt;
| 9  || Top cymbal || Use pitch from last tom-tom note on MIDI channel 8&lt;br /&gt;
|-&lt;br /&gt;
| 10  || Hi-hat || 7 semitones higher than the last tom-tom note on MIDI channel 8&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The initial frequency for the tom-tom is supposed to be two octaves below middle-C according to comments in the official &amp;lt;tt&amp;gt;adlib.c&amp;lt;/tt&amp;gt;, however {{TODO|this doesn&#039;t seem to be the case.}}&lt;br /&gt;
&lt;br /&gt;
=== Differences to MIDI ===&lt;br /&gt;
&lt;br /&gt;
==== Polyphonic key pressure ====&lt;br /&gt;
&lt;br /&gt;
According to MIDI specification, event 0xA# should have two byte parameters (the key/note and the pressure for that note), however this format provides only one byte parameter.&lt;br /&gt;
&lt;br /&gt;
It is used to control channel volume. It frequently appears in the beginning of MIDI stream. Also it may be used for dynamic volume control of currently played note (for example: fade in, fade out, or tremolo effects).&lt;br /&gt;
&lt;br /&gt;
==== Velocity parameter ====&lt;br /&gt;
&lt;br /&gt;
This parameter goes with Note On and Note Off events. Since the format is inherited from ROL, it doesn&#039;t have note velocity specification.&lt;br /&gt;
&lt;br /&gt;
It also changes current channel volume, same as event previously described.&lt;br /&gt;
&lt;br /&gt;
If &amp;quot;Note On&amp;quot; event has velocity parameter equal to 0, it is treated as &amp;quot;Note Off&amp;quot; event, and channel volume is not changed.&lt;br /&gt;
&lt;br /&gt;
==== Tempo multiplier ====&lt;br /&gt;
&lt;br /&gt;
This event is structured like System Exclusive event, beginning with bytes 0xF0 0x7F and ending with 0xF7 byte.&lt;br /&gt;
&lt;br /&gt;
By default, it does have fixed length of 6 bytes (including status bytes), and is used to change song speed during playback. It consists of an integer and a fractional part, in 1/128.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Byte&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0xF0&lt;br /&gt;
| SysEx Status Byte&lt;br /&gt;
|-&lt;br /&gt;
| 0x7F&lt;br /&gt;
| Universal Realtime Command&lt;br /&gt;
|-&lt;br /&gt;
| 0x00&lt;br /&gt;
| Reserved&lt;br /&gt;
|-&lt;br /&gt;
| XX&lt;br /&gt;
| Integer part&lt;br /&gt;
|-&lt;br /&gt;
| YY&lt;br /&gt;
| Fractional part 1/128&lt;br /&gt;
|-&lt;br /&gt;
| 0xF7&lt;br /&gt;
| End of SysEx&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
So the actual frequency calculated like this:&lt;br /&gt;
&lt;br /&gt;
 multiplier = XX + YY / 128&lt;br /&gt;
 frequency = (basicTempo / 60) * tickBeat * multiplier&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
{{BeginFileFormatTools|Type=audio}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = AdLib &amp;lt;tt&amp;gt;play.exe&amp;lt;/tt&amp;gt;&lt;br /&gt;
| Platform = DOS&lt;br /&gt;
| canPlay = Yes&lt;br /&gt;
| canCreate = No&lt;br /&gt;
| canModify = No&lt;br /&gt;
| canExport = No&lt;br /&gt;
| canImport = No&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = No&lt;br /&gt;
| notes = Part of AdLib Programmer&#039;s Guide&lt;br /&gt;
}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = AdLib &amp;lt;tt&amp;gt;convert.exe&amp;lt;/tt&amp;gt;&lt;br /&gt;
| Platform = DOS&lt;br /&gt;
| canPlay = No&lt;br /&gt;
| canCreate = No&lt;br /&gt;
| canModify = No&lt;br /&gt;
| canExport = No&lt;br /&gt;
| canImport = Yes; [[ROL Format|.rol]]&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = No&lt;br /&gt;
| notes = Part of AdLib Programmer&#039;s Guide&lt;br /&gt;
}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = [[Camoto]]&lt;br /&gt;
| Platform = Linux/Win&lt;br /&gt;
| canPlay = Yes&lt;br /&gt;
| canCreate = No&lt;br /&gt;
| canModify = No&lt;br /&gt;
| canExport = Yes; many&lt;br /&gt;
| canImport = No&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = Yes&lt;br /&gt;
}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = [http://www.shikadi.net/utils/vinyl2cmf Vinyl2CMF]&lt;br /&gt;
| Platform = Windows CLI&lt;br /&gt;
| canPlay = No&lt;br /&gt;
| canCreate = No&lt;br /&gt;
| canModify = No&lt;br /&gt;
| canExport = Yes; [[CMF Format|.cmf]]&lt;br /&gt;
| canImport = No&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = No&lt;br /&gt;
| notes =&lt;br /&gt;
}}&lt;br /&gt;
{{EndFileFormatTools}}&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[AdLib Timbre Bank Format]] - companion format for storing instruments for songs in this format&lt;br /&gt;
* http://files.mpoli.fi/software/programm/general/adlip.zip - AdLib Programmer&#039;s Guide, including source code for playing and converting files in this format&lt;br /&gt;
&lt;br /&gt;
== Credits ==&lt;br /&gt;
&lt;br /&gt;
This file format was originally reverse engineered by [[User:Malvineous|Malvineous]] as the [[Vinyl Goddess From Mars]] music format, until [[User:binarymaster|binarymaster]] discovered it was the same as an early AdLib music format, and supplied the documentation on which this article is now based.  If you find this information helpful in a project you&#039;re working on, please give credit where credit is due.  (A link back to this wiki would be nice too!)&lt;/div&gt;</summary>
		<author><name>Binarymaster</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=AdLib_MIDI_Format&amp;diff=6928</id>
		<title>AdLib MIDI Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=AdLib_MIDI_Format&amp;diff=6928"/>
		<updated>2016-07-31T13:04:31Z</updated>

		<summary type="html">&lt;p&gt;Binarymaster: Update format specification from latest research&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Music Infobox&lt;br /&gt;
 | Type = MIDI&lt;br /&gt;
 | Instruments = OPL&lt;br /&gt;
 | NumChannels = 9 or 11&lt;br /&gt;
 | NumTracks = 1&lt;br /&gt;
 | NumPatterns = 1&lt;br /&gt;
 | NumOrders = 0&lt;br /&gt;
 | Tags = Title&lt;br /&gt;
 | Games = &lt;br /&gt;
   {{Game|Kung Fu Louie Vs. The Martial Art Posse}}&lt;br /&gt;
   {{Game|Weird Dreams}}&lt;br /&gt;
   {{Game|DragonStrike}}&lt;br /&gt;
   {{Game|Vinyl Goddess From Mars}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;AdLib MIDI Format&#039;&#039;&#039; is an Ad Lib music format, based on the standard MIDI format.  It is derived from [[ROL Format]] and have compatible specification for playback.  The format has a custom header, but the actual music data mostly in standard MIDI notation.  Despite this, it appears that it was never intended to be played on a MIDI device, as the patch numbers refer to indices into a companion OPL instrument bank in [[AdLib Timbre Bank Format]].&lt;br /&gt;
&lt;br /&gt;
In this respect it is similar to the [[CMF Format]], which also stores OPL music in MIDI notation, but unlike CMF this format keeps the instruments in a separate file.&lt;br /&gt;
&lt;br /&gt;
== File format ==&lt;br /&gt;
&lt;br /&gt;
The file is arranged like this:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| UINT8 || majorVersion || Major version number (usually 1)&lt;br /&gt;
|-&lt;br /&gt;
| UINT8 || minorVersion || Minor version number (usually 0)&lt;br /&gt;
|-&lt;br /&gt;
| INT32LE || tuneId || Song identification number&lt;br /&gt;
|-&lt;br /&gt;
| char[30] || tuneName || Song title, null terminated&lt;br /&gt;
|-&lt;br /&gt;
| UINT8 || tickBeat || Number of ticks per beat&lt;br /&gt;
|-&lt;br /&gt;
| UINT8 || beatMeasure || Number of beats per measure&lt;br /&gt;
|-&lt;br /&gt;
| INT32LE || totalTick || Length of song, in ticks&lt;br /&gt;
|-&lt;br /&gt;
| INT32LE || dataSize || Length of MIDI data block, in bytes&lt;br /&gt;
|-&lt;br /&gt;
| INT32LE || nrCommand || Total number of MIDI events in song, including final 0xFC &amp;quot;stop&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| BYTE[8] || filler || Padding, set to zero&lt;br /&gt;
|-&lt;br /&gt;
| UINT8 || soundMode || OPL rhythm mode: 0=melodic (off), 1=percussive (on)&lt;br /&gt;
|-&lt;br /&gt;
| UINT8 || pitchBRange || Pitchbend range (1-12)&lt;br /&gt;
|-&lt;br /&gt;
| UINT16 || basicTempo || Song tempo, in beats-per-minute.&lt;br /&gt;
|-&lt;br /&gt;
| BYTE[8] || filler2 || Padding, set to zero&lt;br /&gt;
|-&lt;br /&gt;
| BYTE[dataSize] || data || Song data in standard MIDI format (same content as a MIDI MTrk block, almost)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The only known version of this format is 1.0.&lt;br /&gt;
&lt;br /&gt;
=== Timing ===&lt;br /&gt;
&lt;br /&gt;
The MIDI delay bytes in the song data are in units of &amp;quot;ticks&amp;quot;, as per normal.  The fields &amp;lt;tt&amp;gt;tickBeat&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;beatMeasure&amp;lt;/tt&amp;gt; can be used to convert ticks into beats and measures if desired, for example when drawing a musical staff.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;basicTempo&amp;lt;/tt&amp;gt; field controls the song playback speed and is measured in beats per minute.  The playback frequency can be calculated as follows:&lt;br /&gt;
&lt;br /&gt;
 frequency = (basicTempo / 60) * tickBeat&lt;br /&gt;
&lt;br /&gt;
For a song that plays at 120BPM and with 10 ticks per beat, this works out as:&lt;br /&gt;
&lt;br /&gt;
  frequency = (120 / 60) * 10&lt;br /&gt;
            = 20 Hz&lt;br /&gt;
&lt;br /&gt;
Therefore playback should happen at 20 ticks per second to be at the correct tempo.&lt;br /&gt;
&lt;br /&gt;
=== Rhythm mode ===&lt;br /&gt;
&lt;br /&gt;
If &amp;lt;tt&amp;gt;soundMode&amp;lt;/tt&amp;gt; is 0, then rhythm mode is off.  Valid MIDI channels are 0 to 8 inclusive.&lt;br /&gt;
&lt;br /&gt;
When &amp;lt;tt&amp;gt;soundMode&amp;lt;/tt&amp;gt; is 1, then rhythm mode is on.  Valid MIDI channels are 0 to 10, with 0 to 5 being melodic and 6 to 10 being percussive (see table below.)  The official code actually treats any nonzero value as enabling rhythm mode, however only the values 0 and 1 should be used.&lt;br /&gt;
&lt;br /&gt;
Both the top cymbal and the snare drum only use the OPL carrier registers, but the values for these registers are actually stored in the file&#039;s modulator fields.  The carrier fields for these instruments appear to be unused.  In other words, percussive instruments always have their settings loaded from the instrument&#039;s modulator fields, even when the values are loaded into the OPL chip&#039;s carrier registers.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! MIDI channel !! Percussive instrument !! Operator used in file !! OPL cell&lt;br /&gt;
|-&lt;br /&gt;
| 0-5 || Melodic || Modulator&amp;lt;br/&amp;gt;Carrier || Modulator&amp;lt;br/&amp;gt;Carrier&lt;br /&gt;
|-&lt;br /&gt;
| 6  || Bass drum || Modulator&amp;lt;br/&amp;gt;Carrier || 13 - Channel 7 Modulator&amp;lt;br/&amp;gt;16 - Channel 7 Carrier&lt;br /&gt;
|-&lt;br /&gt;
| 7  || Snare drum || Modulator || 17 - Channel 8 Carrier&lt;br /&gt;
|-&lt;br /&gt;
| 8  || Tom tom || Modulator || 15 - Channel 9 Modulator&lt;br /&gt;
|-&lt;br /&gt;
| 9  || Top cymbal || Modulator || 18 - Channel 9 Carrier&lt;br /&gt;
|-&lt;br /&gt;
| 10  || Hi-hat || Modulator || 14 - Channel 8 Modulator&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
There is no indicator whether a patch is percussive or melodic, so this is controlled entirely by which MIDI channel it is used on.  It is possible to use the same patch for both percussive and melodic channels.&lt;br /&gt;
&lt;br /&gt;
In percussive mode, the pitch of the single-operator percussive instruments is handled specially (that is, the snare drum, tom tom, top cymbal and hi-hat.  The bass drum is not considered here.)  When a note is played on MIDI channel 8 (tom-tom), the pitch on the other instruments is changed also.  The changes are:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! MIDI channel !! Percussive instrument !! Note pitch&lt;br /&gt;
|-&lt;br /&gt;
| 7  || Snare drum || 7 semitones higher than the last tom-tom note on MIDI channel 8&lt;br /&gt;
|-&lt;br /&gt;
| 8  || Tom tom || Use pitch as indicated in the MIDI note-on event&lt;br /&gt;
|-&lt;br /&gt;
| 9  || Top cymbal || Use pitch from last tom-tom note on MIDI channel 8&lt;br /&gt;
|-&lt;br /&gt;
| 10  || Hi-hat || 7 semitones higher than the last tom-tom note on MIDI channel 8&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The initial frequency for the tom-tom is supposed to be two octaves below middle-C according to comments in the official &amp;lt;tt&amp;gt;adlib.c&amp;lt;/tt&amp;gt;, however {{TODO|this doesn&#039;t seem to be the case.}}&lt;br /&gt;
&lt;br /&gt;
=== Differences to MIDI ===&lt;br /&gt;
&lt;br /&gt;
==== Polyphonic key pressure ====&lt;br /&gt;
&lt;br /&gt;
According to MIDI specification, event 0xA# should have two byte parameters (the key/note and the pressure for that note), however this format provides only one byte parameter.&lt;br /&gt;
&lt;br /&gt;
It is used to control channel volume. It frequently appears in the beginning of MIDI stream. Also it may be used for dynamic volume control of currently played note (for example: fade in, fade out, or tremolo effects).&lt;br /&gt;
&lt;br /&gt;
==== Velocity parameter ====&lt;br /&gt;
&lt;br /&gt;
This parameter goes with Note On and Note Off events. Since the format is inherited from ROL, it doesn&#039;t have note velocity specification.&lt;br /&gt;
&lt;br /&gt;
It also changes current channel volume, same as event previously described.&lt;br /&gt;
&lt;br /&gt;
If &amp;quot;Note On&amp;quot; event has velocity parameter equal to 0, it is treated as &amp;quot;Note Off&amp;quot; event, and channel volume is not changed.&lt;br /&gt;
&lt;br /&gt;
==== Tempo multiplier ====&lt;br /&gt;
&lt;br /&gt;
This event is structured like System Exclusive event, beginning with bytes 0xF0 0x7F and ending with 0xF7 byte.&lt;br /&gt;
&lt;br /&gt;
By default, it does have fixed length of 6 bytes (including status bytes), and is used to change song speed during playback. It consists of an integer and a fractional part, in 1/128.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Byte&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0xF0&lt;br /&gt;
| SysEx Status Byte&lt;br /&gt;
|-&lt;br /&gt;
| 0x7F&lt;br /&gt;
| Universal Realtime Command&lt;br /&gt;
|-&lt;br /&gt;
| 0x00&lt;br /&gt;
| Reserved&lt;br /&gt;
|-&lt;br /&gt;
| XX&lt;br /&gt;
| Integer part&lt;br /&gt;
|-&lt;br /&gt;
| YY&lt;br /&gt;
| Fractional part 1/128&lt;br /&gt;
|-&lt;br /&gt;
| 0xF7&lt;br /&gt;
| End of SysEx&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
So the actual frequency calculated like this:&lt;br /&gt;
&lt;br /&gt;
 multiplier = XX + YY / 128&lt;br /&gt;
 frequency = (basicTempo / 60) * tickBeat * multiplier&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
{{BeginFileFormatTools|Type=audio}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = AdLib &amp;lt;tt&amp;gt;play.exe&amp;lt;/tt&amp;gt;&lt;br /&gt;
| Platform = DOS&lt;br /&gt;
| canPlay = Yes&lt;br /&gt;
| canCreate = No&lt;br /&gt;
| canModify = No&lt;br /&gt;
| canExport = No&lt;br /&gt;
| canImport = No&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = No&lt;br /&gt;
| notes = Part of AdLib Programmer&#039;s Guide&lt;br /&gt;
}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = AdLib &amp;lt;tt&amp;gt;convert.exe&amp;lt;/tt&amp;gt;&lt;br /&gt;
| Platform = DOS&lt;br /&gt;
| canPlay = No&lt;br /&gt;
| canCreate = No&lt;br /&gt;
| canModify = No&lt;br /&gt;
| canExport = No&lt;br /&gt;
| canImport = Yes; [[ROL Format|.rol]]&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = No&lt;br /&gt;
| notes = Part of AdLib Programmer&#039;s Guide&lt;br /&gt;
}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = [[Camoto]]&lt;br /&gt;
| Platform = Linux/Win&lt;br /&gt;
| canPlay = Yes&lt;br /&gt;
| canCreate = No&lt;br /&gt;
| canModify = No&lt;br /&gt;
| canExport = Yes; many&lt;br /&gt;
| canImport = No&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = Yes&lt;br /&gt;
}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = [http://www.shikadi.net/utils/vinyl2cmf Vinyl2CMF]&lt;br /&gt;
| Platform = Windows CLI&lt;br /&gt;
| canPlay = No&lt;br /&gt;
| canCreate = No&lt;br /&gt;
| canModify = No&lt;br /&gt;
| canExport = Yes; [[CMF Format|.cmf]]&lt;br /&gt;
| canImport = No&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = No&lt;br /&gt;
| notes =&lt;br /&gt;
}}&lt;br /&gt;
{{EndFileFormatTools}}&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[AdLib Timbre Bank Format]] - companion format for storing instruments for songs in this format&lt;br /&gt;
* http://files.mpoli.fi/software/programm/general/adlip.zip - AdLib Programmer&#039;s Guide, including source code for playing and converting files in this format&lt;br /&gt;
&lt;br /&gt;
== Credits ==&lt;br /&gt;
&lt;br /&gt;
This file format was originally reverse engineered by [[User:Malvineous|Malvineous]] as the [[Vinyl Goddess From Mars]] music format, until [[User:binarymaster|binarymaster]] discovered it was the same as an early AdLib music format, and supplied the documentation on which this article is now based.  If you find this information helpful in a project you&#039;re working on, please give credit where credit is due.  (A link back to this wiki would be nice too!)&lt;/div&gt;</summary>
		<author><name>Binarymaster</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=AdLib_Instrument_Bank_Format&amp;diff=6927</id>
		<title>AdLib Instrument Bank Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=AdLib_Instrument_Bank_Format&amp;diff=6927"/>
		<updated>2016-07-28T10:14:59Z</updated>

		<summary type="html">&lt;p&gt;Binarymaster: /* Tools */ add AdLib Bank Manager&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NeedMoreInfo}}&lt;br /&gt;
{{Instrument Infobox&lt;br /&gt;
 | Type = OPL&lt;br /&gt;
 | Count = 65535&lt;br /&gt;
 | Names = Yes, 8 chars&lt;br /&gt;
 | Games = &lt;br /&gt;
   {{Game|SkyRoads}}&lt;br /&gt;
   {{Game|Super Tetris}}&lt;br /&gt;
   {{Game|Wordtris}}&lt;br /&gt;
   {{Game|Witchaven}}&lt;br /&gt;
   {{Game|Witchaven II}}&lt;br /&gt;
   {{Game|Dark Legions}}&lt;br /&gt;
}}&lt;br /&gt;
The &#039;&#039;&#039;Ad Lib BNK Format&#039;&#039;&#039; is an instrument bank file created by the Ad Lib Corporation. It was designed for version 1.5 of &#039;&#039;AdLib Visual Composer&#039;&#039; in 1989, to work in conjunction with [[ROL Format]] music files.  It had been discovered that the ~80-byte [[AdLib Instrument Format|individual instrument files]] were actually using closer to 1,024 bytes of disk space each, due to the way the DOS FAT filesystem allocates at least one cluster per file.  By combining all the instruments into a single &amp;lt;tt&amp;gt;.bnk&amp;lt;/tt&amp;gt; file, disk space could be drastically reduced.&lt;br /&gt;
&lt;br /&gt;
BNK files contain all of the custom instrument data for a set of ROL songs which contained the notes to play. Games that feature music composed with AdLib Visual Composer usually have BNK files as well, although in the case of [[:Category:id Software|id Software]] titles, the two files were converted into [[IMF Format]] during game development. Also this format used by [[Human Machine Interfaces MIDI Format|Human Machine Interfaces]] sound engine for music instruments in HMP and HMI files.&lt;br /&gt;
&lt;br /&gt;
The format can be opened and edited by the Instrument Maker program that came with AdLib Visual Composer.&lt;br /&gt;
&lt;br /&gt;
== File format ==&lt;br /&gt;
&lt;br /&gt;
The file begins with a header:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT8]] || verMajor || Major version number&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT8]] || verMinor || Minor version number&lt;br /&gt;
|-&lt;br /&gt;
| [[char]] || signature || &amp;quot;ADLIB-&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT16LE]] || numUsed || Number of instrument records in use&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT16LE]] || numInstruments || Number of instrument records in the file&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT32LE]] || offsetName || Offset where instrument names begin&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT32LE]] || offsetData || Offset where instrument data begins&lt;br /&gt;
|-&lt;br /&gt;
| [[BYTE]][8] || pad || Padded with 0x00&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This is followed by a list of instrument names, repeated &amp;lt;tt&amp;gt;numInstruments&amp;lt;/tt&amp;gt; times:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT16LE]] || index || Index into data section&amp;lt;br&amp;gt;Calculation: &amp;lt;tt&amp;gt;offsetInstr = offsetData + (index * sizeof(PackedTimbre))&amp;lt;/tt&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT8]] || flags || 0 if this record is not used, else 1&lt;br /&gt;
|-&lt;br /&gt;
| [[char]][9] || name || Instrument name - must be NULL-terminated&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
It&#039;s important that it must be sorted by instrument name in alphabetical order to be correctly processed by Ad Lib tools.&lt;br /&gt;
&lt;br /&gt;
At this point, the current position should be the same as &amp;lt;tt&amp;gt;offsetData&amp;lt;/tt&amp;gt;.  The actual instrument data follows, again repeated once for each instrument.  The instrument data is in the following format, which is almost identical to the [[AdLib Instrument Format]] except with only one byte to store each field instead of two.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT8]] || iPercussive || 0: Melodic instrument&amp;lt;br&amp;gt;1: Percussive instrument&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT8]] || iVoiceNum || Voice number (percussive only)&lt;br /&gt;
|-&lt;br /&gt;
| OPLREGS || oplModulator || Register values for the Modulator operator (op 0)&lt;br /&gt;
|-&lt;br /&gt;
| OPLREGS || oplCarrier || Register values for the Carrier operator (op 1)&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT8]] || iModWaveSel || Modulator wave select (OPL base register 0xE0)&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT8]] || iCarWaveSel || Carrier wave select (OPL base register 0xE0)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;OPLREGS&#039;&#039; structure is defined as:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description !! OPL base register !! Value range&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT8]] || ksl         || Key scaling level                   || 0x40 (bits 6-7)        ||&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT8]] || multiple    || Frequency multiplier                || 0x20 (bits 0-3)        || iMultiple &amp;amp; 0x0F is sent to OPL register [verify this]&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT8]] || feedback    || Feedback [op 0 only, op 1 ignored]  || 0xC0 (bits 1-3)        ||&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT8]] || attack      || Attack rate                         || 0x60 (upper four bits) || [verify this]&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT8]] || sustain     || Sustain level                       || 0x80 (upper four bits) || [verify this]&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT8]] || eg          || Envelope gain (nonzero value is on) || 0x20 (bit 5)           || [verify this]&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT8]] || decay       || Decay rate                          || 0x60 (lower four bits) || [verify this]&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT8]] || releaseRate || Release rate                        || 0x80 (lower four bits) || [verify this]&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT8]] || totalLevel  || Total output level                  || 0x40 (bit 0-5)         || [verify this]&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT8]] || am          || Amplitude modulation (Tremolo)      || 0x20 (bit 7)           || [verify this]&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT8]] || vib         || Frequency Vibrato                   || 0x20 (bit 6)           || [verify this]&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT8]] || ksr         || Key scaling/envelope rate           || 0x20 (bit 4)           || [verify this]&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT8]] || con         || Connector [op 0 only, op 1 ignored] || 0xC0 (bit 0, inverted) || 0: OPL bit set to 1&amp;lt;br&amp;gt;other: OPL bit set to 0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This structure is almost identical to an individual instrument in [[AdLib Instrument Format]], but with [[UINT8]] fields instead of [[UINT16LE]].&lt;br /&gt;
&lt;br /&gt;
== Human Machine Interfaces version (&amp;quot;Version 0.0&amp;quot;)==&lt;br /&gt;
&lt;br /&gt;
{{TODO|Find out more about what is altered and how this version could be worked with.}}&lt;br /&gt;
&lt;br /&gt;
The version of this format associated with HMP/HMI files is altered and incompatible with most tools that work with BNK files. Known differences include:&lt;br /&gt;
* The major and minor version numbers in the header are both zero.&lt;br /&gt;
* The flags byte in the instrument names list may have values other than 0 or 1, and a null flags byte might not be indicative of an unused sample.&lt;br /&gt;
The header and names list otherwise appear to follow the format spec.  The instrument data itself has not yet been inspected for differences.&lt;br /&gt;
&lt;br /&gt;
Known examples of games that include files of this version include two possibly standardized file names: DRUMS.BNK and MELODIC.BNK.  Dark Legions also includes a BNKDRUM.BNK.  All of the known &amp;quot;version 0.0&amp;quot; files are 5,404 bytes in length, with 128 instrument records reported in the header, but have differing contents.&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
{{BeginFileFormatTools|Type=audio}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = AdLib &amp;lt;tt&amp;gt;bankmng.exe&amp;lt;/tt&amp;gt;&lt;br /&gt;
| Platform = DOS&lt;br /&gt;
| canPlay = No&lt;br /&gt;
| canCreate = Yes&lt;br /&gt;
| canModify = Yes&lt;br /&gt;
| canExport = Yes; [[AdLib Instrument Format|.ins]]&lt;br /&gt;
| canImport = Yes; [[AdLib Instrument Format|.ins]]&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = No&lt;br /&gt;
| notes = Part of &#039;&#039;AdLib Visual Composer&#039;&#039; and &#039;&#039;AdLib Programmer&#039;s Manual&#039;&#039;&lt;br /&gt;
}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = [[SBTimbre]]&lt;br /&gt;
| Platform = DOS&lt;br /&gt;
| canPlay = Yes&lt;br /&gt;
| canCreate = No&lt;br /&gt;
| canModify = No&lt;br /&gt;
| canExport = Yes; [[IBK Format|.ibk]]&lt;br /&gt;
| canImport = No&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = No&lt;br /&gt;
| notes =&lt;br /&gt;
}}&lt;br /&gt;
{{EndFileFormatTools}}&lt;/div&gt;</summary>
		<author><name>Binarymaster</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=AdLib_Instrument_Bank_Format&amp;diff=6926</id>
		<title>AdLib Instrument Bank Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=AdLib_Instrument_Bank_Format&amp;diff=6926"/>
		<updated>2016-07-28T10:11:37Z</updated>

		<summary type="html">&lt;p&gt;Binarymaster: /* File format */ instrument order&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NeedMoreInfo}}&lt;br /&gt;
{{Instrument Infobox&lt;br /&gt;
 | Type = OPL&lt;br /&gt;
 | Count = 65535&lt;br /&gt;
 | Names = Yes, 8 chars&lt;br /&gt;
 | Games = &lt;br /&gt;
   {{Game|SkyRoads}}&lt;br /&gt;
   {{Game|Super Tetris}}&lt;br /&gt;
   {{Game|Wordtris}}&lt;br /&gt;
   {{Game|Witchaven}}&lt;br /&gt;
   {{Game|Witchaven II}}&lt;br /&gt;
   {{Game|Dark Legions}}&lt;br /&gt;
}}&lt;br /&gt;
The &#039;&#039;&#039;Ad Lib BNK Format&#039;&#039;&#039; is an instrument bank file created by the Ad Lib Corporation. It was designed for version 1.5 of &#039;&#039;AdLib Visual Composer&#039;&#039; in 1989, to work in conjunction with [[ROL Format]] music files.  It had been discovered that the ~80-byte [[AdLib Instrument Format|individual instrument files]] were actually using closer to 1,024 bytes of disk space each, due to the way the DOS FAT filesystem allocates at least one cluster per file.  By combining all the instruments into a single &amp;lt;tt&amp;gt;.bnk&amp;lt;/tt&amp;gt; file, disk space could be drastically reduced.&lt;br /&gt;
&lt;br /&gt;
BNK files contain all of the custom instrument data for a set of ROL songs which contained the notes to play. Games that feature music composed with AdLib Visual Composer usually have BNK files as well, although in the case of [[:Category:id Software|id Software]] titles, the two files were converted into [[IMF Format]] during game development. Also this format used by [[Human Machine Interfaces MIDI Format|Human Machine Interfaces]] sound engine for music instruments in HMP and HMI files.&lt;br /&gt;
&lt;br /&gt;
The format can be opened and edited by the Instrument Maker program that came with AdLib Visual Composer.&lt;br /&gt;
&lt;br /&gt;
== File format ==&lt;br /&gt;
&lt;br /&gt;
The file begins with a header:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT8]] || verMajor || Major version number&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT8]] || verMinor || Minor version number&lt;br /&gt;
|-&lt;br /&gt;
| [[char]] || signature || &amp;quot;ADLIB-&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT16LE]] || numUsed || Number of instrument records in use&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT16LE]] || numInstruments || Number of instrument records in the file&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT32LE]] || offsetName || Offset where instrument names begin&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT32LE]] || offsetData || Offset where instrument data begins&lt;br /&gt;
|-&lt;br /&gt;
| [[BYTE]][8] || pad || Padded with 0x00&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This is followed by a list of instrument names, repeated &amp;lt;tt&amp;gt;numInstruments&amp;lt;/tt&amp;gt; times:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT16LE]] || index || Index into data section&amp;lt;br&amp;gt;Calculation: &amp;lt;tt&amp;gt;offsetInstr = offsetData + (index * sizeof(PackedTimbre))&amp;lt;/tt&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT8]] || flags || 0 if this record is not used, else 1&lt;br /&gt;
|-&lt;br /&gt;
| [[char]][9] || name || Instrument name - must be NULL-terminated&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
It&#039;s important that it must be sorted by instrument name in alphabetical order to be correctly processed by Ad Lib tools.&lt;br /&gt;
&lt;br /&gt;
At this point, the current position should be the same as &amp;lt;tt&amp;gt;offsetData&amp;lt;/tt&amp;gt;.  The actual instrument data follows, again repeated once for each instrument.  The instrument data is in the following format, which is almost identical to the [[AdLib Instrument Format]] except with only one byte to store each field instead of two.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT8]] || iPercussive || 0: Melodic instrument&amp;lt;br&amp;gt;1: Percussive instrument&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT8]] || iVoiceNum || Voice number (percussive only)&lt;br /&gt;
|-&lt;br /&gt;
| OPLREGS || oplModulator || Register values for the Modulator operator (op 0)&lt;br /&gt;
|-&lt;br /&gt;
| OPLREGS || oplCarrier || Register values for the Carrier operator (op 1)&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT8]] || iModWaveSel || Modulator wave select (OPL base register 0xE0)&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT8]] || iCarWaveSel || Carrier wave select (OPL base register 0xE0)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;OPLREGS&#039;&#039; structure is defined as:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description !! OPL base register !! Value range&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT8]] || ksl         || Key scaling level                   || 0x40 (bits 6-7)        ||&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT8]] || multiple    || Frequency multiplier                || 0x20 (bits 0-3)        || iMultiple &amp;amp; 0x0F is sent to OPL register [verify this]&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT8]] || feedback    || Feedback [op 0 only, op 1 ignored]  || 0xC0 (bits 1-3)        ||&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT8]] || attack      || Attack rate                         || 0x60 (upper four bits) || [verify this]&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT8]] || sustain     || Sustain level                       || 0x80 (upper four bits) || [verify this]&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT8]] || eg          || Envelope gain (nonzero value is on) || 0x20 (bit 5)           || [verify this]&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT8]] || decay       || Decay rate                          || 0x60 (lower four bits) || [verify this]&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT8]] || releaseRate || Release rate                        || 0x80 (lower four bits) || [verify this]&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT8]] || totalLevel  || Total output level                  || 0x40 (bit 0-5)         || [verify this]&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT8]] || am          || Amplitude modulation (Tremolo)      || 0x20 (bit 7)           || [verify this]&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT8]] || vib         || Frequency Vibrato                   || 0x20 (bit 6)           || [verify this]&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT8]] || ksr         || Key scaling/envelope rate           || 0x20 (bit 4)           || [verify this]&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT8]] || con         || Connector [op 0 only, op 1 ignored] || 0xC0 (bit 0, inverted) || 0: OPL bit set to 1&amp;lt;br&amp;gt;other: OPL bit set to 0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This structure is almost identical to an individual instrument in [[AdLib Instrument Format]], but with [[UINT8]] fields instead of [[UINT16LE]].&lt;br /&gt;
&lt;br /&gt;
== Human Machine Interfaces version (&amp;quot;Version 0.0&amp;quot;)==&lt;br /&gt;
&lt;br /&gt;
{{TODO|Find out more about what is altered and how this version could be worked with.}}&lt;br /&gt;
&lt;br /&gt;
The version of this format associated with HMP/HMI files is altered and incompatible with most tools that work with BNK files. Known differences include:&lt;br /&gt;
* The major and minor version numbers in the header are both zero.&lt;br /&gt;
* The flags byte in the instrument names list may have values other than 0 or 1, and a null flags byte might not be indicative of an unused sample.&lt;br /&gt;
The header and names list otherwise appear to follow the format spec.  The instrument data itself has not yet been inspected for differences.&lt;br /&gt;
&lt;br /&gt;
Known examples of games that include files of this version include two possibly standardized file names: DRUMS.BNK and MELODIC.BNK.  Dark Legions also includes a BNKDRUM.BNK.  All of the known &amp;quot;version 0.0&amp;quot; files are 5,404 bytes in length, with 128 instrument records reported in the header, but have differing contents.&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
{{BeginFileFormatTools|Type=audio}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = [[SBTimbre]]&lt;br /&gt;
| Platform = DOS&lt;br /&gt;
| canPlay = Yes&lt;br /&gt;
| canCreate = No&lt;br /&gt;
| canModify = No&lt;br /&gt;
| canExport = Yes; [[IBK Format|.ibk]]&lt;br /&gt;
| canImport = No&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = No&lt;br /&gt;
| notes =&lt;br /&gt;
}}&lt;br /&gt;
{{EndFileFormatTools}}&lt;/div&gt;</summary>
		<author><name>Binarymaster</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=XMI_Format&amp;diff=6874</id>
		<title>XMI Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=XMI_Format&amp;diff=6874"/>
		<updated>2016-07-09T19:41:28Z</updated>

		<summary type="html">&lt;p&gt;Binarymaster: /* TIMB */ timbre array correction&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Music Infobox&lt;br /&gt;
 | Type = MIDI&lt;br /&gt;
 | Instruments = MIDI&lt;br /&gt;
 | NumChannels = 16&lt;br /&gt;
 | NumTracks = 1&lt;br /&gt;
 | NumPatterns = 1&lt;br /&gt;
 | NumOrders = 1&lt;br /&gt;
 | Games = &lt;br /&gt;
   {{Game|The Lost Vikings}}&lt;br /&gt;
   {{Game|Master of Magic}}&lt;br /&gt;
   {{Game|SimCity 2000}}&lt;br /&gt;
}}&lt;br /&gt;
The &#039;&#039;&#039;e&amp;lt;u&amp;gt;X&amp;lt;/u&amp;gt;tended &amp;lt;u&amp;gt;MI&amp;lt;/u&amp;gt;DI file format&#039;&#039;&#039; is used by the Miles Sound System (MSS) for storing game music.&lt;br /&gt;
&lt;br /&gt;
== File format ==&lt;br /&gt;
&lt;br /&gt;
The file format is made up of two standard [[Interchange File Format (IFF)]] files one after the other.  As there is more than one root-level chunk in the same file, technically the file does not meet the IFF standard which only allows one root-level chunk per file.  The chunks are arranged as follows:&lt;br /&gt;
&lt;br /&gt;
* FORM (type XDIR)&lt;br /&gt;
** INFO&lt;br /&gt;
&lt;br /&gt;
Immediately following this is another IFF file, which contains a &#039;&#039;&#039;FORM&#039;&#039;&#039; subchunk for each sequence (song) stored in the XMI file:&lt;br /&gt;
&lt;br /&gt;
* CAT (type XMID)&lt;br /&gt;
** FORM (type XMID) - first song&lt;br /&gt;
*** TIMB&lt;br /&gt;
*** EVNT&lt;br /&gt;
** FORM (type XMID) - second song (optional)&lt;br /&gt;
*** TIMB&lt;br /&gt;
*** EVNT&lt;br /&gt;
** etc. for as many songs as needed&lt;br /&gt;
&lt;br /&gt;
It is unknown why the files are arranged as multiple separate IFF files concatenated, rather than one IFF with the same chunk arrangement, but perhaps it is due to a misunderstanding on the part of the format designers of the way the IFF format works.&lt;br /&gt;
&lt;br /&gt;
=== IFF root chunk 1 (FORM:XDIR) ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;FORM&#039;&#039;&#039; chunk is of type &#039;&#039;&#039;XDIR&#039;&#039;&#039;.  It contains one subchunk of type &#039;&#039;&#039;INFO&#039;&#039;&#039;.  The contents of the &#039;&#039;&#039;INFO&#039;&#039;&#039; chunk are as follows:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Data type!!Name!!Description&lt;br /&gt;
|-&lt;br /&gt;
| [[INT16LE]] || seqCount || Number of sequences (songs) in the file&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== IFF root chunk 2 (CAT&amp;amp;nbsp;:XMID) ===&lt;br /&gt;
&lt;br /&gt;
This chunk is a simple list, with one &#039;&#039;&#039;FORM:XMID&#039;&#039;&#039; subchunk for each song in the file, which contains all the information necessary to play that single song.  Each &#039;&#039;&#039;FORM&#039;&#039;&#039; subchunk is further broken up into the following chunks.&lt;br /&gt;
&lt;br /&gt;
==== TIMB ====&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;TIMB&#039;&#039;&#039; chunk stores details about the MIDI patches used in the song.  It is used so that normal MIDI patch-change events can set instrument banks at the same time.  It has the following structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Data type!!Name!!Description&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT16LE]] || count || Entry count of the following array&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Then it is followed by structure, repeated &amp;lt;tt&amp;gt;count&amp;lt;/tt&amp;gt; times:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Data type!!Name!!Description&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT8]] || patch || MIDI patch for this instrument number&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT8]] || bank || MIDI bank for this instrument number&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each entry in the array is repeated once for each instrument in the current track.&lt;br /&gt;
&lt;br /&gt;
The official XMI creation utility (&amp;lt;tt&amp;gt;midiform&amp;lt;/tt&amp;gt;) uses MIDI controller &amp;lt;tt&amp;gt;AIL_TIMB_BNK&amp;lt;/tt&amp;gt; (114) to set the bank on a given channel, and a standard MIDI program change event to store the patch.  These two values (bank and patch) are used to populate an entry in the &#039;&#039;&#039;TIMB&#039;&#039;&#039; chunk on the next note-on event on the channel.&lt;br /&gt;
&lt;br /&gt;
==== RBRN ====&lt;br /&gt;
&lt;br /&gt;
The optional &#039;&#039;&#039;RBRN&#039;&#039;&#039; chunk is used to store seek destinations where playback should jump to when encountering a branch event.  It is an array of the following structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Data type!!Name!!Description&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT16LE]] || id || Branch ID, used to select this branch destination&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT32LE]] || dest || Seek destination for this branch, expressed as a number of bytes since the start of the event data, i.e. 0 means the start of the song.  It is important that this points to the start of an event or delay value, otherwise the results will be unpredictable.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
It is unknown whether the chunk order is important, however the official XMI creation utility (&amp;lt;tt&amp;gt;midiform&amp;lt;/tt&amp;gt;) places this chunk after &#039;&#039;&#039;TIMB&#039;&#039;&#039; and before &#039;&#039;&#039;EVNT&#039;&#039;&#039;.  If there are no branch points then the chunk is omitted entirely.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;midiform&amp;lt;/tt&amp;gt; uses MIDI controller number &amp;lt;tt&amp;gt;AIL_BRANCH_PT&amp;lt;/tt&amp;gt; (120) to place branch destination points in a song, with the controller value setting the &amp;lt;tt&amp;gt;id&amp;lt;/tt&amp;gt; for that branch point.  These controller events are not removed from the MIDI data, so the first event at each branch point is likely to be MIDI controller 120 on some channel.  This is just an observation however, and these MIDI controller events are by no means required.&lt;br /&gt;
&lt;br /&gt;
{{TODO|It is unknown how branch points are triggered (whether it is by code or by other MIDI events.)}}&lt;br /&gt;
&lt;br /&gt;
==== EVNT ====&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;EVNT&#039;&#039;&#039; chunk stores the MIDI events to play.  There is only one track per song.&lt;br /&gt;
&lt;br /&gt;
The event data is almost in standard MIDI format (as per the data in the [[MID Format]] MTrk chunk), with two important differences. &lt;br /&gt;
&lt;br /&gt;
The first difference is &amp;quot;Note On&amp;quot; event contains 3 parameters - the note number, velocity level (same as standard MIDI), and also duration in ticks. Duration is stored as variable-length value in concatenated bits format. Since note events store information about its duration, there are no &amp;quot;Note Off&amp;quot; events. {{TODO|Provide example}}&lt;br /&gt;
&lt;br /&gt;
The second difference is both store delays as variable-length values, but while standard MIDI stores delays as a series of 7-bit values that are concatenated together to produce the final number, XMI instead stores the values as a series of 7-bit values that are summed to produce the final value.&lt;br /&gt;
&lt;br /&gt;
To further complicate matters, if there is no delay at all, then the delay byte is completely omitted.  This means when reading in a byte, the high-bit will need to be inspected to work out whether the byte is the first part of a delay value (high-bit unset) or a MIDI event (high-bit set.)  If the high bit is not set, the values should be read and summed until a byte (possibly the first one) is not 127.&lt;br /&gt;
&lt;br /&gt;
For example: (newlines added for clarity only)&lt;br /&gt;
&lt;br /&gt;
    C1 71    // C1 has high-bit set so this is a MIDI event&lt;br /&gt;
    C2 71    // C2 again has high bit set to this is another MIDI event with a delay of zero in between&lt;br /&gt;
    10       // 10 does not have the high bit set so this is a delay of 10&lt;br /&gt;
    C3 72    // Another MIDI event&lt;br /&gt;
    7F 22    // 7F does not have the high bit set so this is a delay, but 7F means there is another delay byte following&lt;br /&gt;
             //   Actual delay is 7F + 22 = A1&lt;br /&gt;
&lt;br /&gt;
There is no limit to the number of 0x7F bytes that may be supplied in a row for long delays, however a reasonable limit should be placed on this to avoid infinite loops in the case of corrupted data.&lt;br /&gt;
&lt;br /&gt;
Note that because of this way of using the high-bit to signal the meaning of the byte (delay vs event), the standard MIDI &amp;quot;running status&amp;quot; is not available as the high-bit is now used for this alternate purpose.&lt;br /&gt;
&lt;br /&gt;
== MIDI controller assignments ==&lt;br /&gt;
&lt;br /&gt;
The following MIDI controllers are given specific meaning when used in XMI files:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Controller !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| 32 || AIL sysex start address MSB (queue 0) || {{TODO|?}}&lt;br /&gt;
|-&lt;br /&gt;
| 33 || AIL sysex start address KSB (queue 0) || {{TODO|?}}&lt;br /&gt;
|-&lt;br /&gt;
| 34 || AIL sysex start address LSB (queue 0) || {{TODO|?}}&lt;br /&gt;
|-&lt;br /&gt;
| 35 || AIL sysex data byte (queue 0) || {{TODO|?}}&lt;br /&gt;
|-&lt;br /&gt;
| 36 || AIL final sysex data byte (queue 0) || {{TODO|?}}&lt;br /&gt;
|-&lt;br /&gt;
| 37 || AIL sysex start address MSB (queue 1) || {{TODO|?}}&lt;br /&gt;
|-&lt;br /&gt;
| 38 || AIL sysex start address KSB (queue 1) || {{TODO|?}}&lt;br /&gt;
|-&lt;br /&gt;
| 39 || AIL sysex start address LSB (queue 1) || {{TODO|?}}&lt;br /&gt;
|-&lt;br /&gt;
| 40 || AIL sysex data byte (queue 1) || {{TODO|?}}&lt;br /&gt;
|-&lt;br /&gt;
| 41 || AIL final sysex data byte (queue 1) || {{TODO|?}}&lt;br /&gt;
|-&lt;br /&gt;
| 42 || AIL sysex start address MSB (queue 2) || {{TODO|?}}&lt;br /&gt;
|-&lt;br /&gt;
| 43 || AIL sysex start address KSB (queue 2) || {{TODO|?}}&lt;br /&gt;
|-&lt;br /&gt;
| 44 || AIL sysex start address LSB (queue 2) || {{TODO|?}}&lt;br /&gt;
|-&lt;br /&gt;
| 45 || AIL sysex data byte (queue 2) || {{TODO|?}}&lt;br /&gt;
|-&lt;br /&gt;
| 46 || AIL final sysex data byte (queue 2) || {{TODO|?}}&lt;br /&gt;
|-&lt;br /&gt;
|colspan=3|&lt;br /&gt;
|-&lt;br /&gt;
| 58 || AIL rhythm setup timbre || {{TODO|?}}&lt;br /&gt;
|-&lt;br /&gt;
| 59 || AIL MT-32 patch reverb switch || {{TODO|?}}&lt;br /&gt;
|-&lt;br /&gt;
| 60 || AIL MT-32 patch bender range || {{TODO|?}}&lt;br /&gt;
|-&lt;br /&gt;
| 61 || AIL MT-32 reverb mode || {{TODO|?}}&lt;br /&gt;
|-&lt;br /&gt;
| 62 || AIL MT-32 reverb time || {{TODO|?}}&lt;br /&gt;
|-&lt;br /&gt;
| 63 || AIL MT-32 reverb level || {{TODO|?}}&lt;br /&gt;
|-&lt;br /&gt;
|colspan=3|&lt;br /&gt;
|-&lt;br /&gt;
| 110 || AIL channel lock/release || {{TODO|?}}&lt;br /&gt;
|-&lt;br /&gt;
| 111 || AIL channel lock protection || {{TODO|?}}&lt;br /&gt;
|-&lt;br /&gt;
| 112 || AIL voice protection || {{TODO|?}}&lt;br /&gt;
|-&lt;br /&gt;
| 113 || AIL timbre protection || {{TODO|?}}&lt;br /&gt;
|-&lt;br /&gt;
| 114 || AIL patch bank select || Select patch bank (see [[#TIMB]] above)&lt;br /&gt;
|-&lt;br /&gt;
| 115 || AIL indirect controller prefix || {{TODO|?}}&lt;br /&gt;
|-&lt;br /&gt;
| 116 || AIL loop: FOR loop = 1 to n || {{TODO|Loop start point?}}&lt;br /&gt;
|-&lt;br /&gt;
| 117 || AIL loop: NEXT/BREAK || {{TODO|Return to last loop start point?}}&lt;br /&gt;
|-&lt;br /&gt;
| 118 || AIL clear beat/measure count || {{TODO|?}}&lt;br /&gt;
|-&lt;br /&gt;
| 119 || AIL callback trigger || {{TODO|?}}&lt;br /&gt;
|-&lt;br /&gt;
| 120 || AIL sequence index || Branch point destination (see [[#RBRN]] above)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
&lt;br /&gt;
* http://www.ke5fx.com/ - homepage of John Miles, original author of the Miles Sound System and designer of the XMI file format&lt;br /&gt;
&lt;br /&gt;
== Credits ==&lt;br /&gt;
&lt;br /&gt;
This file format was documented by [[User:Malvineous|Malvineous]] from reading the Miles Sound System source code available from John Miles&#039; homepage.  If you find this information helpful in a project you&#039;re working on, please give credit where credit is due.  (A link back to this wiki would be nice too!)&lt;/div&gt;</summary>
		<author><name>Binarymaster</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=PAK_Format_(Westwood)&amp;diff=6858</id>
		<title>PAK Format (Westwood)</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=PAK_Format_(Westwood)&amp;diff=6858"/>
		<updated>2016-06-29T20:11:13Z</updated>

		<summary type="html">&lt;p&gt;Binarymaster: Correct name&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Archive Infobox&lt;br /&gt;
 | MaxFiles = 65,536&lt;br /&gt;
 | FAT = Beginning&lt;br /&gt;
 | Names = Yes, 8.3&lt;br /&gt;
 | Metadata = None&lt;br /&gt;
 | Subdirectories = N&lt;br /&gt;
 | Compressed = N&lt;br /&gt;
 | Encrypted = N&lt;br /&gt;
 | Hidden = Y&lt;br /&gt;
 | Games = &lt;br /&gt;
   {{Game|Dune II}}&lt;br /&gt;
   {{Game|Eye of the Beholder}}&lt;br /&gt;
   {{Game|Lands of Lore: The Throne of Chaos}}&lt;br /&gt;
   {{Game|The Legend of Kyrandia, Book One}}&lt;br /&gt;
   {{Game|The Legend of Kyrandia, Book Two: The Hand of Fate}}&lt;br /&gt;
   {{Game|The Legend of Kyrandia, Book Three: Malcolm&#039;s Revenge}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Westwood&#039;s &#039;&#039;&#039;PAK Format&#039;&#039;&#039; is a simple group file used in their games from 1991-1994. It is efficient in the sense that it only stores file names and starting positions in the header, so file lengths must be inferred. It does not support compression. There are three different versions of the header layouts which are nearly identical and backward-compatible with the previous version. Each update makes it slightly easier to read the header.&lt;br /&gt;
&lt;br /&gt;
* Version 1: Eye of the Beholder 1&lt;br /&gt;
* Version 2: Dune II, Legend of Kyrandia 1&lt;br /&gt;
* Version 3: Legend of Kyrandia 2, Lands of Lore 1, Legend of Kyrandia 3&lt;br /&gt;
&lt;br /&gt;
== File format ==&lt;br /&gt;
&lt;br /&gt;
=== Signature ===&lt;br /&gt;
&lt;br /&gt;
PAK files have no signature. They are usually given the extension .PAK, but not always.&lt;br /&gt;
&lt;br /&gt;
=== File Entry ===&lt;br /&gt;
&lt;br /&gt;
The header contains a list of files consisting of a 32-bit file offset and a null-terminating file name. Depending on the version, the header ends either when the file pointer equals the offset of the first file (version 1), or when you encounter a file offset of 0 (versions 2 and 3).&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Data type!!Description&lt;br /&gt;
|-&lt;br /&gt;
|[[char]] cFilename||File name (8.3 style), null terminated, variable width.&lt;br /&gt;
|-&lt;br /&gt;
|[[UINT32LE]] iOffset||File&#039;s starting offset in the PAK archive.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each file&#039;s size must be calculated by subtracting it from the next file&#039;s offset. Version 1 PAK files have a final file offset equal to the size of the file. Version 2 PAK files replace this offset with a end of header flag (0x0000), so the end of the last file must be inferred from the size of the file itself. Version 3 PAK files have an additional file offset with an empty file name (just a null) to determine the size of the last file and then feature a end of header flag (0x0000). Because of this, version 2 PAK files cannot contain hidden files after the last file.&lt;br /&gt;
&lt;br /&gt;
== Source Code ==&lt;br /&gt;
&lt;br /&gt;
This FreeBASIC code will extract all of the files from a version 1, 2, or 3 PAK file into the folder you specify.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;freebasic&amp;quot;&amp;gt;&lt;br /&gt;
&#039; This program will extract the files stored in a Westwood PAK file used in various games in the first half of the 1990s.&lt;br /&gt;
&#039; There are three versions of the PAK file. Version 1 was used only in Eye of the Beholder 1. To determine the &lt;br /&gt;
&#039; end of the header, just wait until the file pointer equals the position of the first file. The last file offset is the &lt;br /&gt;
&#039; length of the file. Version 2 was first used in Dune II. It&#039;s header ends when the file offset is zero (0x0000). &lt;br /&gt;
&#039; Version 3 was first used in The Legend of Kyrandia 2. It has an additional empty file name with a file offset so you &lt;br /&gt;
&#039; can easily determine the size of the last file rather than relying on the length of the file, like in version 2.&lt;br /&gt;
&lt;br /&gt;
Dim As String PAKFile = &amp;quot;C:\\Games\\Kyrandia\\dat.pak&amp;quot;&lt;br /&gt;
Dim As String ExportFolder = &amp;quot;C:\\Games\\Kyrandia\\dat&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Open PAKFile For Binary As #1&lt;br /&gt;
&lt;br /&gt;
Dim As UInteger FileStart(1000)&lt;br /&gt;
Dim As String   FileName(1000)&lt;br /&gt;
Dim As UInteger Position&lt;br /&gt;
Dim As String   Char&lt;br /&gt;
Dim As UInteger FileCount = 0&lt;br /&gt;
Dim As UInteger FileNo&lt;br /&gt;
Dim As ULong    FileSize&lt;br /&gt;
Dim As UInteger ByteNo&lt;br /&gt;
&lt;br /&gt;
&#039; Loop through the header.&lt;br /&gt;
Do&lt;br /&gt;
    &#039; 4-byte file start position.&lt;br /&gt;
    Get #1, , FileStart(FileCount)&lt;br /&gt;
&lt;br /&gt;
    Position = Seek(1)&lt;br /&gt;
    &lt;br /&gt;
    &#039; Trap for version 2 and 3 PAK files.&lt;br /&gt;
    If FileStart(FileCount) = 0 Then&lt;br /&gt;
        Exit Do&lt;br /&gt;
    Else&lt;br /&gt;
        &#039; Trap for version 1 PAK files.&lt;br /&gt;
        If (Position - 1) = FileStart(0) Then&lt;br /&gt;
            FileCount = FileCount + 1&lt;br /&gt;
            Exit Do&lt;br /&gt;
        Else&lt;br /&gt;
            &#039; Read the file name until we hit a null.&lt;br /&gt;
            FileName(FileCount) = &amp;quot;&amp;quot;&lt;br /&gt;
            Do&lt;br /&gt;
                Char = &amp;quot; &amp;quot;&lt;br /&gt;
                Get #1, , Char&lt;br /&gt;
                If Asc(Char) &amp;lt;&amp;gt; 0 Then&lt;br /&gt;
                    FileName(FileCount) = FileName(FileCount) + Char&lt;br /&gt;
                End If&lt;br /&gt;
            Loop While Asc(Char) &amp;lt;&amp;gt; 0&lt;br /&gt;
&lt;br /&gt;
            FileCount = FileCount + 1&lt;br /&gt;
        End If&lt;br /&gt;
    End If&lt;br /&gt;
Loop&lt;br /&gt;
&lt;br /&gt;
FileCount = FileCount - 1&lt;br /&gt;
&lt;br /&gt;
MKDir(ExportFolder)&lt;br /&gt;
&lt;br /&gt;
For FileNo = 0 To FileCount&lt;br /&gt;
    &#039; Read the previous file from the PAK.&lt;br /&gt;
    &lt;br /&gt;
    &#039; Get the file size.&lt;br /&gt;
    If FileNo = FileCount Then&lt;br /&gt;
        &#039; Trap for version 1 and 2 PAK files.&lt;br /&gt;
        FileSize = LoF(1) - FileStart(FileNo)&lt;br /&gt;
    Else&lt;br /&gt;
        FileSize = FileStart(FileNo + 1) - FileStart(FileNo)&lt;br /&gt;
    End If&lt;br /&gt;
&lt;br /&gt;
    Print Using &amp;quot;###) File: \\            \\ Offset: ########,,   Size: ########,&amp;quot;; FileNo; FileName(FileNo); FileStart(FileNo); FileSize&lt;br /&gt;
&lt;br /&gt;
    &#039; Trap for version 3 PAK files.&lt;br /&gt;
    If FileSize &amp;gt; 0 Then&lt;br /&gt;
        &#039; Create a buffer to store the next file.&lt;br /&gt;
        ReDim As Byte FileData(0 To FileSize)&lt;br /&gt;
        &lt;br /&gt;
        &#039; Load the file from the PAK into the buffer.&lt;br /&gt;
        Seek 1, FileStart(FileNo) + 1&lt;br /&gt;
        For ByteNo = 0 To (FileSize - 1)&lt;br /&gt;
            Get #1, , FileData(ByteNo)&lt;br /&gt;
        Next ByteNo&lt;br /&gt;
    &lt;br /&gt;
        &#039; Save the buffer to the export folder.&lt;br /&gt;
        Open ExportFolder + &amp;quot;\\&amp;quot; + FileName(FileNo) For Binary As #2&lt;br /&gt;
        For ByteNo = 0 To (FileSize - 1)&lt;br /&gt;
            Put #2, , FileData(ByteNo)&lt;br /&gt;
        Next ByteNo&lt;br /&gt;
        Close #2&lt;br /&gt;
    End If&lt;br /&gt;
Next FileNo&lt;br /&gt;
&lt;br /&gt;
Close #1&lt;br /&gt;
&lt;br /&gt;
Sleep&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Credits ==&lt;br /&gt;
&lt;br /&gt;
This archive format was reverse engineered by [[User:TheAlmightyGuru|TheAlmightyGuru]]. If you find this information helpful in a project you&#039;re working on, please give credit where credit is due. (A link back to this wiki would be nice too!)&lt;/div&gt;</summary>
		<author><name>Binarymaster</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=ADL_Format&amp;diff=6857</id>
		<title>ADL Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=ADL_Format&amp;diff=6857"/>
		<updated>2016-06-29T20:08:37Z</updated>

		<summary type="html">&lt;p&gt;Binarymaster: Add Kyrandia 2&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Stub}}&lt;br /&gt;
	&lt;br /&gt;
ADL files are used in the Westwood Studios PC-DOS games to play sound through an adlib compatible sound card.&lt;br /&gt;
&lt;br /&gt;
Each ADL file contains these blocks:&lt;br /&gt;
# Song indexes for the following pointer array&lt;br /&gt;
# Pointer array for sound/music tracks&lt;br /&gt;
# Pointer array for adlib instruments&lt;br /&gt;
# Tracks data&lt;br /&gt;
# Instruments data&lt;br /&gt;
&lt;br /&gt;
Each pointer in array is relative to the size of primary indexes block.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; |&lt;br /&gt;
! Game&lt;br /&gt;
! Primary Indexes&lt;br /&gt;
! Track Pointers&lt;br /&gt;
! Instrument Pointers&lt;br /&gt;
! First Track Offset&lt;br /&gt;
! First Track Absolute Offset&lt;br /&gt;
|-&lt;br /&gt;
! [[Eye of the Beholder|EOB]]&lt;br /&gt;
| 120 (8-bit)&lt;br /&gt;
| 150 (16-bit)&lt;br /&gt;
| 150 (16-bit)&lt;br /&gt;
| 0x258&lt;br /&gt;
| 0x2D0&lt;br /&gt;
|-&lt;br /&gt;
! [[Eye of the Beholder 2|EOB 2]]&lt;br /&gt;
| 120 (8-bit)&lt;br /&gt;
| 250 (16-bit)&lt;br /&gt;
| 250 (16-bit)&lt;br /&gt;
| 0x3E8&lt;br /&gt;
| 0x460&lt;br /&gt;
|-&lt;br /&gt;
! [[Kyrandia 1]]&lt;br /&gt;
| 120 (8-bit)&lt;br /&gt;
| 250 (16-bit)&lt;br /&gt;
| 250 (16-bit)&lt;br /&gt;
| 0x3E8&lt;br /&gt;
| 0x460&lt;br /&gt;
|-&lt;br /&gt;
! [[Dune II]]&lt;br /&gt;
| 120 (8-bit)&lt;br /&gt;
| 250 (16-bit)&lt;br /&gt;
| 250 (16-bit)&lt;br /&gt;
| 0x3E8&lt;br /&gt;
| 0x460&lt;br /&gt;
|-&lt;br /&gt;
! [[Lands of Lore]]&lt;br /&gt;
| 250 (16-bit)&lt;br /&gt;
| 500 (16-bit)&lt;br /&gt;
| 500 (16-bit)&lt;br /&gt;
| 0x7D0&lt;br /&gt;
| 0x9C4&lt;br /&gt;
|-&lt;br /&gt;
! [[Kyrandia 2]]&lt;br /&gt;
| 250 (16-bit)&lt;br /&gt;
| 500 (16-bit)&lt;br /&gt;
| 500 (16-bit)&lt;br /&gt;
| 0x7D0&lt;br /&gt;
| 0x9C4&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.vgmpf.com/Wiki/index.php?title=ADL ADL page on VGMPF]&lt;/div&gt;</summary>
		<author><name>Binarymaster</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=ADL_Format&amp;diff=6855</id>
		<title>ADL Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=ADL_Format&amp;diff=6855"/>
		<updated>2016-06-26T20:13:10Z</updated>

		<summary type="html">&lt;p&gt;Binarymaster: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Stub}}&lt;br /&gt;
	&lt;br /&gt;
ADL files are used in the Westwood Studios PC-DOS games to play sound through an adlib compatible sound card.&lt;br /&gt;
&lt;br /&gt;
Each ADL file contains these blocks:&lt;br /&gt;
# Song indexes for the following pointer array&lt;br /&gt;
# Pointer array for sound/music tracks&lt;br /&gt;
# Pointer array for adlib instruments&lt;br /&gt;
# Tracks data&lt;br /&gt;
# Instruments data&lt;br /&gt;
&lt;br /&gt;
Each pointer in array is relative to the size of primary indexes block.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; |&lt;br /&gt;
! Game&lt;br /&gt;
! Primary Indexes&lt;br /&gt;
! Track Pointers&lt;br /&gt;
! Instrument Pointers&lt;br /&gt;
! First Track Offset&lt;br /&gt;
! First Track Absolute Offset&lt;br /&gt;
|-&lt;br /&gt;
! EOB&lt;br /&gt;
| 120 (8-bit)&lt;br /&gt;
| 150 (16-bit)&lt;br /&gt;
| 150 (16-bit)&lt;br /&gt;
| 0x258&lt;br /&gt;
| 0x2D0&lt;br /&gt;
|-&lt;br /&gt;
! EOB 2&lt;br /&gt;
| 120 (8-bit)&lt;br /&gt;
| 250 (16-bit)&lt;br /&gt;
| 250 (16-bit)&lt;br /&gt;
| 0x3E8&lt;br /&gt;
| 0x460&lt;br /&gt;
|-&lt;br /&gt;
! Kyrandia 1&lt;br /&gt;
| 120 (8-bit)&lt;br /&gt;
| 250 (16-bit)&lt;br /&gt;
| 250 (16-bit)&lt;br /&gt;
| 0x3E8&lt;br /&gt;
| 0x460&lt;br /&gt;
|-&lt;br /&gt;
! Dune II&lt;br /&gt;
| 120 (8-bit)&lt;br /&gt;
| 250 (16-bit)&lt;br /&gt;
| 250 (16-bit)&lt;br /&gt;
| 0x3E8&lt;br /&gt;
| 0x460&lt;br /&gt;
|-&lt;br /&gt;
! Lands of Lore&lt;br /&gt;
| 250 (16-bit)&lt;br /&gt;
| 500 (16-bit)&lt;br /&gt;
| 500 (16-bit)&lt;br /&gt;
| 0x7D0&lt;br /&gt;
| 0x9C4&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
* [http://www.vgmpf.com/Wiki/index.php?title=ADL vgmpf.com/Wiki/index.php?title=ADL] - Some information on VGMPF.&lt;/div&gt;</summary>
		<author><name>Binarymaster</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=ADL_Format&amp;diff=6854</id>
		<title>ADL Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=ADL_Format&amp;diff=6854"/>
		<updated>2016-06-26T17:04:58Z</updated>

		<summary type="html">&lt;p&gt;Binarymaster: Reveal some info&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Stub}}&lt;br /&gt;
	&lt;br /&gt;
ADL files are used in the Westwood Studios PC-DOS games to play sound through an adlib compatible sound card.&lt;br /&gt;
&lt;br /&gt;
Each ADL file contains these blocks:&lt;br /&gt;
# Song indexes for the following pointer array&lt;br /&gt;
# Pointer array for sound/music tracks&lt;br /&gt;
# Pointer array for adlib instruments&lt;br /&gt;
# Tracks data&lt;br /&gt;
# Instruments data&lt;br /&gt;
&lt;br /&gt;
Each pointer in array is relative to the size of primary indexes block.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; |&lt;br /&gt;
! Game&lt;br /&gt;
! Primary Indexes&lt;br /&gt;
! Track Pointers&lt;br /&gt;
! Instrument Pointers&lt;br /&gt;
! First Track Offset&lt;br /&gt;
|-&lt;br /&gt;
! EOB&lt;br /&gt;
| 120 (8-bit)&lt;br /&gt;
| 150 (16-bit)&lt;br /&gt;
| 150 (16-bit)&lt;br /&gt;
| 0x2D0&lt;br /&gt;
|-&lt;br /&gt;
! EOB 2&lt;br /&gt;
| 120 (8-bit)&lt;br /&gt;
| 250 (16-bit)&lt;br /&gt;
| 250 (16-bit)&lt;br /&gt;
| 0x460&lt;br /&gt;
|-&lt;br /&gt;
! Kyrandia 1&lt;br /&gt;
| 120 (8-bit)&lt;br /&gt;
| 250 (16-bit)&lt;br /&gt;
| 250 (16-bit)&lt;br /&gt;
| 0x460&lt;br /&gt;
|-&lt;br /&gt;
! Dune II&lt;br /&gt;
| 120 (8-bit)&lt;br /&gt;
| 250 (16-bit)&lt;br /&gt;
| 250 (16-bit)&lt;br /&gt;
| 0x460&lt;br /&gt;
|-&lt;br /&gt;
! Lands of Lore&lt;br /&gt;
| 250 (16-bit)&lt;br /&gt;
| 500 (16-bit)&lt;br /&gt;
| 500 (16-bit)&lt;br /&gt;
| 0x9C4&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
* [http://www.vgmpf.com/Wiki/index.php?title=ADL vgmpf.com/Wiki/index.php?title=ADL] - Some information on VGMPF.&lt;/div&gt;</summary>
		<author><name>Binarymaster</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=XMI_Format&amp;diff=6852</id>
		<title>XMI Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=XMI_Format&amp;diff=6852"/>
		<updated>2016-06-10T22:47:15Z</updated>

		<summary type="html">&lt;p&gt;Binarymaster: /* EVNT */ specific note events&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Music Infobox&lt;br /&gt;
 | Type = MIDI&lt;br /&gt;
 | Instruments = MIDI&lt;br /&gt;
 | NumChannels = 16&lt;br /&gt;
 | NumTracks = 1&lt;br /&gt;
 | NumPatterns = 1&lt;br /&gt;
 | NumOrders = 1&lt;br /&gt;
 | Games = &lt;br /&gt;
   {{Game|The Lost Vikings}}&lt;br /&gt;
   {{Game|Master of Magic}}&lt;br /&gt;
   {{Game|SimCity 2000}}&lt;br /&gt;
}}&lt;br /&gt;
The &#039;&#039;&#039;e&amp;lt;u&amp;gt;X&amp;lt;/u&amp;gt;tended &amp;lt;u&amp;gt;MI&amp;lt;/u&amp;gt;DI file format&#039;&#039;&#039; is used by the Miles Sound System (MSS) for storing game music.&lt;br /&gt;
&lt;br /&gt;
== File format ==&lt;br /&gt;
&lt;br /&gt;
The file format is made up of two standard [[Interchange File Format (IFF)]] files one after the other.  As there is more than one root-level chunk in the same file, technically the file does not meet the IFF standard which only allows one root-level chunk per file.  The chunks are arranged as follows:&lt;br /&gt;
&lt;br /&gt;
* FORM (type XDIR)&lt;br /&gt;
** INFO&lt;br /&gt;
&lt;br /&gt;
Immediately following this is another IFF file, which contains a &#039;&#039;&#039;FORM&#039;&#039;&#039; subchunk for each sequence (song) stored in the XMI file:&lt;br /&gt;
&lt;br /&gt;
* CAT (type XMID)&lt;br /&gt;
** FORM (type XMID) - first song&lt;br /&gt;
*** TIMB&lt;br /&gt;
*** EVNT&lt;br /&gt;
** FORM (type XMID) - second song (optional)&lt;br /&gt;
*** TIMB&lt;br /&gt;
*** EVNT&lt;br /&gt;
** etc. for as many songs as needed&lt;br /&gt;
&lt;br /&gt;
It is unknown why the files are arranged as multiple separate IFF files concatenated, rather than one IFF with the same chunk arrangement, but perhaps it is due to a misunderstanding on the part of the format designers of the way the IFF format works.&lt;br /&gt;
&lt;br /&gt;
=== IFF root chunk 1 (FORM:XDIR) ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;FORM&#039;&#039;&#039; chunk is of type &#039;&#039;&#039;XDIR&#039;&#039;&#039;.  It contains one subchunk of type &#039;&#039;&#039;INFO&#039;&#039;&#039;.  The contents of the &#039;&#039;&#039;INFO&#039;&#039;&#039; chunk are as follows:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Data type!!Name!!Description&lt;br /&gt;
|-&lt;br /&gt;
| [[INT16LE]] || seqCount || Number of sequences (songs) in the file&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== IFF root chunk 2 (CAT&amp;amp;nbsp;:XMID) ===&lt;br /&gt;
&lt;br /&gt;
This chunk is a simple list, with one &#039;&#039;&#039;FORM:XMID&#039;&#039;&#039; subchunk for each song in the file, which contains all the information necessary to play that single song.  Each &#039;&#039;&#039;FORM&#039;&#039;&#039; subchunk is further broken up into the following chunks.&lt;br /&gt;
&lt;br /&gt;
==== TIMB ====&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;TIMB&#039;&#039;&#039; chunk stores details about the MIDI patches used in the song.  It is used so that normal MIDI patch-change events can set instrument banks at the same time.  It is an array of the following structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Data type!!Name!!Description&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT8]] || patch || MIDI patch for this instrument number&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT8]] || bank || MIDI bank for this instrument number&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This structure is repeated once for each instrument in the file.&lt;br /&gt;
&lt;br /&gt;
The official XMI creation utility (&amp;lt;tt&amp;gt;midiform&amp;lt;/tt&amp;gt;) uses MIDI controller &amp;lt;tt&amp;gt;AIL_TIMB_BNK&amp;lt;/tt&amp;gt; (114) to set the bank on a given channel, and a standard MIDI program change event to store the patch.  These two values (bank and patch) are used to populate an entry in the &#039;&#039;&#039;TIMB&#039;&#039;&#039; chunk on the next note-on event on the channel.&lt;br /&gt;
&lt;br /&gt;
==== RBRN ====&lt;br /&gt;
&lt;br /&gt;
The optional &#039;&#039;&#039;RBRN&#039;&#039;&#039; chunk is used to store seek destinations where playback should jump to when encountering a branch event.  It is an array of the following structure:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Data type!!Name!!Description&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT16LE]] || id || Branch ID, used to select this branch destination&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT32LE]] || dest || Seek destination for this branch, expressed as a number of bytes since the start of the event data, i.e. 0 means the start of the song.  It is important that this points to the start of an event or delay value, otherwise the results will be unpredictable.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
It is unknown whether the chunk order is important, however the official XMI creation utility (&amp;lt;tt&amp;gt;midiform&amp;lt;/tt&amp;gt;) places this chunk after &#039;&#039;&#039;TIMB&#039;&#039;&#039; and before &#039;&#039;&#039;EVNT&#039;&#039;&#039;.  If there are no branch points then the chunk is omitted entirely.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;midiform&amp;lt;/tt&amp;gt; uses MIDI controller number &amp;lt;tt&amp;gt;AIL_BRANCH_PT&amp;lt;/tt&amp;gt; (120) to place branch destination points in a song, with the controller value setting the &amp;lt;tt&amp;gt;id&amp;lt;/tt&amp;gt; for that branch point.  These controller events are not removed from the MIDI data, so the first event at each branch point is likely to be MIDI controller 120 on some channel.  This is just an observation however, and these MIDI controller events are by no means required.&lt;br /&gt;
&lt;br /&gt;
{{TODO|It is unknown how branch points are triggered (whether it is by code or by other MIDI events.)}}&lt;br /&gt;
&lt;br /&gt;
==== EVNT ====&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;EVNT&#039;&#039;&#039; chunk stores the MIDI events to play.  There is only one track per song.&lt;br /&gt;
&lt;br /&gt;
The event data is almost in standard MIDI format (as per the data in the [[MID Format]] MTrk chunk), with two important differences. &lt;br /&gt;
&lt;br /&gt;
The first difference is &amp;quot;Note On&amp;quot; event contains 3 parameters - the note number, velocity level (same as standard MIDI), and also duration in ticks. Duration is stored as variable-length value in concatenated bits format. Since note events store information about its duration, there are no &amp;quot;Note Off&amp;quot; events. {{TODO|Provide example}}&lt;br /&gt;
&lt;br /&gt;
The second difference is both store delays as variable-length values, but while standard MIDI stores delays as a series of 7-bit values that are concatenated together to produce the final number, XMI instead stores the values as a series of 7-bit values that are summed to produce the final value.&lt;br /&gt;
&lt;br /&gt;
To further complicate matters, if there is no delay at all, then the delay byte is completely omitted.  This means when reading in a byte, the high-bit will need to be inspected to work out whether the byte is the first part of a delay value (high-bit unset) or a MIDI event (high-bit set.)  If the high bit is not set, the values should be read and summed until a byte (possibly the first one) is not 127.&lt;br /&gt;
&lt;br /&gt;
For example: (newlines added for clarity only)&lt;br /&gt;
&lt;br /&gt;
    C1 71    // C1 has high-bit set so this is a MIDI event&lt;br /&gt;
    C2 71    // C2 again has high bit set to this is another MIDI event with a delay of zero in between&lt;br /&gt;
    10       // 10 does not have the high bit set so this is a delay of 10&lt;br /&gt;
    C3 72    // Another MIDI event&lt;br /&gt;
    7F 22    // 7F does not have the high bit set so this is a delay, but 7F means there is another delay byte following&lt;br /&gt;
             //   Actual delay is 7F + 22 = A1&lt;br /&gt;
&lt;br /&gt;
There is no limit to the number of 0x7F bytes that may be supplied in a row for long delays, however a reasonable limit should be placed on this to avoid infinite loops in the case of corrupted data.&lt;br /&gt;
&lt;br /&gt;
Note that because of this way of using the high-bit to signal the meaning of the byte (delay vs event), the standard MIDI &amp;quot;running status&amp;quot; is not available as the high-bit is now used for this alternate purpose.&lt;br /&gt;
&lt;br /&gt;
== MIDI controller assignments ==&lt;br /&gt;
&lt;br /&gt;
The following MIDI controllers are given specific meaning when used in XMI files:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Controller !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| 32 || AIL sysex start address MSB (queue 0) || {{TODO|?}}&lt;br /&gt;
|-&lt;br /&gt;
| 33 || AIL sysex start address KSB (queue 0) || {{TODO|?}}&lt;br /&gt;
|-&lt;br /&gt;
| 34 || AIL sysex start address LSB (queue 0) || {{TODO|?}}&lt;br /&gt;
|-&lt;br /&gt;
| 35 || AIL sysex data byte (queue 0) || {{TODO|?}}&lt;br /&gt;
|-&lt;br /&gt;
| 36 || AIL final sysex data byte (queue 0) || {{TODO|?}}&lt;br /&gt;
|-&lt;br /&gt;
| 37 || AIL sysex start address MSB (queue 1) || {{TODO|?}}&lt;br /&gt;
|-&lt;br /&gt;
| 38 || AIL sysex start address KSB (queue 1) || {{TODO|?}}&lt;br /&gt;
|-&lt;br /&gt;
| 39 || AIL sysex start address LSB (queue 1) || {{TODO|?}}&lt;br /&gt;
|-&lt;br /&gt;
| 40 || AIL sysex data byte (queue 1) || {{TODO|?}}&lt;br /&gt;
|-&lt;br /&gt;
| 41 || AIL final sysex data byte (queue 1) || {{TODO|?}}&lt;br /&gt;
|-&lt;br /&gt;
| 42 || AIL sysex start address MSB (queue 2) || {{TODO|?}}&lt;br /&gt;
|-&lt;br /&gt;
| 43 || AIL sysex start address KSB (queue 2) || {{TODO|?}}&lt;br /&gt;
|-&lt;br /&gt;
| 44 || AIL sysex start address LSB (queue 2) || {{TODO|?}}&lt;br /&gt;
|-&lt;br /&gt;
| 45 || AIL sysex data byte (queue 2) || {{TODO|?}}&lt;br /&gt;
|-&lt;br /&gt;
| 46 || AIL final sysex data byte (queue 2) || {{TODO|?}}&lt;br /&gt;
|-&lt;br /&gt;
|colspan=3|&lt;br /&gt;
|-&lt;br /&gt;
| 58 || AIL rhythm setup timbre || {{TODO|?}}&lt;br /&gt;
|-&lt;br /&gt;
| 59 || AIL MT-32 patch reverb switch || {{TODO|?}}&lt;br /&gt;
|-&lt;br /&gt;
| 60 || AIL MT-32 patch bender range || {{TODO|?}}&lt;br /&gt;
|-&lt;br /&gt;
| 61 || AIL MT-32 reverb mode || {{TODO|?}}&lt;br /&gt;
|-&lt;br /&gt;
| 62 || AIL MT-32 reverb time || {{TODO|?}}&lt;br /&gt;
|-&lt;br /&gt;
| 63 || AIL MT-32 reverb level || {{TODO|?}}&lt;br /&gt;
|-&lt;br /&gt;
|colspan=3|&lt;br /&gt;
|-&lt;br /&gt;
| 110 || AIL channel lock/release || {{TODO|?}}&lt;br /&gt;
|-&lt;br /&gt;
| 111 || AIL channel lock protection || {{TODO|?}}&lt;br /&gt;
|-&lt;br /&gt;
| 112 || AIL voice protection || {{TODO|?}}&lt;br /&gt;
|-&lt;br /&gt;
| 113 || AIL timbre protection || {{TODO|?}}&lt;br /&gt;
|-&lt;br /&gt;
| 114 || AIL patch bank select || Select patch bank (see [[#TIMB]] above)&lt;br /&gt;
|-&lt;br /&gt;
| 115 || AIL indirect controller prefix || {{TODO|?}}&lt;br /&gt;
|-&lt;br /&gt;
| 116 || AIL loop: FOR loop = 1 to n || {{TODO|Loop start point?}}&lt;br /&gt;
|-&lt;br /&gt;
| 117 || AIL loop: NEXT/BREAK || {{TODO|Return to last loop start point?}}&lt;br /&gt;
|-&lt;br /&gt;
| 118 || AIL clear beat/measure count || {{TODO|?}}&lt;br /&gt;
|-&lt;br /&gt;
| 119 || AIL callback trigger || {{TODO|?}}&lt;br /&gt;
|-&lt;br /&gt;
| 120 || AIL sequence index || Branch point destination (see [[#RBRN]] above)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
&lt;br /&gt;
* http://www.ke5fx.com/ - homepage of John Miles, original author of the Miles Sound System and designer of the XMI file format&lt;br /&gt;
&lt;br /&gt;
== Credits ==&lt;br /&gt;
&lt;br /&gt;
This file format was documented by [[User:Malvineous|Malvineous]] from reading the Miles Sound System source code available from John Miles&#039; homepage.  If you find this information helpful in a project you&#039;re working on, please give credit where credit is due.  (A link back to this wiki would be nice too!)&lt;/div&gt;</summary>
		<author><name>Binarymaster</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=MDI_Format&amp;diff=6761</id>
		<title>MDI Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=MDI_Format&amp;diff=6761"/>
		<updated>2016-01-18T21:40:51Z</updated>

		<summary type="html">&lt;p&gt;Binarymaster: Link to Prehistorik&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Music Infobox&lt;br /&gt;
 | Type = MIDI&lt;br /&gt;
 | Instruments = MIDI&lt;br /&gt;
 | NumChannels = 16&lt;br /&gt;
 | NumTracks = 65535&lt;br /&gt;
 | NumPatterns = 1&lt;br /&gt;
 | NumOrders = 0&lt;br /&gt;
 | Tags = Text events&lt;br /&gt;
 | Games = &lt;br /&gt;
   {{Game|Dark Ages}}&lt;br /&gt;
   {{Game|Galactix}}&lt;br /&gt;
   {{Game|Prehistorik}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;MDI Format&#039;&#039;&#039; is a [[MID Format|standard MIDI file]] that contains MIDI meta events for setting OPL instrument settings.  It is a way of storing FM/OPL instruments inside a standard MIDI file, with the file being a standard, fully compatible .mid file.  Players that are not aware of the FM/OPL commands will simply ignore them and play the file as normal.&lt;br /&gt;
&lt;br /&gt;
The special commands are described in the [[MID Format#0x7F: Manufacturer-specific|manufacturer-specific section of the MID Format article]].&lt;br /&gt;
&lt;br /&gt;
Typically standard MIDI files use the &amp;lt;tt&amp;gt;.mid&amp;lt;/tt&amp;gt; filename extension, while files that use the FM/OPL commands are given the &amp;lt;tt&amp;gt;.mdi&amp;lt;/tt&amp;gt; extension.&lt;/div&gt;</summary>
		<author><name>Binarymaster</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=Prehistorik&amp;diff=6760</id>
		<title>Prehistorik</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=Prehistorik&amp;diff=6760"/>
		<updated>2016-01-18T21:38:54Z</updated>

		<summary type="html">&lt;p&gt;Binarymaster: Correct link to MDI&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Game Infobox&lt;br /&gt;
 | Levels = No&lt;br /&gt;
 | Tiles = No&lt;br /&gt;
 | Sprites = No&lt;br /&gt;
 | Fullscreen = Edit&lt;br /&gt;
 | Sound = No&lt;br /&gt;
 | Music = Edit&lt;br /&gt;
 | Text = No&lt;br /&gt;
 | Story = No&lt;br /&gt;
 | Interface = No&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[Prehistorik]] is a platform game.&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
{{BeginFileFormatTools|Type=game}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = [[Camoto]]&lt;br /&gt;
| Platform = Linux/Windows&lt;br /&gt;
| grp = Edit&lt;br /&gt;
| map = No&lt;br /&gt;
| gfx = No&lt;br /&gt;
| mus = Edit&lt;br /&gt;
| sfx = No&lt;br /&gt;
| txt = No&lt;br /&gt;
| sav = No&lt;br /&gt;
| exe = No&lt;br /&gt;
}}&lt;br /&gt;
{{EndFileFormatTools}}&lt;br /&gt;
&lt;br /&gt;
{{BeginGameFileList}}&lt;br /&gt;
{{GameFile&lt;br /&gt;
 | Name = *.cur&amp;lt;br/&amp;gt;*.vga&lt;br /&gt;
 | Format = [[CUR Format]]&lt;br /&gt;
 | KnownFormat = Yes&lt;br /&gt;
 | Desc = Archives storing game data - many of the other files in this list are inside these ones&lt;br /&gt;
}}&lt;br /&gt;
{{GameFile&lt;br /&gt;
 | Name = *.dur&lt;br /&gt;
 | Format = ?&lt;br /&gt;
 | KnownFormat = No&lt;br /&gt;
 | Desc = ?&lt;br /&gt;
}}&lt;br /&gt;
{{GameFile&lt;br /&gt;
 | Name = *.mat&lt;br /&gt;
 | Format = ?&lt;br /&gt;
 | KnownFormat = No&lt;br /&gt;
 | Desc = Graphics&lt;br /&gt;
}}&lt;br /&gt;
{{GameFile&lt;br /&gt;
 | Name = *.mdi&lt;br /&gt;
 | Format = [[MDI Format]]&lt;br /&gt;
 | KnownFormat = Yes&lt;br /&gt;
 | Desc = Background music (&amp;lt;tt&amp;gt;*buz.mdi&amp;lt;/tt&amp;gt; are for the &amp;quot;buzzer&amp;quot; - PC speaker)&lt;br /&gt;
}}&lt;br /&gt;
{{GameFile&lt;br /&gt;
 | Name = *.pc1&lt;br /&gt;
 | Format = [[LBM Format]]&lt;br /&gt;
 | KnownFormat = Yes&lt;br /&gt;
 | Desc = 320&amp;amp;times;200 full-screen images&lt;br /&gt;
}}&lt;br /&gt;
{{GameFile&lt;br /&gt;
 | Name = *.voc&lt;br /&gt;
 | Format = [[VOC Format]]&lt;br /&gt;
 | KnownFormat = Yes&lt;br /&gt;
 | Desc = Sound effects&lt;br /&gt;
}}&lt;br /&gt;
{{EndGameFileList}}&lt;br /&gt;
&lt;br /&gt;
Additionally, the following data is contained within &amp;lt;tt&amp;gt;historik.exe&amp;lt;/tt&amp;gt;.  The filenames are made up for ease of description.&lt;br /&gt;
&lt;br /&gt;
{{BeginGameFileList|header=false|offsets=true}}&lt;br /&gt;
{{GameFile&lt;br /&gt;
 | Offset = 0x21A2E&lt;br /&gt;
 | Name = level1-1.pre&lt;br /&gt;
 | Format = [[Prehistorik Level Format]]&lt;br /&gt;
 | KnownFormat = Partial&lt;br /&gt;
 | Desc = Level 1, screen 1&lt;br /&gt;
}}&lt;br /&gt;
{{GameFile&lt;br /&gt;
 | Offset = 0x21A64&lt;br /&gt;
 | Name = level1-2.pre&lt;br /&gt;
 | Format = [[Prehistorik Level Format]]&lt;br /&gt;
 | KnownFormat = Partial&lt;br /&gt;
 | Desc = Level 1, screen 2&lt;br /&gt;
}}&lt;br /&gt;
{{EndGameFileList}}&lt;br /&gt;
&lt;br /&gt;
{{TODO|Add offsets of rest of levels, or find out where they are stored}}&lt;br /&gt;
[[Category:Sidescroller]]&lt;/div&gt;</summary>
		<author><name>Binarymaster</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=Duke_1_Level_Format&amp;diff=6697</id>
		<title>Duke 1 Level Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=Duke_1_Level_Format&amp;diff=6697"/>
		<updated>2015-11-06T16:50:04Z</updated>

		<summary type="html">&lt;p&gt;Binarymaster: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Map Infobox&lt;br /&gt;
 | Type = 2D tile-based&lt;br /&gt;
 | Layers = 1&lt;br /&gt;
 | Tile size = 16&amp;amp;times;16&lt;br /&gt;
 | Viewport = 208&amp;amp;times;160&lt;br /&gt;
 | Games = &lt;br /&gt;
   {{Game|Duke Nukem}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The levels in [[Duke Nukem]] 1 are stored in the files &amp;lt;tt&amp;gt;WORLDALx.DNy&amp;lt;/tt&amp;gt;, where y is the episode number, and x is the level number, going from 1-9 then A-C. Oddly, level 2 is the intermediate level and level C is the demo level.&lt;br /&gt;
&lt;br /&gt;
Level structure is very simple, each level is 128x90 tiles in size and consists of 11520 UINT16LE words (23040 bytes) of data. Each word controls what appears on one tile in the level. (The level has only one plane, containing background, foreground and enemies. Thus each word is sometimes called a ShapeThing. Because of this limit, the game has some interesting shortcuts to allow things to appear more naturally, such as an enemy tile using the tile before it as its background.) The following values control what appears:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Range (hex) !! Class !! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0000-05FF || Flashers || Animated backgrounds or stationary backdrops, Duke can pass through these.&lt;br /&gt;
|-&lt;br /&gt;
| 0600-17FF || Backgrounds || Static background objects that Duke can pass through.&lt;br /&gt;
|-&lt;br /&gt;
| 1800-2FFF || Solids || Static foreground objects that Duke cannot pass through.&lt;br /&gt;
|-&lt;br /&gt;
| 3000-3059 || Active || This is the fun stuff, all the things that move, such as techbots, bonuses, items, Duke&#039;s starting location, hazards (spikes, force fields), doors, keyholes/access slots, conveyor belts and some special effect items (such as mirror floor and transparent windows).&lt;br /&gt;
|-&lt;br /&gt;
| 306A-FFFF || (Hacks) || Static foreground objects that Duke cannot pass through. The first tiles use tile images from BORDER.DN? and most of the later tiles are displayed as random junk.  All of these tiles are clingable.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Tile mapping ==&lt;br /&gt;
&lt;br /&gt;
The Level&#039;s tiles use tile graphics from 8 files: &amp;lt;tt&amp;gt;BACK0.DN?&amp;lt;/tt&amp;gt; through &amp;lt;tt&amp;gt;BACK3.DN?&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;SOLID0.DN?&amp;lt;/tt&amp;gt; through &amp;lt;tt&amp;gt;SOLID3.DN?&amp;lt;/tt&amp;gt;. Tiles from &amp;lt;tt&amp;gt;BORDER.DN?&amp;lt;/tt&amp;gt; can also be used, though they are not &amp;quot;officially&amp;quot; supported.&lt;br /&gt;
&lt;br /&gt;
Each file contains 48 tiles (at least the game loads 48 tiles from each file), so there are 384 &amp;quot;actual&amp;quot; tiles. Due to the way the tile graphics are stored in memory, you need to divide the tile value by 32 (EGA plane size of a 16x16 pixel tile) to get a tile index from the data stored in the level file.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Range (hex) !! File&lt;br /&gt;
|-&lt;br /&gt;
| 0000-05FF || BACK0.DN?&lt;br /&gt;
|-&lt;br /&gt;
| 0600-0BFF || BACK1.DN?&lt;br /&gt;
|-&lt;br /&gt;
| 0C00-11FF || BACK2.DN?&lt;br /&gt;
|-&lt;br /&gt;
| 1200-17FF || BACK3.DN?&lt;br /&gt;
|-&lt;br /&gt;
| 1800-1DFF || SOLID0.DN?&lt;br /&gt;
|-&lt;br /&gt;
| 1E00-23FF || SOLID1.DN?&lt;br /&gt;
|-&lt;br /&gt;
| 2400-29FF || SOLID2.DN?&lt;br /&gt;
|-&lt;br /&gt;
| 2A00-2FFF || SOLID3.DN?&lt;br /&gt;
|-&lt;br /&gt;
| 3000-367F || Varies, see below&lt;br /&gt;
|-&lt;br /&gt;
| 4000-? || current backdrop 1 (hack)&lt;br /&gt;
|-&lt;br /&gt;
| 8100-? || current backdrop 2 (hack)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Active ===&lt;br /&gt;
&lt;br /&gt;
The follow tiles appear to be manually mapped.  These tile codes from the map do not need to be divided by 32, unlike the other tilecodes.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Tile code (hex) !! File !! Tile index !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| 3000 || OBJECT0.DN1 || 0     || Bonus       || Grey box, empty&lt;br /&gt;
|-&lt;br /&gt;
| 3001 || OBJECT0.DN1 || 5     || Interactive || Elevator&lt;br /&gt;
|-&lt;br /&gt;
| 3002 || {{TODO|?}}  || ?     || Interactive || Left-moving conveyor belt start, must be left of end tile&lt;br /&gt;
|-&lt;br /&gt;
| 3003 || {{TODO|?}}  || ?     || Interactive || Left-moving conveyor belt end, must be on right of start tile&lt;br /&gt;
|-&lt;br /&gt;
| 3004 || {{TODO|?}}  || ?     || Interactive || Right-moving conveyor belt start, must be left of end tile&lt;br /&gt;
|-&lt;br /&gt;
| 3005 || {{TODO|?}}  || ?     || Interactive || Right-moving conveyor belt end, must be on right of start tile&lt;br /&gt;
|-&lt;br /&gt;
| 3006 || OBJECT0.DN1 || 10    || Bonus       || Grey box (0 @ OBJECT0.DN1), contains shoes&lt;br /&gt;
|-&lt;br /&gt;
| 3007 || OBJECT0.DN1 || 11-17 || Interactive || Rocket, tile below is replaced with default tile after rocket takeoff&lt;br /&gt;
|-&lt;br /&gt;
| 3008 || OBJECT0.DN1 || 24-28 || Hazard      || Flamethrower, firing to the right (three tiles wide including placement tile)&lt;br /&gt;
|-&lt;br /&gt;
| 3009 || OBJECT0.DN1 || 18    || Bonus       || Grey box (0 @ OBJECT0.DN1), contains helmet {{TODO|Is this really a helmet?}}&lt;br /&gt;
|-&lt;br /&gt;
| 300A || OBJECT0.DN1 || 29-33 || Hazard      || Flamethrower, firing to the left (three tiles wide including placement tile)&lt;br /&gt;
|-&lt;br /&gt;
| 300B || ANIM0.DN1   || 0-5   || Enemy       || Floating 1x1 robot with purple antenna&lt;br /&gt;
|-&lt;br /&gt;
| 300C || ANIM0.DN1   || 10-33 || Enemy       || Jumping 2x2 robot&lt;br /&gt;
|-&lt;br /&gt;
| 300D || ANIM0.DN1   || 34-41 || Enemy       || Wheeled 2x1 robot with blue wheels&lt;br /&gt;
|-&lt;br /&gt;
| 300E || ANIM1.DN1   || 0-31  || Enemy       || 2x2 rotating wheel with flames&lt;br /&gt;
|-&lt;br /&gt;
| 300F || OBJECT0.DN1 || 43    || Bonus       || Grey box (0 @ OBJECT0.DN1), contains raygun (ammo)&lt;br /&gt;
|-&lt;br /&gt;
| 3010 || ANIM1.DN1   || 32    || Enemy       || 1x1 robot&lt;br /&gt;
|-&lt;br /&gt;
| 3011 || -           || -     || -           || Exit door (only 1 instance allowed!)&lt;br /&gt;
|-&lt;br /&gt;
| 3012 || ANIM2.DN1   || 17    || Bonus       || Grey box (0 @ OBJECT0.DN1), contains dynamite&lt;br /&gt;
|-&lt;br /&gt;
| 3013 || ANIM2.DN1   || 24-31 || Enemy       || Flying orb monster, each shot removes one orb&lt;br /&gt;
|-&lt;br /&gt;
| 3014 || -           || -     || Decorative  || Shimmering water effect, also affects tile below this one&lt;br /&gt;
|-&lt;br /&gt;
| 3015 || ANIM2.DN1   || 32-35 || Bonus       || Red box (1 @ OBJECT2.DN1), contains soda can&lt;br /&gt;
|-&lt;br /&gt;
| 3016 || ANIM2.DN1   || 40-43 || Enemy       || Green bitey creature walking up and down walls, facing right&lt;br /&gt;
|-&lt;br /&gt;
| 3017 || ANIM2.DN1   || 44-47 || Enemy       || Green bitey creature walking up and down walls, facing left&lt;br /&gt;
|-&lt;br /&gt;
| 3018 || OBJECT0.DN1 || 44    || Bonus       || Red box (1 @ OBJECT2.DN1), contains turkey drumstick&lt;br /&gt;
|-&lt;br /&gt;
| 3019 || ANIM3.DN1   || 0     || -           || Bridge that explodes when stepped on twice (only 1 instance allowed!)&lt;br /&gt;
|-&lt;br /&gt;
| 301A || OBJECT1.DN1 || 0-3   || Hazard      || Blue force field, horizontal&lt;br /&gt;
|-&lt;br /&gt;
| 301B || ANIM3.DN1   || 12-19 || Hazard      || Rotating fan blades, can&#039;t stand on when shot&lt;br /&gt;
|-&lt;br /&gt;
| 301C || ANIM3.DN1   || 12-19 || Hazard      || Rotating fan blades, can stand on when shot&lt;br /&gt;
|-&lt;br /&gt;
| 301D || OBJECT1.DN1 || 8     || Bonus       || Blue box (0 @ OBJECT2.DN1), contains football&lt;br /&gt;
|-&lt;br /&gt;
| 301E || OBJECT1.DN1 || 9     || Bonus       || Blue box (0 @ OBJECT2.DN1), contains joystick&lt;br /&gt;
|-&lt;br /&gt;
| 301F || OBJECT1.DN1 || 10    || Bonus       || Blue box (0 @ OBJECT2.DN1), contains &amp;quot;DN&amp;quot; floppy&lt;br /&gt;
|-&lt;br /&gt;
| 3020 || OBJECT1.DN1 || 13    || Bonus       || Grey box (0 @ OBJECT2.DN1), contains robohand&lt;br /&gt;
|-&lt;br /&gt;
| 3021 || OBJECT1.DN1 || 15-18 || Hazard      || White/blue force field, vertical&lt;br /&gt;
|-&lt;br /&gt;
| 3022 || ANIM3.DN1   || 20-47 || Enemy       || Helicopter&lt;br /&gt;
|-&lt;br /&gt;
| 3023 || OBJECT1.DN1 || 19-23 || Bonus       || Blue box (0 @ OBJECT2.DN1), contains balloon&lt;br /&gt;
|-&lt;br /&gt;
| 3024 || ANIM4.DN1   || 8-10  || Bonus       || Security camera&lt;br /&gt;
|-&lt;br /&gt;
| 3025 || ANIM4.DN1   || 11    || Decorative  || Brown spikes&lt;br /&gt;
|-&lt;br /&gt;
| 3026 || ANIM4.DN1   || 12    || Decorative  || Rock, left half&lt;br /&gt;
|-&lt;br /&gt;
| 3027 || ANIM4.DN1   || 13    || Decorative  || Rock, right half&lt;br /&gt;
|-&lt;br /&gt;
| 3028 || ANIM4.DN1   || 14    || Decorative  || Grey rounded window&lt;br /&gt;
|-&lt;br /&gt;
| 3029 || OBJECT1.DN1 || 24    || Bonus       || Grey box (0 @ OBJECT0.DN1), contains nuclear molecule&lt;br /&gt;
|-&lt;br /&gt;
| 302A || OBJECT1.DN1 || 33    || Hazard      || Loose/falling ACME sign, left half&lt;br /&gt;
|-&lt;br /&gt;
| 302B || OBJECT1.DN1 || 34    || Hazard      || Loose/falling ACME sign, right half&lt;br /&gt;
|-&lt;br /&gt;
| 302C || OBJECT1.DN1 || 45-46 || Hazard      || Spike, pokes up when walking over&lt;br /&gt;
|-&lt;br /&gt;
| 302D || OBJECT1.DN1 || 47-49 || Bonus       || Blue box (0 @ OBJECT2.DN1), contains magenta flag&lt;br /&gt;
|-&lt;br /&gt;
| 302E || OBJECT2.DN1 || 2-4   || Bonus       || Blue box (0 @ OBJECT2.DN1), contains radio&lt;br /&gt;
|-&lt;br /&gt;
| 302F || ANIM4.DN1   || 20-28 || Interactive || Teleporter, transports to tilecode 3030&lt;br /&gt;
|-&lt;br /&gt;
| 3030 || ANIM4.DN1   || 20-28 || Interactive || Teleporter, transports to tilecode 302F&lt;br /&gt;
|-&lt;br /&gt;
| 3031 || ANIM4.DN1   || 31    || Hazard      || Spiky round red bomb, bouncing&lt;br /&gt;
|-&lt;br /&gt;
| 3032 || -           || -     || Interactive || Player start point&lt;br /&gt;
|-&lt;br /&gt;
| 3033 || OBJECT1.DN1 || 14    || Bonus       || Grey box (0 @ OBJECT0.DN1), contains access card&lt;br /&gt;
|-&lt;br /&gt;
| 3034 || OBJECT2.DN1 || 5-12  || Interactive || Access card activation point&lt;br /&gt;
|-&lt;br /&gt;
| 3035 || OBJECT2.DN1 || 14-15 || Interactive || Robohand activation point&lt;br /&gt;
|-&lt;br /&gt;
| 3036 || {{TODO|?}}  || ?     || ?           || Red girder, creates a bridge when Robohand activation point is used&lt;br /&gt;
|-&lt;br /&gt;
| 3037 || OBJECT2.DN1 || 21    || Bonus       || Grey box (0 @ OBJECT0.DN1), contains &amp;quot;D&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 3038 || OBJECT2.DN1 || 21    || Bonus       || Grey box (0 @ OBJECT0.DN1), contains &amp;quot;U&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 3039 || OBJECT2.DN1 || 21    || Bonus       || Grey box (0 @ OBJECT0.DN1), contains &amp;quot;K&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 303A || OBJECT2.DN1 || 21    || Bonus       || Grey box (0 @ OBJECT0.DN1), contains &amp;quot;E&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 303B || ANIM2.DN1   || 18-23 || Bonus       || Purple rabbit thing, 5000 bonus points&lt;br /&gt;
|-&lt;br /&gt;
| 303C || ANIM5.DN1   || 1     || Enemy       || Fire monster&lt;br /&gt;
|-&lt;br /&gt;
| 303D || ANIM5.DN1   || 12    || Decorative  || Diamond-shaped wire mesh&lt;br /&gt;
|-&lt;br /&gt;
| 303E || ANIM5.DN1   || 13    || Decorative  || Window showing through to backdrop, left half&lt;br /&gt;
|-&lt;br /&gt;
| 303F || ANIM5.DN1   || 14    || Decorative  || Window showing through to backdrop, right half&lt;br /&gt;
|-&lt;br /&gt;
| 3040 || OBJECT2.DN1 || 23    || Interactive || Message, press up to read (blank message for most levels?)&lt;br /&gt;
|-&lt;br /&gt;
| 3041 || - || - || - || Screen display with Dr. Proton&lt;br /&gt;
|-&lt;br /&gt;
| 3042 || ANIM5.DN1   || 30-42 || Enemy       || Dr Proton, E3 boss, killable (&amp;quot;I won it all!&amp;quot;, game ends)&lt;br /&gt;
|-&lt;br /&gt;
| 3043 || ANIM5.DN1   || 30-42 || Enemy       || Dr Proton, E1 boss, not killable (escapes to moon, game ends)&lt;br /&gt;
|-&lt;br /&gt;
| 3044 || OBJECT2.DN1 || 24    || Interactive || Door key, red&lt;br /&gt;
|-&lt;br /&gt;
| 3045 || OBJECT2.DN1 || 25    || Interactive || Door key, green&lt;br /&gt;
|-&lt;br /&gt;
| 3046 || OBJECT2.DN1 || 26    || Interactive || Door key, blue&lt;br /&gt;
|-&lt;br /&gt;
| 3047 || OBJECT2.DN1 || 27    || Interactive || Door key, magenta&lt;br /&gt;
|-&lt;br /&gt;
| 3048 || OBJECT2.DN1 || 37    || Interactive || Door lock, operated by red key&lt;br /&gt;
|-&lt;br /&gt;
| 3049 || OBJECT2.DN1 || 38    || Interactive || Door lock, operated by green key&lt;br /&gt;
|-&lt;br /&gt;
| 304A || OBJECT2.DN1 || 39    || Interactive || Door lock, operated by blue key&lt;br /&gt;
|-&lt;br /&gt;
| 304B || OBJECT2.DN1 || 40    || Interactive || Door lock, operated by magenta key&lt;br /&gt;
|-&lt;br /&gt;
| 304C || OBJECT2.DN1 || 28    || Interactive || Door, opened by red lock&lt;br /&gt;
|-&lt;br /&gt;
| 304D || OBJECT2.DN1 || 28    || Interactive || Door, opened by green lock&lt;br /&gt;
|-&lt;br /&gt;
| 304E || OBJECT2.DN1 || 28    || Interactive || Door, opened by blue lock&lt;br /&gt;
|-&lt;br /&gt;
| 304F || OBJECT2.DN1 || 28    || Interactive || Door, opened by magenta lock&lt;br /&gt;
|-&lt;br /&gt;
| 3050 || OBJECT1.DN1 || 8     || Bonus       || Football&lt;br /&gt;
|-&lt;br /&gt;
| 3051 || OBJECT0.DN1 || 44    || Bonus       || Turkey drumstick&lt;br /&gt;
|-&lt;br /&gt;
| 3052 || ANIM2.DN1   || 32-35 || Bonus       || Soda can&lt;br /&gt;
|-&lt;br /&gt;
| 3053 || OBJECT1.DN1 || 10    || Bonus       || &amp;quot;DN&amp;quot; floppy disk&lt;br /&gt;
|-&lt;br /&gt;
| 3054 || OBJECT1.DN1 || 9     || Bonus       || Joystick&lt;br /&gt;
|-&lt;br /&gt;
| 3055 || OBJECT1.DN1 || 47-49 || Bonus       || Purple flag&lt;br /&gt;
|-&lt;br /&gt;
| 3056 || OBJECT2.DN1 || 2-4   || Bonus       || Radio&lt;br /&gt;
|-&lt;br /&gt;
| 3057 || ANIM4.DN1   || 31    || Hazard      || Spiky round red bomb, stationary, explodes on touch&lt;br /&gt;
|-&lt;br /&gt;
| 3058 || OBJECT2.DN1 || 48    || Hazard      || Spikes, poking up&lt;br /&gt;
|-&lt;br /&gt;
| 3059 || OBJECT2.DN1 || 49    || Hazard      || Spikes, poking down&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
There are numerous level editors available, from the basic original ASCII one, to rather advanced ones capable of rendering animations.&lt;br /&gt;
&lt;br /&gt;
* Maps can be found at [http://vgmaps.com/Atlas/PC/index.htm#DukeNukem vgmaps.com]&lt;br /&gt;
* The original level editor is at [http://archive.shikadi.net/sites/www.geocities.com/dooknookimklassik/ Dook Nookim Klassik]&lt;br /&gt;
* A reasonable level editor can be found at [http://crystalshard.net/?p=8&amp;amp;s=51 crystalshard.net]&lt;br /&gt;
* Possibly the best editor is DN1MOD, which renders levels as the game does, by loading the game&#039;s graphics files [http://archive.shikadi.net/sites/members.iinet.net.au/~markim/admiral_bob/files/]&lt;/div&gt;</summary>
		<author><name>Binarymaster</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=Dave_2_Intro_format&amp;diff=6134</id>
		<title>Dave 2 Intro format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=Dave_2_Intro_format&amp;diff=6134"/>
		<updated>2015-04-23T06:10:04Z</updated>

		<summary type="html">&lt;p&gt;Binarymaster: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &amp;lt;tt&amp;gt;INTRO.DD2&amp;lt;/tt&amp;gt; file stores a masked image used at the start of [[Dangerous Dave 2]]. It differs in format and compression from all other files used in the game.&lt;br /&gt;
&lt;br /&gt;
The file is a 256x64 [[Raw EGA data]] image compressed using [[RLEW compression]] The color dark blue is transparent here, acting as a mask while only needing 4 EGA planes.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Notes==&lt;br /&gt;
&lt;br /&gt;
Dave 2 uses a trigonometric function to work out the image&#039;s size and co-ordinates when displaying it.&lt;br /&gt;
Format reverse engineered by [[User:Napalm]] and [[User:Levellass]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Dangerous Dave 2]]&lt;br /&gt;
[[Category:File Formats]]&lt;br /&gt;
[[Category:Graphics Files]]&lt;/div&gt;</summary>
		<author><name>Binarymaster</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=ADL_Format&amp;diff=5989</id>
		<title>ADL Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=ADL_Format&amp;diff=5989"/>
		<updated>2015-01-31T13:59:38Z</updated>

		<summary type="html">&lt;p&gt;Binarymaster: Mark as a stub; add links&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Stub}}&lt;br /&gt;
	&lt;br /&gt;
ADL files are used in the PC-DOS version of EOB1&amp;amp;2 to play sound through an adlib compatible sound card.&lt;br /&gt;
&lt;br /&gt;
For EOB2:&lt;br /&gt;
Offset:&lt;br /&gt;
#x0000: 120 bytes which are indices for the following pointer array&lt;br /&gt;
#x0078: 250*16bit pointers for sound/music tracks&lt;br /&gt;
#x026C: start of configuration data for adlib instruments&lt;br /&gt;
#x????: tracks&lt;br /&gt;
&lt;br /&gt;
EOB1 ADL files are adlib.dat and sound.dat. The difference to EOB2 is the size of the pointer array for tracks which is here 300 bytes instead of 500.&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
* [http://www.vgmpf.com/Wiki/index.php?title=ADL vgmpf.com/Wiki/index.php?title=ADL] - Some information on VGMPF.&lt;/div&gt;</summary>
		<author><name>Binarymaster</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=User_talk:Malvineous&amp;diff=5976</id>
		<title>User talk:Malvineous</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=User_talk:Malvineous&amp;diff=5976"/>
		<updated>2015-01-25T12:02:01Z</updated>

		<summary type="html">&lt;p&gt;Binarymaster: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Wolfenstein 3D -&amp;gt; Wolfenstein 3-D ==&lt;br /&gt;
I&#039;ve corrected the infamous 3D tyop in the names of several Wolf3D-related pages; can you please delete the following ones?&lt;br /&gt;
&lt;br /&gt;
[[:Category:Wolfenstein 3D]] -&amp;gt; Superseded by [[:Category:Wolfenstein 3-D]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[:Image:Wolfenstein_3D.png]] -&amp;gt; Superseded by [[:Image:Wolfenstein_3-D.png]]&lt;br /&gt;
&lt;br /&gt;
Thanks :) --De Zeurkous (zeurkous@zeurcomp.nichten.info), Thu Nov 22 08:18:42 UTC 2007&lt;br /&gt;
&lt;br /&gt;
:Haha, you&#039;ve certainly been busy.  Don&#039;t forget that this wiki isn&#039;t meant to be an encyclopaedia of the games, its main purpose is documenting the file formats and editing tools that can be used with the games, as opposed to how the games behave without any mods, or what they might be called if you forget to change the title screen :-) -- [[User:Malvineous|Malvineous]] 11:14, 22 November 2007 (GMT)&lt;br /&gt;
&lt;br /&gt;
::Nah, I haven&#039;t forgotten. As we&#039;re reinventing the wheel for a semi-virgin wiki, the naming and something static like the cheats seemed like a good place to start :) --De Zeurkous (zeurkous@nichten.info), Thu Nov 22 12:20:04 UTC 2007&lt;br /&gt;
&lt;br /&gt;
== Jill of the Jungle palette ==&lt;br /&gt;
&lt;br /&gt;
Hi, I&#039;m currently working on a level viewer for [[Jill of the Jungle]] (maybe an editor later on). Some of the information I found here has been very useful, but there&#039;s one thing I&#039;m a bit stuck on. On the [[SHA Format]] page it says:&lt;br /&gt;
:&#039;&#039;Each array item contains 4 unsigned bytes, representing CGA, EGA and VGA, respectivley, and then a null value. [...] Each byte maps to the index of a colour in the palette. If there are no colours required, the tile set uses the default colours.&#039;&#039;&lt;br /&gt;
However, it doesn&#039;t say anywhere where the palette can be found. Is it stored in the EXE file? I hope you can help me on this :)&lt;br /&gt;
&lt;br /&gt;
Regards, [[User:Spinal|Spinal]] 13:00, 2 March 2008 (GMT)&lt;br /&gt;
&lt;br /&gt;
:Unfortunately I didn&#039;t write the JotJ SHA page, and I haven&#039;t yet had the time to figure this out.  For Xargon I&#039;ve taken the quick and dirty route and used a screenshot from within DOSBox as the source of the palette, until I can figure out where the palette is located.  If you find this out, don&#039;t forget to update the page! :-) -- [[User:Malvineous|Malvineous]] 22:02, 2 March 2008 (GMT)&lt;br /&gt;
&lt;br /&gt;
::Hey Spinal, sorry, I wrote the [[SHA Format]] page, so that was probably my bad. I wasn&#039;t able to find the palette either. I assume it&#039;s in the .EXE, however I spent a fair bit of time manually mapping it using a Wombat tool (http://www.szevvy.com/node/3). I was also writing a level viewer (initally in XHTML which turned out to be too slow, so then I moved to Flash 9). I tried to email you my findings, but the email bounced. I&#039;m not sure if they were 100% accurat, which is why I never added them to the documentation.&lt;br /&gt;
&lt;br /&gt;
::Hey Malvineous, it seems the Jill - [[DMA Format]] page has been removed. Do you have a log of what happened to it? I&#039;m sure it existed at some point.&lt;br /&gt;
&lt;br /&gt;
::- [[User:dheim|Daniel]] 20:00, 5 March 2008&lt;br /&gt;
&lt;br /&gt;
:::I don&#039;t ever remember seeing a DMA page - certainly there&#039;s nothing in the wiki logs about it being deleted or renamed.  Maybe you started working on it but never got around to saving it?  Or is it one of the Xargon pages that shares the same format as Jill?  (by the way, you can type &amp;lt;nowiki&amp;gt;~~~~&amp;lt;/nowiki&amp;gt; to automatically put in the signature in these messages.) -- [[User:Malvineous|Malvineous]] 11:28, 5 March 2008 (GMT)&lt;br /&gt;
&lt;br /&gt;
::::Sorry, it must have been the stuff in the [[SHA Format]] page that I was thinking of. I may have added the link to the [[DMA Format]] page, and never expanded on it. - [[User:Dheim|Daniel]] 02:46, 6 March 2008 (GMT)&lt;br /&gt;
&lt;br /&gt;
:::::Hi guys. Sorry for the mistake, I mixed up the authors of the SHA and level formats. I&#039;ve written a level viewer in PHP the last week, by using static images instead of getting them from the actual files. This causes some problems for episode 2, which uses a different palette, but besides that it works great :) When everything is done I&#039;ll upload the maps to my server and the tile/object lists to this wiki.&lt;br /&gt;
:::::@Daniel: strange that it bounced, I confirmed my address so it should be working fine... You can mail it to spinal -at- zanderz -dot- net. Also, I saw on your Wombat page that you &amp;quot;have a vague idea of how to do&amp;quot; [[Hocus Pocus]]. Could you share your findings on this wiki? I&#039;d love to make maps, or even a level viewer/editor for that game :) -- [[User:Spinal|Spinal]] 00:32, 8 March 2008 (GMT)&lt;br /&gt;
:Okay, with help of [[User:Dheim|Daniel]] who send me the palette I found it! I&#039;ll put my findings on [[Jill of the Jungle palette]]. -- [[User:Spinal|Spinal]] 15:36, 13 March 2008 (GMT)&lt;br /&gt;
&lt;br /&gt;
== Halloween Harry/Alien Carnage ==&lt;br /&gt;
&lt;br /&gt;
Hi Malvineous. Thanks for your edits on the GMF article! I notice you mentioned there exist versions of the game which don&#039;t require exploding a BNK to get at the game data. What does the directory structure look like for the version you have? I&#039;m working on a map viewer (which will become a map editor at some point) and would like it to be able to work on whatever versions are out there. Thanks for any info. -[[User:Duckthing|Duckthing]] 04:41, 11 December 2010 (GMT)&lt;br /&gt;
&lt;br /&gt;
: Hi Duckthing - no worries, Halloween Harry has long been an interest of mine, but my map editor sadly needs a lot more work before I can begin reverse engineering more file formats so I&#039;m glad you&#039;ve made a start!  AFAIK technically Halloween Harry has no compression, but for whatever reason (probably listed in the Apogee FAQ) they decided to swap episodes 1 and 3, compress the BNK file and then re-release it under the name Alien Carnage.  You can download all available versions (including registered versions since the game was released as freeware in 2007) from [http://www.classicdosgames.com/game/Alien_Carnage.html RGB Classic Games].  BTW not sure if you noticed but I also posted a couple of things on the GMF article&#039;s talk/discussion page. -- [[User:Malvineous|Malvineous]] 06:08, 11 December 2010 (GMT)&lt;br /&gt;
&lt;br /&gt;
:: Thank you! Working with the uncompressed version will keep things less complicated. I did notice the GMF discussion you added, but haven&#039;t had a chance to really go through it yet. -- [[User:Duckthing|Duckthing]] 06:41, 11 December 2010 (GMT)&lt;br /&gt;
&lt;br /&gt;
::: No worries.  If you&#039;re running Linux or MacOSX you should be able to compile [[Camoto|libgamearchive]] which will let you copy files in and out of the BNK files.  This is a library so it&#039;s also possible to use it in your own program for accessing and editing the map files while they&#039;re still inside the BNK, for instance.  (BTW the &#039;minor&#039; tickbox should only be used when the edit does not affect the information on the page - e.g. fixing a typo or a broken URL.  If you are changing the actual content on a page it is never a minor edit!) -- [[User:Malvineous|Malvineous]] 07:51, 11 December 2010 (GMT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Dangerous Dave ==&lt;br /&gt;
&lt;br /&gt;
Working on this, does anyone have any info on the formats? The EGA graphics are 84KB and external, but CGA and VGA graphics unrelated to them are in the 174KB executable, apparently uncompressed, I don&#039;t know how this is possible. I&#039;ve found the levels and partially reverse engineered the format (The first 1000 bytes, a 100x10 array of tiles.) but each level is followed by ~280 bytes of variable and unknown data I assume is sprites. I have a list of internal files in the executable, looks like most of it is non-game code. Any help would be appreciated. -[[User:Levellass|Endian? What are you on about?]] 06:03, 12 December 2010 (GMT)&lt;br /&gt;
&lt;br /&gt;
: Hmm, interesting.  All I can suggest for the levels is - as you&#039;re probably already familiar with - changing the values in a hex editor then loading the game to see what happens.  I would suspect that all the graphics would be in a similar format, so if there are any headers or structures used in the EGA graphics files perhaps they&#039;re duplicated for CGA/VGA?  Also John Romero seems pretty accessible, perhaps you could ask him directly?  Failing that, randomly writing data into the .exe until the images change could be used as a last resort! -- [[User:Malvineous|Malvineous]] 12:09, 12 December 2010 (GMT)&lt;br /&gt;
&lt;br /&gt;
: Ha, that was easier than I expected - uncompressed VGA data is easy to find with a good hex editor ;-)  [http://www.shikadi.net/pics/ddave-vga-hexdump.png This looks like it] -- [[User:Malvineous|Malvineous]] 12:17, 12 December 2010 (GMT)&lt;br /&gt;
&lt;br /&gt;
: Ok that was only the menu graphics.  At offset 0xC629 there&#039;s some sort of offset table which looks very similar to the contents of EGADAVE.DAV but there are extra bytes dotted all over the place - perhaps it&#039;s RLE encoded?  Actually just before that there&#039;s the number 0x6CAA.  If you go a bit less than 0x6CAA bytes after this you end up with another table, which to me suggests that 0x6CAA is the decompressed size of that first table. -- [[User:Malvineous|Malvineous]] 13:01, 12 December 2010 (GMT)&lt;br /&gt;
&lt;br /&gt;
:If I remember it correctly, the VGA sprites and tiles are RLE compressed and it&#039;s not too hard to decompress them. The positions of the enemies in the levels on the other hand are still a mystery to me. [[User:Calvero|Calvero]] 20:43, 12 December 2010 (GMT)&lt;br /&gt;
&lt;br /&gt;
: Looking at the levels, which directly follow the VGA palette, they seem to contain 256 bytes of header data, then the 100x10 tiles, then eight bytes of lead-out data.  Then the next level&#039;s 256 bytes of header, 100x10 tiles, then eight bytes of lead-out.  Although I say &amp;quot;level&amp;quot;, the first &amp;quot;level&amp;quot; seems to contain both level 1 and 2, and this seems to be the way it works in the game - in some levels you can see through to others.  I&#039;m not sure what the 256 bytes of header data are for, but some levels have FF FF 00 00 repeated which seems to indicate two uint16 fields which are blanked out for those levels. -- [[User:Malvineous|Malvineous]] 13:15, 13 December 2010 (GMT)&lt;br /&gt;
&lt;br /&gt;
::First up, levels; where does level 1 start? It&#039;s possible I&#039;m reading the start of a level as the previous level&#039;s end, I looked for the start of tile data, which I assumed, like Keen 1, would be the level start.&lt;br /&gt;
&lt;br /&gt;
::Next, palette; I&#039;m assuming, as you said, it is located just before the level data?&lt;br /&gt;
&lt;br /&gt;
::There is VGA and CGA graphics in the executable, plus headers, but the bulk of graphics for CGA and VGA I haven&#039;t been able to locate. If the data is RLE compressed I should think it would use either Keen 1-3 fullscreen or Jazz Jackrabbit tile RLE, both of which I know well. I&#039;ll look into both of these options, cheers! -[[User:Levellass|Endian? What are you on about?]] 12:03, 20 December 2010 (GMT)&lt;br /&gt;
&lt;br /&gt;
:::I&#039;ve found the VGA and CGA data for the menu graphics.  It looks like the CGA data is stored in a series of 1-bit-per-pixel (monochrome) images.  Or it could be EGA data with the planes split out (e.g. red plane for all images, then green plane for all images, etc.)  I think I found three planes which means it&#039;s probably EGA, as CGA would have a max of two planes.  I&#039;ve also found the font graphics, this looks like 4bpp/16 colour EGA data.  Haven&#039;t seen level graphics yet.  I&#039;ve successfully modded the levels with a hex editor (putting the jetpack everywhere) so now I&#039;ve finally looked at all the levels!  The creatures are definitely not stored in the 100x10 tile data.  Putting random bytes in there revealed that the values are indices into the image files, because if you put the value in for fire it will animate, and the following three or so values show up as still frames from the fire animation.&lt;br /&gt;
&lt;br /&gt;
:::The VGA palette starts at 0x26B0A (I updated the main DDave page with this) + 768 bytes leads straight onto the start of level 1 at 0x26E0A.  So at 0x26E0A there are 256 bytes of data, then 100x10 tiles, then 24 bytes of footer data.  Some of this data (perhaps footer data) might be the level start coordinates, because Dave doesn&#039;t always start the level at the same place (e.g. the warp level when you climb the tree on level 5 and jump off the edge of the screen.) -- [[User:Malvineous|Malvineous]] 12:24, 20 December 2010 (GMT)&lt;br /&gt;
&lt;br /&gt;
:::I think I&#039;ve found all the files so far, I&#039;ve updated [[Dangerous Dave]] with the offsets of the files, including what appears to be CGA and VGA tiles.  I&#039;m not sure what sort of format they&#039;re in though, it looks like they might be compressed (and so the offsets in that list might be off by ~4, as I may have cut off the decompressed-size field.)  I&#039;ve also updated the map format page, I think it&#039;s pretty much fully reverse engineered now. -- [[User:Malvineous|Malvineous]] 05:13, 21 December 2010 (GMT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Noahs Ark 3D and IMFs ==&lt;br /&gt;
&lt;br /&gt;
Been poking around Noah&#039;s Ark 3D, an adaption of the Wolfenstein game and found a few interesting things which I&#039;m hoping to confirm.&lt;br /&gt;
&lt;br /&gt;
First, the game uses MID files, not IMF files for music, second, the MIDI files have an extra word at the start of the file giving the file length. Third, the code uses the first word of the midi file as the length of data to read from the file and put into memory to play. After poking around a bit in Wolfenstein and Keen I believe this is the same with IMF files, that is, ALL IMF files are type 0 as it were and the type 1s are read just like type 0s by the games (The first word is read as the amount of IMF data to copy into memory to play, this is then read as type 0.) I&#039;m not quite sure what this does for the two types since type 1 is would essentially be a type 0 with a header and footer that are part of the AUDIO.xxx format, much like PC\adlib sounds can have the huffman lengths at the start. Are there any games that use &#039;individual&#039; type 1 IMFs (Even if included as part of a group file. All I&#039;ve seen are games like cosmo, where non-AUDIO IMFs are type 0.)&lt;br /&gt;
&lt;br /&gt;
Should there be a Noah&#039;s Ark 3D page and should we add the midi note to the AUDIO format page? It seems that the format can hold any type of music file the game can read, not just IMFs.  -- Levellass&lt;br /&gt;
&lt;br /&gt;
: Yes it is known that the type-1 header might really be part of the AUDIO.xxx format but alas there were many type-1 files floating around the place (incorrectly extracted, you could argue) before this was realised, so the format variant is here to stay.  It does have some advantages though (like tagging files with the song title) but I&#039;m not sure whether anyone has figured out definitively whether the header (and footer, in the case of the Wolf3D files) belongs to the IMF or the AUDIO file.  I guess you&#039;d have to browse the game source code and see how the game uses the data to know for sure.&lt;br /&gt;
&lt;br /&gt;
: As far as the MIDI goes, I believe the AUDIO.xxx file is just a container file like any other, capable of supporting any data at all.  It&#039;s up to the game to decide how to use it.  If anything this makes me think it would fit better if the AUDIO.xxx article was merely documenting the structure, with links to actual audio formats like PC SFX, Adlib SFX, IMF and MIDI and notes about which games make use of which formats.&lt;br /&gt;
&lt;br /&gt;
: Oh and yes, by all means create a page for the new game. -- [[User:Malvineous|Malvineous]] 08:41, 3 February 2011 (GMT)&lt;br /&gt;
&lt;br /&gt;
== Sound Files category ==&lt;br /&gt;
&lt;br /&gt;
I don’t know why there’s a Sound Files category and also an Audio Files category... it seems redundant. I left those categories the way they are though.&lt;br /&gt;
&lt;br /&gt;
Also, the [[File format data types]] page needs some signed ints, but I didn’t know what naming convention you wanted to use. I described something as an [[INT16LE]] on [[BMC Format]]. [[User:Yellowantphil|Yellowantphil]] 20:12, 11 September 2011 (GMT)&lt;br /&gt;
&lt;br /&gt;
: Not sure about the Sound vs Audio - I use the term &#039;audio&#039; to mean both sound and music, but you&#039;re right, if there are separate sound and music categories we don&#039;t really need an audio one as well.  Feel free to update.  [[INT16LE]] is perfectly fine too!  I added a note to the data types page. -- [[User:Malvineous|Malvineous]] 22:30, 11 September 2011 (GMT)&lt;br /&gt;
&lt;br /&gt;
== GamePage template ==&lt;br /&gt;
&lt;br /&gt;
Should the GamePage template add the page to its own category? It seems a little odd that [[Wacky Wheels]] is not in the Wacky Wheels category. [[User:Yellowantphil|Yellowantphil]] 04:51, 16 September 2011 (GMT)&lt;br /&gt;
: I decided against this because there is a link to the game&#039;s page in the category intro at the top of the page.  It seemed unnecessary having another link in amongst all the other pages.  This was also because the game page was really only meant to be a summary, there wasn&#039;t supposed to be a huge amount of detail on it, only links to other pages with the detail (which then would appear in the category list.)  I would imagine that, eventually, [[Wacky Wheels]] would be tweaked to move a lot of the content onto subpages. -- [[User:Malvineous|Malvineous]] 12:58, 16 September 2011 (GMT)&lt;br /&gt;
&lt;br /&gt;
== Scope of the wiki ==&lt;br /&gt;
&lt;br /&gt;
I don’t know how extensive you want the information to be on ModdingWiki... I added a few lists of audio and graphics files a while ago, and there will probably be other information that I’ll find out that’s potentially helpful for level editing but not directly related to it. I can move some information to my website if it starts to become out of scope for your wiki. I also sometimes end up documenting everything imaginable... there’s some minutiae on my website and possibly on your wiki that I ought to go through and delete. [[User:Yellowantphil|Yellowantphil]] 05:28, 10 October 2011 (GMT)&lt;br /&gt;
&lt;br /&gt;
:Hmm, that&#039;s a difficult one - I&#039;m always in favour of documenting more rather than less.  Generally speaking if it&#039;s related to a game and it would help either a programmer writing a utility or a someone trying to change a game manually then it should be documented.  About the only thing that comes to mind that&#039;s over documenting is when some small calculation is expressed in a couple of different programming languages, but I&#039;ve left that in so people can just copy it rather than trying to figure it out from the text.  But the [[Wacky Wheels]] page is probably the gold standard for what all wiki pages should look like :-)  Do you have anything in particular you&#039;re unsure of whether it would fit here? -- [[User:Malvineous|Malvineous]] 10:07, 10 October 2011 (GMT)&lt;br /&gt;
&lt;br /&gt;
::I was mainly thinking of the list of VOC files on [[Wacky Wheels Music and Sound Effects]] and the list of &amp;lt;tt&amp;gt;*.sp&amp;lt;/tt&amp;gt; files on [[Wacky Wheels Graphics Formats]]. I have an expanded list of the &amp;lt;tt&amp;gt;*.sp&amp;lt;/tt&amp;gt; files on my computer but it isn’t finished yet. I guess there isn’t all that much more Wacky Wheels information to be added to this wiki though. There is still some modding information on my website that ought to be moved over here, so that would take up another page or two. I’ve been lazy about doing Wacky Wheels stuff lately, but I might find some time for it this weekend.&lt;br /&gt;
&lt;br /&gt;
::By the way, I guess that guy from Cascadia Games emailed you. It’s pretty interesting that WW might become an iPhone app. He told me that he was going to be using his own game engine, which sounds a lot easier than trying to get a hold of the WW source code and porting it. —[[User:Yellowantphil|Yellowantphil]] 16:46, 15 October 2011 (GMT)&lt;br /&gt;
&lt;br /&gt;
::: I was going to say the list of VOCs might be overkill, but then the list of .sp files might be useful.  To be honest, it&#039;s the sort of thing that you could probably omit if you were feeling lazy, but likewise I don&#039;t mind at all if you choose to include it, so since it&#039;s already there I&#039;m happy to keep it.&lt;br /&gt;
&lt;br /&gt;
::: Yes I did get an e-mail from Cascadia, I was going to pass along your details but it sounds like you&#039;re already aware of it!  Using their own engine might make it a bit smoother than the original, as the jerkiness of turning is my only criticism of the game. -- [[User:Malvineous|Malvineous]] 00:14, 16 October 2011 (GMT)&lt;br /&gt;
&lt;br /&gt;
== Wacky Wheels ==&lt;br /&gt;
&lt;br /&gt;
Basically all of the WW modding information from my website is here now. I moved one page when I realized it should probably be capitalized to match the rest of the pages on this site... you can delete the redirect at [[Wacky Wheels high score files]] if you want to.&lt;br /&gt;
&lt;br /&gt;
Now, I need to remove most of the modding information from my website and refer people here. Then we’ll have reached the glorious future where all WW modding information is in one place. I’m going to keep those two text files of notes on my website though—the information in them is disorganized and I think not 100% accurate, but they might have some information that isn’t here yet.&lt;br /&gt;
&lt;br /&gt;
By the way, how’s Camoto going? I’m planning to use it to make a new WW level, but I won’t have time for it for a few more months. —[[User:Yellowantphil|Yellowantphil]]&lt;br /&gt;
&lt;br /&gt;
: Sounds good!  Thanks for all the effort you&#039;ve put in by moving it across.  I think Wacky Wheels is now the most completely documented game on the wiki!  Also can&#039;t hurt leaving your own info up - sometimes it&#039;s nice to go back to the original source if something is unclear.  Camoto&#039;s going well, but unfortunately I haven&#039;t had much time to work on it over the last few weeks.  You probably won&#039;t be able to make much of a level until I add in the ability to select a tile from the tileset, but that&#039;s in progress and hopefully will be ready by the time you are!  Keep me posted when you do start your level(s?) -- [[User:Malvineous|Malvineous]] 12:22, 2 February 2012 (GMT)&lt;br /&gt;
&lt;br /&gt;
::Well, as I was reading some of the information on my website, I noticed that it isn’t written very well. I wrote those pages back when I had very little experience programming. Anyway, I’m planning to redesign my website soon, and this will save me from having to rewrite a few of those pages.&lt;br /&gt;
&lt;br /&gt;
::The tile editor in Camoto as it is now is still certainly useful—I can add new tile types to a level using a binary editor and then move them around in Camoto. I think that it shouldn’t be too hard to make a new WW level using the Gimp and Camoto plus some binary editing. I recall having some problems with the route editor for the computer players, but I didn’t look into it at the time—I’ll let you know when I’m working with Camoto again, and I’ll try to come up with some useful bug reports or fixes if I run into problems. —[[User:Yellowantphil|Yellowantphil]] 14:06, 2 February 2012 (GMT)&lt;br /&gt;
&lt;br /&gt;
== Catacomb ==&lt;br /&gt;
&lt;br /&gt;
Hey [[User:Malvineous|Malvineous]], do you know anyone who has properly read the [[Inverse_Frequency_Sound_format|Inverse Sound Frequency]] file format and got the sound playing? I&#039;m struggling with some fine details in my game. Sounds play near what they should sound like, but the sound quality is all crackly and some sounds play totally incorrect. I followed a basic [http://web.archive.org/web/20000818033701/http://www.dd.chalmers.se/~f98anga/projects/keen/sounds2raw.c code sample] by Anders Gavare. Does your tool support this? Interested in helping me figure this out? My current code is available at [https://code.google.com/p/cataclone/source/browse/trunk/src/catacomb/catacomb_sound.c catacomb_sound.c] - [[User:Eros|Eros]] 11:57, 5 May 2012 (GMT)&lt;br /&gt;
: Should this be moved to my talk page? - [[User:Eros|Eros]] 11:59, 5 May 2012 (GMT)&lt;br /&gt;
:: Probably best to keep it on my talk page if you want me to respond in a timely manner :-)  I based my old utility off Anders&#039; one too, but it&#039;s been a long time since I looked at the code.  My latest utility doesn&#039;t support sound effects yet.  I know Levellass has written a few utilities to play and edit those sound files, so I think your best bet would probably be to post over at the [http://www.keenmodding.org Keen:Modding] forum.  Do note that PC Speaker effects do sound crackly at the best of times, though!  Also make sure you&#039;ve got the right audio format (8-bit vs 16-bit, signed vs unsigned) - I remember some inconsistencies there causing some very distorted results for me.  I love the name &#039;Cataclone&#039; - does your code compile under Linux? -- [[User:Malvineous|Malvineous]] 13:21, 5 May 2012 (GMT)&lt;br /&gt;
::: I currently compile the code using Code::Blocks with GCC 4.6 -std=gnu99. It *should* compile under Linux. But I haven&#039;t tested that out yet. [[Catacomb]] sounds also have flags attached to each one, It&#039;s not exactly the same specification as what it says @ the [[Inverse_Frequency_Sound_format|Inverse Sound Frequency]] format page. Perhaps the flags would make a difference to the sounds? I have the sound setup @ [https://code.google.com/p/cataclone/source/browse/trunk/src/sound_manager.c sound_manager.c] in the sound_manager_init() method. I use AUDIO_S16 (signed 16-bit) @ 22050 Hz with 2 channels. I have not added support for the priority of the sounds yet, I plan on doing that after I get them playing properly.&lt;br /&gt;
::: I found some information on the [[ROTT]] sound format here: [http://src.gnu-darwin.org/ports/games/rottdc/work/rottdc-1.0-2/rott/_rt_soun.h _rt_soun.h]. This format should be similar to Catacomb as ROTT was developed by [[Apogee]] using the [[Doom]] engine. Here are the flags for the sounds that they define:&lt;br /&gt;
 #define SD_OVERWRITE     0x01&lt;br /&gt;
 #define SD_WRITE         0x02&lt;br /&gt;
 #define SD_LOOP          0x04&lt;br /&gt;
 #define SD_PITCHSHIFTOFF 0x08&lt;br /&gt;
 #define SD_PLAYONCE      0x10&lt;br /&gt;
::: There are also many other sound files for ROTT: [http://src.gnu-darwin.org/ports/games/rottdc/work/rottdc-1.0-2/rott/rt_sound.c], [http://src.gnu-darwin.org/ports/games/rottdc/work/rottdc-1.0-2/rott/rt_sound.h], [http://src.gnu-darwin.org/ports/games/rottdc/work/rottdc-1.0-2/rott/snd_reg.h], [http://src.gnu-darwin.org/ports/games/rottdc/work/rottdc-1.0-2/rott/snd_shar.h], [http://src.gnu-darwin.org/ports/games/rottdc/work/rottdc-1.0-2/rott/sndcards.h]&lt;br /&gt;
:::: I tried it last night and I was able to get it to compile (after a few changes, like using &#039;/&#039; instead of &#039;\&#039; in a couple of #includes) but all I got was a black window and a beep sound, then nothing.  How far advanced is the project?  Should I expect more than that?  I would expect small variations in the file formats between games, but I would be surprised if the core sound data has changed over time. -- [[User:Malvineous|Malvineous]] 02:38, 6 May 2012 (GMT)&lt;br /&gt;
::::: On Windows, you can run around the levels, collide with walls, collect items, etc... I still need to implement monsters, AI and power shots. However, that beep means that the sounds playing. (see line 71 in main.c: catacomb_sounds_play(&amp;quot;foundsound&amp;quot;);). I just committed the catacomb_data.h file. Update it accordingly, you should now see much more than a black screen.&lt;br /&gt;
:::::: Oh wow, that works really well now!  I see what you mean by the sounds.  You might have to output the PCM data to a .wav/.raw file and look at it in a sound editor to see what&#039;s going on.  It sounds like there might be wrapping or something going on.  Also some sounds (like being blocked by a door) play multiple times over the top of themselves.  I guess this is what you meant by priority not being implemented (although maybe you wouldn&#039;t need to handle priority if you can play multiple sounds at the same time, unlike the real PC Speaker.)  One suggestion - if you do decide to support Linux, abstract the calls that open files so that they search for filenames instead - that way you don&#039;t have to rename all the Catacomb files to be uppercase, since Linux has a case-sensitive filesystem and most filenames are usually all lowercase. -- [[User:Malvineous|Malvineous]] 03:42, 6 May 2012 (GMT)&lt;br /&gt;
::::::: I have exported the raw data to a file, then imported the raw data into Audacity using various settings. All of them sound like they do in the game, crackly and sometimes distorted. I really think its some sort of post FX used by the flags. As for files, I&#039;ll code some sort of SafeFileOpen, SafeFileClose functions like the id codebase that open files regardless of case when i get around to implementing the Linux version. - [[User:Eros|Eros]] 03:54, 6 May 2012 (GMT)&lt;br /&gt;
:::::::: If you can e-mail me one of the files (preferably a &#039;quiet&#039; one that&#039;s not supposed to be crackly) I can take a look if you like - malvineous@shikadi.net -- [[User:Malvineous|Malvineous]] 03:57, 6 May 2012 (GMT)&lt;br /&gt;
&lt;br /&gt;
== Merge ==&lt;br /&gt;
&lt;br /&gt;
Is there a way to tag two pages such that it is clear that they should be merged?&lt;br /&gt;
For example, [[Crystal Caves Tileset Format]] describes the same format as [[Duke 1 Tileset Graphics]].[[User:Frenkel|Frenkel]] ([[User talk:Frenkel|talk]]) 21:00, 15 July 2013 (GMT)&lt;br /&gt;
&lt;br /&gt;
: You can mention it on the talk page for one of the articles.  Any suggestions as to what we should call the merged page? -- [[User:Malvineous|Malvineous]] ([[User talk:Malvineous|talk]]) 03:09, 20 July 2013 (GMT)&lt;br /&gt;
&lt;br /&gt;
::Dark Ages is the first game that got released that uses this format, so &#039;&#039;Dark Ages Tileset Format&#039;&#039; could be the name, like all those formats that are named after Commander Keen 1-3.&lt;br /&gt;
::Or we name it after Duke Nukem 1, because that game is probably more popular than Dark Ages, Crystal Caves and Secret Agent, like [[Commander Keen 1-3 Level format]], although Slordax used it before Commander Keen 1-3 did.[[User:Frenkel|Frenkel]] ([[User talk:Frenkel|talk]]) 19:13, 20 July 2013 (GMT)&lt;br /&gt;
&lt;br /&gt;
::: Yes I was thinking along the same lines, naming it after the first game that used the format.  But then the release date doesn&#039;t necessarily indicate which game &amp;quot;invented&amp;quot; the format, if one game took longer to develop and was released late.  I was wondering whether there is a common thread amongst all these games, such as the same programmer or company we could use instead.  In many ways I would prefer a name like &amp;quot;Replogle tileset format&amp;quot; or &amp;quot;Apogee EGA tileset format&amp;quot;.  What do you think? -- [[User:Malvineous|Malvineous]] ([[User talk:Malvineous|talk]]) 23:36, 20 July 2013 (GMT)&lt;br /&gt;
&lt;br /&gt;
:::: I&#039;ve read the [http://www.3drealms.com/news/2006/04/the_apogee_legacy_15.html | Apogee Legacy interview with Peder Jungck] again today. He wrote the ProGraphx Toolbox.&lt;br /&gt;
:::: DN1.EXE contains the string &#039;&#039;Version 1.0 EGA/VGAProGraphx EGA/VGA Toolbox&#039;&#039;,&lt;br /&gt;
:::: CC1.EXE contains the string &#039;&#039;Version 1.5 320x200 PAN EGA/VGAProGraphx EGA/VGA Toolbox&#039;&#039;,&lt;br /&gt;
:::: SAM1.EXE contains the string &#039;&#039;ProGraphx EGA/VGA Toolbox Version 2.0 320x200 EGA/VGA Copyright 1991 by Peder Jungck&#039;&#039; and&lt;br /&gt;
:::: DA3.EXE contains the string &#039;&#039;Version 1.0 EGA/VGAProGraphx EGA/VGA Toolbox&#039;&#039; (DA1.EXE and DA2.exe contain gibberish).&lt;br /&gt;
:::: So I would suggest &#039;&#039;ProGraphx Toolbox tileset format&#039;&#039;. Peder also wrote a book about the toolbox called &#039;&#039;Graphics Programming &amp;amp; Animation: Ultra-Fast Assembly Routines for EGA/VGA Graphics Animation&#039;&#039;. Maybe that book has a better name for the file format. [[User:Frenkel|Frenkel]] ([[User talk:Frenkel|talk]]) 11:03, 21 July 2013 (GMT)&lt;br /&gt;
&lt;br /&gt;
::::: So we know of three different versions of the ProGraphx Toolbox. Dark Ages and Duke Nukem 1 use version 1.0. Each tileset is 8064 bytes long and is in a separate file. Crystal Caves uses version 1.5 and each tileset is 8003 bytes long, but they are all in the same file. Secret Agent uses version 2.0 Each tileset is again 8064 bytes long, they are all in the same file and the file is encrypted. [[User:Frenkel|Frenkel]] ([[User talk:Frenkel|talk]]) 17:00, 28 July 2013 (GMT)&lt;br /&gt;
&lt;br /&gt;
:::::: Thanks for figuring all that out.  I&#039;ve merged the pages and changed the name to [[ProGraphx Toolbox tileset format]] as suggested.  Please feel free to correct anything I have missed. -- [[User:Malvineous|Malvineous]] ([[User talk:Malvineous|talk]]) 02:40, 4 August 2013 (GMT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Guidelines for proper Wiki Editing ==&lt;br /&gt;
Dear Malvineous! Could you post the guidelines (or guide) for proper editing of the Wiki? [[User:The coder|The coder]] ([[User talk:The coder|talk]])&lt;br /&gt;
: Hmm, there isn&#039;t really one, it&#039;s more about finding a similar page and matching the style found there!  Copy and paste works well :-)  There is [[ModdingWiki:Contributing]] but it&#039;s not very detailed. (BTW please put &amp;lt;nowiki&amp;gt;~~~~&amp;lt;/nowiki&amp;gt; at the end of your messages, when you preview the page you will see this gets replaced with your name and the date automatically.) -- [[User:Malvineous|Malvineous]] ([[User talk:Malvineous|talk]]) 21:59, 12 December 2014 (UTC)&lt;br /&gt;
&lt;br /&gt;
== VGFM Music Format ==&lt;br /&gt;
&lt;br /&gt;
Hello, Malvineous!&lt;br /&gt;
&lt;br /&gt;
I accidentally found that [[VGFM Music Format]] is absolutely similar to the [http://www.vgmpf.com/Wiki/index.php?title=MUS_(AdLib) MUS (AdLib)] format which I finished researching yesterday.&lt;br /&gt;
&lt;br /&gt;
And [[VGFM Instrument Format]] is similar to [http://www.vgmpf.com/Wiki/index.php?title=SND_(AdLib) SND (AdLib)].&lt;br /&gt;
&lt;br /&gt;
These formats were developed by Ad Lib Inc, I found the sources and documentation in the Ad Lib developer&#039;s manual downloaded from old BBS board site :)  And these formats are used not only in [[Vinyl Goddess From Mars]] game.&lt;br /&gt;
&lt;br /&gt;
--[[User:Binarymaster|Binarymaster]] ([[User talk:Binarymaster|talk]]) 02:05, 22 January 2015 (UTC)&lt;br /&gt;
&lt;br /&gt;
: Oh wow, what an interesting discovery!!  Do you have any links to the official documentation?  I&#039;d really like to see what else they have to say about the format.  And yes, we should definitely rename the articles here.  What do you think they should be called?  &amp;quot;Ad Lib Music Format&amp;quot; is probably a bit generic given they have a few, like .ROL... -- [[User:Malvineous|Malvineous]] ([[User talk:Malvineous|talk]]) 09:45, 22 January 2015 (UTC)&lt;br /&gt;
:: Here it is: [http://files.mpoli.fi/software/programm/general/adlip.zip adlip.zip] - binaries and source code, probably from Ad Lib Programmer&#039;s Manual. MUS headers are described in CONVERT.C and CONVERT.H files. Fun fact that they also developed another similar format based on MIDI - [http://www.vgmpf.com/Wiki/index.php?title=MDI MDI]. It has similar musical features but stores all data in one file in MIDI format.&lt;br /&gt;
:: Well, I have no idea how to name it better, I think &amp;quot;Ad Lib Music Format&amp;quot; should be suitable for it :) --[[User:Binarymaster|binarymaster]] ([[User talk:Binarymaster|talk]]) 10:30, 22 January 2015 (UTC)&lt;br /&gt;
&lt;br /&gt;
::: Many thanks!!  I&#039;ve updated the article pages with the info I could gain from the source code.  There are still a few unresolved issues (like what exactly the default percussion pitch is) but it has certainly answered a number of questions.  I called it &amp;quot;AdLib MIDI Format&amp;quot; because that&#039;s the name they use in one place in the source code, although it&#039;s not a very descriptive title!  Thanks again for letting me know about this excellent find :-) -- [[User:Malvineous|Malvineous]] ([[User talk:Malvineous|talk]]) 12:48, 24 January 2015 (UTC)&lt;br /&gt;
&lt;br /&gt;
:::: That&#039;s good! I think maybe this format should be named as &amp;quot;AdLib MIDI Format v1.0&amp;quot;, because there is also an improved version of it, probably v2.0 - [http://www.vgmpf.com/Wiki/index.php?title=MDI MDI] (I made a typo in previous posted link), it uses a single file in MIDI format.&lt;br /&gt;
:::: And about [[AdLib Timbre Bank Format]] article - BNK format originally was created in the 1987 with the first release of the [http://www.vgmpf.com/Wiki/index.php?title=AdLib_Visual_Composer AdLib Visual Composer], so actually Ad Lib Inc released its formats in this order:&lt;br /&gt;
:::: &#039;&#039;&#039;1)&#039;&#039;&#039; ROL &amp;amp; BNK (1987, with AdLib Visual Composer)&lt;br /&gt;
:::: &#039;&#039;&#039;2)&#039;&#039;&#039; MUS &amp;amp; SND/TIM (1988, with player and converter)&lt;br /&gt;
:::: &#039;&#039;&#039;3)&#039;&#039;&#039; MDI (1989, also with player and converter)&lt;br /&gt;
:::: Information about third format was placed [http://cd.textfiles.com/soundsensations/MISCPROG/AD-PROG/ here], though the link is not working now.&lt;br /&gt;
:::: --[[User:Binarymaster|binarymaster]] ([[User talk:Binarymaster|talk]]) 13:08, 24 January 2015 (UTC)&lt;br /&gt;
&lt;br /&gt;
::::: Oh wow that&#039;s interesting too.  I think the MUS/SND/TIM format should stay as &amp;quot;AdLib MIDI Format&amp;quot; with no version number, because that file format does have version fields so it&#039;s possible to have v1.0, v2.3, etc. within that format.  The MDI article you linked to actually looks like conventional MIDI with some extra events for setting OPL instruments, so I think this belongs as one of the many backwards-compatible extensions of the [[MID Format]].&lt;br /&gt;
&lt;br /&gt;
::::: With the instrument bank formats that&#039;s really unusual if BNK came first!  It seems very odd for AdLib to produce the SND/TIM format if they already had the more efficient BNK format available.  I was going from the dates in the text files from the programmer&#039;s guide you kindly posted, and bkformat.txt says in Jan 1989 they are in the process of converting their software to use BNK.  Can you confirm there was BNK software earlier than this?  I&#039;m just thinking that Visual Composer may have come out in 1987, but maybe it didn&#039;t get BNK support added until later? -- [[User:Malvineous|Malvineous]] ([[User talk:Malvineous|talk]]) 01:30, 25 January 2015 (UTC)&lt;br /&gt;
&lt;br /&gt;
:::::: Well, I&#039;m sure that first version of Visual Composer was released with AdLib music card, but I don&#039;t know exactly about BNK support. It&#039;s really strange that Ad Lib downgraded the format (BNK is better in structure), but the known formats has converters which converts BNK to X format, but not from X to BNK - this makes sense that BNK was the first format. Also Visual Composer doesn&#039;t support other bank formats, only BNK.&lt;br /&gt;
:::::: BNK creation date 1987 was contributed by [http://www.vgmpf.com/Wiki/index.php?title=User:TheAlmightyGuru Dean Tersigni], I&#039;ll ask him about it.&lt;br /&gt;
&lt;br /&gt;
:::::: Update: I also read information from bkformat.txt, and it seems you&#039;re right :)&lt;br /&gt;
:::::: So actually it was:&lt;br /&gt;
:::::: &#039;&#039;&#039;1)&#039;&#039;&#039; ROL &amp;amp; INS (1987, with AdLib Visual Composer v1.0)&lt;br /&gt;
:::::: &#039;&#039;&#039;2)&#039;&#039;&#039; MUS &amp;amp; SND/TIM (1988, with player and converter)&lt;br /&gt;
:::::: &#039;&#039;&#039;3)&#039;&#039;&#039; BNK (1989, with AdLib Visual Composer v1.5)&lt;br /&gt;
:::::: &#039;&#039;&#039;4)&#039;&#039;&#039; MDI (1989, also with player and converter)&lt;br /&gt;
:::::: Wow, that feel when restored original order of events! :D --[[User:Binarymaster|binarymaster]] ([[User talk:Binarymaster|talk]]) 01:51, 25 January 2015 (UTC)&lt;br /&gt;
&lt;br /&gt;
::::::: That seems to make the most logical sense - there&#039;s a clear improvement with each new format.  I&#039;m glad you agree!  Note that when you say there&#039;s no conversion from &amp;quot;X to BNK&amp;quot; there is BANKMNG.EXE that comes with the programmer&#039;s manual which converts .ins files to .bnk. -- [[User:Malvineous|Malvineous]] ([[User talk:Malvineous|talk]]) 04:09, 25 January 2015 (UTC)&lt;br /&gt;
&lt;br /&gt;
:::::::: True. I forgot about it :) Thanks! --[[User:Binarymaster|binarymaster]] ([[User talk:Binarymaster|talk]]) 12:02, 25 January 2015 (UTC)&lt;/div&gt;</summary>
		<author><name>Binarymaster</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=User_talk:Malvineous&amp;diff=5964</id>
		<title>User talk:Malvineous</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=User_talk:Malvineous&amp;diff=5964"/>
		<updated>2015-01-25T01:53:49Z</updated>

		<summary type="html">&lt;p&gt;Binarymaster: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Wolfenstein 3D -&amp;gt; Wolfenstein 3-D ==&lt;br /&gt;
I&#039;ve corrected the infamous 3D tyop in the names of several Wolf3D-related pages; can you please delete the following ones?&lt;br /&gt;
&lt;br /&gt;
[[:Category:Wolfenstein 3D]] -&amp;gt; Superseded by [[:Category:Wolfenstein 3-D]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[:Image:Wolfenstein_3D.png]] -&amp;gt; Superseded by [[:Image:Wolfenstein_3-D.png]]&lt;br /&gt;
&lt;br /&gt;
Thanks :) --De Zeurkous (zeurkous@zeurcomp.nichten.info), Thu Nov 22 08:18:42 UTC 2007&lt;br /&gt;
&lt;br /&gt;
:Haha, you&#039;ve certainly been busy.  Don&#039;t forget that this wiki isn&#039;t meant to be an encyclopaedia of the games, its main purpose is documenting the file formats and editing tools that can be used with the games, as opposed to how the games behave without any mods, or what they might be called if you forget to change the title screen :-) -- [[User:Malvineous|Malvineous]] 11:14, 22 November 2007 (GMT)&lt;br /&gt;
&lt;br /&gt;
::Nah, I haven&#039;t forgotten. As we&#039;re reinventing the wheel for a semi-virgin wiki, the naming and something static like the cheats seemed like a good place to start :) --De Zeurkous (zeurkous@nichten.info), Thu Nov 22 12:20:04 UTC 2007&lt;br /&gt;
&lt;br /&gt;
== Jill of the Jungle palette ==&lt;br /&gt;
&lt;br /&gt;
Hi, I&#039;m currently working on a level viewer for [[Jill of the Jungle]] (maybe an editor later on). Some of the information I found here has been very useful, but there&#039;s one thing I&#039;m a bit stuck on. On the [[SHA Format]] page it says:&lt;br /&gt;
:&#039;&#039;Each array item contains 4 unsigned bytes, representing CGA, EGA and VGA, respectivley, and then a null value. [...] Each byte maps to the index of a colour in the palette. If there are no colours required, the tile set uses the default colours.&#039;&#039;&lt;br /&gt;
However, it doesn&#039;t say anywhere where the palette can be found. Is it stored in the EXE file? I hope you can help me on this :)&lt;br /&gt;
&lt;br /&gt;
Regards, [[User:Spinal|Spinal]] 13:00, 2 March 2008 (GMT)&lt;br /&gt;
&lt;br /&gt;
:Unfortunately I didn&#039;t write the JotJ SHA page, and I haven&#039;t yet had the time to figure this out.  For Xargon I&#039;ve taken the quick and dirty route and used a screenshot from within DOSBox as the source of the palette, until I can figure out where the palette is located.  If you find this out, don&#039;t forget to update the page! :-) -- [[User:Malvineous|Malvineous]] 22:02, 2 March 2008 (GMT)&lt;br /&gt;
&lt;br /&gt;
::Hey Spinal, sorry, I wrote the [[SHA Format]] page, so that was probably my bad. I wasn&#039;t able to find the palette either. I assume it&#039;s in the .EXE, however I spent a fair bit of time manually mapping it using a Wombat tool (http://www.szevvy.com/node/3). I was also writing a level viewer (initally in XHTML which turned out to be too slow, so then I moved to Flash 9). I tried to email you my findings, but the email bounced. I&#039;m not sure if they were 100% accurat, which is why I never added them to the documentation.&lt;br /&gt;
&lt;br /&gt;
::Hey Malvineous, it seems the Jill - [[DMA Format]] page has been removed. Do you have a log of what happened to it? I&#039;m sure it existed at some point.&lt;br /&gt;
&lt;br /&gt;
::- [[User:dheim|Daniel]] 20:00, 5 March 2008&lt;br /&gt;
&lt;br /&gt;
:::I don&#039;t ever remember seeing a DMA page - certainly there&#039;s nothing in the wiki logs about it being deleted or renamed.  Maybe you started working on it but never got around to saving it?  Or is it one of the Xargon pages that shares the same format as Jill?  (by the way, you can type &amp;lt;nowiki&amp;gt;~~~~&amp;lt;/nowiki&amp;gt; to automatically put in the signature in these messages.) -- [[User:Malvineous|Malvineous]] 11:28, 5 March 2008 (GMT)&lt;br /&gt;
&lt;br /&gt;
::::Sorry, it must have been the stuff in the [[SHA Format]] page that I was thinking of. I may have added the link to the [[DMA Format]] page, and never expanded on it. - [[User:Dheim|Daniel]] 02:46, 6 March 2008 (GMT)&lt;br /&gt;
&lt;br /&gt;
:::::Hi guys. Sorry for the mistake, I mixed up the authors of the SHA and level formats. I&#039;ve written a level viewer in PHP the last week, by using static images instead of getting them from the actual files. This causes some problems for episode 2, which uses a different palette, but besides that it works great :) When everything is done I&#039;ll upload the maps to my server and the tile/object lists to this wiki.&lt;br /&gt;
:::::@Daniel: strange that it bounced, I confirmed my address so it should be working fine... You can mail it to spinal -at- zanderz -dot- net. Also, I saw on your Wombat page that you &amp;quot;have a vague idea of how to do&amp;quot; [[Hocus Pocus]]. Could you share your findings on this wiki? I&#039;d love to make maps, or even a level viewer/editor for that game :) -- [[User:Spinal|Spinal]] 00:32, 8 March 2008 (GMT)&lt;br /&gt;
:Okay, with help of [[User:Dheim|Daniel]] who send me the palette I found it! I&#039;ll put my findings on [[Jill of the Jungle palette]]. -- [[User:Spinal|Spinal]] 15:36, 13 March 2008 (GMT)&lt;br /&gt;
&lt;br /&gt;
== Halloween Harry/Alien Carnage ==&lt;br /&gt;
&lt;br /&gt;
Hi Malvineous. Thanks for your edits on the GMF article! I notice you mentioned there exist versions of the game which don&#039;t require exploding a BNK to get at the game data. What does the directory structure look like for the version you have? I&#039;m working on a map viewer (which will become a map editor at some point) and would like it to be able to work on whatever versions are out there. Thanks for any info. -[[User:Duckthing|Duckthing]] 04:41, 11 December 2010 (GMT)&lt;br /&gt;
&lt;br /&gt;
: Hi Duckthing - no worries, Halloween Harry has long been an interest of mine, but my map editor sadly needs a lot more work before I can begin reverse engineering more file formats so I&#039;m glad you&#039;ve made a start!  AFAIK technically Halloween Harry has no compression, but for whatever reason (probably listed in the Apogee FAQ) they decided to swap episodes 1 and 3, compress the BNK file and then re-release it under the name Alien Carnage.  You can download all available versions (including registered versions since the game was released as freeware in 2007) from [http://www.classicdosgames.com/game/Alien_Carnage.html RGB Classic Games].  BTW not sure if you noticed but I also posted a couple of things on the GMF article&#039;s talk/discussion page. -- [[User:Malvineous|Malvineous]] 06:08, 11 December 2010 (GMT)&lt;br /&gt;
&lt;br /&gt;
:: Thank you! Working with the uncompressed version will keep things less complicated. I did notice the GMF discussion you added, but haven&#039;t had a chance to really go through it yet. -- [[User:Duckthing|Duckthing]] 06:41, 11 December 2010 (GMT)&lt;br /&gt;
&lt;br /&gt;
::: No worries.  If you&#039;re running Linux or MacOSX you should be able to compile [[Camoto|libgamearchive]] which will let you copy files in and out of the BNK files.  This is a library so it&#039;s also possible to use it in your own program for accessing and editing the map files while they&#039;re still inside the BNK, for instance.  (BTW the &#039;minor&#039; tickbox should only be used when the edit does not affect the information on the page - e.g. fixing a typo or a broken URL.  If you are changing the actual content on a page it is never a minor edit!) -- [[User:Malvineous|Malvineous]] 07:51, 11 December 2010 (GMT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Dangerous Dave ==&lt;br /&gt;
&lt;br /&gt;
Working on this, does anyone have any info on the formats? The EGA graphics are 84KB and external, but CGA and VGA graphics unrelated to them are in the 174KB executable, apparently uncompressed, I don&#039;t know how this is possible. I&#039;ve found the levels and partially reverse engineered the format (The first 1000 bytes, a 100x10 array of tiles.) but each level is followed by ~280 bytes of variable and unknown data I assume is sprites. I have a list of internal files in the executable, looks like most of it is non-game code. Any help would be appreciated. -[[User:Levellass|Endian? What are you on about?]] 06:03, 12 December 2010 (GMT)&lt;br /&gt;
&lt;br /&gt;
: Hmm, interesting.  All I can suggest for the levels is - as you&#039;re probably already familiar with - changing the values in a hex editor then loading the game to see what happens.  I would suspect that all the graphics would be in a similar format, so if there are any headers or structures used in the EGA graphics files perhaps they&#039;re duplicated for CGA/VGA?  Also John Romero seems pretty accessible, perhaps you could ask him directly?  Failing that, randomly writing data into the .exe until the images change could be used as a last resort! -- [[User:Malvineous|Malvineous]] 12:09, 12 December 2010 (GMT)&lt;br /&gt;
&lt;br /&gt;
: Ha, that was easier than I expected - uncompressed VGA data is easy to find with a good hex editor ;-)  [http://www.shikadi.net/pics/ddave-vga-hexdump.png This looks like it] -- [[User:Malvineous|Malvineous]] 12:17, 12 December 2010 (GMT)&lt;br /&gt;
&lt;br /&gt;
: Ok that was only the menu graphics.  At offset 0xC629 there&#039;s some sort of offset table which looks very similar to the contents of EGADAVE.DAV but there are extra bytes dotted all over the place - perhaps it&#039;s RLE encoded?  Actually just before that there&#039;s the number 0x6CAA.  If you go a bit less than 0x6CAA bytes after this you end up with another table, which to me suggests that 0x6CAA is the decompressed size of that first table. -- [[User:Malvineous|Malvineous]] 13:01, 12 December 2010 (GMT)&lt;br /&gt;
&lt;br /&gt;
:If I remember it correctly, the VGA sprites and tiles are RLE compressed and it&#039;s not too hard to decompress them. The positions of the enemies in the levels on the other hand are still a mystery to me. [[User:Calvero|Calvero]] 20:43, 12 December 2010 (GMT)&lt;br /&gt;
&lt;br /&gt;
: Looking at the levels, which directly follow the VGA palette, they seem to contain 256 bytes of header data, then the 100x10 tiles, then eight bytes of lead-out data.  Then the next level&#039;s 256 bytes of header, 100x10 tiles, then eight bytes of lead-out.  Although I say &amp;quot;level&amp;quot;, the first &amp;quot;level&amp;quot; seems to contain both level 1 and 2, and this seems to be the way it works in the game - in some levels you can see through to others.  I&#039;m not sure what the 256 bytes of header data are for, but some levels have FF FF 00 00 repeated which seems to indicate two uint16 fields which are blanked out for those levels. -- [[User:Malvineous|Malvineous]] 13:15, 13 December 2010 (GMT)&lt;br /&gt;
&lt;br /&gt;
::First up, levels; where does level 1 start? It&#039;s possible I&#039;m reading the start of a level as the previous level&#039;s end, I looked for the start of tile data, which I assumed, like Keen 1, would be the level start.&lt;br /&gt;
&lt;br /&gt;
::Next, palette; I&#039;m assuming, as you said, it is located just before the level data?&lt;br /&gt;
&lt;br /&gt;
::There is VGA and CGA graphics in the executable, plus headers, but the bulk of graphics for CGA and VGA I haven&#039;t been able to locate. If the data is RLE compressed I should think it would use either Keen 1-3 fullscreen or Jazz Jackrabbit tile RLE, both of which I know well. I&#039;ll look into both of these options, cheers! -[[User:Levellass|Endian? What are you on about?]] 12:03, 20 December 2010 (GMT)&lt;br /&gt;
&lt;br /&gt;
:::I&#039;ve found the VGA and CGA data for the menu graphics.  It looks like the CGA data is stored in a series of 1-bit-per-pixel (monochrome) images.  Or it could be EGA data with the planes split out (e.g. red plane for all images, then green plane for all images, etc.)  I think I found three planes which means it&#039;s probably EGA, as CGA would have a max of two planes.  I&#039;ve also found the font graphics, this looks like 4bpp/16 colour EGA data.  Haven&#039;t seen level graphics yet.  I&#039;ve successfully modded the levels with a hex editor (putting the jetpack everywhere) so now I&#039;ve finally looked at all the levels!  The creatures are definitely not stored in the 100x10 tile data.  Putting random bytes in there revealed that the values are indices into the image files, because if you put the value in for fire it will animate, and the following three or so values show up as still frames from the fire animation.&lt;br /&gt;
&lt;br /&gt;
:::The VGA palette starts at 0x26B0A (I updated the main DDave page with this) + 768 bytes leads straight onto the start of level 1 at 0x26E0A.  So at 0x26E0A there are 256 bytes of data, then 100x10 tiles, then 24 bytes of footer data.  Some of this data (perhaps footer data) might be the level start coordinates, because Dave doesn&#039;t always start the level at the same place (e.g. the warp level when you climb the tree on level 5 and jump off the edge of the screen.) -- [[User:Malvineous|Malvineous]] 12:24, 20 December 2010 (GMT)&lt;br /&gt;
&lt;br /&gt;
:::I think I&#039;ve found all the files so far, I&#039;ve updated [[Dangerous Dave]] with the offsets of the files, including what appears to be CGA and VGA tiles.  I&#039;m not sure what sort of format they&#039;re in though, it looks like they might be compressed (and so the offsets in that list might be off by ~4, as I may have cut off the decompressed-size field.)  I&#039;ve also updated the map format page, I think it&#039;s pretty much fully reverse engineered now. -- [[User:Malvineous|Malvineous]] 05:13, 21 December 2010 (GMT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Noahs Ark 3D and IMFs ==&lt;br /&gt;
&lt;br /&gt;
Been poking around Noah&#039;s Ark 3D, an adaption of the Wolfenstein game and found a few interesting things which I&#039;m hoping to confirm.&lt;br /&gt;
&lt;br /&gt;
First, the game uses MID files, not IMF files for music, second, the MIDI files have an extra word at the start of the file giving the file length. Third, the code uses the first word of the midi file as the length of data to read from the file and put into memory to play. After poking around a bit in Wolfenstein and Keen I believe this is the same with IMF files, that is, ALL IMF files are type 0 as it were and the type 1s are read just like type 0s by the games (The first word is read as the amount of IMF data to copy into memory to play, this is then read as type 0.) I&#039;m not quite sure what this does for the two types since type 1 is would essentially be a type 0 with a header and footer that are part of the AUDIO.xxx format, much like PC\adlib sounds can have the huffman lengths at the start. Are there any games that use &#039;individual&#039; type 1 IMFs (Even if included as part of a group file. All I&#039;ve seen are games like cosmo, where non-AUDIO IMFs are type 0.)&lt;br /&gt;
&lt;br /&gt;
Should there be a Noah&#039;s Ark 3D page and should we add the midi note to the AUDIO format page? It seems that the format can hold any type of music file the game can read, not just IMFs.  -- Levellass&lt;br /&gt;
&lt;br /&gt;
: Yes it is known that the type-1 header might really be part of the AUDIO.xxx format but alas there were many type-1 files floating around the place (incorrectly extracted, you could argue) before this was realised, so the format variant is here to stay.  It does have some advantages though (like tagging files with the song title) but I&#039;m not sure whether anyone has figured out definitively whether the header (and footer, in the case of the Wolf3D files) belongs to the IMF or the AUDIO file.  I guess you&#039;d have to browse the game source code and see how the game uses the data to know for sure.&lt;br /&gt;
&lt;br /&gt;
: As far as the MIDI goes, I believe the AUDIO.xxx file is just a container file like any other, capable of supporting any data at all.  It&#039;s up to the game to decide how to use it.  If anything this makes me think it would fit better if the AUDIO.xxx article was merely documenting the structure, with links to actual audio formats like PC SFX, Adlib SFX, IMF and MIDI and notes about which games make use of which formats.&lt;br /&gt;
&lt;br /&gt;
: Oh and yes, by all means create a page for the new game. -- [[User:Malvineous|Malvineous]] 08:41, 3 February 2011 (GMT)&lt;br /&gt;
&lt;br /&gt;
== Sound Files category ==&lt;br /&gt;
&lt;br /&gt;
I don’t know why there’s a Sound Files category and also an Audio Files category... it seems redundant. I left those categories the way they are though.&lt;br /&gt;
&lt;br /&gt;
Also, the [[File format data types]] page needs some signed ints, but I didn’t know what naming convention you wanted to use. I described something as an [[INT16LE]] on [[BMC Format]]. [[User:Yellowantphil|Yellowantphil]] 20:12, 11 September 2011 (GMT)&lt;br /&gt;
&lt;br /&gt;
: Not sure about the Sound vs Audio - I use the term &#039;audio&#039; to mean both sound and music, but you&#039;re right, if there are separate sound and music categories we don&#039;t really need an audio one as well.  Feel free to update.  [[INT16LE]] is perfectly fine too!  I added a note to the data types page. -- [[User:Malvineous|Malvineous]] 22:30, 11 September 2011 (GMT)&lt;br /&gt;
&lt;br /&gt;
== GamePage template ==&lt;br /&gt;
&lt;br /&gt;
Should the GamePage template add the page to its own category? It seems a little odd that [[Wacky Wheels]] is not in the Wacky Wheels category. [[User:Yellowantphil|Yellowantphil]] 04:51, 16 September 2011 (GMT)&lt;br /&gt;
: I decided against this because there is a link to the game&#039;s page in the category intro at the top of the page.  It seemed unnecessary having another link in amongst all the other pages.  This was also because the game page was really only meant to be a summary, there wasn&#039;t supposed to be a huge amount of detail on it, only links to other pages with the detail (which then would appear in the category list.)  I would imagine that, eventually, [[Wacky Wheels]] would be tweaked to move a lot of the content onto subpages. -- [[User:Malvineous|Malvineous]] 12:58, 16 September 2011 (GMT)&lt;br /&gt;
&lt;br /&gt;
== Scope of the wiki ==&lt;br /&gt;
&lt;br /&gt;
I don’t know how extensive you want the information to be on ModdingWiki... I added a few lists of audio and graphics files a while ago, and there will probably be other information that I’ll find out that’s potentially helpful for level editing but not directly related to it. I can move some information to my website if it starts to become out of scope for your wiki. I also sometimes end up documenting everything imaginable... there’s some minutiae on my website and possibly on your wiki that I ought to go through and delete. [[User:Yellowantphil|Yellowantphil]] 05:28, 10 October 2011 (GMT)&lt;br /&gt;
&lt;br /&gt;
:Hmm, that&#039;s a difficult one - I&#039;m always in favour of documenting more rather than less.  Generally speaking if it&#039;s related to a game and it would help either a programmer writing a utility or a someone trying to change a game manually then it should be documented.  About the only thing that comes to mind that&#039;s over documenting is when some small calculation is expressed in a couple of different programming languages, but I&#039;ve left that in so people can just copy it rather than trying to figure it out from the text.  But the [[Wacky Wheels]] page is probably the gold standard for what all wiki pages should look like :-)  Do you have anything in particular you&#039;re unsure of whether it would fit here? -- [[User:Malvineous|Malvineous]] 10:07, 10 October 2011 (GMT)&lt;br /&gt;
&lt;br /&gt;
::I was mainly thinking of the list of VOC files on [[Wacky Wheels Music and Sound Effects]] and the list of &amp;lt;tt&amp;gt;*.sp&amp;lt;/tt&amp;gt; files on [[Wacky Wheels Graphics Formats]]. I have an expanded list of the &amp;lt;tt&amp;gt;*.sp&amp;lt;/tt&amp;gt; files on my computer but it isn’t finished yet. I guess there isn’t all that much more Wacky Wheels information to be added to this wiki though. There is still some modding information on my website that ought to be moved over here, so that would take up another page or two. I’ve been lazy about doing Wacky Wheels stuff lately, but I might find some time for it this weekend.&lt;br /&gt;
&lt;br /&gt;
::By the way, I guess that guy from Cascadia Games emailed you. It’s pretty interesting that WW might become an iPhone app. He told me that he was going to be using his own game engine, which sounds a lot easier than trying to get a hold of the WW source code and porting it. —[[User:Yellowantphil|Yellowantphil]] 16:46, 15 October 2011 (GMT)&lt;br /&gt;
&lt;br /&gt;
::: I was going to say the list of VOCs might be overkill, but then the list of .sp files might be useful.  To be honest, it&#039;s the sort of thing that you could probably omit if you were feeling lazy, but likewise I don&#039;t mind at all if you choose to include it, so since it&#039;s already there I&#039;m happy to keep it.&lt;br /&gt;
&lt;br /&gt;
::: Yes I did get an e-mail from Cascadia, I was going to pass along your details but it sounds like you&#039;re already aware of it!  Using their own engine might make it a bit smoother than the original, as the jerkiness of turning is my only criticism of the game. -- [[User:Malvineous|Malvineous]] 00:14, 16 October 2011 (GMT)&lt;br /&gt;
&lt;br /&gt;
== Wacky Wheels ==&lt;br /&gt;
&lt;br /&gt;
Basically all of the WW modding information from my website is here now. I moved one page when I realized it should probably be capitalized to match the rest of the pages on this site... you can delete the redirect at [[Wacky Wheels high score files]] if you want to.&lt;br /&gt;
&lt;br /&gt;
Now, I need to remove most of the modding information from my website and refer people here. Then we’ll have reached the glorious future where all WW modding information is in one place. I’m going to keep those two text files of notes on my website though—the information in them is disorganized and I think not 100% accurate, but they might have some information that isn’t here yet.&lt;br /&gt;
&lt;br /&gt;
By the way, how’s Camoto going? I’m planning to use it to make a new WW level, but I won’t have time for it for a few more months. —[[User:Yellowantphil|Yellowantphil]]&lt;br /&gt;
&lt;br /&gt;
: Sounds good!  Thanks for all the effort you&#039;ve put in by moving it across.  I think Wacky Wheels is now the most completely documented game on the wiki!  Also can&#039;t hurt leaving your own info up - sometimes it&#039;s nice to go back to the original source if something is unclear.  Camoto&#039;s going well, but unfortunately I haven&#039;t had much time to work on it over the last few weeks.  You probably won&#039;t be able to make much of a level until I add in the ability to select a tile from the tileset, but that&#039;s in progress and hopefully will be ready by the time you are!  Keep me posted when you do start your level(s?) -- [[User:Malvineous|Malvineous]] 12:22, 2 February 2012 (GMT)&lt;br /&gt;
&lt;br /&gt;
::Well, as I was reading some of the information on my website, I noticed that it isn’t written very well. I wrote those pages back when I had very little experience programming. Anyway, I’m planning to redesign my website soon, and this will save me from having to rewrite a few of those pages.&lt;br /&gt;
&lt;br /&gt;
::The tile editor in Camoto as it is now is still certainly useful—I can add new tile types to a level using a binary editor and then move them around in Camoto. I think that it shouldn’t be too hard to make a new WW level using the Gimp and Camoto plus some binary editing. I recall having some problems with the route editor for the computer players, but I didn’t look into it at the time—I’ll let you know when I’m working with Camoto again, and I’ll try to come up with some useful bug reports or fixes if I run into problems. —[[User:Yellowantphil|Yellowantphil]] 14:06, 2 February 2012 (GMT)&lt;br /&gt;
&lt;br /&gt;
== Catacomb ==&lt;br /&gt;
&lt;br /&gt;
Hey [[User:Malvineous|Malvineous]], do you know anyone who has properly read the [[Inverse_Frequency_Sound_format|Inverse Sound Frequency]] file format and got the sound playing? I&#039;m struggling with some fine details in my game. Sounds play near what they should sound like, but the sound quality is all crackly and some sounds play totally incorrect. I followed a basic [http://web.archive.org/web/20000818033701/http://www.dd.chalmers.se/~f98anga/projects/keen/sounds2raw.c code sample] by Anders Gavare. Does your tool support this? Interested in helping me figure this out? My current code is available at [https://code.google.com/p/cataclone/source/browse/trunk/src/catacomb/catacomb_sound.c catacomb_sound.c] - [[User:Eros|Eros]] 11:57, 5 May 2012 (GMT)&lt;br /&gt;
: Should this be moved to my talk page? - [[User:Eros|Eros]] 11:59, 5 May 2012 (GMT)&lt;br /&gt;
:: Probably best to keep it on my talk page if you want me to respond in a timely manner :-)  I based my old utility off Anders&#039; one too, but it&#039;s been a long time since I looked at the code.  My latest utility doesn&#039;t support sound effects yet.  I know Levellass has written a few utilities to play and edit those sound files, so I think your best bet would probably be to post over at the [http://www.keenmodding.org Keen:Modding] forum.  Do note that PC Speaker effects do sound crackly at the best of times, though!  Also make sure you&#039;ve got the right audio format (8-bit vs 16-bit, signed vs unsigned) - I remember some inconsistencies there causing some very distorted results for me.  I love the name &#039;Cataclone&#039; - does your code compile under Linux? -- [[User:Malvineous|Malvineous]] 13:21, 5 May 2012 (GMT)&lt;br /&gt;
::: I currently compile the code using Code::Blocks with GCC 4.6 -std=gnu99. It *should* compile under Linux. But I haven&#039;t tested that out yet. [[Catacomb]] sounds also have flags attached to each one, It&#039;s not exactly the same specification as what it says @ the [[Inverse_Frequency_Sound_format|Inverse Sound Frequency]] format page. Perhaps the flags would make a difference to the sounds? I have the sound setup @ [https://code.google.com/p/cataclone/source/browse/trunk/src/sound_manager.c sound_manager.c] in the sound_manager_init() method. I use AUDIO_S16 (signed 16-bit) @ 22050 Hz with 2 channels. I have not added support for the priority of the sounds yet, I plan on doing that after I get them playing properly.&lt;br /&gt;
::: I found some information on the [[ROTT]] sound format here: [http://src.gnu-darwin.org/ports/games/rottdc/work/rottdc-1.0-2/rott/_rt_soun.h _rt_soun.h]. This format should be similar to Catacomb as ROTT was developed by [[Apogee]] using the [[Doom]] engine. Here are the flags for the sounds that they define:&lt;br /&gt;
 #define SD_OVERWRITE     0x01&lt;br /&gt;
 #define SD_WRITE         0x02&lt;br /&gt;
 #define SD_LOOP          0x04&lt;br /&gt;
 #define SD_PITCHSHIFTOFF 0x08&lt;br /&gt;
 #define SD_PLAYONCE      0x10&lt;br /&gt;
::: There are also many other sound files for ROTT: [http://src.gnu-darwin.org/ports/games/rottdc/work/rottdc-1.0-2/rott/rt_sound.c], [http://src.gnu-darwin.org/ports/games/rottdc/work/rottdc-1.0-2/rott/rt_sound.h], [http://src.gnu-darwin.org/ports/games/rottdc/work/rottdc-1.0-2/rott/snd_reg.h], [http://src.gnu-darwin.org/ports/games/rottdc/work/rottdc-1.0-2/rott/snd_shar.h], [http://src.gnu-darwin.org/ports/games/rottdc/work/rottdc-1.0-2/rott/sndcards.h]&lt;br /&gt;
:::: I tried it last night and I was able to get it to compile (after a few changes, like using &#039;/&#039; instead of &#039;\&#039; in a couple of #includes) but all I got was a black window and a beep sound, then nothing.  How far advanced is the project?  Should I expect more than that?  I would expect small variations in the file formats between games, but I would be surprised if the core sound data has changed over time. -- [[User:Malvineous|Malvineous]] 02:38, 6 May 2012 (GMT)&lt;br /&gt;
::::: On Windows, you can run around the levels, collide with walls, collect items, etc... I still need to implement monsters, AI and power shots. However, that beep means that the sounds playing. (see line 71 in main.c: catacomb_sounds_play(&amp;quot;foundsound&amp;quot;);). I just committed the catacomb_data.h file. Update it accordingly, you should now see much more than a black screen.&lt;br /&gt;
:::::: Oh wow, that works really well now!  I see what you mean by the sounds.  You might have to output the PCM data to a .wav/.raw file and look at it in a sound editor to see what&#039;s going on.  It sounds like there might be wrapping or something going on.  Also some sounds (like being blocked by a door) play multiple times over the top of themselves.  I guess this is what you meant by priority not being implemented (although maybe you wouldn&#039;t need to handle priority if you can play multiple sounds at the same time, unlike the real PC Speaker.)  One suggestion - if you do decide to support Linux, abstract the calls that open files so that they search for filenames instead - that way you don&#039;t have to rename all the Catacomb files to be uppercase, since Linux has a case-sensitive filesystem and most filenames are usually all lowercase. -- [[User:Malvineous|Malvineous]] 03:42, 6 May 2012 (GMT)&lt;br /&gt;
::::::: I have exported the raw data to a file, then imported the raw data into Audacity using various settings. All of them sound like they do in the game, crackly and sometimes distorted. I really think its some sort of post FX used by the flags. As for files, I&#039;ll code some sort of SafeFileOpen, SafeFileClose functions like the id codebase that open files regardless of case when i get around to implementing the Linux version. - [[User:Eros|Eros]] 03:54, 6 May 2012 (GMT)&lt;br /&gt;
:::::::: If you can e-mail me one of the files (preferably a &#039;quiet&#039; one that&#039;s not supposed to be crackly) I can take a look if you like - malvineous@shikadi.net -- [[User:Malvineous|Malvineous]] 03:57, 6 May 2012 (GMT)&lt;br /&gt;
&lt;br /&gt;
== Merge ==&lt;br /&gt;
&lt;br /&gt;
Is there a way to tag two pages such that it is clear that they should be merged?&lt;br /&gt;
For example, [[Crystal Caves Tileset Format]] describes the same format as [[Duke 1 Tileset Graphics]].[[User:Frenkel|Frenkel]] ([[User talk:Frenkel|talk]]) 21:00, 15 July 2013 (GMT)&lt;br /&gt;
&lt;br /&gt;
: You can mention it on the talk page for one of the articles.  Any suggestions as to what we should call the merged page? -- [[User:Malvineous|Malvineous]] ([[User talk:Malvineous|talk]]) 03:09, 20 July 2013 (GMT)&lt;br /&gt;
&lt;br /&gt;
::Dark Ages is the first game that got released that uses this format, so &#039;&#039;Dark Ages Tileset Format&#039;&#039; could be the name, like all those formats that are named after Commander Keen 1-3.&lt;br /&gt;
::Or we name it after Duke Nukem 1, because that game is probably more popular than Dark Ages, Crystal Caves and Secret Agent, like [[Commander Keen 1-3 Level format]], although Slordax used it before Commander Keen 1-3 did.[[User:Frenkel|Frenkel]] ([[User talk:Frenkel|talk]]) 19:13, 20 July 2013 (GMT)&lt;br /&gt;
&lt;br /&gt;
::: Yes I was thinking along the same lines, naming it after the first game that used the format.  But then the release date doesn&#039;t necessarily indicate which game &amp;quot;invented&amp;quot; the format, if one game took longer to develop and was released late.  I was wondering whether there is a common thread amongst all these games, such as the same programmer or company we could use instead.  In many ways I would prefer a name like &amp;quot;Replogle tileset format&amp;quot; or &amp;quot;Apogee EGA tileset format&amp;quot;.  What do you think? -- [[User:Malvineous|Malvineous]] ([[User talk:Malvineous|talk]]) 23:36, 20 July 2013 (GMT)&lt;br /&gt;
&lt;br /&gt;
:::: I&#039;ve read the [http://www.3drealms.com/news/2006/04/the_apogee_legacy_15.html | Apogee Legacy interview with Peder Jungck] again today. He wrote the ProGraphx Toolbox.&lt;br /&gt;
:::: DN1.EXE contains the string &#039;&#039;Version 1.0 EGA/VGAProGraphx EGA/VGA Toolbox&#039;&#039;,&lt;br /&gt;
:::: CC1.EXE contains the string &#039;&#039;Version 1.5 320x200 PAN EGA/VGAProGraphx EGA/VGA Toolbox&#039;&#039;,&lt;br /&gt;
:::: SAM1.EXE contains the string &#039;&#039;ProGraphx EGA/VGA Toolbox Version 2.0 320x200 EGA/VGA Copyright 1991 by Peder Jungck&#039;&#039; and&lt;br /&gt;
:::: DA3.EXE contains the string &#039;&#039;Version 1.0 EGA/VGAProGraphx EGA/VGA Toolbox&#039;&#039; (DA1.EXE and DA2.exe contain gibberish).&lt;br /&gt;
:::: So I would suggest &#039;&#039;ProGraphx Toolbox tileset format&#039;&#039;. Peder also wrote a book about the toolbox called &#039;&#039;Graphics Programming &amp;amp; Animation: Ultra-Fast Assembly Routines for EGA/VGA Graphics Animation&#039;&#039;. Maybe that book has a better name for the file format. [[User:Frenkel|Frenkel]] ([[User talk:Frenkel|talk]]) 11:03, 21 July 2013 (GMT)&lt;br /&gt;
&lt;br /&gt;
::::: So we know of three different versions of the ProGraphx Toolbox. Dark Ages and Duke Nukem 1 use version 1.0. Each tileset is 8064 bytes long and is in a separate file. Crystal Caves uses version 1.5 and each tileset is 8003 bytes long, but they are all in the same file. Secret Agent uses version 2.0 Each tileset is again 8064 bytes long, they are all in the same file and the file is encrypted. [[User:Frenkel|Frenkel]] ([[User talk:Frenkel|talk]]) 17:00, 28 July 2013 (GMT)&lt;br /&gt;
&lt;br /&gt;
:::::: Thanks for figuring all that out.  I&#039;ve merged the pages and changed the name to [[ProGraphx Toolbox tileset format]] as suggested.  Please feel free to correct anything I have missed. -- [[User:Malvineous|Malvineous]] ([[User talk:Malvineous|talk]]) 02:40, 4 August 2013 (GMT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Guidelines for proper Wiki Editing ==&lt;br /&gt;
Dear Malvineous! Could you post the guidelines (or guide) for proper editing of the Wiki? [[User:The coder|The coder]] ([[User talk:The coder|talk]])&lt;br /&gt;
: Hmm, there isn&#039;t really one, it&#039;s more about finding a similar page and matching the style found there!  Copy and paste works well :-)  There is [[ModdingWiki:Contributing]] but it&#039;s not very detailed. (BTW please put &amp;lt;nowiki&amp;gt;~~~~&amp;lt;/nowiki&amp;gt; at the end of your messages, when you preview the page you will see this gets replaced with your name and the date automatically.) -- [[User:Malvineous|Malvineous]] ([[User talk:Malvineous|talk]]) 21:59, 12 December 2014 (UTC)&lt;br /&gt;
&lt;br /&gt;
== VGFM Music Format ==&lt;br /&gt;
&lt;br /&gt;
Hello, Malvineous!&lt;br /&gt;
&lt;br /&gt;
I accidentally found that [[VGFM Music Format]] is absolutely similar to the [http://www.vgmpf.com/Wiki/index.php?title=MUS_(AdLib) MUS (AdLib)] format which I finished researching yesterday.&lt;br /&gt;
&lt;br /&gt;
And [[VGFM Instrument Format]] is similar to [http://www.vgmpf.com/Wiki/index.php?title=SND_(AdLib) SND (AdLib)].&lt;br /&gt;
&lt;br /&gt;
These formats were developed by Ad Lib Inc, I found the sources and documentation in the Ad Lib developer&#039;s manual downloaded from old BBS board site :)  And these formats are used not only in [[Vinyl Goddess From Mars]] game.&lt;br /&gt;
&lt;br /&gt;
--[[User:Binarymaster|Binarymaster]] ([[User talk:Binarymaster|talk]]) 02:05, 22 January 2015 (UTC)&lt;br /&gt;
&lt;br /&gt;
: Oh wow, what an interesting discovery!!  Do you have any links to the official documentation?  I&#039;d really like to see what else they have to say about the format.  And yes, we should definitely rename the articles here.  What do you think they should be called?  &amp;quot;Ad Lib Music Format&amp;quot; is probably a bit generic given they have a few, like .ROL... -- [[User:Malvineous|Malvineous]] ([[User talk:Malvineous|talk]]) 09:45, 22 January 2015 (UTC)&lt;br /&gt;
:: Here it is: [http://files.mpoli.fi/software/programm/general/adlip.zip adlip.zip] - binaries and source code, probably from Ad Lib Programmer&#039;s Manual. MUS headers are described in CONVERT.C and CONVERT.H files. Fun fact that they also developed another similar format based on MIDI - [http://www.vgmpf.com/Wiki/index.php?title=MDI MDI]. It has similar musical features but stores all data in one file in MIDI format.&lt;br /&gt;
:: Well, I have no idea how to name it better, I think &amp;quot;Ad Lib Music Format&amp;quot; should be suitable for it :) --[[User:Binarymaster|binarymaster]] ([[User talk:Binarymaster|talk]]) 10:30, 22 January 2015 (UTC)&lt;br /&gt;
&lt;br /&gt;
::: Many thanks!!  I&#039;ve updated the article pages with the info I could gain from the source code.  There are still a few unresolved issues (like what exactly the default percussion pitch is) but it has certainly answered a number of questions.  I called it &amp;quot;AdLib MIDI Format&amp;quot; because that&#039;s the name they use in one place in the source code, although it&#039;s not a very descriptive title!  Thanks again for letting me know about this excellent find :-) -- [[User:Malvineous|Malvineous]] ([[User talk:Malvineous|talk]]) 12:48, 24 January 2015 (UTC)&lt;br /&gt;
&lt;br /&gt;
:::: That&#039;s good! I think maybe this format should be named as &amp;quot;AdLib MIDI Format v1.0&amp;quot;, because there is also an improved version of it, probably v2.0 - [http://www.vgmpf.com/Wiki/index.php?title=MDI MDI] (I made a typo in previous posted link), it uses a single file in MIDI format.&lt;br /&gt;
:::: And about [[AdLib Timbre Bank Format]] article - BNK format originally was created in the 1987 with the first release of the [http://www.vgmpf.com/Wiki/index.php?title=AdLib_Visual_Composer AdLib Visual Composer], so actually Ad Lib Inc released its formats in this order:&lt;br /&gt;
:::: &#039;&#039;&#039;1)&#039;&#039;&#039; ROL &amp;amp; BNK (1987, with AdLib Visual Composer)&lt;br /&gt;
:::: &#039;&#039;&#039;2)&#039;&#039;&#039; MUS &amp;amp; SND/TIM (1988, with player and converter)&lt;br /&gt;
:::: &#039;&#039;&#039;3)&#039;&#039;&#039; MDI (1989, also with player and converter)&lt;br /&gt;
:::: Information about third format was placed [http://cd.textfiles.com/soundsensations/MISCPROG/AD-PROG/ here], though the link is not working now.&lt;br /&gt;
:::: --[[User:Binarymaster|binarymaster]] ([[User talk:Binarymaster|talk]]) 13:08, 24 January 2015 (UTC)&lt;br /&gt;
&lt;br /&gt;
::::: Oh wow that&#039;s interesting too.  I think the MUS/SND/TIM format should stay as &amp;quot;AdLib MIDI Format&amp;quot; with no version number, because that file format does have version fields so it&#039;s possible to have v1.0, v2.3, etc. within that format.  The MDI article you linked to actually looks like conventional MIDI with some extra events for setting OPL instruments, so I think this belongs as one of the many backwards-compatible extensions of the [[MID Format]].&lt;br /&gt;
&lt;br /&gt;
::::: With the instrument bank formats that&#039;s really unusual if BNK came first!  It seems very odd for AdLib to produce the SND/TIM format if they already had the more efficient BNK format available.  I was going from the dates in the text files from the programmer&#039;s guide you kindly posted, and bkformat.txt says in Jan 1989 they are in the process of converting their software to use BNK.  Can you confirm there was BNK software earlier than this?  I&#039;m just thinking that Visual Composer may have come out in 1987, but maybe it didn&#039;t get BNK support added until later? -- [[User:Malvineous|Malvineous]] ([[User talk:Malvineous|talk]]) 01:30, 25 January 2015 (UTC)&lt;br /&gt;
&lt;br /&gt;
:::::: Well, I&#039;m sure that first version of Visual Composer was released with AdLib music card, but I don&#039;t know exactly about BNK support. It&#039;s really strange that Ad Lib downgraded the format (BNK is better in structure), but the known formats has converters which converts BNK to X format, but not from X to BNK - this makes sense that BNK was the first format. Also Visual Composer doesn&#039;t support other bank formats, only BNK.&lt;br /&gt;
:::::: BNK creation date 1987 was contributed by [http://www.vgmpf.com/Wiki/index.php?title=User:TheAlmightyGuru Dean Tersigni], I&#039;ll ask him about it.&lt;br /&gt;
&lt;br /&gt;
:::::: Update: I also read information from bkformat.txt, and it seems you&#039;re right :)&lt;br /&gt;
:::::: So actually it was:&lt;br /&gt;
:::::: &#039;&#039;&#039;1)&#039;&#039;&#039; ROL &amp;amp; INS (1987, with AdLib Visual Composer v1.0)&lt;br /&gt;
:::::: &#039;&#039;&#039;2)&#039;&#039;&#039; MUS &amp;amp; SND/TIM (1988, with player and converter)&lt;br /&gt;
:::::: &#039;&#039;&#039;3)&#039;&#039;&#039; BNK (1989, with AdLib Visual Composer v1.5)&lt;br /&gt;
:::::: &#039;&#039;&#039;4)&#039;&#039;&#039; MDI (1989, also with player and converter)&lt;br /&gt;
:::::: Wow, that feel when restored original order of events! :D --[[User:Binarymaster|binarymaster]] ([[User talk:Binarymaster|talk]]) 01:51, 25 January 2015 (UTC)&lt;/div&gt;</summary>
		<author><name>Binarymaster</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=User_talk:Malvineous&amp;diff=5963</id>
		<title>User talk:Malvineous</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=User_talk:Malvineous&amp;diff=5963"/>
		<updated>2015-01-25T01:51:02Z</updated>

		<summary type="html">&lt;p&gt;Binarymaster: /* VGFM Music Format */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Wolfenstein 3D -&amp;gt; Wolfenstein 3-D ==&lt;br /&gt;
I&#039;ve corrected the infamous 3D tyop in the names of several Wolf3D-related pages; can you please delete the following ones?&lt;br /&gt;
&lt;br /&gt;
[[:Category:Wolfenstein 3D]] -&amp;gt; Superseded by [[:Category:Wolfenstein 3-D]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[:Image:Wolfenstein_3D.png]] -&amp;gt; Superseded by [[:Image:Wolfenstein_3-D.png]]&lt;br /&gt;
&lt;br /&gt;
Thanks :) --De Zeurkous (zeurkous@zeurcomp.nichten.info), Thu Nov 22 08:18:42 UTC 2007&lt;br /&gt;
&lt;br /&gt;
:Haha, you&#039;ve certainly been busy.  Don&#039;t forget that this wiki isn&#039;t meant to be an encyclopaedia of the games, its main purpose is documenting the file formats and editing tools that can be used with the games, as opposed to how the games behave without any mods, or what they might be called if you forget to change the title screen :-) -- [[User:Malvineous|Malvineous]] 11:14, 22 November 2007 (GMT)&lt;br /&gt;
&lt;br /&gt;
::Nah, I haven&#039;t forgotten. As we&#039;re reinventing the wheel for a semi-virgin wiki, the naming and something static like the cheats seemed like a good place to start :) --De Zeurkous (zeurkous@nichten.info), Thu Nov 22 12:20:04 UTC 2007&lt;br /&gt;
&lt;br /&gt;
== Jill of the Jungle palette ==&lt;br /&gt;
&lt;br /&gt;
Hi, I&#039;m currently working on a level viewer for [[Jill of the Jungle]] (maybe an editor later on). Some of the information I found here has been very useful, but there&#039;s one thing I&#039;m a bit stuck on. On the [[SHA Format]] page it says:&lt;br /&gt;
:&#039;&#039;Each array item contains 4 unsigned bytes, representing CGA, EGA and VGA, respectivley, and then a null value. [...] Each byte maps to the index of a colour in the palette. If there are no colours required, the tile set uses the default colours.&#039;&#039;&lt;br /&gt;
However, it doesn&#039;t say anywhere where the palette can be found. Is it stored in the EXE file? I hope you can help me on this :)&lt;br /&gt;
&lt;br /&gt;
Regards, [[User:Spinal|Spinal]] 13:00, 2 March 2008 (GMT)&lt;br /&gt;
&lt;br /&gt;
:Unfortunately I didn&#039;t write the JotJ SHA page, and I haven&#039;t yet had the time to figure this out.  For Xargon I&#039;ve taken the quick and dirty route and used a screenshot from within DOSBox as the source of the palette, until I can figure out where the palette is located.  If you find this out, don&#039;t forget to update the page! :-) -- [[User:Malvineous|Malvineous]] 22:02, 2 March 2008 (GMT)&lt;br /&gt;
&lt;br /&gt;
::Hey Spinal, sorry, I wrote the [[SHA Format]] page, so that was probably my bad. I wasn&#039;t able to find the palette either. I assume it&#039;s in the .EXE, however I spent a fair bit of time manually mapping it using a Wombat tool (http://www.szevvy.com/node/3). I was also writing a level viewer (initally in XHTML which turned out to be too slow, so then I moved to Flash 9). I tried to email you my findings, but the email bounced. I&#039;m not sure if they were 100% accurat, which is why I never added them to the documentation.&lt;br /&gt;
&lt;br /&gt;
::Hey Malvineous, it seems the Jill - [[DMA Format]] page has been removed. Do you have a log of what happened to it? I&#039;m sure it existed at some point.&lt;br /&gt;
&lt;br /&gt;
::- [[User:dheim|Daniel]] 20:00, 5 March 2008&lt;br /&gt;
&lt;br /&gt;
:::I don&#039;t ever remember seeing a DMA page - certainly there&#039;s nothing in the wiki logs about it being deleted or renamed.  Maybe you started working on it but never got around to saving it?  Or is it one of the Xargon pages that shares the same format as Jill?  (by the way, you can type &amp;lt;nowiki&amp;gt;~~~~&amp;lt;/nowiki&amp;gt; to automatically put in the signature in these messages.) -- [[User:Malvineous|Malvineous]] 11:28, 5 March 2008 (GMT)&lt;br /&gt;
&lt;br /&gt;
::::Sorry, it must have been the stuff in the [[SHA Format]] page that I was thinking of. I may have added the link to the [[DMA Format]] page, and never expanded on it. - [[User:Dheim|Daniel]] 02:46, 6 March 2008 (GMT)&lt;br /&gt;
&lt;br /&gt;
:::::Hi guys. Sorry for the mistake, I mixed up the authors of the SHA and level formats. I&#039;ve written a level viewer in PHP the last week, by using static images instead of getting them from the actual files. This causes some problems for episode 2, which uses a different palette, but besides that it works great :) When everything is done I&#039;ll upload the maps to my server and the tile/object lists to this wiki.&lt;br /&gt;
:::::@Daniel: strange that it bounced, I confirmed my address so it should be working fine... You can mail it to spinal -at- zanderz -dot- net. Also, I saw on your Wombat page that you &amp;quot;have a vague idea of how to do&amp;quot; [[Hocus Pocus]]. Could you share your findings on this wiki? I&#039;d love to make maps, or even a level viewer/editor for that game :) -- [[User:Spinal|Spinal]] 00:32, 8 March 2008 (GMT)&lt;br /&gt;
:Okay, with help of [[User:Dheim|Daniel]] who send me the palette I found it! I&#039;ll put my findings on [[Jill of the Jungle palette]]. -- [[User:Spinal|Spinal]] 15:36, 13 March 2008 (GMT)&lt;br /&gt;
&lt;br /&gt;
== Halloween Harry/Alien Carnage ==&lt;br /&gt;
&lt;br /&gt;
Hi Malvineous. Thanks for your edits on the GMF article! I notice you mentioned there exist versions of the game which don&#039;t require exploding a BNK to get at the game data. What does the directory structure look like for the version you have? I&#039;m working on a map viewer (which will become a map editor at some point) and would like it to be able to work on whatever versions are out there. Thanks for any info. -[[User:Duckthing|Duckthing]] 04:41, 11 December 2010 (GMT)&lt;br /&gt;
&lt;br /&gt;
: Hi Duckthing - no worries, Halloween Harry has long been an interest of mine, but my map editor sadly needs a lot more work before I can begin reverse engineering more file formats so I&#039;m glad you&#039;ve made a start!  AFAIK technically Halloween Harry has no compression, but for whatever reason (probably listed in the Apogee FAQ) they decided to swap episodes 1 and 3, compress the BNK file and then re-release it under the name Alien Carnage.  You can download all available versions (including registered versions since the game was released as freeware in 2007) from [http://www.classicdosgames.com/game/Alien_Carnage.html RGB Classic Games].  BTW not sure if you noticed but I also posted a couple of things on the GMF article&#039;s talk/discussion page. -- [[User:Malvineous|Malvineous]] 06:08, 11 December 2010 (GMT)&lt;br /&gt;
&lt;br /&gt;
:: Thank you! Working with the uncompressed version will keep things less complicated. I did notice the GMF discussion you added, but haven&#039;t had a chance to really go through it yet. -- [[User:Duckthing|Duckthing]] 06:41, 11 December 2010 (GMT)&lt;br /&gt;
&lt;br /&gt;
::: No worries.  If you&#039;re running Linux or MacOSX you should be able to compile [[Camoto|libgamearchive]] which will let you copy files in and out of the BNK files.  This is a library so it&#039;s also possible to use it in your own program for accessing and editing the map files while they&#039;re still inside the BNK, for instance.  (BTW the &#039;minor&#039; tickbox should only be used when the edit does not affect the information on the page - e.g. fixing a typo or a broken URL.  If you are changing the actual content on a page it is never a minor edit!) -- [[User:Malvineous|Malvineous]] 07:51, 11 December 2010 (GMT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Dangerous Dave ==&lt;br /&gt;
&lt;br /&gt;
Working on this, does anyone have any info on the formats? The EGA graphics are 84KB and external, but CGA and VGA graphics unrelated to them are in the 174KB executable, apparently uncompressed, I don&#039;t know how this is possible. I&#039;ve found the levels and partially reverse engineered the format (The first 1000 bytes, a 100x10 array of tiles.) but each level is followed by ~280 bytes of variable and unknown data I assume is sprites. I have a list of internal files in the executable, looks like most of it is non-game code. Any help would be appreciated. -[[User:Levellass|Endian? What are you on about?]] 06:03, 12 December 2010 (GMT)&lt;br /&gt;
&lt;br /&gt;
: Hmm, interesting.  All I can suggest for the levels is - as you&#039;re probably already familiar with - changing the values in a hex editor then loading the game to see what happens.  I would suspect that all the graphics would be in a similar format, so if there are any headers or structures used in the EGA graphics files perhaps they&#039;re duplicated for CGA/VGA?  Also John Romero seems pretty accessible, perhaps you could ask him directly?  Failing that, randomly writing data into the .exe until the images change could be used as a last resort! -- [[User:Malvineous|Malvineous]] 12:09, 12 December 2010 (GMT)&lt;br /&gt;
&lt;br /&gt;
: Ha, that was easier than I expected - uncompressed VGA data is easy to find with a good hex editor ;-)  [http://www.shikadi.net/pics/ddave-vga-hexdump.png This looks like it] -- [[User:Malvineous|Malvineous]] 12:17, 12 December 2010 (GMT)&lt;br /&gt;
&lt;br /&gt;
: Ok that was only the menu graphics.  At offset 0xC629 there&#039;s some sort of offset table which looks very similar to the contents of EGADAVE.DAV but there are extra bytes dotted all over the place - perhaps it&#039;s RLE encoded?  Actually just before that there&#039;s the number 0x6CAA.  If you go a bit less than 0x6CAA bytes after this you end up with another table, which to me suggests that 0x6CAA is the decompressed size of that first table. -- [[User:Malvineous|Malvineous]] 13:01, 12 December 2010 (GMT)&lt;br /&gt;
&lt;br /&gt;
:If I remember it correctly, the VGA sprites and tiles are RLE compressed and it&#039;s not too hard to decompress them. The positions of the enemies in the levels on the other hand are still a mystery to me. [[User:Calvero|Calvero]] 20:43, 12 December 2010 (GMT)&lt;br /&gt;
&lt;br /&gt;
: Looking at the levels, which directly follow the VGA palette, they seem to contain 256 bytes of header data, then the 100x10 tiles, then eight bytes of lead-out data.  Then the next level&#039;s 256 bytes of header, 100x10 tiles, then eight bytes of lead-out.  Although I say &amp;quot;level&amp;quot;, the first &amp;quot;level&amp;quot; seems to contain both level 1 and 2, and this seems to be the way it works in the game - in some levels you can see through to others.  I&#039;m not sure what the 256 bytes of header data are for, but some levels have FF FF 00 00 repeated which seems to indicate two uint16 fields which are blanked out for those levels. -- [[User:Malvineous|Malvineous]] 13:15, 13 December 2010 (GMT)&lt;br /&gt;
&lt;br /&gt;
::First up, levels; where does level 1 start? It&#039;s possible I&#039;m reading the start of a level as the previous level&#039;s end, I looked for the start of tile data, which I assumed, like Keen 1, would be the level start.&lt;br /&gt;
&lt;br /&gt;
::Next, palette; I&#039;m assuming, as you said, it is located just before the level data?&lt;br /&gt;
&lt;br /&gt;
::There is VGA and CGA graphics in the executable, plus headers, but the bulk of graphics for CGA and VGA I haven&#039;t been able to locate. If the data is RLE compressed I should think it would use either Keen 1-3 fullscreen or Jazz Jackrabbit tile RLE, both of which I know well. I&#039;ll look into both of these options, cheers! -[[User:Levellass|Endian? What are you on about?]] 12:03, 20 December 2010 (GMT)&lt;br /&gt;
&lt;br /&gt;
:::I&#039;ve found the VGA and CGA data for the menu graphics.  It looks like the CGA data is stored in a series of 1-bit-per-pixel (monochrome) images.  Or it could be EGA data with the planes split out (e.g. red plane for all images, then green plane for all images, etc.)  I think I found three planes which means it&#039;s probably EGA, as CGA would have a max of two planes.  I&#039;ve also found the font graphics, this looks like 4bpp/16 colour EGA data.  Haven&#039;t seen level graphics yet.  I&#039;ve successfully modded the levels with a hex editor (putting the jetpack everywhere) so now I&#039;ve finally looked at all the levels!  The creatures are definitely not stored in the 100x10 tile data.  Putting random bytes in there revealed that the values are indices into the image files, because if you put the value in for fire it will animate, and the following three or so values show up as still frames from the fire animation.&lt;br /&gt;
&lt;br /&gt;
:::The VGA palette starts at 0x26B0A (I updated the main DDave page with this) + 768 bytes leads straight onto the start of level 1 at 0x26E0A.  So at 0x26E0A there are 256 bytes of data, then 100x10 tiles, then 24 bytes of footer data.  Some of this data (perhaps footer data) might be the level start coordinates, because Dave doesn&#039;t always start the level at the same place (e.g. the warp level when you climb the tree on level 5 and jump off the edge of the screen.) -- [[User:Malvineous|Malvineous]] 12:24, 20 December 2010 (GMT)&lt;br /&gt;
&lt;br /&gt;
:::I think I&#039;ve found all the files so far, I&#039;ve updated [[Dangerous Dave]] with the offsets of the files, including what appears to be CGA and VGA tiles.  I&#039;m not sure what sort of format they&#039;re in though, it looks like they might be compressed (and so the offsets in that list might be off by ~4, as I may have cut off the decompressed-size field.)  I&#039;ve also updated the map format page, I think it&#039;s pretty much fully reverse engineered now. -- [[User:Malvineous|Malvineous]] 05:13, 21 December 2010 (GMT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Noahs Ark 3D and IMFs ==&lt;br /&gt;
&lt;br /&gt;
Been poking around Noah&#039;s Ark 3D, an adaption of the Wolfenstein game and found a few interesting things which I&#039;m hoping to confirm.&lt;br /&gt;
&lt;br /&gt;
First, the game uses MID files, not IMF files for music, second, the MIDI files have an extra word at the start of the file giving the file length. Third, the code uses the first word of the midi file as the length of data to read from the file and put into memory to play. After poking around a bit in Wolfenstein and Keen I believe this is the same with IMF files, that is, ALL IMF files are type 0 as it were and the type 1s are read just like type 0s by the games (The first word is read as the amount of IMF data to copy into memory to play, this is then read as type 0.) I&#039;m not quite sure what this does for the two types since type 1 is would essentially be a type 0 with a header and footer that are part of the AUDIO.xxx format, much like PC\adlib sounds can have the huffman lengths at the start. Are there any games that use &#039;individual&#039; type 1 IMFs (Even if included as part of a group file. All I&#039;ve seen are games like cosmo, where non-AUDIO IMFs are type 0.)&lt;br /&gt;
&lt;br /&gt;
Should there be a Noah&#039;s Ark 3D page and should we add the midi note to the AUDIO format page? It seems that the format can hold any type of music file the game can read, not just IMFs.  -- Levellass&lt;br /&gt;
&lt;br /&gt;
: Yes it is known that the type-1 header might really be part of the AUDIO.xxx format but alas there were many type-1 files floating around the place (incorrectly extracted, you could argue) before this was realised, so the format variant is here to stay.  It does have some advantages though (like tagging files with the song title) but I&#039;m not sure whether anyone has figured out definitively whether the header (and footer, in the case of the Wolf3D files) belongs to the IMF or the AUDIO file.  I guess you&#039;d have to browse the game source code and see how the game uses the data to know for sure.&lt;br /&gt;
&lt;br /&gt;
: As far as the MIDI goes, I believe the AUDIO.xxx file is just a container file like any other, capable of supporting any data at all.  It&#039;s up to the game to decide how to use it.  If anything this makes me think it would fit better if the AUDIO.xxx article was merely documenting the structure, with links to actual audio formats like PC SFX, Adlib SFX, IMF and MIDI and notes about which games make use of which formats.&lt;br /&gt;
&lt;br /&gt;
: Oh and yes, by all means create a page for the new game. -- [[User:Malvineous|Malvineous]] 08:41, 3 February 2011 (GMT)&lt;br /&gt;
&lt;br /&gt;
== Sound Files category ==&lt;br /&gt;
&lt;br /&gt;
I don’t know why there’s a Sound Files category and also an Audio Files category... it seems redundant. I left those categories the way they are though.&lt;br /&gt;
&lt;br /&gt;
Also, the [[File format data types]] page needs some signed ints, but I didn’t know what naming convention you wanted to use. I described something as an [[INT16LE]] on [[BMC Format]]. [[User:Yellowantphil|Yellowantphil]] 20:12, 11 September 2011 (GMT)&lt;br /&gt;
&lt;br /&gt;
: Not sure about the Sound vs Audio - I use the term &#039;audio&#039; to mean both sound and music, but you&#039;re right, if there are separate sound and music categories we don&#039;t really need an audio one as well.  Feel free to update.  [[INT16LE]] is perfectly fine too!  I added a note to the data types page. -- [[User:Malvineous|Malvineous]] 22:30, 11 September 2011 (GMT)&lt;br /&gt;
&lt;br /&gt;
== GamePage template ==&lt;br /&gt;
&lt;br /&gt;
Should the GamePage template add the page to its own category? It seems a little odd that [[Wacky Wheels]] is not in the Wacky Wheels category. [[User:Yellowantphil|Yellowantphil]] 04:51, 16 September 2011 (GMT)&lt;br /&gt;
: I decided against this because there is a link to the game&#039;s page in the category intro at the top of the page.  It seemed unnecessary having another link in amongst all the other pages.  This was also because the game page was really only meant to be a summary, there wasn&#039;t supposed to be a huge amount of detail on it, only links to other pages with the detail (which then would appear in the category list.)  I would imagine that, eventually, [[Wacky Wheels]] would be tweaked to move a lot of the content onto subpages. -- [[User:Malvineous|Malvineous]] 12:58, 16 September 2011 (GMT)&lt;br /&gt;
&lt;br /&gt;
== Scope of the wiki ==&lt;br /&gt;
&lt;br /&gt;
I don’t know how extensive you want the information to be on ModdingWiki... I added a few lists of audio and graphics files a while ago, and there will probably be other information that I’ll find out that’s potentially helpful for level editing but not directly related to it. I can move some information to my website if it starts to become out of scope for your wiki. I also sometimes end up documenting everything imaginable... there’s some minutiae on my website and possibly on your wiki that I ought to go through and delete. [[User:Yellowantphil|Yellowantphil]] 05:28, 10 October 2011 (GMT)&lt;br /&gt;
&lt;br /&gt;
:Hmm, that&#039;s a difficult one - I&#039;m always in favour of documenting more rather than less.  Generally speaking if it&#039;s related to a game and it would help either a programmer writing a utility or a someone trying to change a game manually then it should be documented.  About the only thing that comes to mind that&#039;s over documenting is when some small calculation is expressed in a couple of different programming languages, but I&#039;ve left that in so people can just copy it rather than trying to figure it out from the text.  But the [[Wacky Wheels]] page is probably the gold standard for what all wiki pages should look like :-)  Do you have anything in particular you&#039;re unsure of whether it would fit here? -- [[User:Malvineous|Malvineous]] 10:07, 10 October 2011 (GMT)&lt;br /&gt;
&lt;br /&gt;
::I was mainly thinking of the list of VOC files on [[Wacky Wheels Music and Sound Effects]] and the list of &amp;lt;tt&amp;gt;*.sp&amp;lt;/tt&amp;gt; files on [[Wacky Wheels Graphics Formats]]. I have an expanded list of the &amp;lt;tt&amp;gt;*.sp&amp;lt;/tt&amp;gt; files on my computer but it isn’t finished yet. I guess there isn’t all that much more Wacky Wheels information to be added to this wiki though. There is still some modding information on my website that ought to be moved over here, so that would take up another page or two. I’ve been lazy about doing Wacky Wheels stuff lately, but I might find some time for it this weekend.&lt;br /&gt;
&lt;br /&gt;
::By the way, I guess that guy from Cascadia Games emailed you. It’s pretty interesting that WW might become an iPhone app. He told me that he was going to be using his own game engine, which sounds a lot easier than trying to get a hold of the WW source code and porting it. —[[User:Yellowantphil|Yellowantphil]] 16:46, 15 October 2011 (GMT)&lt;br /&gt;
&lt;br /&gt;
::: I was going to say the list of VOCs might be overkill, but then the list of .sp files might be useful.  To be honest, it&#039;s the sort of thing that you could probably omit if you were feeling lazy, but likewise I don&#039;t mind at all if you choose to include it, so since it&#039;s already there I&#039;m happy to keep it.&lt;br /&gt;
&lt;br /&gt;
::: Yes I did get an e-mail from Cascadia, I was going to pass along your details but it sounds like you&#039;re already aware of it!  Using their own engine might make it a bit smoother than the original, as the jerkiness of turning is my only criticism of the game. -- [[User:Malvineous|Malvineous]] 00:14, 16 October 2011 (GMT)&lt;br /&gt;
&lt;br /&gt;
== Wacky Wheels ==&lt;br /&gt;
&lt;br /&gt;
Basically all of the WW modding information from my website is here now. I moved one page when I realized it should probably be capitalized to match the rest of the pages on this site... you can delete the redirect at [[Wacky Wheels high score files]] if you want to.&lt;br /&gt;
&lt;br /&gt;
Now, I need to remove most of the modding information from my website and refer people here. Then we’ll have reached the glorious future where all WW modding information is in one place. I’m going to keep those two text files of notes on my website though—the information in them is disorganized and I think not 100% accurate, but they might have some information that isn’t here yet.&lt;br /&gt;
&lt;br /&gt;
By the way, how’s Camoto going? I’m planning to use it to make a new WW level, but I won’t have time for it for a few more months. —[[User:Yellowantphil|Yellowantphil]]&lt;br /&gt;
&lt;br /&gt;
: Sounds good!  Thanks for all the effort you&#039;ve put in by moving it across.  I think Wacky Wheels is now the most completely documented game on the wiki!  Also can&#039;t hurt leaving your own info up - sometimes it&#039;s nice to go back to the original source if something is unclear.  Camoto&#039;s going well, but unfortunately I haven&#039;t had much time to work on it over the last few weeks.  You probably won&#039;t be able to make much of a level until I add in the ability to select a tile from the tileset, but that&#039;s in progress and hopefully will be ready by the time you are!  Keep me posted when you do start your level(s?) -- [[User:Malvineous|Malvineous]] 12:22, 2 February 2012 (GMT)&lt;br /&gt;
&lt;br /&gt;
::Well, as I was reading some of the information on my website, I noticed that it isn’t written very well. I wrote those pages back when I had very little experience programming. Anyway, I’m planning to redesign my website soon, and this will save me from having to rewrite a few of those pages.&lt;br /&gt;
&lt;br /&gt;
::The tile editor in Camoto as it is now is still certainly useful—I can add new tile types to a level using a binary editor and then move them around in Camoto. I think that it shouldn’t be too hard to make a new WW level using the Gimp and Camoto plus some binary editing. I recall having some problems with the route editor for the computer players, but I didn’t look into it at the time—I’ll let you know when I’m working with Camoto again, and I’ll try to come up with some useful bug reports or fixes if I run into problems. —[[User:Yellowantphil|Yellowantphil]] 14:06, 2 February 2012 (GMT)&lt;br /&gt;
&lt;br /&gt;
== Catacomb ==&lt;br /&gt;
&lt;br /&gt;
Hey [[User:Malvineous|Malvineous]], do you know anyone who has properly read the [[Inverse_Frequency_Sound_format|Inverse Sound Frequency]] file format and got the sound playing? I&#039;m struggling with some fine details in my game. Sounds play near what they should sound like, but the sound quality is all crackly and some sounds play totally incorrect. I followed a basic [http://web.archive.org/web/20000818033701/http://www.dd.chalmers.se/~f98anga/projects/keen/sounds2raw.c code sample] by Anders Gavare. Does your tool support this? Interested in helping me figure this out? My current code is available at [https://code.google.com/p/cataclone/source/browse/trunk/src/catacomb/catacomb_sound.c catacomb_sound.c] - [[User:Eros|Eros]] 11:57, 5 May 2012 (GMT)&lt;br /&gt;
: Should this be moved to my talk page? - [[User:Eros|Eros]] 11:59, 5 May 2012 (GMT)&lt;br /&gt;
:: Probably best to keep it on my talk page if you want me to respond in a timely manner :-)  I based my old utility off Anders&#039; one too, but it&#039;s been a long time since I looked at the code.  My latest utility doesn&#039;t support sound effects yet.  I know Levellass has written a few utilities to play and edit those sound files, so I think your best bet would probably be to post over at the [http://www.keenmodding.org Keen:Modding] forum.  Do note that PC Speaker effects do sound crackly at the best of times, though!  Also make sure you&#039;ve got the right audio format (8-bit vs 16-bit, signed vs unsigned) - I remember some inconsistencies there causing some very distorted results for me.  I love the name &#039;Cataclone&#039; - does your code compile under Linux? -- [[User:Malvineous|Malvineous]] 13:21, 5 May 2012 (GMT)&lt;br /&gt;
::: I currently compile the code using Code::Blocks with GCC 4.6 -std=gnu99. It *should* compile under Linux. But I haven&#039;t tested that out yet. [[Catacomb]] sounds also have flags attached to each one, It&#039;s not exactly the same specification as what it says @ the [[Inverse_Frequency_Sound_format|Inverse Sound Frequency]] format page. Perhaps the flags would make a difference to the sounds? I have the sound setup @ [https://code.google.com/p/cataclone/source/browse/trunk/src/sound_manager.c sound_manager.c] in the sound_manager_init() method. I use AUDIO_S16 (signed 16-bit) @ 22050 Hz with 2 channels. I have not added support for the priority of the sounds yet, I plan on doing that after I get them playing properly.&lt;br /&gt;
::: I found some information on the [[ROTT]] sound format here: [http://src.gnu-darwin.org/ports/games/rottdc/work/rottdc-1.0-2/rott/_rt_soun.h _rt_soun.h]. This format should be similar to Catacomb as ROTT was developed by [[Apogee]] using the [[Doom]] engine. Here are the flags for the sounds that they define:&lt;br /&gt;
 #define SD_OVERWRITE     0x01&lt;br /&gt;
 #define SD_WRITE         0x02&lt;br /&gt;
 #define SD_LOOP          0x04&lt;br /&gt;
 #define SD_PITCHSHIFTOFF 0x08&lt;br /&gt;
 #define SD_PLAYONCE      0x10&lt;br /&gt;
::: There are also many other sound files for ROTT: [http://src.gnu-darwin.org/ports/games/rottdc/work/rottdc-1.0-2/rott/rt_sound.c], [http://src.gnu-darwin.org/ports/games/rottdc/work/rottdc-1.0-2/rott/rt_sound.h], [http://src.gnu-darwin.org/ports/games/rottdc/work/rottdc-1.0-2/rott/snd_reg.h], [http://src.gnu-darwin.org/ports/games/rottdc/work/rottdc-1.0-2/rott/snd_shar.h], [http://src.gnu-darwin.org/ports/games/rottdc/work/rottdc-1.0-2/rott/sndcards.h]&lt;br /&gt;
:::: I tried it last night and I was able to get it to compile (after a few changes, like using &#039;/&#039; instead of &#039;\&#039; in a couple of #includes) but all I got was a black window and a beep sound, then nothing.  How far advanced is the project?  Should I expect more than that?  I would expect small variations in the file formats between games, but I would be surprised if the core sound data has changed over time. -- [[User:Malvineous|Malvineous]] 02:38, 6 May 2012 (GMT)&lt;br /&gt;
::::: On Windows, you can run around the levels, collide with walls, collect items, etc... I still need to implement monsters, AI and power shots. However, that beep means that the sounds playing. (see line 71 in main.c: catacomb_sounds_play(&amp;quot;foundsound&amp;quot;);). I just committed the catacomb_data.h file. Update it accordingly, you should now see much more than a black screen.&lt;br /&gt;
:::::: Oh wow, that works really well now!  I see what you mean by the sounds.  You might have to output the PCM data to a .wav/.raw file and look at it in a sound editor to see what&#039;s going on.  It sounds like there might be wrapping or something going on.  Also some sounds (like being blocked by a door) play multiple times over the top of themselves.  I guess this is what you meant by priority not being implemented (although maybe you wouldn&#039;t need to handle priority if you can play multiple sounds at the same time, unlike the real PC Speaker.)  One suggestion - if you do decide to support Linux, abstract the calls that open files so that they search for filenames instead - that way you don&#039;t have to rename all the Catacomb files to be uppercase, since Linux has a case-sensitive filesystem and most filenames are usually all lowercase. -- [[User:Malvineous|Malvineous]] 03:42, 6 May 2012 (GMT)&lt;br /&gt;
::::::: I have exported the raw data to a file, then imported the raw data into Audacity using various settings. All of them sound like they do in the game, crackly and sometimes distorted. I really think its some sort of post FX used by the flags. As for files, I&#039;ll code some sort of SafeFileOpen, SafeFileClose functions like the id codebase that open files regardless of case when i get around to implementing the Linux version. - [[User:Eros|Eros]] 03:54, 6 May 2012 (GMT)&lt;br /&gt;
:::::::: If you can e-mail me one of the files (preferably a &#039;quiet&#039; one that&#039;s not supposed to be crackly) I can take a look if you like - malvineous@shikadi.net -- [[User:Malvineous|Malvineous]] 03:57, 6 May 2012 (GMT)&lt;br /&gt;
&lt;br /&gt;
== Merge ==&lt;br /&gt;
&lt;br /&gt;
Is there a way to tag two pages such that it is clear that they should be merged?&lt;br /&gt;
For example, [[Crystal Caves Tileset Format]] describes the same format as [[Duke 1 Tileset Graphics]].[[User:Frenkel|Frenkel]] ([[User talk:Frenkel|talk]]) 21:00, 15 July 2013 (GMT)&lt;br /&gt;
&lt;br /&gt;
: You can mention it on the talk page for one of the articles.  Any suggestions as to what we should call the merged page? -- [[User:Malvineous|Malvineous]] ([[User talk:Malvineous|talk]]) 03:09, 20 July 2013 (GMT)&lt;br /&gt;
&lt;br /&gt;
::Dark Ages is the first game that got released that uses this format, so &#039;&#039;Dark Ages Tileset Format&#039;&#039; could be the name, like all those formats that are named after Commander Keen 1-3.&lt;br /&gt;
::Or we name it after Duke Nukem 1, because that game is probably more popular than Dark Ages, Crystal Caves and Secret Agent, like [[Commander Keen 1-3 Level format]], although Slordax used it before Commander Keen 1-3 did.[[User:Frenkel|Frenkel]] ([[User talk:Frenkel|talk]]) 19:13, 20 July 2013 (GMT)&lt;br /&gt;
&lt;br /&gt;
::: Yes I was thinking along the same lines, naming it after the first game that used the format.  But then the release date doesn&#039;t necessarily indicate which game &amp;quot;invented&amp;quot; the format, if one game took longer to develop and was released late.  I was wondering whether there is a common thread amongst all these games, such as the same programmer or company we could use instead.  In many ways I would prefer a name like &amp;quot;Replogle tileset format&amp;quot; or &amp;quot;Apogee EGA tileset format&amp;quot;.  What do you think? -- [[User:Malvineous|Malvineous]] ([[User talk:Malvineous|talk]]) 23:36, 20 July 2013 (GMT)&lt;br /&gt;
&lt;br /&gt;
:::: I&#039;ve read the [http://www.3drealms.com/news/2006/04/the_apogee_legacy_15.html | Apogee Legacy interview with Peder Jungck] again today. He wrote the ProGraphx Toolbox.&lt;br /&gt;
:::: DN1.EXE contains the string &#039;&#039;Version 1.0 EGA/VGAProGraphx EGA/VGA Toolbox&#039;&#039;,&lt;br /&gt;
:::: CC1.EXE contains the string &#039;&#039;Version 1.5 320x200 PAN EGA/VGAProGraphx EGA/VGA Toolbox&#039;&#039;,&lt;br /&gt;
:::: SAM1.EXE contains the string &#039;&#039;ProGraphx EGA/VGA Toolbox Version 2.0 320x200 EGA/VGA Copyright 1991 by Peder Jungck&#039;&#039; and&lt;br /&gt;
:::: DA3.EXE contains the string &#039;&#039;Version 1.0 EGA/VGAProGraphx EGA/VGA Toolbox&#039;&#039; (DA1.EXE and DA2.exe contain gibberish).&lt;br /&gt;
:::: So I would suggest &#039;&#039;ProGraphx Toolbox tileset format&#039;&#039;. Peder also wrote a book about the toolbox called &#039;&#039;Graphics Programming &amp;amp; Animation: Ultra-Fast Assembly Routines for EGA/VGA Graphics Animation&#039;&#039;. Maybe that book has a better name for the file format. [[User:Frenkel|Frenkel]] ([[User talk:Frenkel|talk]]) 11:03, 21 July 2013 (GMT)&lt;br /&gt;
&lt;br /&gt;
::::: So we know of three different versions of the ProGraphx Toolbox. Dark Ages and Duke Nukem 1 use version 1.0. Each tileset is 8064 bytes long and is in a separate file. Crystal Caves uses version 1.5 and each tileset is 8003 bytes long, but they are all in the same file. Secret Agent uses version 2.0 Each tileset is again 8064 bytes long, they are all in the same file and the file is encrypted. [[User:Frenkel|Frenkel]] ([[User talk:Frenkel|talk]]) 17:00, 28 July 2013 (GMT)&lt;br /&gt;
&lt;br /&gt;
:::::: Thanks for figuring all that out.  I&#039;ve merged the pages and changed the name to [[ProGraphx Toolbox tileset format]] as suggested.  Please feel free to correct anything I have missed. -- [[User:Malvineous|Malvineous]] ([[User talk:Malvineous|talk]]) 02:40, 4 August 2013 (GMT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Guidelines for proper Wiki Editing ==&lt;br /&gt;
Dear Malvineous! Could you post the guidelines (or guide) for proper editing of the Wiki? [[User:The coder|The coder]] ([[User talk:The coder|talk]])&lt;br /&gt;
: Hmm, there isn&#039;t really one, it&#039;s more about finding a similar page and matching the style found there!  Copy and paste works well :-)  There is [[ModdingWiki:Contributing]] but it&#039;s not very detailed. (BTW please put &amp;lt;nowiki&amp;gt;~~~~&amp;lt;/nowiki&amp;gt; at the end of your messages, when you preview the page you will see this gets replaced with your name and the date automatically.) -- [[User:Malvineous|Malvineous]] ([[User talk:Malvineous|talk]]) 21:59, 12 December 2014 (UTC)&lt;br /&gt;
&lt;br /&gt;
== VGFM Music Format ==&lt;br /&gt;
&lt;br /&gt;
Hello, Malvineous!&lt;br /&gt;
&lt;br /&gt;
I accidentally found that [[VGFM Music Format]] is absolutely similar to the [http://www.vgmpf.com/Wiki/index.php?title=MUS_(AdLib) MUS (AdLib)] format which I finished researching yesterday.&lt;br /&gt;
&lt;br /&gt;
And [[VGFM Instrument Format]] is similar to [http://www.vgmpf.com/Wiki/index.php?title=SND_(AdLib) SND (AdLib)].&lt;br /&gt;
&lt;br /&gt;
These formats were developed by Ad Lib Inc, I found the sources and documentation in the Ad Lib developer&#039;s manual downloaded from old BBS board site :)  And these formats are used not only in [[Vinyl Goddess From Mars]] game.&lt;br /&gt;
&lt;br /&gt;
--[[User:Binarymaster|Binarymaster]] ([[User talk:Binarymaster|talk]]) 02:05, 22 January 2015 (UTC)&lt;br /&gt;
&lt;br /&gt;
: Oh wow, what an interesting discovery!!  Do you have any links to the official documentation?  I&#039;d really like to see what else they have to say about the format.  And yes, we should definitely rename the articles here.  What do you think they should be called?  &amp;quot;Ad Lib Music Format&amp;quot; is probably a bit generic given they have a few, like .ROL... -- [[User:Malvineous|Malvineous]] ([[User talk:Malvineous|talk]]) 09:45, 22 January 2015 (UTC)&lt;br /&gt;
:: Here it is: [http://files.mpoli.fi/software/programm/general/adlip.zip adlip.zip] - binaries and source code, probably from Ad Lib Programmer&#039;s Manual. MUS headers are described in CONVERT.C and CONVERT.H files. Fun fact that they also developed another similar format based on MIDI - [http://www.vgmpf.com/Wiki/index.php?title=MDI MDI]. It has similar musical features but stores all data in one file in MIDI format.&lt;br /&gt;
:: Well, I have no idea how to name it better, I think &amp;quot;Ad Lib Music Format&amp;quot; should be suitable for it :) --[[User:Binarymaster|binarymaster]] ([[User talk:Binarymaster|talk]]) 10:30, 22 January 2015 (UTC)&lt;br /&gt;
&lt;br /&gt;
::: Many thanks!!  I&#039;ve updated the article pages with the info I could gain from the source code.  There are still a few unresolved issues (like what exactly the default percussion pitch is) but it has certainly answered a number of questions.  I called it &amp;quot;AdLib MIDI Format&amp;quot; because that&#039;s the name they use in one place in the source code, although it&#039;s not a very descriptive title!  Thanks again for letting me know about this excellent find :-) -- [[User:Malvineous|Malvineous]] ([[User talk:Malvineous|talk]]) 12:48, 24 January 2015 (UTC)&lt;br /&gt;
&lt;br /&gt;
:::: That&#039;s good! I think maybe this format should be named as &amp;quot;AdLib MIDI Format v1.0&amp;quot;, because there is also an improved version of it, probably v2.0 - [http://www.vgmpf.com/Wiki/index.php?title=MDI MDI] (I made a typo in previous posted link), it uses a single file in MIDI format.&lt;br /&gt;
:::: And about [[AdLib Timbre Bank Format]] article - BNK format originally was created in the 1987 with the first release of the [http://www.vgmpf.com/Wiki/index.php?title=AdLib_Visual_Composer AdLib Visual Composer], so actually Ad Lib Inc released its formats in this order:&lt;br /&gt;
:::: &#039;&#039;&#039;1)&#039;&#039;&#039; ROL &amp;amp; BNK (1987, with AdLib Visual Composer)&lt;br /&gt;
:::: &#039;&#039;&#039;2)&#039;&#039;&#039; MUS &amp;amp; SND/TIM (1988, with player and converter)&lt;br /&gt;
:::: &#039;&#039;&#039;3)&#039;&#039;&#039; MDI (1989, also with player and converter)&lt;br /&gt;
:::: Information about third format was placed [http://cd.textfiles.com/soundsensations/MISCPROG/AD-PROG/ here], though the link is not working now.&lt;br /&gt;
:::: --[[User:Binarymaster|binarymaster]] ([[User talk:Binarymaster|talk]]) 13:08, 24 January 2015 (UTC)&lt;br /&gt;
&lt;br /&gt;
::::: Oh wow that&#039;s interesting too.  I think the MUS/SND/TIM format should stay as &amp;quot;AdLib MIDI Format&amp;quot; with no version number, because that file format does have version fields so it&#039;s possible to have v1.0, v2.3, etc. within that format.  The MDI article you linked to actually looks like conventional MIDI with some extra events for setting OPL instruments, so I think this belongs as one of the many backwards-compatible extensions of the [[MID Format]].&lt;br /&gt;
&lt;br /&gt;
::::: With the instrument bank formats that&#039;s really unusual if BNK came first!  It seems very odd for AdLib to produce the SND/TIM format if they already had the more efficient BNK format available.  I was going from the dates in the text files from the programmer&#039;s guide you kindly posted, and bkformat.txt says in Jan 1989 they are in the process of converting their software to use BNK.  Can you confirm there was BNK software earlier than this?  I&#039;m just thinking that Visual Composer may have come out in 1987, but maybe it didn&#039;t get BNK support added until later? -- [[User:Malvineous|Malvineous]] ([[User talk:Malvineous|talk]]) 01:30, 25 January 2015 (UTC)&lt;br /&gt;
&lt;br /&gt;
:::::: Well, I&#039;m sure that first version of Visual Composer was released with AdLib music card, but I don&#039;t know exactly about BNK support. It&#039;s really strange that Ad Lib downgraded the format (BNK is better in structure), but the known formats has converters which converts BNK to X format, but not from X to BNK - this makes sense that BNK was the first format. Also Visual Composer doesn&#039;t support other bank formats, only BNK.&lt;br /&gt;
:::::: BNK creation date 1987 was contributed by [http://www.vgmpf.com/Wiki/index.php?title=User:TheAlmightyGuru Dean Tersigni], I&#039;ll ask him about it.&lt;br /&gt;
&lt;br /&gt;
:::::: Update: I also read information from bkformat.txt, and it seems you&#039;re right :)&lt;br /&gt;
:::::: So actually it was:&lt;br /&gt;
:::::: &#039;&#039;&#039;1)&#039;&#039;&#039; ROL &amp;amp; INS (1987, with AdLib Visual Composer v1.0)&lt;br /&gt;
:::::: &#039;&#039;&#039;2)&#039;&#039;&#039; MUS &amp;amp; SND/TIM (1988, with player and converter)&lt;br /&gt;
:::::: &#039;&#039;&#039;3)&#039;&#039;&#039; ROL &amp;amp; BNK (1989, with AdLib Visual Composer v1.5)&lt;br /&gt;
:::::: &#039;&#039;&#039;4)&#039;&#039;&#039; MDI (1989, also with player and converter)&lt;br /&gt;
:::::: Wow, that feel when restored original order of events! :D --[[User:Binarymaster|binarymaster]] ([[User talk:Binarymaster|talk]]) 01:51, 25 January 2015 (UTC)&lt;/div&gt;</summary>
		<author><name>Binarymaster</name></author>
	</entry>
</feed>