<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.multimedia.cx/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=GreaseMonkey</id>
	<title>MultimediaWiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.multimedia.cx/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=GreaseMonkey"/>
	<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php/Special:Contributions/GreaseMonkey"/>
	<updated>2026-05-01T08:23:52Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.5</generator>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Impulse_Tracker&amp;diff=14183</id>
		<title>Impulse Tracker</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Impulse_Tracker&amp;diff=14183"/>
		<updated>2012-10-15T07:04:51Z</updated>

		<summary type="html">&lt;p&gt;GreaseMonkey: Hxx (vibrato) documented. as far as i know, this is about as accurate as it gets.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* Extension: it&lt;br /&gt;
&lt;br /&gt;
==File Format==&lt;br /&gt;
''TODO''&lt;br /&gt;
&lt;br /&gt;
''it would be interesting to find out how the MIDI/timestamp stuff after the pointer list works... the other TODOs I (GM) know about''&lt;br /&gt;
&lt;br /&gt;
==IT214 sample compression==&lt;br /&gt;
&lt;br /&gt;
If bit 3 (0x08 compressed samples) is set, the sample is compressed.&lt;br /&gt;
&lt;br /&gt;
* Compression is split into blocks, where the '''uncompressed size''' is 0x8000 '''bytes''' (0x4000 samples for 16-bit, and 0x8000 otherwise).&lt;br /&gt;
* Once a block is decompressed (or at least fails to decompress), the data is then delta decoded.&lt;br /&gt;
* The sample conversion flags are applied '''per-block''' rather than for the whole sample. These are probably applied after delta decoding.&lt;br /&gt;
* IT215 samples are IT214-compressed samples with the &amp;quot;Delta&amp;quot; flag (not the &amp;quot;Byte Delta&amp;quot; flag) set in the conversion flags.&lt;br /&gt;
* Each compressed block starts with a 16-bit length field, and then the bitstream is encoded in little-endian binary (LSB up).&lt;br /&gt;
* There is a &amp;quot;bit width&amp;quot; initially set to 9 for 8-bit samples, and 17 for 16-bit samples.&lt;br /&gt;
* The &amp;quot;bit width&amp;quot; is changed by special values inside their respective types. If such a special value is not triggered, the values are read as signed values, and unpacked&lt;br /&gt;
* There are three types of blocks, which we will call A, B, and C.&lt;br /&gt;
** Type A: Bit widths 1 through 6. Special value is 1 in the top bit and 0s for the rest. If such a value is triggered, it then reads 3 (8-bit) or 4 (16-bit) bits for calculating the new bit width (see below).&lt;br /&gt;
** Type B: Bit widths 7 through n, where n is 8 for 8-bit samples and 16 for 16-bit. Special values are 0...0100 through 1...1011 for 8-bit and 0...01000 through 1...10111 for 16-bit. If such a value is triggered, subtract 0...0100 (8-bit) or 0...01000 (16-bit) and use that to calculate the new bit width (see below).&lt;br /&gt;
** Type C: Bit width n+1. If the top bit is set, the lower 8 bits plus 1 are the new bit width.&lt;br /&gt;
* Barring type C, the new width selected is (v+1), except where v+1 &amp;gt;= the previous bit width, in which case the new width is v+1.&lt;br /&gt;
* If an invalid bit width is selected (only possible in type C), the decompressor '''terminates and leaves all the remaining values as 0 before delta decoding.'''&lt;br /&gt;
* The defacto standard for compressed stereo samples (as set by XMPlay) is to decompress the left channel '''entirely separately''' from the right channel (where the data follows immediately afterwards), rather than decompress them together and separate afterwards.&lt;br /&gt;
&lt;br /&gt;
''if this is a bit too messy, feel free to tidy it up''&lt;br /&gt;
&lt;br /&gt;
==Playback notes==&lt;br /&gt;
''TODO''&lt;br /&gt;
&lt;br /&gt;
===Resonant filters===&lt;br /&gt;
&lt;br /&gt;
The resonant filter (added in 2.14p3) uses the following formula:&lt;br /&gt;
&lt;br /&gt;
*K[n] = a * S[n] + b * K[n-1] + c * K[n-2]&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
*K[n] is the outputted value at time n&lt;br /&gt;
*S[n] is the input value at time n&lt;br /&gt;
*a = 1/(1+d+e)&lt;br /&gt;
*b = (d+2e) / (1+d+e)&lt;br /&gt;
*c = -e / (1+d+e)&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
*d = 2pr+2p-1&lt;br /&gt;
*e = r^2&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
*r = playback_frequency * (2.0*PI*110.0*(2.0^0.25)) / (2^(cutoff/24.0))&lt;br /&gt;
*p = 10^((-resonance*24.0)/(128.0f*20.0f))&lt;br /&gt;
&lt;br /&gt;
Some formulae can be simplified:&lt;br /&gt;
*d = (2p)(r+1)-1&lt;br /&gt;
*b = (d+2e)*a&lt;br /&gt;
*c = -e*a&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
IT uses a table for 2p, and calculates r on the fly. The number &amp;quot;(2.0*PI*110.0*(2.0^0.25))&amp;quot; is precalculated.&lt;br /&gt;
&lt;br /&gt;
For more information:&lt;br /&gt;
*[http://schismtracker.org/wiki/Resonant%20Filters Formulae + source code snippets from Jeffrey Lim]&lt;br /&gt;
&lt;br /&gt;
===Effects===&lt;br /&gt;
&lt;br /&gt;
====Axx====&lt;br /&gt;
Set song speed.&lt;br /&gt;
&lt;br /&gt;
====Bxx====&lt;br /&gt;
Jump to Order.&lt;br /&gt;
*If this comes after an SBx loop command, '''the effect is done as-is'''.&lt;br /&gt;
&lt;br /&gt;
====Cxx====&lt;br /&gt;
Break to row.&lt;br /&gt;
*If this comes after an SBx loop command, '''the effect is ignored'''. ''TODO: look into how this information is relayed''&lt;br /&gt;
&lt;br /&gt;
====Dxx====&lt;br /&gt;
Volume slide.&lt;br /&gt;
&lt;br /&gt;
====Exx====&lt;br /&gt;
Pitch slide down.&lt;br /&gt;
&lt;br /&gt;
====Fxx====&lt;br /&gt;
Pitch slide up.&lt;br /&gt;
&lt;br /&gt;
====Gxx====&lt;br /&gt;
Slide to note.&lt;br /&gt;
&lt;br /&gt;
====Hxy====&lt;br /&gt;
Vibrato with speed x*4, depth y*4.&lt;br /&gt;
&lt;br /&gt;
This behaves in a very weird way, and virtually nothing does it right (though most do it &amp;quot;acceptably close&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
Vibrato retriggers in the following situations:&lt;br /&gt;
*When the last time vibrato was used, it was on a different instrument and/or sample ''(TODO: confirm which)''&lt;br /&gt;
&lt;br /&gt;
Vibrato does NOT retrigger on:&lt;br /&gt;
*New note&lt;br /&gt;
*New instrument/sample, barring the exception given above&lt;br /&gt;
&lt;br /&gt;
''TODO: look into &amp;quot;random waveform&amp;quot;.''&lt;br /&gt;
&lt;br /&gt;
*'''Pre-add''' the vibrato speed to the vibrato offset, except when Old Effects is enabled and this is tick 0.&lt;br /&gt;
*Load the value &amp;quot;v&amp;quot; from the selected vibrato table (available in ITTECH.TXT)&lt;br /&gt;
**Note that &amp;quot;random&amp;quot; does NOT use a table, but actually spits out a random number.&lt;br /&gt;
*Multiply v by the vibrato depth.&lt;br /&gt;
*If old effects are enabled, '''v = ~(v&amp;lt;&amp;lt;1)''' (in other words, v = -(v*2+1)).&lt;br /&gt;
*If negative, do a '''one's compliment''' negation of v (that is, v = -(v+1)), and use the slide down tables (or for Amiga slides, just remember to slide down instead of up). Otherwise, use the slide up tables.&lt;br /&gt;
*v = (v'''+32''')&amp;gt;&amp;gt;6 (that is, v = (v+32)/64). Yes, this is rounded.&lt;br /&gt;
*If using linear slides, check if v &amp;lt; 16. If so, do a fine slide by v. Otherwise, do a normal slide by v&amp;gt;&amp;gt;2 (that is, v/4). '''It only does one or the other.'''&lt;br /&gt;
*Otherwise, just do a fine Amiga slide by v.&lt;br /&gt;
&lt;br /&gt;
====Ixy====&lt;br /&gt;
Tremor with ontime x and offtime y.&lt;br /&gt;
&lt;br /&gt;
====Jxy====&lt;br /&gt;
Arpeggio.&lt;br /&gt;
&lt;br /&gt;
====Kxx====&lt;br /&gt;
Dual command: H00 &amp;amp; Dxx&lt;br /&gt;
&lt;br /&gt;
====Lxx====&lt;br /&gt;
Dual command: G00 &amp;amp; Dxx&lt;br /&gt;
&lt;br /&gt;
====Mxx====&lt;br /&gt;
Set channel volume.&lt;br /&gt;
* If xx is &amp;gt; 0x40, '''the effect is ignored.'''&lt;br /&gt;
&lt;br /&gt;
====Nxx====&lt;br /&gt;
Channel volume slide.&lt;br /&gt;
&lt;br /&gt;
====Oxx====&lt;br /&gt;
Set sample offset.&lt;br /&gt;
&lt;br /&gt;
====Pxy====&lt;br /&gt;
Panning slide.&lt;br /&gt;
&lt;br /&gt;
====Qxy====&lt;br /&gt;
Retrig.&lt;br /&gt;
&lt;br /&gt;
====Rxy====&lt;br /&gt;
Tremolo with speed x, depth y.&lt;br /&gt;
&lt;br /&gt;
====Sxy - Miscellaneous effects====&lt;br /&gt;
&lt;br /&gt;
=====S0x=====&lt;br /&gt;
Set filter. Not implemented in Impulse Tracker.&lt;br /&gt;
&lt;br /&gt;
* '''S00 - repeats the last nonzero Sxx effect for the channel.'''&lt;br /&gt;
&lt;br /&gt;
=====S1x=====&lt;br /&gt;
Set glissando control. Not implemented in Impulse Tracker.&lt;br /&gt;
&lt;br /&gt;
=====S2x=====&lt;br /&gt;
Set finetune. Not Implemented in Impulse Tracker.&lt;br /&gt;
&lt;br /&gt;
=====S3x=====&lt;br /&gt;
Set vibrato waveform.&lt;br /&gt;
&lt;br /&gt;
Values for x:&lt;br /&gt;
*0: Sine wave&lt;br /&gt;
*1: Ramp down&lt;br /&gt;
*2: Square wave&lt;br /&gt;
*3: Random wave&lt;br /&gt;
&lt;br /&gt;
* '''If x &amp;gt; 3, the effect is ignored.'''&lt;br /&gt;
&lt;br /&gt;
=====S4x=====&lt;br /&gt;
Set tremolo waveform.&lt;br /&gt;
&lt;br /&gt;
Uses the same waveform table as S3x. '''If x &amp;gt; 3, the effect is ignored.'''&lt;br /&gt;
&lt;br /&gt;
=====S5x=====&lt;br /&gt;
Set panbrello waveform.&lt;br /&gt;
&lt;br /&gt;
Uses the same waveform table as S3x.&lt;br /&gt;
&lt;br /&gt;
* '''If x &amp;gt; 3, the effect is ignored.'''&lt;br /&gt;
* This effect '''retriggers the panbrello waveform position'''.&lt;br /&gt;
&lt;br /&gt;
=====S6x=====&lt;br /&gt;
Pattern delay for x ticks.&lt;br /&gt;
&lt;br /&gt;
=====S70=====&lt;br /&gt;
Past note cut.&lt;br /&gt;
&lt;br /&gt;
=====S71=====&lt;br /&gt;
Past note off.&lt;br /&gt;
&lt;br /&gt;
=====S72=====&lt;br /&gt;
Past note fade.&lt;br /&gt;
&lt;br /&gt;
=====S73=====&lt;br /&gt;
Set NNA to note cut.&lt;br /&gt;
&lt;br /&gt;
=====S74=====&lt;br /&gt;
Set NNA to continue.&lt;br /&gt;
&lt;br /&gt;
=====S75=====&lt;br /&gt;
Set NNA to note off.&lt;br /&gt;
&lt;br /&gt;
=====S76=====&lt;br /&gt;
Set NNA to note fade.&lt;br /&gt;
&lt;br /&gt;
=====S77=====&lt;br /&gt;
Turn off volume envelope.&lt;br /&gt;
&lt;br /&gt;
=====S78=====&lt;br /&gt;
Turn on volume envelope.&lt;br /&gt;
&lt;br /&gt;
=====S79=====&lt;br /&gt;
Turn off panning envelope.&lt;br /&gt;
&lt;br /&gt;
=====S7A=====&lt;br /&gt;
Turn on panning envelope.&lt;br /&gt;
&lt;br /&gt;
=====S7B=====&lt;br /&gt;
Turn off pitch envelope.&lt;br /&gt;
&lt;br /&gt;
=====S7C=====&lt;br /&gt;
Turn on pitch envelope.&lt;br /&gt;
&lt;br /&gt;
=====S8x=====&lt;br /&gt;
Set panning position.&lt;br /&gt;
&lt;br /&gt;
=====S91=====&lt;br /&gt;
Set surround sound.&lt;br /&gt;
&lt;br /&gt;
=====SAy=====&lt;br /&gt;
Set high value of sample offset yxx00h&lt;br /&gt;
&lt;br /&gt;
=====SBx=====&lt;br /&gt;
Pattern loop.&lt;br /&gt;
&lt;br /&gt;
=====SCx=====&lt;br /&gt;
Note cut after x ticks.&lt;br /&gt;
&lt;br /&gt;
=====SDx=====&lt;br /&gt;
Note delay for x ticks.&lt;br /&gt;
&lt;br /&gt;
=====SEx=====&lt;br /&gt;
Pattern delay for x rows&lt;br /&gt;
&lt;br /&gt;
=====SFx=====&lt;br /&gt;
Set parameterised MIDI macro.&lt;br /&gt;
&lt;br /&gt;
====Txx====&lt;br /&gt;
Set Tempo.&lt;br /&gt;
&lt;br /&gt;
====Uxy====&lt;br /&gt;
Fine vibrato with speed x*4, depth y.&lt;br /&gt;
&lt;br /&gt;
====Vxx====&lt;br /&gt;
Set global volume.&lt;br /&gt;
* If xx is &amp;gt; 0x80, '''the effect is ignored.'''&lt;br /&gt;
&lt;br /&gt;
====Wxy====&lt;br /&gt;
Global volume slide.&lt;br /&gt;
* IT versions &amp;lt; 1.06 had a bug where a slide up would clip to 0 instead of 128.&lt;br /&gt;
&lt;br /&gt;
====Xxx====&lt;br /&gt;
Set panning position. Sets panning to '''(xx + 2) div 4'''&lt;br /&gt;
&lt;br /&gt;
====Yxy====&lt;br /&gt;
Panbrello with speed x, depth y.&lt;br /&gt;
&lt;br /&gt;
* '''If the panbrello waveform is set to 'Random', then the speed is interpreted as a delay'''.&lt;br /&gt;
&lt;br /&gt;
====Zxx====&lt;br /&gt;
MIDI Macros&lt;br /&gt;
&lt;br /&gt;
[[Category: Music Pattern Formats]]&lt;/div&gt;</summary>
		<author><name>GreaseMonkey</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Impulse_Tracker&amp;diff=13810</id>
		<title>Impulse Tracker</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Impulse_Tracker&amp;diff=13810"/>
		<updated>2012-01-23T08:43:48Z</updated>

		<summary type="html">&lt;p&gt;GreaseMonkey: /* Resonant filters */ trying to make this more accurate&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* Extension: it&lt;br /&gt;
&lt;br /&gt;
==File Format==&lt;br /&gt;
''TODO''&lt;br /&gt;
&lt;br /&gt;
''it would be interesting to find out how the MIDI/timestamp stuff after the pointer list works... the other TODOs I (GM) know about''&lt;br /&gt;
&lt;br /&gt;
==IT214 sample compression==&lt;br /&gt;
&lt;br /&gt;
If bit 3 (0x08 compressed samples) is set, the sample is compressed.&lt;br /&gt;
&lt;br /&gt;
* Compression is split into blocks, where the '''uncompressed size''' is 0x8000 '''bytes''' (0x4000 samples for 16-bit, and 0x8000 otherwise).&lt;br /&gt;
* Once a block is decompressed (or at least fails to decompress), the data is then delta decoded.&lt;br /&gt;
* The sample conversion flags are applied '''per-block''' rather than for the whole sample. These are probably applied after delta decoding.&lt;br /&gt;
* IT215 samples are IT214-compressed samples with the &amp;quot;Delta&amp;quot; flag (not the &amp;quot;Byte Delta&amp;quot; flag) set in the conversion flags.&lt;br /&gt;
* Each compressed block starts with a 16-bit length field, and then the bitstream is encoded in little-endian binary (LSB up).&lt;br /&gt;
* There is a &amp;quot;bit width&amp;quot; initially set to 9 for 8-bit samples, and 17 for 16-bit samples.&lt;br /&gt;
* The &amp;quot;bit width&amp;quot; is changed by special values inside their respective types. If such a special value is not triggered, the values are read as signed values, and unpacked&lt;br /&gt;
* There are three types of blocks, which we will call A, B, and C.&lt;br /&gt;
** Type A: Bit widths 1 through 6. Special value is 1 in the top bit and 0s for the rest. If such a value is triggered, it then reads 3 (8-bit) or 4 (16-bit) bits for calculating the new bit width (see below).&lt;br /&gt;
** Type B: Bit widths 7 through n, where n is 8 for 8-bit samples and 16 for 16-bit. Special values are 0...0100 through 1...1011 for 8-bit and 0...01000 through 1...10111 for 16-bit. If such a value is triggered, subtract 0...0100 (8-bit) or 0...01000 (16-bit) and use that to calculate the new bit width (see below).&lt;br /&gt;
** Type C: Bit width n+1. If the top bit is set, the lower 8 bits plus 1 are the new bit width.&lt;br /&gt;
* Barring type C, the new width selected is (v+1), except where v+1 &amp;gt;= the previous bit width, in which case the new width is v+1.&lt;br /&gt;
* If an invalid bit width is selected (only possible in type C), the decompressor '''terminates and leaves all the remaining values as 0 before delta decoding.'''&lt;br /&gt;
* The defacto standard for compressed stereo samples (as set by XMPlay) is to decompress the left channel '''entirely separately''' from the right channel (where the data follows immediately afterwards), rather than decompress them together and separate afterwards.&lt;br /&gt;
&lt;br /&gt;
''if this is a bit too messy, feel free to tidy it up''&lt;br /&gt;
&lt;br /&gt;
==Playback notes==&lt;br /&gt;
''TODO''&lt;br /&gt;
&lt;br /&gt;
===Resonant filters===&lt;br /&gt;
&lt;br /&gt;
The resonant filter (added in 2.14p3) uses the following formula:&lt;br /&gt;
&lt;br /&gt;
*K[n] = a * S[n] + b * K[n-1] + c * K[n-2]&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
*K[n] is the outputted value at time n&lt;br /&gt;
*S[n] is the input value at time n&lt;br /&gt;
*a = 1/(1+d+e)&lt;br /&gt;
*b = (d+2e) / (1+d+e)&lt;br /&gt;
*c = -e / (1+d+e)&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
*d = 2pr+2p-1&lt;br /&gt;
*e = r^2&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
*r = playback_frequency * (2.0*PI*110.0*(2.0^0.25)) / (2^(cutoff/24.0))&lt;br /&gt;
*p = 10^((-resonance*24.0)/(128.0f*20.0f))&lt;br /&gt;
&lt;br /&gt;
Some formulae can be simplified:&lt;br /&gt;
*d = (2p)(r+1)-1&lt;br /&gt;
*b = (d+2e)*a&lt;br /&gt;
*c = -e*a&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
IT uses a table for 2p, and calculates r on the fly. The number &amp;quot;(2.0*PI*110.0*(2.0^0.25))&amp;quot; is precalculated.&lt;br /&gt;
&lt;br /&gt;
For more information:&lt;br /&gt;
*[http://schismtracker.org/wiki/Resonant%20Filters Formulae + source code snippets from Jeffrey Lim]&lt;br /&gt;
&lt;br /&gt;
===Effects===&lt;br /&gt;
&lt;br /&gt;
====Axx====&lt;br /&gt;
Set song speed.&lt;br /&gt;
&lt;br /&gt;
====Bxx====&lt;br /&gt;
Jump to Order.&lt;br /&gt;
*If this comes after an SBx loop command, '''the effect is done as-is'''.&lt;br /&gt;
&lt;br /&gt;
====Cxx====&lt;br /&gt;
Break to row.&lt;br /&gt;
*If this comes after an SBx loop command, '''the effect is ignored'''. ''TODO: look into how this information is relayed''&lt;br /&gt;
&lt;br /&gt;
====Dxx====&lt;br /&gt;
Volume slide.&lt;br /&gt;
&lt;br /&gt;
====Exx====&lt;br /&gt;
Pitch slide down.&lt;br /&gt;
&lt;br /&gt;
====Fxx====&lt;br /&gt;
Pitch slide up.&lt;br /&gt;
&lt;br /&gt;
====Gxx====&lt;br /&gt;
Slide to note.&lt;br /&gt;
&lt;br /&gt;
====Hxy====&lt;br /&gt;
Vibrato with speed x, depth y.&lt;br /&gt;
&lt;br /&gt;
====Ixy====&lt;br /&gt;
Tremor with ontime x and offtime y.&lt;br /&gt;
&lt;br /&gt;
====Jxy====&lt;br /&gt;
Arpeggio.&lt;br /&gt;
&lt;br /&gt;
====Kxx====&lt;br /&gt;
Dual command: H00 &amp;amp; Dxx&lt;br /&gt;
&lt;br /&gt;
====Lxx====&lt;br /&gt;
Dual command: G00 &amp;amp; Dxx&lt;br /&gt;
&lt;br /&gt;
====Mxx====&lt;br /&gt;
Set channel volume.&lt;br /&gt;
* If xx is &amp;gt; 0x40, '''the effect is ignored.'''&lt;br /&gt;
&lt;br /&gt;
====Nxx====&lt;br /&gt;
Channel volume slide.&lt;br /&gt;
&lt;br /&gt;
====Oxx====&lt;br /&gt;
Set sample offset.&lt;br /&gt;
&lt;br /&gt;
====Pxy====&lt;br /&gt;
Panning slide.&lt;br /&gt;
&lt;br /&gt;
====Qxy====&lt;br /&gt;
Retrig.&lt;br /&gt;
&lt;br /&gt;
====Rxy====&lt;br /&gt;
Tremolo with speed x, depth y.&lt;br /&gt;
&lt;br /&gt;
====Sxy - Miscellaneous effects====&lt;br /&gt;
&lt;br /&gt;
=====S0x=====&lt;br /&gt;
Set filter. Not implemented in Impulse Tracker.&lt;br /&gt;
&lt;br /&gt;
* '''S00 - repeats the last nonzero Sxx effect for the channel.'''&lt;br /&gt;
&lt;br /&gt;
=====S1x=====&lt;br /&gt;
Set glissando control. Not implemented in Impulse Tracker.&lt;br /&gt;
&lt;br /&gt;
=====S2x=====&lt;br /&gt;
Set finetune. Not Implemented in Impulse Tracker.&lt;br /&gt;
&lt;br /&gt;
=====S3x=====&lt;br /&gt;
Set vibrato waveform.&lt;br /&gt;
&lt;br /&gt;
Values for x:&lt;br /&gt;
*0: Sine wave&lt;br /&gt;
*1: Ramp down&lt;br /&gt;
*2: Square wave&lt;br /&gt;
*3: Random wave&lt;br /&gt;
&lt;br /&gt;
* '''If x &amp;gt; 3, the effect is ignored.'''&lt;br /&gt;
&lt;br /&gt;
=====S4x=====&lt;br /&gt;
Set tremolo waveform.&lt;br /&gt;
&lt;br /&gt;
Uses the same waveform table as S3x. '''If x &amp;gt; 3, the effect is ignored.'''&lt;br /&gt;
&lt;br /&gt;
=====S5x=====&lt;br /&gt;
Set panbrello waveform.&lt;br /&gt;
&lt;br /&gt;
Uses the same waveform table as S3x.&lt;br /&gt;
&lt;br /&gt;
* '''If x &amp;gt; 3, the effect is ignored.'''&lt;br /&gt;
* This effect '''retriggers the panbrello waveform position'''.&lt;br /&gt;
&lt;br /&gt;
=====S6x=====&lt;br /&gt;
Pattern delay for x ticks.&lt;br /&gt;
&lt;br /&gt;
=====S70=====&lt;br /&gt;
Past note cut.&lt;br /&gt;
&lt;br /&gt;
=====S71=====&lt;br /&gt;
Past note off.&lt;br /&gt;
&lt;br /&gt;
=====S72=====&lt;br /&gt;
Past note fade.&lt;br /&gt;
&lt;br /&gt;
=====S73=====&lt;br /&gt;
Set NNA to note cut.&lt;br /&gt;
&lt;br /&gt;
=====S74=====&lt;br /&gt;
Set NNA to continue.&lt;br /&gt;
&lt;br /&gt;
=====S75=====&lt;br /&gt;
Set NNA to note off.&lt;br /&gt;
&lt;br /&gt;
=====S76=====&lt;br /&gt;
Set NNA to note fade.&lt;br /&gt;
&lt;br /&gt;
=====S77=====&lt;br /&gt;
Turn off volume envelope.&lt;br /&gt;
&lt;br /&gt;
=====S78=====&lt;br /&gt;
Turn on volume envelope.&lt;br /&gt;
&lt;br /&gt;
=====S79=====&lt;br /&gt;
Turn off panning envelope.&lt;br /&gt;
&lt;br /&gt;
=====S7A=====&lt;br /&gt;
Turn on panning envelope.&lt;br /&gt;
&lt;br /&gt;
=====S7B=====&lt;br /&gt;
Turn off pitch envelope.&lt;br /&gt;
&lt;br /&gt;
=====S7C=====&lt;br /&gt;
Turn on pitch envelope.&lt;br /&gt;
&lt;br /&gt;
=====S8x=====&lt;br /&gt;
Set panning position.&lt;br /&gt;
&lt;br /&gt;
=====S91=====&lt;br /&gt;
Set surround sound.&lt;br /&gt;
&lt;br /&gt;
=====SAy=====&lt;br /&gt;
Set high value of sample offset yxx00h&lt;br /&gt;
&lt;br /&gt;
=====SBx=====&lt;br /&gt;
Pattern loop.&lt;br /&gt;
&lt;br /&gt;
=====SCx=====&lt;br /&gt;
Note cut after x ticks.&lt;br /&gt;
&lt;br /&gt;
=====SDx=====&lt;br /&gt;
Note delay for x ticks.&lt;br /&gt;
&lt;br /&gt;
=====SEx=====&lt;br /&gt;
Pattern delay for x rows&lt;br /&gt;
&lt;br /&gt;
=====SFx=====&lt;br /&gt;
Set parameterised MIDI macro.&lt;br /&gt;
&lt;br /&gt;
====Txx====&lt;br /&gt;
Set Tempo.&lt;br /&gt;
&lt;br /&gt;
====Uxy====&lt;br /&gt;
Fine vibrato with speed x, depth y.&lt;br /&gt;
&lt;br /&gt;
====Vxx====&lt;br /&gt;
Set global volume.&lt;br /&gt;
* If xx is &amp;gt; 0x80, '''the effect is ignored.'''&lt;br /&gt;
&lt;br /&gt;
====Wxy====&lt;br /&gt;
Global volume slide.&lt;br /&gt;
* IT versions &amp;lt; 1.06 had a bug where a slide up would clip to 0 instead of 128.&lt;br /&gt;
&lt;br /&gt;
====Xxx====&lt;br /&gt;
Set panning position. Sets panning to '''(xx + 2) div 4'''&lt;br /&gt;
&lt;br /&gt;
====Yxy====&lt;br /&gt;
Panbrello with speed x, depth y.&lt;br /&gt;
&lt;br /&gt;
* '''If the panbrello waveform is set to 'Random', then the speed is interpreted as a delay'''.&lt;br /&gt;
&lt;br /&gt;
====Zxx====&lt;br /&gt;
MIDI Macros&lt;br /&gt;
&lt;br /&gt;
[[Category: Music Pattern Formats]]&lt;/div&gt;</summary>
		<author><name>GreaseMonkey</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Impulse_Tracker&amp;diff=13805</id>
		<title>Impulse Tracker</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Impulse_Tracker&amp;diff=13805"/>
		<updated>2012-01-22T10:07:52Z</updated>

		<summary type="html">&lt;p&gt;GreaseMonkey: /* Wxy */ a bug i found in an old version&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* Extension: it&lt;br /&gt;
&lt;br /&gt;
==File Format==&lt;br /&gt;
''TODO''&lt;br /&gt;
&lt;br /&gt;
''it would be interesting to find out how the MIDI/timestamp stuff after the pointer list works... the other TODOs I (GM) know about''&lt;br /&gt;
&lt;br /&gt;
==IT214 sample compression==&lt;br /&gt;
&lt;br /&gt;
If bit 3 (0x08 compressed samples) is set, the sample is compressed.&lt;br /&gt;
&lt;br /&gt;
* Compression is split into blocks, where the '''uncompressed size''' is 0x8000 '''bytes''' (0x4000 samples for 16-bit, and 0x8000 otherwise).&lt;br /&gt;
* Once a block is decompressed (or at least fails to decompress), the data is then delta decoded.&lt;br /&gt;
* The sample conversion flags are applied '''per-block''' rather than for the whole sample. These are probably applied after delta decoding.&lt;br /&gt;
* IT215 samples are IT214-compressed samples with the &amp;quot;Delta&amp;quot; flag (not the &amp;quot;Byte Delta&amp;quot; flag) set in the conversion flags.&lt;br /&gt;
* Each compressed block starts with a 16-bit length field, and then the bitstream is encoded in little-endian binary (LSB up).&lt;br /&gt;
* There is a &amp;quot;bit width&amp;quot; initially set to 9 for 8-bit samples, and 17 for 16-bit samples.&lt;br /&gt;
* The &amp;quot;bit width&amp;quot; is changed by special values inside their respective types. If such a special value is not triggered, the values are read as signed values, and unpacked&lt;br /&gt;
* There are three types of blocks, which we will call A, B, and C.&lt;br /&gt;
** Type A: Bit widths 1 through 6. Special value is 1 in the top bit and 0s for the rest. If such a value is triggered, it then reads 3 (8-bit) or 4 (16-bit) bits for calculating the new bit width (see below).&lt;br /&gt;
** Type B: Bit widths 7 through n, where n is 8 for 8-bit samples and 16 for 16-bit. Special values are 0...0100 through 1...1011 for 8-bit and 0...01000 through 1...10111 for 16-bit. If such a value is triggered, subtract 0...0100 (8-bit) or 0...01000 (16-bit) and use that to calculate the new bit width (see below).&lt;br /&gt;
** Type C: Bit width n+1. If the top bit is set, the lower 8 bits plus 1 are the new bit width.&lt;br /&gt;
* Barring type C, the new width selected is (v+1), except where v+1 &amp;gt;= the previous bit width, in which case the new width is v+1.&lt;br /&gt;
* If an invalid bit width is selected (only possible in type C), the decompressor '''terminates and leaves all the remaining values as 0 before delta decoding.'''&lt;br /&gt;
* The defacto standard for compressed stereo samples (as set by XMPlay) is to decompress the left channel '''entirely separately''' from the right channel (where the data follows immediately afterwards), rather than decompress them together and separate afterwards.&lt;br /&gt;
&lt;br /&gt;
''if this is a bit too messy, feel free to tidy it up''&lt;br /&gt;
&lt;br /&gt;
==Playback notes==&lt;br /&gt;
''TODO''&lt;br /&gt;
&lt;br /&gt;
===Resonant filters===&lt;br /&gt;
&lt;br /&gt;
The resonant filter (added in 2.14p3) uses the following formula:&lt;br /&gt;
&lt;br /&gt;
*K[n] = a * S[n] + b * K[n-1] + c * K[n-2]&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
*K[n] is the outputted value at time n&lt;br /&gt;
*S[n] is the input value at time n&lt;br /&gt;
*a = 1/(1+d+e)&lt;br /&gt;
*b = (d+2e) / (1+d+e)&lt;br /&gt;
*c = -e / (1+d+e)&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
*d = 2pr+2p-1&lt;br /&gt;
*e = r^2&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
*r = 2^((cutoff/24.0)/(2.0*PI*110.0*(2.0^0.25))) (probably divided by the playback frequency)&lt;br /&gt;
*p = 10^((-resonance*24.0)/(128.0f*20.0f))&lt;br /&gt;
&lt;br /&gt;
''TODO: The information is from [http://schismtracker.org/wiki/Resonant%20Filters here] and needs to be confirmed for accuracy (as in, where does the playback frequency come in?).''&lt;br /&gt;
&lt;br /&gt;
===Effects===&lt;br /&gt;
&lt;br /&gt;
====Axx====&lt;br /&gt;
Set song speed.&lt;br /&gt;
&lt;br /&gt;
====Bxx====&lt;br /&gt;
Jump to Order.&lt;br /&gt;
*If this comes after an SBx loop command, '''the effect is done as-is'''.&lt;br /&gt;
&lt;br /&gt;
====Cxx====&lt;br /&gt;
Break to row.&lt;br /&gt;
*If this comes after an SBx loop command, '''the effect is ignored'''. ''TODO: look into how this information is relayed''&lt;br /&gt;
&lt;br /&gt;
====Dxx====&lt;br /&gt;
Volume slide.&lt;br /&gt;
&lt;br /&gt;
====Exx====&lt;br /&gt;
Pitch slide down.&lt;br /&gt;
&lt;br /&gt;
====Fxx====&lt;br /&gt;
Pitch slide up.&lt;br /&gt;
&lt;br /&gt;
====Gxx====&lt;br /&gt;
Slide to note.&lt;br /&gt;
&lt;br /&gt;
====Hxy====&lt;br /&gt;
Vibrato with speed x, depth y.&lt;br /&gt;
&lt;br /&gt;
====Ixy====&lt;br /&gt;
Tremor with ontime x and offtime y.&lt;br /&gt;
&lt;br /&gt;
====Jxy====&lt;br /&gt;
Arpeggio.&lt;br /&gt;
&lt;br /&gt;
====Kxx====&lt;br /&gt;
Dual command: H00 &amp;amp; Dxx&lt;br /&gt;
&lt;br /&gt;
====Lxx====&lt;br /&gt;
Dual command: G00 &amp;amp; Dxx&lt;br /&gt;
&lt;br /&gt;
====Mxx====&lt;br /&gt;
Set channel volume.&lt;br /&gt;
* If xx is &amp;gt; 0x40, '''the effect is ignored.'''&lt;br /&gt;
&lt;br /&gt;
====Nxx====&lt;br /&gt;
Channel volume slide.&lt;br /&gt;
&lt;br /&gt;
====Oxx====&lt;br /&gt;
Set sample offset.&lt;br /&gt;
&lt;br /&gt;
====Pxy====&lt;br /&gt;
Panning slide.&lt;br /&gt;
&lt;br /&gt;
====Qxy====&lt;br /&gt;
Retrig.&lt;br /&gt;
&lt;br /&gt;
====Rxy====&lt;br /&gt;
Tremolo with speed x, depth y.&lt;br /&gt;
&lt;br /&gt;
====Sxy - Miscellaneous effects====&lt;br /&gt;
&lt;br /&gt;
=====S0x=====&lt;br /&gt;
Set filter. Not implemented in Impulse Tracker.&lt;br /&gt;
&lt;br /&gt;
* '''S00 - repeats the last nonzero Sxx effect for the channel.'''&lt;br /&gt;
&lt;br /&gt;
=====S1x=====&lt;br /&gt;
Set glissando control. Not implemented in Impulse Tracker.&lt;br /&gt;
&lt;br /&gt;
=====S2x=====&lt;br /&gt;
Set finetune. Not Implemented in Impulse Tracker.&lt;br /&gt;
&lt;br /&gt;
=====S3x=====&lt;br /&gt;
Set vibrato waveform.&lt;br /&gt;
&lt;br /&gt;
Values for x:&lt;br /&gt;
*0: Sine wave&lt;br /&gt;
*1: Ramp down&lt;br /&gt;
*2: Square wave&lt;br /&gt;
*3: Random wave&lt;br /&gt;
&lt;br /&gt;
* '''If x &amp;gt; 3, the effect is ignored.'''&lt;br /&gt;
&lt;br /&gt;
=====S4x=====&lt;br /&gt;
Set tremolo waveform.&lt;br /&gt;
&lt;br /&gt;
Uses the same waveform table as S3x. '''If x &amp;gt; 3, the effect is ignored.'''&lt;br /&gt;
&lt;br /&gt;
=====S5x=====&lt;br /&gt;
Set panbrello waveform.&lt;br /&gt;
&lt;br /&gt;
Uses the same waveform table as S3x.&lt;br /&gt;
&lt;br /&gt;
* '''If x &amp;gt; 3, the effect is ignored.'''&lt;br /&gt;
* This effect '''retriggers the panbrello waveform position'''.&lt;br /&gt;
&lt;br /&gt;
=====S6x=====&lt;br /&gt;
Pattern delay for x ticks.&lt;br /&gt;
&lt;br /&gt;
=====S70=====&lt;br /&gt;
Past note cut.&lt;br /&gt;
&lt;br /&gt;
=====S71=====&lt;br /&gt;
Past note off.&lt;br /&gt;
&lt;br /&gt;
=====S72=====&lt;br /&gt;
Past note fade.&lt;br /&gt;
&lt;br /&gt;
=====S73=====&lt;br /&gt;
Set NNA to note cut.&lt;br /&gt;
&lt;br /&gt;
=====S74=====&lt;br /&gt;
Set NNA to continue.&lt;br /&gt;
&lt;br /&gt;
=====S75=====&lt;br /&gt;
Set NNA to note off.&lt;br /&gt;
&lt;br /&gt;
=====S76=====&lt;br /&gt;
Set NNA to note fade.&lt;br /&gt;
&lt;br /&gt;
=====S77=====&lt;br /&gt;
Turn off volume envelope.&lt;br /&gt;
&lt;br /&gt;
=====S78=====&lt;br /&gt;
Turn on volume envelope.&lt;br /&gt;
&lt;br /&gt;
=====S79=====&lt;br /&gt;
Turn off panning envelope.&lt;br /&gt;
&lt;br /&gt;
=====S7A=====&lt;br /&gt;
Turn on panning envelope.&lt;br /&gt;
&lt;br /&gt;
=====S7B=====&lt;br /&gt;
Turn off pitch envelope.&lt;br /&gt;
&lt;br /&gt;
=====S7C=====&lt;br /&gt;
Turn on pitch envelope.&lt;br /&gt;
&lt;br /&gt;
=====S8x=====&lt;br /&gt;
Set panning position.&lt;br /&gt;
&lt;br /&gt;
=====S91=====&lt;br /&gt;
Set surround sound.&lt;br /&gt;
&lt;br /&gt;
=====SAy=====&lt;br /&gt;
Set high value of sample offset yxx00h&lt;br /&gt;
&lt;br /&gt;
=====SBx=====&lt;br /&gt;
Pattern loop.&lt;br /&gt;
&lt;br /&gt;
=====SCx=====&lt;br /&gt;
Note cut after x ticks.&lt;br /&gt;
&lt;br /&gt;
=====SDx=====&lt;br /&gt;
Note delay for x ticks.&lt;br /&gt;
&lt;br /&gt;
=====SEx=====&lt;br /&gt;
Pattern delay for x rows&lt;br /&gt;
&lt;br /&gt;
=====SFx=====&lt;br /&gt;
Set parameterised MIDI macro.&lt;br /&gt;
&lt;br /&gt;
====Txx====&lt;br /&gt;
Set Tempo.&lt;br /&gt;
&lt;br /&gt;
====Uxy====&lt;br /&gt;
Fine vibrato with speed x, depth y.&lt;br /&gt;
&lt;br /&gt;
====Vxx====&lt;br /&gt;
Set global volume.&lt;br /&gt;
* If xx is &amp;gt; 0x80, '''the effect is ignored.'''&lt;br /&gt;
&lt;br /&gt;
====Wxy====&lt;br /&gt;
Global volume slide.&lt;br /&gt;
* IT versions &amp;lt; 1.06 had a bug where a slide up would clip to 0 instead of 128.&lt;br /&gt;
&lt;br /&gt;
====Xxx====&lt;br /&gt;
Set panning position. Sets panning to '''(xx + 2) div 4'''&lt;br /&gt;
&lt;br /&gt;
====Yxy====&lt;br /&gt;
Panbrello with speed x, depth y.&lt;br /&gt;
&lt;br /&gt;
* '''If the panbrello waveform is set to 'Random', then the speed is interpreted as a delay'''.&lt;br /&gt;
&lt;br /&gt;
====Zxx====&lt;br /&gt;
MIDI Macros&lt;br /&gt;
&lt;br /&gt;
[[Category: Music Pattern Formats]]&lt;/div&gt;</summary>
		<author><name>GreaseMonkey</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Impulse_Tracker&amp;diff=13804</id>
		<title>Impulse Tracker</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Impulse_Tracker&amp;diff=13804"/>
		<updated>2012-01-22T10:06:44Z</updated>

		<summary type="html">&lt;p&gt;GreaseMonkey: /* Resonant filters */ adding some info&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* Extension: it&lt;br /&gt;
&lt;br /&gt;
==File Format==&lt;br /&gt;
''TODO''&lt;br /&gt;
&lt;br /&gt;
''it would be interesting to find out how the MIDI/timestamp stuff after the pointer list works... the other TODOs I (GM) know about''&lt;br /&gt;
&lt;br /&gt;
==IT214 sample compression==&lt;br /&gt;
&lt;br /&gt;
If bit 3 (0x08 compressed samples) is set, the sample is compressed.&lt;br /&gt;
&lt;br /&gt;
* Compression is split into blocks, where the '''uncompressed size''' is 0x8000 '''bytes''' (0x4000 samples for 16-bit, and 0x8000 otherwise).&lt;br /&gt;
* Once a block is decompressed (or at least fails to decompress), the data is then delta decoded.&lt;br /&gt;
* The sample conversion flags are applied '''per-block''' rather than for the whole sample. These are probably applied after delta decoding.&lt;br /&gt;
* IT215 samples are IT214-compressed samples with the &amp;quot;Delta&amp;quot; flag (not the &amp;quot;Byte Delta&amp;quot; flag) set in the conversion flags.&lt;br /&gt;
* Each compressed block starts with a 16-bit length field, and then the bitstream is encoded in little-endian binary (LSB up).&lt;br /&gt;
* There is a &amp;quot;bit width&amp;quot; initially set to 9 for 8-bit samples, and 17 for 16-bit samples.&lt;br /&gt;
* The &amp;quot;bit width&amp;quot; is changed by special values inside their respective types. If such a special value is not triggered, the values are read as signed values, and unpacked&lt;br /&gt;
* There are three types of blocks, which we will call A, B, and C.&lt;br /&gt;
** Type A: Bit widths 1 through 6. Special value is 1 in the top bit and 0s for the rest. If such a value is triggered, it then reads 3 (8-bit) or 4 (16-bit) bits for calculating the new bit width (see below).&lt;br /&gt;
** Type B: Bit widths 7 through n, where n is 8 for 8-bit samples and 16 for 16-bit. Special values are 0...0100 through 1...1011 for 8-bit and 0...01000 through 1...10111 for 16-bit. If such a value is triggered, subtract 0...0100 (8-bit) or 0...01000 (16-bit) and use that to calculate the new bit width (see below).&lt;br /&gt;
** Type C: Bit width n+1. If the top bit is set, the lower 8 bits plus 1 are the new bit width.&lt;br /&gt;
* Barring type C, the new width selected is (v+1), except where v+1 &amp;gt;= the previous bit width, in which case the new width is v+1.&lt;br /&gt;
* If an invalid bit width is selected (only possible in type C), the decompressor '''terminates and leaves all the remaining values as 0 before delta decoding.'''&lt;br /&gt;
* The defacto standard for compressed stereo samples (as set by XMPlay) is to decompress the left channel '''entirely separately''' from the right channel (where the data follows immediately afterwards), rather than decompress them together and separate afterwards.&lt;br /&gt;
&lt;br /&gt;
''if this is a bit too messy, feel free to tidy it up''&lt;br /&gt;
&lt;br /&gt;
==Playback notes==&lt;br /&gt;
''TODO''&lt;br /&gt;
&lt;br /&gt;
===Resonant filters===&lt;br /&gt;
&lt;br /&gt;
The resonant filter (added in 2.14p3) uses the following formula:&lt;br /&gt;
&lt;br /&gt;
*K[n] = a * S[n] + b * K[n-1] + c * K[n-2]&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
*K[n] is the outputted value at time n&lt;br /&gt;
*S[n] is the input value at time n&lt;br /&gt;
*a = 1/(1+d+e)&lt;br /&gt;
*b = (d+2e) / (1+d+e)&lt;br /&gt;
*c = -e / (1+d+e)&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
*d = 2pr+2p-1&lt;br /&gt;
*e = r^2&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
*r = 2^((cutoff/24.0)/(2.0*PI*110.0*(2.0^0.25))) (probably divided by the playback frequency)&lt;br /&gt;
*p = 10^((-resonance*24.0)/(128.0f*20.0f))&lt;br /&gt;
&lt;br /&gt;
''TODO: The information is from [http://schismtracker.org/wiki/Resonant%20Filters here] and needs to be confirmed for accuracy (as in, where does the playback frequency come in?).''&lt;br /&gt;
&lt;br /&gt;
===Effects===&lt;br /&gt;
&lt;br /&gt;
====Axx====&lt;br /&gt;
Set song speed.&lt;br /&gt;
&lt;br /&gt;
====Bxx====&lt;br /&gt;
Jump to Order.&lt;br /&gt;
*If this comes after an SBx loop command, '''the effect is done as-is'''.&lt;br /&gt;
&lt;br /&gt;
====Cxx====&lt;br /&gt;
Break to row.&lt;br /&gt;
*If this comes after an SBx loop command, '''the effect is ignored'''. ''TODO: look into how this information is relayed''&lt;br /&gt;
&lt;br /&gt;
====Dxx====&lt;br /&gt;
Volume slide.&lt;br /&gt;
&lt;br /&gt;
====Exx====&lt;br /&gt;
Pitch slide down.&lt;br /&gt;
&lt;br /&gt;
====Fxx====&lt;br /&gt;
Pitch slide up.&lt;br /&gt;
&lt;br /&gt;
====Gxx====&lt;br /&gt;
Slide to note.&lt;br /&gt;
&lt;br /&gt;
====Hxy====&lt;br /&gt;
Vibrato with speed x, depth y.&lt;br /&gt;
&lt;br /&gt;
====Ixy====&lt;br /&gt;
Tremor with ontime x and offtime y.&lt;br /&gt;
&lt;br /&gt;
====Jxy====&lt;br /&gt;
Arpeggio.&lt;br /&gt;
&lt;br /&gt;
====Kxx====&lt;br /&gt;
Dual command: H00 &amp;amp; Dxx&lt;br /&gt;
&lt;br /&gt;
====Lxx====&lt;br /&gt;
Dual command: G00 &amp;amp; Dxx&lt;br /&gt;
&lt;br /&gt;
====Mxx====&lt;br /&gt;
Set channel volume.&lt;br /&gt;
* If xx is &amp;gt; 0x40, '''the effect is ignored.'''&lt;br /&gt;
&lt;br /&gt;
====Nxx====&lt;br /&gt;
Channel volume slide.&lt;br /&gt;
&lt;br /&gt;
====Oxx====&lt;br /&gt;
Set sample offset.&lt;br /&gt;
&lt;br /&gt;
====Pxy====&lt;br /&gt;
Panning slide.&lt;br /&gt;
&lt;br /&gt;
====Qxy====&lt;br /&gt;
Retrig.&lt;br /&gt;
&lt;br /&gt;
====Rxy====&lt;br /&gt;
Tremolo with speed x, depth y.&lt;br /&gt;
&lt;br /&gt;
====Sxy - Miscellaneous effects====&lt;br /&gt;
&lt;br /&gt;
=====S0x=====&lt;br /&gt;
Set filter. Not implemented in Impulse Tracker.&lt;br /&gt;
&lt;br /&gt;
* '''S00 - repeats the last nonzero Sxx effect for the channel.'''&lt;br /&gt;
&lt;br /&gt;
=====S1x=====&lt;br /&gt;
Set glissando control. Not implemented in Impulse Tracker.&lt;br /&gt;
&lt;br /&gt;
=====S2x=====&lt;br /&gt;
Set finetune. Not Implemented in Impulse Tracker.&lt;br /&gt;
&lt;br /&gt;
=====S3x=====&lt;br /&gt;
Set vibrato waveform.&lt;br /&gt;
&lt;br /&gt;
Values for x:&lt;br /&gt;
*0: Sine wave&lt;br /&gt;
*1: Ramp down&lt;br /&gt;
*2: Square wave&lt;br /&gt;
*3: Random wave&lt;br /&gt;
&lt;br /&gt;
* '''If x &amp;gt; 3, the effect is ignored.'''&lt;br /&gt;
&lt;br /&gt;
=====S4x=====&lt;br /&gt;
Set tremolo waveform.&lt;br /&gt;
&lt;br /&gt;
Uses the same waveform table as S3x. '''If x &amp;gt; 3, the effect is ignored.'''&lt;br /&gt;
&lt;br /&gt;
=====S5x=====&lt;br /&gt;
Set panbrello waveform.&lt;br /&gt;
&lt;br /&gt;
Uses the same waveform table as S3x.&lt;br /&gt;
&lt;br /&gt;
* '''If x &amp;gt; 3, the effect is ignored.'''&lt;br /&gt;
* This effect '''retriggers the panbrello waveform position'''.&lt;br /&gt;
&lt;br /&gt;
=====S6x=====&lt;br /&gt;
Pattern delay for x ticks.&lt;br /&gt;
&lt;br /&gt;
=====S70=====&lt;br /&gt;
Past note cut.&lt;br /&gt;
&lt;br /&gt;
=====S71=====&lt;br /&gt;
Past note off.&lt;br /&gt;
&lt;br /&gt;
=====S72=====&lt;br /&gt;
Past note fade.&lt;br /&gt;
&lt;br /&gt;
=====S73=====&lt;br /&gt;
Set NNA to note cut.&lt;br /&gt;
&lt;br /&gt;
=====S74=====&lt;br /&gt;
Set NNA to continue.&lt;br /&gt;
&lt;br /&gt;
=====S75=====&lt;br /&gt;
Set NNA to note off.&lt;br /&gt;
&lt;br /&gt;
=====S76=====&lt;br /&gt;
Set NNA to note fade.&lt;br /&gt;
&lt;br /&gt;
=====S77=====&lt;br /&gt;
Turn off volume envelope.&lt;br /&gt;
&lt;br /&gt;
=====S78=====&lt;br /&gt;
Turn on volume envelope.&lt;br /&gt;
&lt;br /&gt;
=====S79=====&lt;br /&gt;
Turn off panning envelope.&lt;br /&gt;
&lt;br /&gt;
=====S7A=====&lt;br /&gt;
Turn on panning envelope.&lt;br /&gt;
&lt;br /&gt;
=====S7B=====&lt;br /&gt;
Turn off pitch envelope.&lt;br /&gt;
&lt;br /&gt;
=====S7C=====&lt;br /&gt;
Turn on pitch envelope.&lt;br /&gt;
&lt;br /&gt;
=====S8x=====&lt;br /&gt;
Set panning position.&lt;br /&gt;
&lt;br /&gt;
=====S91=====&lt;br /&gt;
Set surround sound.&lt;br /&gt;
&lt;br /&gt;
=====SAy=====&lt;br /&gt;
Set high value of sample offset yxx00h&lt;br /&gt;
&lt;br /&gt;
=====SBx=====&lt;br /&gt;
Pattern loop.&lt;br /&gt;
&lt;br /&gt;
=====SCx=====&lt;br /&gt;
Note cut after x ticks.&lt;br /&gt;
&lt;br /&gt;
=====SDx=====&lt;br /&gt;
Note delay for x ticks.&lt;br /&gt;
&lt;br /&gt;
=====SEx=====&lt;br /&gt;
Pattern delay for x rows&lt;br /&gt;
&lt;br /&gt;
=====SFx=====&lt;br /&gt;
Set parameterised MIDI macro.&lt;br /&gt;
&lt;br /&gt;
====Txx====&lt;br /&gt;
Set Tempo.&lt;br /&gt;
&lt;br /&gt;
====Uxy====&lt;br /&gt;
Fine vibrato with speed x, depth y.&lt;br /&gt;
&lt;br /&gt;
====Vxx====&lt;br /&gt;
Set global volume.&lt;br /&gt;
* If xx is &amp;gt; 0x80, '''the effect is ignored.'''&lt;br /&gt;
&lt;br /&gt;
====Wxy====&lt;br /&gt;
Global volume slide.&lt;br /&gt;
&lt;br /&gt;
====Xxx====&lt;br /&gt;
Set panning position. Sets panning to '''(xx + 2) div 4'''&lt;br /&gt;
&lt;br /&gt;
====Yxy====&lt;br /&gt;
Panbrello with speed x, depth y.&lt;br /&gt;
&lt;br /&gt;
* '''If the panbrello waveform is set to 'Random', then the speed is interpreted as a delay'''.&lt;br /&gt;
&lt;br /&gt;
====Zxx====&lt;br /&gt;
MIDI Macros&lt;br /&gt;
&lt;br /&gt;
[[Category: Music Pattern Formats]]&lt;/div&gt;</summary>
		<author><name>GreaseMonkey</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Impulse_Tracker&amp;diff=13803</id>
		<title>Impulse Tracker</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Impulse_Tracker&amp;diff=13803"/>
		<updated>2012-01-22T09:37:23Z</updated>

		<summary type="html">&lt;p&gt;GreaseMonkey: /* IT214 sample compression */ the explanation might be a bit crap, sorry, but there's something here.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* Extension: it&lt;br /&gt;
&lt;br /&gt;
==File Format==&lt;br /&gt;
''TODO''&lt;br /&gt;
&lt;br /&gt;
''it would be interesting to find out how the MIDI/timestamp stuff after the pointer list works... the other TODOs I (GM) know about''&lt;br /&gt;
&lt;br /&gt;
==IT214 sample compression==&lt;br /&gt;
&lt;br /&gt;
If bit 3 (0x08 compressed samples) is set, the sample is compressed.&lt;br /&gt;
&lt;br /&gt;
* Compression is split into blocks, where the '''uncompressed size''' is 0x8000 '''bytes''' (0x4000 samples for 16-bit, and 0x8000 otherwise).&lt;br /&gt;
* Once a block is decompressed (or at least fails to decompress), the data is then delta decoded.&lt;br /&gt;
* The sample conversion flags are applied '''per-block''' rather than for the whole sample. These are probably applied after delta decoding.&lt;br /&gt;
* IT215 samples are IT214-compressed samples with the &amp;quot;Delta&amp;quot; flag (not the &amp;quot;Byte Delta&amp;quot; flag) set in the conversion flags.&lt;br /&gt;
* Each compressed block starts with a 16-bit length field, and then the bitstream is encoded in little-endian binary (LSB up).&lt;br /&gt;
* There is a &amp;quot;bit width&amp;quot; initially set to 9 for 8-bit samples, and 17 for 16-bit samples.&lt;br /&gt;
* The &amp;quot;bit width&amp;quot; is changed by special values inside their respective types. If such a special value is not triggered, the values are read as signed values, and unpacked&lt;br /&gt;
* There are three types of blocks, which we will call A, B, and C.&lt;br /&gt;
** Type A: Bit widths 1 through 6. Special value is 1 in the top bit and 0s for the rest. If such a value is triggered, it then reads 3 (8-bit) or 4 (16-bit) bits for calculating the new bit width (see below).&lt;br /&gt;
** Type B: Bit widths 7 through n, where n is 8 for 8-bit samples and 16 for 16-bit. Special values are 0...0100 through 1...1011 for 8-bit and 0...01000 through 1...10111 for 16-bit. If such a value is triggered, subtract 0...0100 (8-bit) or 0...01000 (16-bit) and use that to calculate the new bit width (see below).&lt;br /&gt;
** Type C: Bit width n+1. If the top bit is set, the lower 8 bits plus 1 are the new bit width.&lt;br /&gt;
* Barring type C, the new width selected is (v+1), except where v+1 &amp;gt;= the previous bit width, in which case the new width is v+1.&lt;br /&gt;
* If an invalid bit width is selected (only possible in type C), the decompressor '''terminates and leaves all the remaining values as 0 before delta decoding.'''&lt;br /&gt;
* The defacto standard for compressed stereo samples (as set by XMPlay) is to decompress the left channel '''entirely separately''' from the right channel (where the data follows immediately afterwards), rather than decompress them together and separate afterwards.&lt;br /&gt;
&lt;br /&gt;
''if this is a bit too messy, feel free to tidy it up''&lt;br /&gt;
&lt;br /&gt;
==Playback notes==&lt;br /&gt;
''TODO''&lt;br /&gt;
&lt;br /&gt;
===Resonant filters===&lt;br /&gt;
''TODO''&lt;br /&gt;
&lt;br /&gt;
===Effects===&lt;br /&gt;
&lt;br /&gt;
====Axx====&lt;br /&gt;
Set song speed.&lt;br /&gt;
&lt;br /&gt;
====Bxx====&lt;br /&gt;
Jump to Order.&lt;br /&gt;
*If this comes after an SBx loop command, '''the effect is done as-is'''.&lt;br /&gt;
&lt;br /&gt;
====Cxx====&lt;br /&gt;
Break to row.&lt;br /&gt;
*If this comes after an SBx loop command, '''the effect is ignored'''. ''TODO: look into how this information is relayed''&lt;br /&gt;
&lt;br /&gt;
====Dxx====&lt;br /&gt;
Volume slide.&lt;br /&gt;
&lt;br /&gt;
====Exx====&lt;br /&gt;
Pitch slide down.&lt;br /&gt;
&lt;br /&gt;
====Fxx====&lt;br /&gt;
Pitch slide up.&lt;br /&gt;
&lt;br /&gt;
====Gxx====&lt;br /&gt;
Slide to note.&lt;br /&gt;
&lt;br /&gt;
====Hxy====&lt;br /&gt;
Vibrato with speed x, depth y.&lt;br /&gt;
&lt;br /&gt;
====Ixy====&lt;br /&gt;
Tremor with ontime x and offtime y.&lt;br /&gt;
&lt;br /&gt;
====Jxy====&lt;br /&gt;
Arpeggio.&lt;br /&gt;
&lt;br /&gt;
====Kxx====&lt;br /&gt;
Dual command: H00 &amp;amp; Dxx&lt;br /&gt;
&lt;br /&gt;
====Lxx====&lt;br /&gt;
Dual command: G00 &amp;amp; Dxx&lt;br /&gt;
&lt;br /&gt;
====Mxx====&lt;br /&gt;
Set channel volume.&lt;br /&gt;
* If xx is &amp;gt; 0x40, '''the effect is ignored.'''&lt;br /&gt;
&lt;br /&gt;
====Nxx====&lt;br /&gt;
Channel volume slide.&lt;br /&gt;
&lt;br /&gt;
====Oxx====&lt;br /&gt;
Set sample offset.&lt;br /&gt;
&lt;br /&gt;
====Pxy====&lt;br /&gt;
Panning slide.&lt;br /&gt;
&lt;br /&gt;
====Qxy====&lt;br /&gt;
Retrig.&lt;br /&gt;
&lt;br /&gt;
====Rxy====&lt;br /&gt;
Tremolo with speed x, depth y.&lt;br /&gt;
&lt;br /&gt;
====Sxy - Miscellaneous effects====&lt;br /&gt;
&lt;br /&gt;
=====S0x=====&lt;br /&gt;
Set filter. Not implemented in Impulse Tracker.&lt;br /&gt;
&lt;br /&gt;
* '''S00 - repeats the last nonzero Sxx effect for the channel.'''&lt;br /&gt;
&lt;br /&gt;
=====S1x=====&lt;br /&gt;
Set glissando control. Not implemented in Impulse Tracker.&lt;br /&gt;
&lt;br /&gt;
=====S2x=====&lt;br /&gt;
Set finetune. Not Implemented in Impulse Tracker.&lt;br /&gt;
&lt;br /&gt;
=====S3x=====&lt;br /&gt;
Set vibrato waveform.&lt;br /&gt;
&lt;br /&gt;
Values for x:&lt;br /&gt;
*0: Sine wave&lt;br /&gt;
*1: Ramp down&lt;br /&gt;
*2: Square wave&lt;br /&gt;
*3: Random wave&lt;br /&gt;
&lt;br /&gt;
* '''If x &amp;gt; 3, the effect is ignored.'''&lt;br /&gt;
&lt;br /&gt;
=====S4x=====&lt;br /&gt;
Set tremolo waveform.&lt;br /&gt;
&lt;br /&gt;
Uses the same waveform table as S3x. '''If x &amp;gt; 3, the effect is ignored.'''&lt;br /&gt;
&lt;br /&gt;
=====S5x=====&lt;br /&gt;
Set panbrello waveform.&lt;br /&gt;
&lt;br /&gt;
Uses the same waveform table as S3x.&lt;br /&gt;
&lt;br /&gt;
* '''If x &amp;gt; 3, the effect is ignored.'''&lt;br /&gt;
* This effect '''retriggers the panbrello waveform position'''.&lt;br /&gt;
&lt;br /&gt;
=====S6x=====&lt;br /&gt;
Pattern delay for x ticks.&lt;br /&gt;
&lt;br /&gt;
=====S70=====&lt;br /&gt;
Past note cut.&lt;br /&gt;
&lt;br /&gt;
=====S71=====&lt;br /&gt;
Past note off.&lt;br /&gt;
&lt;br /&gt;
=====S72=====&lt;br /&gt;
Past note fade.&lt;br /&gt;
&lt;br /&gt;
=====S73=====&lt;br /&gt;
Set NNA to note cut.&lt;br /&gt;
&lt;br /&gt;
=====S74=====&lt;br /&gt;
Set NNA to continue.&lt;br /&gt;
&lt;br /&gt;
=====S75=====&lt;br /&gt;
Set NNA to note off.&lt;br /&gt;
&lt;br /&gt;
=====S76=====&lt;br /&gt;
Set NNA to note fade.&lt;br /&gt;
&lt;br /&gt;
=====S77=====&lt;br /&gt;
Turn off volume envelope.&lt;br /&gt;
&lt;br /&gt;
=====S78=====&lt;br /&gt;
Turn on volume envelope.&lt;br /&gt;
&lt;br /&gt;
=====S79=====&lt;br /&gt;
Turn off panning envelope.&lt;br /&gt;
&lt;br /&gt;
=====S7A=====&lt;br /&gt;
Turn on panning envelope.&lt;br /&gt;
&lt;br /&gt;
=====S7B=====&lt;br /&gt;
Turn off pitch envelope.&lt;br /&gt;
&lt;br /&gt;
=====S7C=====&lt;br /&gt;
Turn on pitch envelope.&lt;br /&gt;
&lt;br /&gt;
=====S8x=====&lt;br /&gt;
Set panning position.&lt;br /&gt;
&lt;br /&gt;
=====S91=====&lt;br /&gt;
Set surround sound.&lt;br /&gt;
&lt;br /&gt;
=====SAy=====&lt;br /&gt;
Set high value of sample offset yxx00h&lt;br /&gt;
&lt;br /&gt;
=====SBx=====&lt;br /&gt;
Pattern loop.&lt;br /&gt;
&lt;br /&gt;
=====SCx=====&lt;br /&gt;
Note cut after x ticks.&lt;br /&gt;
&lt;br /&gt;
=====SDx=====&lt;br /&gt;
Note delay for x ticks.&lt;br /&gt;
&lt;br /&gt;
=====SEx=====&lt;br /&gt;
Pattern delay for x rows&lt;br /&gt;
&lt;br /&gt;
=====SFx=====&lt;br /&gt;
Set parameterised MIDI macro.&lt;br /&gt;
&lt;br /&gt;
====Txx====&lt;br /&gt;
Set Tempo.&lt;br /&gt;
&lt;br /&gt;
====Uxy====&lt;br /&gt;
Fine vibrato with speed x, depth y.&lt;br /&gt;
&lt;br /&gt;
====Vxx====&lt;br /&gt;
Set global volume.&lt;br /&gt;
* If xx is &amp;gt; 0x80, '''the effect is ignored.'''&lt;br /&gt;
&lt;br /&gt;
====Wxy====&lt;br /&gt;
Global volume slide.&lt;br /&gt;
&lt;br /&gt;
====Xxx====&lt;br /&gt;
Set panning position. Sets panning to '''(xx + 2) div 4'''&lt;br /&gt;
&lt;br /&gt;
====Yxy====&lt;br /&gt;
Panbrello with speed x, depth y.&lt;br /&gt;
&lt;br /&gt;
* '''If the panbrello waveform is set to 'Random', then the speed is interpreted as a delay'''.&lt;br /&gt;
&lt;br /&gt;
====Zxx====&lt;br /&gt;
MIDI Macros&lt;br /&gt;
&lt;br /&gt;
[[Category: Music Pattern Formats]]&lt;/div&gt;</summary>
		<author><name>GreaseMonkey</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Impulse_Tracker&amp;diff=13802</id>
		<title>Impulse Tracker</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Impulse_Tracker&amp;diff=13802"/>
		<updated>2012-01-22T09:20:49Z</updated>

		<summary type="html">&lt;p&gt;GreaseMonkey: some stuff i learnt&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* Extension: it&lt;br /&gt;
&lt;br /&gt;
==File Format==&lt;br /&gt;
''TODO''&lt;br /&gt;
&lt;br /&gt;
''it would be interesting to find out how the MIDI/timestamp stuff after the pointer list works... the other TODOs I (GM) know about''&lt;br /&gt;
&lt;br /&gt;
==IT214 sample compression==&lt;br /&gt;
''TODO''&lt;br /&gt;
&lt;br /&gt;
==Playback notes==&lt;br /&gt;
''TODO''&lt;br /&gt;
&lt;br /&gt;
===Resonant filters===&lt;br /&gt;
''TODO''&lt;br /&gt;
&lt;br /&gt;
===Effects===&lt;br /&gt;
&lt;br /&gt;
====Axx====&lt;br /&gt;
Set song speed.&lt;br /&gt;
&lt;br /&gt;
====Bxx====&lt;br /&gt;
Jump to Order.&lt;br /&gt;
*If this comes after an SBx loop command, '''the effect is done as-is'''.&lt;br /&gt;
&lt;br /&gt;
====Cxx====&lt;br /&gt;
Break to row.&lt;br /&gt;
*If this comes after an SBx loop command, '''the effect is ignored'''. ''TODO: look into how this information is relayed''&lt;br /&gt;
&lt;br /&gt;
====Dxx====&lt;br /&gt;
Volume slide.&lt;br /&gt;
&lt;br /&gt;
====Exx====&lt;br /&gt;
Pitch slide down.&lt;br /&gt;
&lt;br /&gt;
====Fxx====&lt;br /&gt;
Pitch slide up.&lt;br /&gt;
&lt;br /&gt;
====Gxx====&lt;br /&gt;
Slide to note.&lt;br /&gt;
&lt;br /&gt;
====Hxy====&lt;br /&gt;
Vibrato with speed x, depth y.&lt;br /&gt;
&lt;br /&gt;
====Ixy====&lt;br /&gt;
Tremor with ontime x and offtime y.&lt;br /&gt;
&lt;br /&gt;
====Jxy====&lt;br /&gt;
Arpeggio.&lt;br /&gt;
&lt;br /&gt;
====Kxx====&lt;br /&gt;
Dual command: H00 &amp;amp; Dxx&lt;br /&gt;
&lt;br /&gt;
====Lxx====&lt;br /&gt;
Dual command: G00 &amp;amp; Dxx&lt;br /&gt;
&lt;br /&gt;
====Mxx====&lt;br /&gt;
Set channel volume.&lt;br /&gt;
* If xx is &amp;gt; 0x40, '''the effect is ignored.'''&lt;br /&gt;
&lt;br /&gt;
====Nxx====&lt;br /&gt;
Channel volume slide.&lt;br /&gt;
&lt;br /&gt;
====Oxx====&lt;br /&gt;
Set sample offset.&lt;br /&gt;
&lt;br /&gt;
====Pxy====&lt;br /&gt;
Panning slide.&lt;br /&gt;
&lt;br /&gt;
====Qxy====&lt;br /&gt;
Retrig.&lt;br /&gt;
&lt;br /&gt;
====Rxy====&lt;br /&gt;
Tremolo with speed x, depth y.&lt;br /&gt;
&lt;br /&gt;
====Sxy - Miscellaneous effects====&lt;br /&gt;
&lt;br /&gt;
=====S0x=====&lt;br /&gt;
Set filter. Not implemented in Impulse Tracker.&lt;br /&gt;
&lt;br /&gt;
* '''S00 - repeats the last nonzero Sxx effect for the channel.'''&lt;br /&gt;
&lt;br /&gt;
=====S1x=====&lt;br /&gt;
Set glissando control. Not implemented in Impulse Tracker.&lt;br /&gt;
&lt;br /&gt;
=====S2x=====&lt;br /&gt;
Set finetune. Not Implemented in Impulse Tracker.&lt;br /&gt;
&lt;br /&gt;
=====S3x=====&lt;br /&gt;
Set vibrato waveform.&lt;br /&gt;
&lt;br /&gt;
Values for x:&lt;br /&gt;
*0: Sine wave&lt;br /&gt;
*1: Ramp down&lt;br /&gt;
*2: Square wave&lt;br /&gt;
*3: Random wave&lt;br /&gt;
&lt;br /&gt;
* '''If x &amp;gt; 3, the effect is ignored.'''&lt;br /&gt;
&lt;br /&gt;
=====S4x=====&lt;br /&gt;
Set tremolo waveform.&lt;br /&gt;
&lt;br /&gt;
Uses the same waveform table as S3x. '''If x &amp;gt; 3, the effect is ignored.'''&lt;br /&gt;
&lt;br /&gt;
=====S5x=====&lt;br /&gt;
Set panbrello waveform.&lt;br /&gt;
&lt;br /&gt;
Uses the same waveform table as S3x.&lt;br /&gt;
&lt;br /&gt;
* '''If x &amp;gt; 3, the effect is ignored.'''&lt;br /&gt;
* This effect '''retriggers the panbrello waveform position'''.&lt;br /&gt;
&lt;br /&gt;
=====S6x=====&lt;br /&gt;
Pattern delay for x ticks.&lt;br /&gt;
&lt;br /&gt;
=====S70=====&lt;br /&gt;
Past note cut.&lt;br /&gt;
&lt;br /&gt;
=====S71=====&lt;br /&gt;
Past note off.&lt;br /&gt;
&lt;br /&gt;
=====S72=====&lt;br /&gt;
Past note fade.&lt;br /&gt;
&lt;br /&gt;
=====S73=====&lt;br /&gt;
Set NNA to note cut.&lt;br /&gt;
&lt;br /&gt;
=====S74=====&lt;br /&gt;
Set NNA to continue.&lt;br /&gt;
&lt;br /&gt;
=====S75=====&lt;br /&gt;
Set NNA to note off.&lt;br /&gt;
&lt;br /&gt;
=====S76=====&lt;br /&gt;
Set NNA to note fade.&lt;br /&gt;
&lt;br /&gt;
=====S77=====&lt;br /&gt;
Turn off volume envelope.&lt;br /&gt;
&lt;br /&gt;
=====S78=====&lt;br /&gt;
Turn on volume envelope.&lt;br /&gt;
&lt;br /&gt;
=====S79=====&lt;br /&gt;
Turn off panning envelope.&lt;br /&gt;
&lt;br /&gt;
=====S7A=====&lt;br /&gt;
Turn on panning envelope.&lt;br /&gt;
&lt;br /&gt;
=====S7B=====&lt;br /&gt;
Turn off pitch envelope.&lt;br /&gt;
&lt;br /&gt;
=====S7C=====&lt;br /&gt;
Turn on pitch envelope.&lt;br /&gt;
&lt;br /&gt;
=====S8x=====&lt;br /&gt;
Set panning position.&lt;br /&gt;
&lt;br /&gt;
=====S91=====&lt;br /&gt;
Set surround sound.&lt;br /&gt;
&lt;br /&gt;
=====SAy=====&lt;br /&gt;
Set high value of sample offset yxx00h&lt;br /&gt;
&lt;br /&gt;
=====SBx=====&lt;br /&gt;
Pattern loop.&lt;br /&gt;
&lt;br /&gt;
=====SCx=====&lt;br /&gt;
Note cut after x ticks.&lt;br /&gt;
&lt;br /&gt;
=====SDx=====&lt;br /&gt;
Note delay for x ticks.&lt;br /&gt;
&lt;br /&gt;
=====SEx=====&lt;br /&gt;
Pattern delay for x rows&lt;br /&gt;
&lt;br /&gt;
=====SFx=====&lt;br /&gt;
Set parameterised MIDI macro.&lt;br /&gt;
&lt;br /&gt;
====Txx====&lt;br /&gt;
Set Tempo.&lt;br /&gt;
&lt;br /&gt;
====Uxy====&lt;br /&gt;
Fine vibrato with speed x, depth y.&lt;br /&gt;
&lt;br /&gt;
====Vxx====&lt;br /&gt;
Set global volume.&lt;br /&gt;
* If xx is &amp;gt; 0x80, '''the effect is ignored.'''&lt;br /&gt;
&lt;br /&gt;
====Wxy====&lt;br /&gt;
Global volume slide.&lt;br /&gt;
&lt;br /&gt;
====Xxx====&lt;br /&gt;
Set panning position. Sets panning to '''(xx + 2) div 4'''&lt;br /&gt;
&lt;br /&gt;
====Yxy====&lt;br /&gt;
Panbrello with speed x, depth y.&lt;br /&gt;
&lt;br /&gt;
* '''If the panbrello waveform is set to 'Random', then the speed is interpreted as a delay'''.&lt;br /&gt;
&lt;br /&gt;
====Zxx====&lt;br /&gt;
MIDI Macros&lt;br /&gt;
&lt;br /&gt;
[[Category: Music Pattern Formats]]&lt;/div&gt;</summary>
		<author><name>GreaseMonkey</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Nintendo_Sound_Format&amp;diff=13801</id>
		<title>Nintendo Sound Format</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Nintendo_Sound_Format&amp;diff=13801"/>
		<updated>2012-01-20T07:58:00Z</updated>

		<summary type="html">&lt;p&gt;GreaseMonkey: here, have some info&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* Extension: nsf&lt;br /&gt;
&lt;br /&gt;
NSF files contain music playback programs extracted from [[Nintendo]] Entertainment System (NES) games.&lt;br /&gt;
&lt;br /&gt;
==Header==&lt;br /&gt;
&lt;br /&gt;
As given in the official specification:&lt;br /&gt;
&lt;br /&gt;
 offset  # of bytes   Function&lt;br /&gt;
 ----------------------------&lt;br /&gt;
 &lt;br /&gt;
 0000    5   STRING  &amp;quot;NESM&amp;quot;,01Ah  ; denotes an NES sound format file&lt;br /&gt;
 0005    1   BYTE    Version number (currently 01h)&lt;br /&gt;
 0006    1   BYTE    Total songs   (1=1 song, 2=2 songs, etc)&lt;br /&gt;
 0007    1   BYTE    Starting song (1= 1st song, 2=2nd song, etc)&lt;br /&gt;
 0008    2   WORD    (lo/hi) load address of data (8000-FFFF)&lt;br /&gt;
 000a    2   WORD    (lo/hi) init address of data (8000-FFFF)&lt;br /&gt;
 000c    2   WORD    (lo/hi) play address of data (8000-FFFF)&lt;br /&gt;
 000e    32  STRING  The name of the song, null terminated&lt;br /&gt;
 002e    32  STRING  The artist, if known, null terminated&lt;br /&gt;
 004e    32  STRING  The Copyright holder, null terminated&lt;br /&gt;
 006e    2   WORD    (lo/hi) speed, in 1/1000000th sec ticks, NTSC (see text)&lt;br /&gt;
 0070    8   BYTE    Bankswitch Init Values (see text, and FDS section)&lt;br /&gt;
 0078    2   WORD    (lo/hi) speed, in 1/1000000th sec ticks, PAL (see text)&lt;br /&gt;
 007a    1   BYTE    PAL/NTSC bits:&lt;br /&gt;
                  bit 0: if clear, this is an NTSC tune&lt;br /&gt;
                  bit 0: if set, this is a PAL tune&lt;br /&gt;
                  bit 1: if set, this is a dual PAL/NTSC tune&lt;br /&gt;
                  bits 2-7: not used. they *must* be 0&lt;br /&gt;
 007b    1   BYTE    Extra Sound Chip Support&lt;br /&gt;
                  bit 0: if set, this song uses VRCVI&lt;br /&gt;
                  bit 1: if set, this song uses VRCVII&lt;br /&gt;
                  bit 2: if set, this song uses FDS Sound&lt;br /&gt;
                  bit 3: if set, this song uses MMC5 audio&lt;br /&gt;
                  bit 4: if set, this song uses Namco 106&lt;br /&gt;
                  bit 5: if set, this song uses Sunsoft FME-07&lt;br /&gt;
                  bits 6,7: future expansion: they *must* be 0&lt;br /&gt;
 007c    4   ----    4 extra bytes for expansion (must be 00h)&lt;br /&gt;
 0080    nnn ----    The music program/data follows&lt;br /&gt;
&lt;br /&gt;
Note that only the Namco 163 has a sound expansion, not the (very similar) Namco 106 as noted.&lt;br /&gt;
&lt;br /&gt;
==External links==&lt;br /&gt;
*[http://kevtris.org/nes/nsfspec.txt NES Music Format Spec] - official spec by Kevin Horton (kevtris)&lt;br /&gt;
&lt;br /&gt;
''TODO: this isn't actually a &amp;quot;music pattern format&amp;quot; - it's an executable one.''&lt;br /&gt;
&lt;br /&gt;
[[Category:Container Formats]]&lt;br /&gt;
[[Category:Music Pattern Formats]]&lt;br /&gt;
[[Category:Formats missing in FFmpeg]]&lt;/div&gt;</summary>
		<author><name>GreaseMonkey</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Scream_Tracker_3_Module&amp;diff=13656</id>
		<title>Scream Tracker 3 Module</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Scream_Tracker_3_Module&amp;diff=13656"/>
		<updated>2011-10-05T12:22:13Z</updated>

		<summary type="html">&lt;p&gt;GreaseMonkey: /* Sxy */ marked this as &amp;quot;use last nonzero effect&amp;quot; by request of Saga_Musix&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* Extension: s3m&lt;br /&gt;
A normally 16-channel module format for MS-DOS on the PC, it can also support OPL2 FM synthesis (9 melodic channels). While the format itself can technically support 32 channels, only the 25 mentioned have any meaning assigned to them, and they are usually not all used at the same time.&lt;br /&gt;
&lt;br /&gt;
Aspects which are easy to get wrong with this format are in '''bold text'''.&lt;br /&gt;
&lt;br /&gt;
Unless otherwise specified, this information pertains to Scream Tracker v3.21's play routine.&lt;br /&gt;
&lt;br /&gt;
==File Format==&lt;br /&gt;
&lt;br /&gt;
The format is little-endian (least significant byte first). A &amp;quot;byte&amp;quot; is 8 bits, a &amp;quot;word&amp;quot; is 16 bits, and a &amp;quot;dword&amp;quot; (double word) is 32 bits. Hex values will be denoted with &amp;quot;0x&amp;quot;. A parapointer points to pp*16 in the file due to the DOS nature of the format.&lt;br /&gt;
&lt;br /&gt;
Note that if some parts of the format are inconsistent, it's usually best to let it slip, as ST3 itself will allegedly for instance load instruments which don't have the &amp;quot;SCRS&amp;quot; / &amp;quot;SCRI&amp;quot; mark.&lt;br /&gt;
&lt;br /&gt;
*28 bytes: module name, NUL-terminated, NUL-padded.&lt;br /&gt;
*Byte: 0x1A.&lt;br /&gt;
*Byte: 16 (0x10) to indicate this is a Scream Tracker 3 module.&lt;br /&gt;
*2 reserved bytes, should be set to 0x00.&lt;br /&gt;
*6 words, denoting the following:&lt;br /&gt;
**Order count&lt;br /&gt;
**Instrument count&lt;br /&gt;
**Pattern count&lt;br /&gt;
**Flags&lt;br /&gt;
***Bit 0 (pre-3.01 ONLY): ST2 vibrato ''(effect unknown)''.&lt;br /&gt;
***Bit 1 (pre-3.01 ONLY): ST2 tempo ''(effect unknown)''.&lt;br /&gt;
***Bit 3 (pre-3.01 ONLY): Amiga slides ''(effect unknown)''.&lt;br /&gt;
***Bit 4: 0-vol optimisations - turn off looping notes which have a zero volume for more than(?) 2 rows.&lt;br /&gt;
***Bit 5: Amiga limits (limit periods to confine to 113 &amp;lt;= x &amp;lt;= 856).&lt;br /&gt;
***Bit 6 (pre-3.01 ONLY): Enable filter / sfx with SB ''(effect unknown)''.&lt;br /&gt;
***Bit 7: ST3.00 volume slides ('''automatically enabled if tracker version is &amp;lt;= 0x1300''') - if enabled, ''all'' volume slides occur ''every'' tick.&lt;br /&gt;
***Bit 8: Special custom data in file (uses &amp;quot;Special&amp;quot; field)&lt;br /&gt;
**Tracker version&lt;br /&gt;
***0x1xyy == Scream Tracker x.yy&lt;br /&gt;
***0x2xyy == Imago Orpheus x.yy&lt;br /&gt;
***0x3xyy == Impulse Tracker x.yy&lt;br /&gt;
***0x4xyy == Schism Tracker (version numbering scheme is different)&lt;br /&gt;
***0x5xyy == OpenMPT&lt;br /&gt;
**File format information&lt;br /&gt;
***1 == signed samples (horribly, horribly old)&lt;br /&gt;
***2 == unsigned samples&lt;br /&gt;
***Anything else is invalid and ST3 will not load the file(?).&lt;br /&gt;
*4 byte string: &amp;quot;SCRM&amp;quot;&lt;br /&gt;
*6 bytes, denoting the following:&lt;br /&gt;
**Global volume (range 0 &amp;lt;= x &amp;lt;= 64) which is used in calculating individual channel volumes '''and is nasty.'''&lt;br /&gt;
**Initial speed (ticks per row / TPR) - '''if 0 ''or 255'', it is ignored''' and the previous value used when you loaded the song is used instead. The value of 255 is very unusual as AFF (set speed to 0xFF == 255) still works.&lt;br /&gt;
**Initial tempo - if '''less than 33, it is ignored''' and the previous value used when you loaded the song is used instead.&lt;br /&gt;
**Mixing volume (range 16 &amp;lt;= x &amp;lt;= 127) which is only used for Sound Blaster. '''It is multiplied by 11/8 when stereo is on.'''&lt;br /&gt;
**Ultra-click removal which is only used for Gravis Ultrasound. ST3.21's interface only allows inputting of values 8, 12, or 16. Allegedly this is the number of GUS channels to allocate to guarantee that this value / 2 channels will play w/o clicks.&lt;br /&gt;
**Default pan value flag, if equal to 252 then load the default panning values at the end of the header, otherwise don't bother.&lt;br /&gt;
*8 reserved bytes, should be set to 0x00, although some trackers write stuff in here.&lt;br /&gt;
*1 parapointer: &amp;quot;Special&amp;quot;, used to point to &amp;quot;special custom data&amp;quot; which is not used in ST 3.01 or later. ST3.21's TECH.DOC refers to ExtHead which is not mentioned anywhere else. This should be safe to ignore.&lt;br /&gt;
*32 bytes indicating channel settings, as follows:&lt;br /&gt;
**If bit 8 is set, this channel is enabled.&lt;br /&gt;
**The lower 7 bits indicate the channel type:&lt;br /&gt;
***0 &amp;lt;= x &amp;lt;= 7: Left PCM channel 1-8 (Lx)&lt;br /&gt;
***8 &amp;lt;= x &amp;lt;= 15: Right PCM channel 1-8 (Rx)&lt;br /&gt;
***16 &amp;lt;= x &amp;lt;= 24: Adlib/OPL2 #1 melody (Ax)&lt;br /&gt;
***25 &amp;lt;= x &amp;lt;= 29: Adlib/OPL2 #1 drums (A_, where _ can be one of {''(TODO: look this up''}) - these are unused.&lt;br /&gt;
***Immediately after Adlib/OPL2 #1, there's some provision for a second OPL2 chip, although this does not appear to be supported / used.&lt;br /&gt;
**'''It is possible to map two pattern channels to the same output channel, which allows for some quirks. This is NOT supported by virtually any player other than ST3 itself.''' pys3m supports it, but is very obscure and quite slow. '''WARNING:''' Despite being less useful than you might expect, there ARE reasons why people would do this!&lt;br /&gt;
*Order list: series of bytes indicating pattern indices.&lt;br /&gt;
*Instrument parapointer list: series of parapointers pointing to instruments.&lt;br /&gt;
*Pattern parapointer list: series of parapointers pointing to patterns.&lt;br /&gt;
*OPTIONAL: Panning list: Entries are as follows:&lt;br /&gt;
**Bits 6 and 7 are reserved.&lt;br /&gt;
**Bit 5(?): If set, use the value specified, otherwise use default (7 for mono, 3(L) / C(R) for stereo).&lt;br /&gt;
**Bits 0-3: Specified panning value if default not used.&lt;br /&gt;
&lt;br /&gt;
''TODO: ST3.21's TECH.DOC should cover instruments.''&lt;br /&gt;
&lt;br /&gt;
==Playback Notes==&lt;br /&gt;
&lt;br /&gt;
Note w/o sample results in retriggering the note without resetting the volume.&lt;br /&gt;
&lt;br /&gt;
Sample w/o note results in resetting the volume and ''switching samples'' w/o retriggering the note. If the C4 speeds differ, this could potentially be out of tune as it does not convert the internal period values. If the note is off, it will stay off - it will not retrigger.&lt;br /&gt;
&lt;br /&gt;
Vibrato and tremolo have a full cycle length of 256, though Hxy and Rxy use x*4 and y*4 as their parameters.&lt;br /&gt;
&lt;br /&gt;
Base clock is '''14317456 Hz''' (documentation '''incorrectly says''' 14317056 Hz, correct value is the expected 8363*1712). When calculating a note's period, use the following table:&lt;br /&gt;
&lt;br /&gt;
  C    C#   D    D#   E    F    F#   G    G#   A   A#   A&lt;br /&gt;
 1712,1616,1524,1440,1356,1280,1208,1140,1076,1016,960,907&lt;br /&gt;
&lt;br /&gt;
and calculate the period like so:&lt;br /&gt;
&lt;br /&gt;
 period = 8363 * 16 * (note &amp;gt;&amp;gt; octave) / middle_c_frequency_of_instrument&lt;br /&gt;
&lt;br /&gt;
''Theoretically'', both the period and the volume have &amp;quot;stored&amp;quot; values and &amp;quot;active&amp;quot; values.&lt;br /&gt;
&lt;br /&gt;
'''Volumes actually peak at 63''', and not 64. Setting the volume to 64 will actually make it go to 63.&lt;br /&gt;
&lt;br /&gt;
However, on '''adlib channels''', if the default volume is 64, it will use 64. Any further operations on the volume will clip it to within the 0-63 range.&lt;br /&gt;
&lt;br /&gt;
Many effects use the '''latest nonzero effect parameter encountered''', as noted a bit further below.&lt;br /&gt;
&lt;br /&gt;
===Multiple channel mapping quirk===&lt;br /&gt;
'''It is possible to map two pattern channels to one output channel.''' However, it is rather quirky, but usable.&lt;br /&gt;
&lt;br /&gt;
Note that '''only the last pattern channel's effects are used'''.&lt;br /&gt;
&lt;br /&gt;
''TODO: document this quirk in detail.''&lt;br /&gt;
&lt;br /&gt;
==Effects==&lt;br /&gt;
&lt;br /&gt;
''TODO the rest''&lt;br /&gt;
&lt;br /&gt;
Effects marked with a % use '''the latest nonzero effect parameter to show up'''. Effects with a * have their own memory.&lt;br /&gt;
&lt;br /&gt;
===Axx===&lt;br /&gt;
Set speed. If the parameter '''is 0''', the effect is '''ignored'''.&lt;br /&gt;
&lt;br /&gt;
===Bxx===&lt;br /&gt;
Order jump.&lt;br /&gt;
&lt;br /&gt;
===Cxy===&lt;br /&gt;
Jump to row x*10 + y. The value provided is in '''decimal'''. If the row number specified '''is 64 or higher, the effect is ignored'''.&lt;br /&gt;
&lt;br /&gt;
===Dxy (%)===&lt;br /&gt;
Volume slide. If one of the values are 0, then we slide on all nonzero ticks. If one of the values are F, then we slide on all zero ticks. That means that '''D0F slides down 15 on all ticks and DF0 slides up 15 on all ticks'''.&lt;br /&gt;
&lt;br /&gt;
However, if fast slides are enabled (if they are set as a flag or the version is &amp;lt;= 0x1300), then, unless we're doing a fineslide, we slide on all ticks.&lt;br /&gt;
&lt;br /&gt;
When we do a volume slide, we slide the active volume '''without modifying the stored volume'''.&lt;br /&gt;
&lt;br /&gt;
The checking order is not the same as ImpulseTracker.&lt;br /&gt;
&lt;br /&gt;
Here's a full detailed description of all possible cases (0x00..0xFF) and how both Scream Tracker and Impulse Tracker handle them:&lt;br /&gt;
*D0x, 1 &amp;lt;= x &amp;lt;= 0xE: slide down by x on all nonzero ticks. Also slide on tick 0, if fast slides are enabled.&lt;br /&gt;
*Dx0, 1 &amp;lt;= x &amp;lt;= 0xE: slide up by x on all nonzero ticks. Also slide on tick 0, if fast slides are enabled.&lt;br /&gt;
*DFx, 1 &amp;lt;= x &amp;lt;= 0xE: slide down by x on tick 0.&lt;br /&gt;
*DxF, 1 &amp;lt;= x &amp;lt;= 0xE: slide up by x on tick 0.&lt;br /&gt;
*DFF: slide up by 15 on tick 0.&lt;br /&gt;
*D0F: slide down by 15 on all ticks. Not affected at all by the fast slides flag.&lt;br /&gt;
*DF0: slide up by 15 on all ticks. Not affected at all by the fast slides flag.&lt;br /&gt;
*Dxy, 1 &amp;lt;= x &amp;lt;= 0xE, 1 &amp;lt;= y &amp;lt;= 0xE: Scream Tracker treats it as a slide down by y, i.e. equivalent to D0y. Impulse Tracker does nothing.&lt;br /&gt;
*D00: Scream Tracker uses the last nonzero effect parameter in the channel. Impulse Tracker uses the last nonzero value used for Dxx, Kxx or Lxx in the channel.&lt;br /&gt;
&lt;br /&gt;
===Exx (%)===&lt;br /&gt;
Slide down.&lt;br /&gt;
&lt;br /&gt;
===Fxx (%)===&lt;br /&gt;
Slide up.&lt;br /&gt;
&lt;br /&gt;
===Gxx (*)===&lt;br /&gt;
Slide to note.&lt;br /&gt;
&lt;br /&gt;
Peculiarities in the Scream Tracker implementation of this effect:&lt;br /&gt;
*If the current note is empty, the destination note is set to the '''last note''' to show up in the channel, '''even if it has occurred without the Gxx effect'''.&lt;br /&gt;
*Gxx '''doesn't clear the target note''' when it is reached, so any future Gxx with no note will keep sliding back to this particular note.&lt;br /&gt;
&lt;br /&gt;
===Hxy (*)===&lt;br /&gt;
Vibrato. This effect '''shares memory''' with '''Uxy'''.&lt;br /&gt;
&lt;br /&gt;
===Ixy (%)===&lt;br /&gt;
Tremor. ''TODO: this effect is weird.''&lt;br /&gt;
&lt;br /&gt;
(Looking through what's released of the ST3 playback source code, tremor is not retriggered if there's a Dxy effect, or something like that, but this needs to be clarified.)&lt;br /&gt;
&lt;br /&gt;
===Jxy (%)===&lt;br /&gt;
Arpeggio. ''TODO: this effect is weird.''&lt;br /&gt;
&lt;br /&gt;
===Kxy (%)===&lt;br /&gt;
H00 + Dxy.&lt;br /&gt;
&lt;br /&gt;
The volume slide, performed by this effect differs from Dxy in the following ways:&lt;br /&gt;
* '''The first tick of this effect is ignored.''' This is due to a no-op in the &amp;quot;first tick&amp;quot; pointer table.&lt;br /&gt;
* As a result of the previous point, fine slides do not work. However, '''the &amp;quot;other&amp;quot; effect''' (H00 in case of Kxy; G00 in case of Lxy) ''' is also not performed when a fine volume slide is requested.'''&lt;br /&gt;
&lt;br /&gt;
===Lxy (%)===&lt;br /&gt;
G00 + Dxy.&lt;br /&gt;
&lt;br /&gt;
The volume slide '''differs from Dxy'''. See '''Kxy''' for details.&lt;br /&gt;
&lt;br /&gt;
===Oxx (*)===&lt;br /&gt;
Set sample offset.&lt;br /&gt;
&lt;br /&gt;
===Qxy (%)===&lt;br /&gt;
Retrigger note every y ticks with volume modifier x.&lt;br /&gt;
&lt;br /&gt;
Values for x:&lt;br /&gt;
*0: 0&lt;br /&gt;
*1: -1&lt;br /&gt;
*2: -2&lt;br /&gt;
*3: -4&lt;br /&gt;
*4: -8&lt;br /&gt;
*5: -16&lt;br /&gt;
*6: *2/3&lt;br /&gt;
*7: *1/2&lt;br /&gt;
*8: ?&lt;br /&gt;
*9: 1&lt;br /&gt;
*A: 2&lt;br /&gt;
*B: 4&lt;br /&gt;
*C: 8&lt;br /&gt;
*D: 16&lt;br /&gt;
*E: *3/2&lt;br /&gt;
*F: *2&lt;br /&gt;
&lt;br /&gt;
'''6 isn't exactly *2/3.''' It seems to use the following table:&lt;br /&gt;
&lt;br /&gt;
  TwoThirds: array [0..63] of Byte =&lt;br /&gt;
  ( 0,  0,  1,  1,  2,  3,  3,  4,  5,  5,  6,  6,  7,  8,  8,  9,&lt;br /&gt;
   10, 10, 11, 11, 12, 13, 13, 14, 15, 15, 16, 16, 17, 18, 18, 19,&lt;br /&gt;
   20, 20, 21, 21, 22, 23, 23, 24, 25, 25, 26, 26, 27, 28, 28, 29,&lt;br /&gt;
   30, 30, 31, 31, 32, 33, 33, 34, 35, 35, 36, 36, 37, 38, 38, 39);&lt;br /&gt;
&lt;br /&gt;
This effect changes only the active volume, '''without modifying the stored volume.'''&lt;br /&gt;
&lt;br /&gt;
===Rxy (%)===&lt;br /&gt;
Tremolo. x*4 is speed, y*4 is depth. This effect is screwy, but not as screwy as previously documented.&lt;br /&gt;
&lt;br /&gt;
*Get xy from the '''latest nonzero effect parameter''' to appear in the channel.&lt;br /&gt;
*'''On tick 1''' (the '''second''' tick of the row) set the active volume to '''the stored volume plus''' (depth * value) / (max_amplitude * 2) (Rxy peaks at 32 in each direction), and for each '''nonzero''' tick increase the tremolo position by the speed. '''The stored volume is untouched.'''&lt;br /&gt;
*'''If the song speed (not tremolo speed, but song speed - ticks per row) is 1, the active volume is also untouched. It is not set to the stored volume!'''&lt;br /&gt;
*'''Tremolo will not work if the stored volume is 0 (or 64 - adlib only).'''&lt;br /&gt;
&lt;br /&gt;
===Sxy (%)===&lt;br /&gt;
Miscellaneous effects.&lt;br /&gt;
&lt;br /&gt;
''TODO: check what value xy is taken for Sxy''&lt;br /&gt;
&lt;br /&gt;
====S0x====&lt;br /&gt;
Set filter. Not implemented in Scream Tracker 3.&lt;br /&gt;
&lt;br /&gt;
====S1x====&lt;br /&gt;
Set glissando control.&lt;br /&gt;
&lt;br /&gt;
====S2x====&lt;br /&gt;
Set finetune.&lt;br /&gt;
&lt;br /&gt;
====S3x====&lt;br /&gt;
Set vibrato waveform.&lt;br /&gt;
&lt;br /&gt;
====S4x====&lt;br /&gt;
Set tremolo waveform.&lt;br /&gt;
&lt;br /&gt;
====S8x====&lt;br /&gt;
Set panning position. Scream Tracker 3 supports this only on the Gravis Ultrasound.&lt;br /&gt;
&lt;br /&gt;
====SAx====&lt;br /&gt;
Old stereo control. This appears in PANIC.S3M, but may have been removed since Scream Tracker 3.01 BETA. libmodplug, and in turn SchismTracker, convert these to S8x effects.&lt;br /&gt;
&lt;br /&gt;
''TODO: work out how SAx converts to S8x effects.''&lt;br /&gt;
&lt;br /&gt;
====SBx====&lt;br /&gt;
Loop pattern.&lt;br /&gt;
&lt;br /&gt;
Unlike other trackers, '''the loopback info (i.e. the loopback point and counter) is global''' and not per channel.&lt;br /&gt;
&lt;br /&gt;
====SCx====&lt;br /&gt;
Note cut after x ticks.&lt;br /&gt;
&lt;br /&gt;
*If '''the argument is 0''', the effect '''is ignored'''.&lt;br /&gt;
*When the note is cut, the volume is '''not''' set to 0. Instead playback is temporarily '''frozen''' and may be '''resumed by a following Exx, Fxx, Gxx, Hxx, Jxx, Kxx, Lxx or Uxx command'''.&lt;br /&gt;
&lt;br /&gt;
====SDx====&lt;br /&gt;
Note delay for x ticks.&lt;br /&gt;
&lt;br /&gt;
====SEx====&lt;br /&gt;
Pattern delay for x rows.&lt;br /&gt;
&lt;br /&gt;
====SFx====&lt;br /&gt;
FunkRepeat. Not implemented in Scream Tracker 3.&lt;br /&gt;
&lt;br /&gt;
===Txx===&lt;br /&gt;
Set tempo. If the parameter is '''less than 33''', the effect is '''ignored'''.&lt;br /&gt;
&lt;br /&gt;
===Uxy (*)===&lt;br /&gt;
Fine vibrato. This effect '''shares memory''' with '''Hxy'''.&lt;br /&gt;
&lt;br /&gt;
===Vxx===&lt;br /&gt;
Set global volume. This effect has several quirks:&lt;br /&gt;
&lt;br /&gt;
*Normally, it does not affect events on the same row, where the effect is set. However, '''there are some exceptions to that rule''', read below for details.&lt;br /&gt;
*It does not affect past notes, that are still playing, unless '''their volume is changed''', which '''applies the new global volume to that voice''' as well.&lt;br /&gt;
*This effect '''is actually processed on tick 1 (that is the second tick)''' of the row. This has several consequences:&lt;br /&gt;
**The effect '''doesn't do anything''', if '''the current speed is 1'''.&lt;br /&gt;
**The effect '''is applied to notes on the current row, that have a note delay effect''' (SDx with x &amp;gt;= 1). For notes on the same row '''that have a note delay of 1 tick''', the effect is only applied to '''channels, that are processed after''' the channel with the set global volume effect. For notes on the same row that have a '''note delay of 2 ticks or more''', the effect is applied '''regardless of the relative position of the channel''' in the processing order. ''TODO: Document the processing order, since it isn't very obvious (I think it's L1, L2, ..., L8, R1, R2, ..., R8, but I'm not 100% sure).''&lt;br /&gt;
**The effect '''is also applied''' on the same row if anything updates the note volume '''on tick 1''' or '''tick 2''' (depends on processing order), like the '''Dxx effect''' (when doing a non-fine slide, of course).&lt;br /&gt;
*Vxx with parameter '''values higher than 0x40''' are '''ignored'''.&lt;br /&gt;
&lt;br /&gt;
[[Category: Music Pattern Formats]]&lt;/div&gt;</summary>
		<author><name>GreaseMonkey</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Scream_Tracker_3_Module&amp;diff=13399</id>
		<title>Scream Tracker 3 Module</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Scream_Tracker_3_Module&amp;diff=13399"/>
		<updated>2011-04-03T05:45:56Z</updated>

		<summary type="html">&lt;p&gt;GreaseMonkey: /* File Format */ storlek pointed out an inaccuracy.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* Extension: s3m&lt;br /&gt;
A normally 16-channel module format for MS-DOS on the PC, it can also support OPL2 FM synthesis (9 melodic channels). While the format itself can technically support 32 channels, only the 25 mentioned have any meaning assigned to them, and they are usually not all used at the same time.&lt;br /&gt;
&lt;br /&gt;
Aspects which are easy to get wrong with this format are in '''bold text'''.&lt;br /&gt;
&lt;br /&gt;
Unless otherwise specified, this information pertains to Scream Tracker v3.21's play routine.&lt;br /&gt;
&lt;br /&gt;
==File Format==&lt;br /&gt;
&lt;br /&gt;
The format is little-endian (least significant byte first). A &amp;quot;byte&amp;quot; is 8 bits, a &amp;quot;word&amp;quot; is 16 bits, and a &amp;quot;dword&amp;quot; (double word) is 32 bits. Hex values will be denoted with &amp;quot;0x&amp;quot;. A parapointer points to pp*16 in the file due to the DOS nature of the format.&lt;br /&gt;
&lt;br /&gt;
Note that if some parts of the format are inconsistent, it's usually best to let it slip, as ST3 itself will allegedly for instance load instruments which don't have the &amp;quot;SCRS&amp;quot; / &amp;quot;SCRI&amp;quot; mark.&lt;br /&gt;
&lt;br /&gt;
*28 bytes: module name, NUL-terminated, NUL-padded.&lt;br /&gt;
*Byte: 0x1A.&lt;br /&gt;
*Byte: 16 (0x10) to indicate this is a Scream Tracker 3 module.&lt;br /&gt;
*2 reserved bytes, should be set to 0x00.&lt;br /&gt;
*6 words, denoting the following:&lt;br /&gt;
**Order count&lt;br /&gt;
**Instrument count&lt;br /&gt;
**Pattern count&lt;br /&gt;
**Flags&lt;br /&gt;
***Bit 0 (pre-3.01 ONLY): ST2 vibrato ''(effect unknown)''.&lt;br /&gt;
***Bit 1 (pre-3.01 ONLY): ST2 tempo ''(effect unknown)''.&lt;br /&gt;
***Bit 3 (pre-3.01 ONLY): Amiga slides ''(effect unknown)''.&lt;br /&gt;
***Bit 4: 0-vol optimisations - turn off looping notes which have a zero volume for more than(?) 2 rows.&lt;br /&gt;
***Bit 5: Amiga limits (limit periods to confine to 113 &amp;lt;= x &amp;lt;= 856).&lt;br /&gt;
***Bit 6 (pre-3.01 ONLY): Enable filter / sfx with SB ''(effect unknown)''.&lt;br /&gt;
***Bit 7: ST3.00 volume slides ('''automatically enabled if tracker version is &amp;lt;= 0x1300''') - if enabled, ''all'' volume slides occur ''every'' tick.&lt;br /&gt;
***Bit 8: Special custom data in file (uses &amp;quot;Special&amp;quot; field)&lt;br /&gt;
*Tracker version&lt;br /&gt;
**0x1xyy == Scream Tracker x.yy&lt;br /&gt;
**0x2xyy == Imago Orpheus x.yy&lt;br /&gt;
**0x3xyy == Impulse Tracker x.yy&lt;br /&gt;
**0x4xyy == Schism Tracker (version numbering scheme is different)&lt;br /&gt;
**0x5xyy == OpenMPT&lt;br /&gt;
*File format information&lt;br /&gt;
**1 == signed samples (horribly, horribly old)&lt;br /&gt;
**2 == unsigned samples&lt;br /&gt;
**Anything else is invalid and ST3 will not load the file(?).&lt;br /&gt;
*4 byte string: &amp;quot;SCRM&amp;quot;&lt;br /&gt;
*6 bytes, denoting the following:&lt;br /&gt;
**Global volume (range 0 &amp;lt;= x &amp;lt;= 64) which is used in calculating individual channel volumes '''and is nasty.'''&lt;br /&gt;
**Initial speed (ticks per row / TPR) - '''if 0 ''or 255'', it is ignored''' and the previous value used when you loaded the song is used instead. The value of 255 is very unusual as AFF (set speed to 0xFF == 255) still works.&lt;br /&gt;
**Initial tempo - if '''less than 33, it is ignored''' and the previous value used when you loaded the song is used instead.&lt;br /&gt;
**Mixing volume (range 16 &amp;lt;= x &amp;lt;= 127) which is only used for Sound Blaster. '''It is multiplied by 11/8 when stereo is on.'''&lt;br /&gt;
**Ultra-click removal which is only used for Gravis Ultrasound. ST3.21's interface only allows inputting of values 8, 12, or 16. Allegedly this is the number of GUS channels to allocate to guarantee that this value / 2 channels will play w/o clicks.&lt;br /&gt;
**Default pan value flag, if equal to 252 then load the default panning values at the end of the header, otherwise don't bother.&lt;br /&gt;
*8 reserved bytes, should be set to 0x00, although some trackers write stuff in here.&lt;br /&gt;
*1 parapointer: &amp;quot;Special&amp;quot;, used to point to &amp;quot;special custom data&amp;quot; which is not used in ST 3.01 or later. ST3.21's TECH.DOC refers to ExtHead which is not mentioned anywhere else. This should be safe to ignore.&lt;br /&gt;
*32 bytes indicating channel settings, as follows:&lt;br /&gt;
**If bit 8 is set, this channel is enabled.&lt;br /&gt;
**The lower 7 bits indicate the channel type:&lt;br /&gt;
***0 &amp;lt;= x &amp;lt;= 7: Left PCM channel 1-8 (Lx)&lt;br /&gt;
***8 &amp;lt;= x &amp;lt;= 15: Right PCM channel 1-8 (Rx)&lt;br /&gt;
***16 &amp;lt;= x &amp;lt;= 24: Adlib/OPL2 #1 melody (Ax)&lt;br /&gt;
***25 &amp;lt;= x &amp;lt;= 29: Adlib/OPL2 #1 drums (A_, where _ can be one of {''(TODO: look this up''}) - these are unused.&lt;br /&gt;
***Immediately after Adlib/OPL2 #1, there's some provision for a second OPL2 chip, although this does not appear to be supported / used.&lt;br /&gt;
**'''It is possible to map two pattern channels to the same output channel, which allows for some quirks. This is NOT supported by virtually any player other than ST3 itself.''' pys3m supports it, but is very obscure and quite slow. '''WARNING:''' Despite being less useful than you might expect, there ARE reasons why people would do this!&lt;br /&gt;
*Order list: series of bytes indicating pattern indices.&lt;br /&gt;
*Instrument parapointer list: series of parapointers pointing to instruments.&lt;br /&gt;
*Pattern parapointer list: series of parapointers pointing to patterns.&lt;br /&gt;
*OPTIONAL: Panning list: Entries are as follows:&lt;br /&gt;
**Bits 6 and 7 are reserved.&lt;br /&gt;
**Bit 5(?): If set, use the value specified, otherwise use default (7 for mono, 3(L) / C(R) for stereo).&lt;br /&gt;
**Bits 0-3: Specified panning value if default not used.&lt;br /&gt;
&lt;br /&gt;
''TODO: ST3.21's TECH.DOC should cover instruments.''&lt;br /&gt;
&lt;br /&gt;
==Playback Notes==&lt;br /&gt;
&lt;br /&gt;
Note w/o sample results in retriggering the note without resetting the volume.&lt;br /&gt;
&lt;br /&gt;
Sample w/o note results in resetting the volume and ''switching samples'' w/o retriggering the note. If the C4 speeds differ, this could potentially be out of tune as it does not convert the internal period values. If the note is off, it will stay off - it will not retrigger.&lt;br /&gt;
&lt;br /&gt;
Vibrato and tremolo have a full cycle length of 256, though Hxy and Rxy use x*4 and y*4 as their parameters.&lt;br /&gt;
&lt;br /&gt;
Base clock is '''14317456 Hz''' (documentation '''incorrectly says''' 14317056 Hz, correct value is the expected 8363*1712). When calculating a note's period, use the following table:&lt;br /&gt;
&lt;br /&gt;
  C    C#   D    D#   E    F    F#   G    G#   A   A#   A&lt;br /&gt;
 1712,1616,1524,1440,1356,1280,1208,1140,1076,1016,960,907&lt;br /&gt;
&lt;br /&gt;
and calculate the period like so:&lt;br /&gt;
&lt;br /&gt;
 period = 8363 * 16 * (note &amp;gt;&amp;gt; octave) / middle_c_frequency_of_instrument&lt;br /&gt;
&lt;br /&gt;
''Theoretically'', both the period and the volume have &amp;quot;stored&amp;quot; values and &amp;quot;active&amp;quot; values.&lt;br /&gt;
&lt;br /&gt;
'''Volumes actually peak at 63''', and not 64. Setting the volume to 64 will actually make it go to 63.&lt;br /&gt;
&lt;br /&gt;
However, on '''adlib channels''', if the default volume is 64, it will use 64. Any further operations on the volume will clip it to within the 0-63 range.&lt;br /&gt;
&lt;br /&gt;
Many effects use the '''latest nonzero effect parameter encountered''', as noted a bit further below.&lt;br /&gt;
&lt;br /&gt;
===Multiple channel mapping quirk===&lt;br /&gt;
'''It is possible to map two pattern channels to one output channel.''' However, it is rather quirky, but usable.&lt;br /&gt;
&lt;br /&gt;
Note that '''only the last pattern channel's effects are used'''.&lt;br /&gt;
&lt;br /&gt;
''TODO: document this quirk in detail.''&lt;br /&gt;
&lt;br /&gt;
==Effects==&lt;br /&gt;
&lt;br /&gt;
''TODO the rest''&lt;br /&gt;
&lt;br /&gt;
Effects marked with a % use '''the latest nonzero effect parameter to show up'''. Effects with a * have their own memory.&lt;br /&gt;
&lt;br /&gt;
===Axx===&lt;br /&gt;
Set speed. If the parameter '''is 0''', the effect is '''ignored'''.&lt;br /&gt;
&lt;br /&gt;
===Bxx===&lt;br /&gt;
Order jump.&lt;br /&gt;
&lt;br /&gt;
===Cxy===&lt;br /&gt;
Jump to row x*10 + y. The value provided is in '''decimal'''. If the row number specified '''is 64 or higher, the effect is ignored'''.&lt;br /&gt;
&lt;br /&gt;
===Dxy (%)===&lt;br /&gt;
Volume slide. If one of the values are 0, then we slide on all nonzero ticks. If one of the values are F, then we slide on all zero ticks. That means that '''D0F slides down 15 on all ticks and DF0 slides up 15 on all ticks'''.&lt;br /&gt;
&lt;br /&gt;
However, if fast slides are enabled (if they are set as a flag or the version is &amp;lt;= 0x1300), then, unless we're doing a fineslide, we slide on all ticks.&lt;br /&gt;
&lt;br /&gt;
When we do a volume slide, we slide the active volume '''without modifying the stored volume'''.&lt;br /&gt;
&lt;br /&gt;
The checking order is not the same as ImpulseTracker.&lt;br /&gt;
&lt;br /&gt;
Here's a full detailed description of all possible cases (0x00..0xFF) and how both Scream Tracker and Impulse Tracker handle them:&lt;br /&gt;
*D0x, 1 &amp;lt;= x &amp;lt;= 0xE: slide down by x on all nonzero ticks. Also slide on tick 0, if fast slides are enabled.&lt;br /&gt;
*Dx0, 1 &amp;lt;= x &amp;lt;= 0xE: slide up by x on all nonzero ticks. Also slide on tick 0, if fast slides are enabled.&lt;br /&gt;
*DFx, 1 &amp;lt;= x &amp;lt;= 0xE: slide down by x on tick 0.&lt;br /&gt;
*DxF, 1 &amp;lt;= x &amp;lt;= 0xE: slide up by x on tick 0.&lt;br /&gt;
*DFF: slide up by 15 on tick 0.&lt;br /&gt;
*D0F: slide down by 15 on all ticks. Not affected at all by the fast slides flag.&lt;br /&gt;
*DF0: slide up by 15 on all ticks. Not affected at all by the fast slides flag.&lt;br /&gt;
*Dxy, 1 &amp;lt;= x &amp;lt;= 0xE, 1 &amp;lt;= y &amp;lt;= 0xE: Scream Tracker treats it as a slide down by y, i.e. equivalent to D0y. Impulse Tracker does nothing.&lt;br /&gt;
*D00: Scream Tracker uses the last nonzero effect parameter in the channel. Impulse Tracker uses the last nonzero value used for Dxx, Kxx or Lxx in the channel.&lt;br /&gt;
&lt;br /&gt;
===Exx (%)===&lt;br /&gt;
Slide down.&lt;br /&gt;
&lt;br /&gt;
===Fxx (%)===&lt;br /&gt;
Slide up.&lt;br /&gt;
&lt;br /&gt;
===Gxx (*)===&lt;br /&gt;
Slide to note.&lt;br /&gt;
&lt;br /&gt;
Peculiarities in the Scream Tracker implementation of this effect:&lt;br /&gt;
*If the current note is empty, the destination note is set to the '''last note''' to show up in the channel, '''even if it has occurred without the Gxx effect'''.&lt;br /&gt;
*Gxx '''doesn't clear the target note''' when it is reached, so any future Gxx with no note will keep sliding back to this particular note.&lt;br /&gt;
&lt;br /&gt;
===Hxy (*)===&lt;br /&gt;
Vibrato. This effect '''shares memory''' with '''Uxy'''.&lt;br /&gt;
&lt;br /&gt;
===Ixy (%)===&lt;br /&gt;
Tremor. ''TODO: this effect is weird.''&lt;br /&gt;
&lt;br /&gt;
(Looking through what's released of the ST3 playback source code, tremor is not retriggered if there's a Dxy effect, or something like that, but this needs to be clarified.)&lt;br /&gt;
&lt;br /&gt;
===Jxy (%)===&lt;br /&gt;
Arpeggio. ''TODO: this effect is weird.''&lt;br /&gt;
&lt;br /&gt;
===Kxy (%)===&lt;br /&gt;
H00 + Dxy.&lt;br /&gt;
&lt;br /&gt;
The volume slide, performed by this effect differs from Dxy in the following ways:&lt;br /&gt;
* '''The first tick of this effect is ignored.''' This is due to a no-op in the &amp;quot;first tick&amp;quot; pointer table.&lt;br /&gt;
&lt;br /&gt;
===Lxy (%)===&lt;br /&gt;
G00 + Dxy.&lt;br /&gt;
&lt;br /&gt;
The volume slide '''differs from Dxy'''. See '''Kxy''' for details.&lt;br /&gt;
&lt;br /&gt;
===Oxx (*)===&lt;br /&gt;
Set sample offset.&lt;br /&gt;
&lt;br /&gt;
===Qxy (%)===&lt;br /&gt;
Retrigger note every y ticks with volume modifier x.&lt;br /&gt;
&lt;br /&gt;
Values for x:&lt;br /&gt;
*0: 0&lt;br /&gt;
*1: -1&lt;br /&gt;
*2: -2&lt;br /&gt;
*3: -4&lt;br /&gt;
*4: -8&lt;br /&gt;
*5: -16&lt;br /&gt;
*6: *2/3&lt;br /&gt;
*7: *1/2&lt;br /&gt;
*8: ?&lt;br /&gt;
*9: 1&lt;br /&gt;
*A: 2&lt;br /&gt;
*B: 4&lt;br /&gt;
*C: 8&lt;br /&gt;
*D: 16&lt;br /&gt;
*E: *3/2&lt;br /&gt;
*F: *2&lt;br /&gt;
&lt;br /&gt;
'''6 isn't exactly *2/3.''' It seems to use the following table:&lt;br /&gt;
&lt;br /&gt;
  TwoThirds: array [0..63] of Byte =&lt;br /&gt;
  ( 0,  0,  1,  1,  2,  3,  3,  4,  5,  5,  6,  6,  7,  8,  8,  9,&lt;br /&gt;
   10, 10, 11, 11, 12, 13, 13, 14, 15, 15, 16, 16, 17, 18, 18, 19,&lt;br /&gt;
   20, 20, 21, 21, 22, 23, 23, 24, 25, 25, 26, 26, 27, 28, 28, 29,&lt;br /&gt;
   30, 30, 31, 31, 32, 33, 33, 34, 35, 35, 36, 36, 37, 38, 38, 39);&lt;br /&gt;
&lt;br /&gt;
This effect changes only the active volume, '''without modifying the stored volume.'''&lt;br /&gt;
&lt;br /&gt;
===Rxy (%)===&lt;br /&gt;
Tremolo. x*4 is speed, y*4 is depth. This effect is screwy, but not as screwy as previously documented.&lt;br /&gt;
&lt;br /&gt;
*Get xy from the '''latest nonzero effect parameter''' to appear in the channel.&lt;br /&gt;
*'''On tick 1''' (the '''second''' tick of the row) set the active volume to '''the stored volume plus''' (depth * value) / (max_amplitude * 2) (Rxy peaks at 32 in each direction), and for each '''nonzero''' tick increase the tremolo position by the speed. '''The stored volume is untouched.'''&lt;br /&gt;
*'''If the song speed (not tremolo speed, but song speed - ticks per row) is 1, the active volume is also untouched. It is not set to the stored volume!'''&lt;br /&gt;
*'''Tremolo will not work if the stored volume is 0 (or 64 - adlib only).'''&lt;br /&gt;
&lt;br /&gt;
===Sxy===&lt;br /&gt;
Miscellaneous effects.&lt;br /&gt;
&lt;br /&gt;
''TODO: check what value xy is taken for Sxy''&lt;br /&gt;
&lt;br /&gt;
====S0x====&lt;br /&gt;
Set filter. Not implemented in Scream Tracker 3.&lt;br /&gt;
&lt;br /&gt;
====S1x====&lt;br /&gt;
Set glissando control.&lt;br /&gt;
&lt;br /&gt;
====S2x====&lt;br /&gt;
Set finetune.&lt;br /&gt;
&lt;br /&gt;
====S3x====&lt;br /&gt;
Set vibrato waveform.&lt;br /&gt;
&lt;br /&gt;
====S4x====&lt;br /&gt;
Set tremolo waveform.&lt;br /&gt;
&lt;br /&gt;
====S8x====&lt;br /&gt;
Set panning position. Scream Tracker 3 supports this only on the Gravis Ultrasound.&lt;br /&gt;
&lt;br /&gt;
====SAx====&lt;br /&gt;
Old stereo control. This appears in PANIC.S3M, but may have been removed since Scream Tracker 3.01 BETA. libmodplug, and in turn SchismTracker, convert these to S8x effects.&lt;br /&gt;
&lt;br /&gt;
''TODO: work out how SAx converts to S8x effects.''&lt;br /&gt;
&lt;br /&gt;
====SBx====&lt;br /&gt;
Loop pattern.&lt;br /&gt;
&lt;br /&gt;
====SCx====&lt;br /&gt;
Note cut after x ticks.&lt;br /&gt;
&lt;br /&gt;
*If '''the argument is 0''', the effect '''is ignored'''.&lt;br /&gt;
*When the note is cut, the volume is '''not''' set to 0. Instead playback is temporarily '''frozen''' and may be '''resumed by a following Exx, Fxx, Gxx, Hxx, Jxx, Kxx, Lxx or Uxx command'''.&lt;br /&gt;
&lt;br /&gt;
====SDx====&lt;br /&gt;
Note delay for x ticks.&lt;br /&gt;
&lt;br /&gt;
====SEx====&lt;br /&gt;
Pattern delay for x rows.&lt;br /&gt;
&lt;br /&gt;
====SFx====&lt;br /&gt;
FunkRepeat. Not implemented in Scream Tracker 3.&lt;br /&gt;
&lt;br /&gt;
===Txx===&lt;br /&gt;
Set tempo. If the parameter is '''less than 33''', the effect is '''ignored'''.&lt;br /&gt;
&lt;br /&gt;
===Uxy (*)===&lt;br /&gt;
Fine vibrato. This effect '''shares memory''' with '''Hxy'''.&lt;br /&gt;
&lt;br /&gt;
===Vxx===&lt;br /&gt;
Set global volume. This effect has several quirks:&lt;br /&gt;
&lt;br /&gt;
*Normally, it does not affect events on the same row, where the effect is set. However, '''there are some exceptions to that rule''', read below for details.&lt;br /&gt;
*It does not affect past notes, that are still playing, unless '''their volume is changed''', which '''applies the new global volume to that voice''' as well.&lt;br /&gt;
*This effect '''is actually processed on tick 1 (that is the second tick)''' of the row. This has several consequences:&lt;br /&gt;
**The effect '''doesn't do anything''', if '''the current speed is 1'''.&lt;br /&gt;
**The effect '''is applied to notes on the current row, that have a note delay effect''' (SDx with x &amp;gt;= 1). For notes on the same row '''that have a note delay of 1 tick''', the effect is only applied to '''channels, that are processed after''' the channel with the set global volume effect. For notes on the same row that have a '''note delay of 2 ticks or more''', the effect is applied '''regardless of the relative position of the channel''' in the processing order. ''TODO: Document the processing order, since it isn't very obvious (I think it's L1, L2, ..., L8, R1, R2, ..., R8, but I'm not 100% sure).''&lt;br /&gt;
**The effect '''is also applied''' on the same row if anything updates the note volume '''on tick 1''' or '''tick 2''' (depends on processing order), like the '''Dxx effect''' (when doing a non-fine slide, of course).&lt;br /&gt;
*Vxx with parameter '''values higher than 0x40''' are '''ignored'''.&lt;br /&gt;
&lt;br /&gt;
[[Category: Music Pattern Formats]]&lt;/div&gt;</summary>
		<author><name>GreaseMonkey</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Scream_Tracker_3_Module&amp;diff=13398</id>
		<title>Scream Tracker 3 Module</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Scream_Tracker_3_Module&amp;diff=13398"/>
		<updated>2011-04-03T05:34:27Z</updated>

		<summary type="html">&lt;p&gt;GreaseMonkey: /* Dxy (%) */ TODOne. Why was that still there?&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* Extension: s3m&lt;br /&gt;
A normally 16-channel module format for MS-DOS on the PC, it can also support OPL2 FM synthesis (9 melodic channels). While the format itself can technically support 32 channels, only the 25 mentioned have any meaning assigned to them, and they are usually not all used at the same time.&lt;br /&gt;
&lt;br /&gt;
Aspects which are easy to get wrong with this format are in '''bold text'''.&lt;br /&gt;
&lt;br /&gt;
Unless otherwise specified, this information pertains to Scream Tracker v3.21's play routine.&lt;br /&gt;
&lt;br /&gt;
==File Format==&lt;br /&gt;
&lt;br /&gt;
The format is little-endian (least significant byte first). A &amp;quot;byte&amp;quot; is 8 bits, a &amp;quot;word&amp;quot; is 16 bits, and a &amp;quot;dword&amp;quot; (double word) is 32 bits. Hex values will be denoted with &amp;quot;0x&amp;quot;. A parapointer points to pp*16 in the file due to the DOS nature of the format.&lt;br /&gt;
&lt;br /&gt;
Note that if some parts of the format are inconsistent, it's usually best to let it slip, as ST3 itself will allegedly for instance load instruments which don't have the &amp;quot;SCRS&amp;quot; / &amp;quot;SCRI&amp;quot; mark.&lt;br /&gt;
&lt;br /&gt;
*28 bytes: module name, NUL-terminated, NUL-padded.&lt;br /&gt;
*Byte: 0x1A.&lt;br /&gt;
*Byte: 16 (0x10) to indicate this is a Scream Tracker 3 module.&lt;br /&gt;
*2 reserved bytes, should be set to 0x00.&lt;br /&gt;
*6 words, denoting the following:&lt;br /&gt;
**Order count&lt;br /&gt;
**Instrument count&lt;br /&gt;
**Pattern count&lt;br /&gt;
**Flags&lt;br /&gt;
***Bit 0 (pre-3.01 ONLY): ST2 vibrato ''(effect unknown)''.&lt;br /&gt;
***Bit 1 (pre-3.01 ONLY): ST2 tempo ''(effect unknown)''.&lt;br /&gt;
***Bit 3 (pre-3.01 ONLY): Amiga slides ''(effect unknown)''.&lt;br /&gt;
***Bit 4: 0-vol optimisations - turn off looping notes which have a zero volume for more than(?) 2 rows.&lt;br /&gt;
***Bit 5: Amiga limits (limit periods to confine to 113 &amp;lt;= x &amp;lt;= 856).&lt;br /&gt;
***Bit 6 (pre-3.01 ONLY): Enable filter / sfx with SB ''(effect unknown)''.&lt;br /&gt;
***Bit 7: ST3.00 volume slides ('''automatically enabled if tracker version is &amp;lt;= 0x1300''') - if enabled, ''all'' volume slides occur ''every'' tick.&lt;br /&gt;
***Bit 8: Special custom data in file (uses &amp;quot;Special&amp;quot; field)&lt;br /&gt;
*Tracker version&lt;br /&gt;
**0x1xyy == Scream Tracker x.yy&lt;br /&gt;
**0x2xyy == Imago Orpheus x.yy&lt;br /&gt;
**0x3xyy == Impulse Tracker x.yy&lt;br /&gt;
**0x4xyy == Schism Tracker (version numbering scheme is different)&lt;br /&gt;
**0x5xyy == OpenMPT&lt;br /&gt;
*File format information&lt;br /&gt;
**1 == signed samples (horribly, horribly old)&lt;br /&gt;
**2 == unsigned samples&lt;br /&gt;
**Anything else is invalid and ST3 will not load the file(?).&lt;br /&gt;
*4 byte string: &amp;quot;SCRM&amp;quot;&lt;br /&gt;
*6 bytes, denoting the following:&lt;br /&gt;
**Global volume (range 0 &amp;lt;= x &amp;lt;= 64) which is used in calculating individual channel volumes '''and is nasty.'''&lt;br /&gt;
**Initial speed (ticks per row / TPR) - '''if 0 ''or 255'', it is ignored''' and 6 is used instead. The value of 255 is very unusual as AFF (set speed to 0xFF == 255) still works.&lt;br /&gt;
**Initial tempo - if '''less than 33, it is ignored''' and 125 is used instead.&lt;br /&gt;
**Mixing volume (range 16 &amp;lt;= x &amp;lt;= 127) which is only used for Sound Blaster. '''It is multiplied by 11/8 when stereo is on.'''&lt;br /&gt;
**Ultra-click removal which is only used for Gravis Ultrasound. ST3.21's interface only allows inputting of values 8, 12, or 16. Allegedly this is the number of GUS channels to allocate to guarantee that this value / 2 channels will play w/o clicks.&lt;br /&gt;
**Default pan value flag, if equal to 252 then load the default panning values at the end of the header, otherwise don't bother.&lt;br /&gt;
*8 reserved bytes, should be set to 0x00, although some trackers write stuff in here.&lt;br /&gt;
*1 parapointer: &amp;quot;Special&amp;quot;, used to point to &amp;quot;special custom data&amp;quot; which is not used in ST 3.01 or later. ST3.21's TECH.DOC refers to ExtHead which is not mentioned anywhere else. This should be safe to ignore.&lt;br /&gt;
*32 bytes indicating channel settings, as follows:&lt;br /&gt;
**If bit 8 is set, this channel is enabled.&lt;br /&gt;
**The lower 7 bits indicate the channel type:&lt;br /&gt;
***0 &amp;lt;= x &amp;lt;= 7: Left PCM channel 1-8 (Lx)&lt;br /&gt;
***8 &amp;lt;= x &amp;lt;= 15: Right PCM channel 1-8 (Rx)&lt;br /&gt;
***16 &amp;lt;= x &amp;lt;= 24: Adlib/OPL2 #1 melody (Ax)&lt;br /&gt;
***25 &amp;lt;= x &amp;lt;= 29: Adlib/OPL2 #1 drums (A_, where _ can be one of {''(TODO: look this up''}) - ''is this used?''&lt;br /&gt;
***Immediately after Adlib/OPL2 #1, there's some provision for a second OPL2 chip, although this does not appear to be supported / used.&lt;br /&gt;
**'''It is possible to map two pattern channels to the same output channel, which allows for some quirks. This is NOT supported by virtually any player other than ST3 itself.''' pys3m supports it, but is very obscure and quite slow. '''WARNING:''' Despite being less useful than you might expect, there ARE reasons why people would do this!&lt;br /&gt;
*Order list: series of bytes indicating pattern indices.&lt;br /&gt;
*Instrument parapointer list: series of parapointers pointing to instruments.&lt;br /&gt;
*Pattern parapointer list: series of parapointers pointing to patterns.&lt;br /&gt;
*OPTIONAL: Panning list: Entries are as follows:&lt;br /&gt;
**Bits 6 and 7 are reserved.&lt;br /&gt;
**Bit 5(?): If set, use the value specified, otherwise use default (7 for mono, 3(L) / C(R) for stereo).&lt;br /&gt;
**Bits 0-3: Specified panning value if default not used.&lt;br /&gt;
&lt;br /&gt;
''TODO: ST3.21's TECH.DOC should cover instruments.''&lt;br /&gt;
&lt;br /&gt;
==Playback Notes==&lt;br /&gt;
&lt;br /&gt;
Note w/o sample results in retriggering the note without resetting the volume.&lt;br /&gt;
&lt;br /&gt;
Sample w/o note results in resetting the volume and ''switching samples'' w/o retriggering the note. If the C4 speeds differ, this could potentially be out of tune as it does not convert the internal period values. If the note is off, it will stay off - it will not retrigger.&lt;br /&gt;
&lt;br /&gt;
Vibrato and tremolo have a full cycle length of 256, though Hxy and Rxy use x*4 and y*4 as their parameters.&lt;br /&gt;
&lt;br /&gt;
Base clock is '''14317456 Hz''' (documentation '''incorrectly says''' 14317056 Hz, correct value is the expected 8363*1712). When calculating a note's period, use the following table:&lt;br /&gt;
&lt;br /&gt;
  C    C#   D    D#   E    F    F#   G    G#   A   A#   A&lt;br /&gt;
 1712,1616,1524,1440,1356,1280,1208,1140,1076,1016,960,907&lt;br /&gt;
&lt;br /&gt;
and calculate the period like so:&lt;br /&gt;
&lt;br /&gt;
 period = 8363 * 16 * (note &amp;gt;&amp;gt; octave) / middle_c_frequency_of_instrument&lt;br /&gt;
&lt;br /&gt;
''Theoretically'', both the period and the volume have &amp;quot;stored&amp;quot; values and &amp;quot;active&amp;quot; values.&lt;br /&gt;
&lt;br /&gt;
'''Volumes actually peak at 63''', and not 64. Setting the volume to 64 will actually make it go to 63.&lt;br /&gt;
&lt;br /&gt;
However, on '''adlib channels''', if the default volume is 64, it will use 64. Any further operations on the volume will clip it to within the 0-63 range.&lt;br /&gt;
&lt;br /&gt;
Many effects use the '''latest nonzero effect parameter encountered''', as noted a bit further below.&lt;br /&gt;
&lt;br /&gt;
===Multiple channel mapping quirk===&lt;br /&gt;
'''It is possible to map two pattern channels to one output channel.''' However, it is rather quirky, but usable.&lt;br /&gt;
&lt;br /&gt;
Note that '''only the last pattern channel's effects are used'''.&lt;br /&gt;
&lt;br /&gt;
''TODO: document this quirk in detail.''&lt;br /&gt;
&lt;br /&gt;
==Effects==&lt;br /&gt;
&lt;br /&gt;
''TODO the rest''&lt;br /&gt;
&lt;br /&gt;
Effects marked with a % use '''the latest nonzero effect parameter to show up'''. Effects with a * have their own memory.&lt;br /&gt;
&lt;br /&gt;
===Axx===&lt;br /&gt;
Set speed. If the parameter '''is 0''', the effect is '''ignored'''.&lt;br /&gt;
&lt;br /&gt;
===Bxx===&lt;br /&gt;
Order jump.&lt;br /&gt;
&lt;br /&gt;
===Cxy===&lt;br /&gt;
Jump to row x*10 + y. The value provided is in '''decimal'''. If the row number specified '''is 64 or higher, the effect is ignored'''.&lt;br /&gt;
&lt;br /&gt;
===Dxy (%)===&lt;br /&gt;
Volume slide. If one of the values are 0, then we slide on all nonzero ticks. If one of the values are F, then we slide on all zero ticks. That means that '''D0F slides down 15 on all ticks and DF0 slides up 15 on all ticks'''.&lt;br /&gt;
&lt;br /&gt;
However, if fast slides are enabled (if they are set as a flag or the version is &amp;lt;= 0x1300), then, unless we're doing a fineslide, we slide on all ticks.&lt;br /&gt;
&lt;br /&gt;
When we do a volume slide, we slide the active volume '''without modifying the stored volume'''.&lt;br /&gt;
&lt;br /&gt;
The checking order is not the same as ImpulseTracker.&lt;br /&gt;
&lt;br /&gt;
Here's a full detailed description of all possible cases (0x00..0xFF) and how both Scream Tracker and Impulse Tracker handle them:&lt;br /&gt;
*D0x, 1 &amp;lt;= x &amp;lt;= 0xE: slide down by x on all nonzero ticks. Also slide on tick 0, if fast slides are enabled.&lt;br /&gt;
*Dx0, 1 &amp;lt;= x &amp;lt;= 0xE: slide up by x on all nonzero ticks. Also slide on tick 0, if fast slides are enabled.&lt;br /&gt;
*DFx, 1 &amp;lt;= x &amp;lt;= 0xE: slide down by x on tick 0.&lt;br /&gt;
*DxF, 1 &amp;lt;= x &amp;lt;= 0xE: slide up by x on tick 0.&lt;br /&gt;
*DFF: slide up by 15 on tick 0.&lt;br /&gt;
*D0F: slide down by 15 on all ticks. Not affected at all by the fast slides flag.&lt;br /&gt;
*DF0: slide up by 15 on all ticks. Not affected at all by the fast slides flag.&lt;br /&gt;
*Dxy, 1 &amp;lt;= x &amp;lt;= 0xE, 1 &amp;lt;= y &amp;lt;= 0xE: Scream Tracker treats it as a slide down by y, i.e. equivalent to D0y. Impulse Tracker does nothing.&lt;br /&gt;
*D00: Scream Tracker uses the last nonzero effect parameter in the channel. Impulse Tracker uses the last nonzero value used for Dxx, Kxx or Lxx in the channel.&lt;br /&gt;
&lt;br /&gt;
===Exx (%)===&lt;br /&gt;
Slide down.&lt;br /&gt;
&lt;br /&gt;
===Fxx (%)===&lt;br /&gt;
Slide up.&lt;br /&gt;
&lt;br /&gt;
===Gxx (*)===&lt;br /&gt;
Slide to note.&lt;br /&gt;
&lt;br /&gt;
Peculiarities in the Scream Tracker implementation of this effect:&lt;br /&gt;
*If the current note is empty, the destination note is set to the '''last note''' to show up in the channel, '''even if it has occurred without the Gxx effect'''.&lt;br /&gt;
*Gxx '''doesn't clear the target note''' when it is reached, so any future Gxx with no note will keep sliding back to this particular note.&lt;br /&gt;
&lt;br /&gt;
===Hxy (*)===&lt;br /&gt;
Vibrato. This effect '''shares memory''' with '''Uxy'''.&lt;br /&gt;
&lt;br /&gt;
===Ixy (%)===&lt;br /&gt;
Tremor. ''TODO: this effect is weird.''&lt;br /&gt;
&lt;br /&gt;
(Looking through what's released of the ST3 playback source code, tremor is not retriggered if there's a Dxy effect, or something like that, but this needs to be clarified.)&lt;br /&gt;
&lt;br /&gt;
===Jxy (%)===&lt;br /&gt;
Arpeggio. ''TODO: this effect is weird.''&lt;br /&gt;
&lt;br /&gt;
===Kxy (%)===&lt;br /&gt;
H00 + Dxy.&lt;br /&gt;
&lt;br /&gt;
The volume slide, performed by this effect differs from Dxy in the following ways:&lt;br /&gt;
* '''The first tick of this effect is ignored.''' This is due to a no-op in the &amp;quot;first tick&amp;quot; pointer table.&lt;br /&gt;
&lt;br /&gt;
===Lxy (%)===&lt;br /&gt;
G00 + Dxy.&lt;br /&gt;
&lt;br /&gt;
The volume slide '''differs from Dxy'''. See '''Kxy''' for details.&lt;br /&gt;
&lt;br /&gt;
===Oxx (*)===&lt;br /&gt;
Set sample offset.&lt;br /&gt;
&lt;br /&gt;
===Qxy (%)===&lt;br /&gt;
Retrigger note every y ticks with volume modifier x.&lt;br /&gt;
&lt;br /&gt;
Values for x:&lt;br /&gt;
*0: 0&lt;br /&gt;
*1: -1&lt;br /&gt;
*2: -2&lt;br /&gt;
*3: -4&lt;br /&gt;
*4: -8&lt;br /&gt;
*5: -16&lt;br /&gt;
*6: *2/3&lt;br /&gt;
*7: *1/2&lt;br /&gt;
*8: ?&lt;br /&gt;
*9: 1&lt;br /&gt;
*A: 2&lt;br /&gt;
*B: 4&lt;br /&gt;
*C: 8&lt;br /&gt;
*D: 16&lt;br /&gt;
*E: *3/2&lt;br /&gt;
*F: *2&lt;br /&gt;
&lt;br /&gt;
'''6 isn't exactly *2/3.''' It seems to use the following table:&lt;br /&gt;
&lt;br /&gt;
  TwoThirds: array [0..63] of Byte =&lt;br /&gt;
  ( 0,  0,  1,  1,  2,  3,  3,  4,  5,  5,  6,  6,  7,  8,  8,  9,&lt;br /&gt;
   10, 10, 11, 11, 12, 13, 13, 14, 15, 15, 16, 16, 17, 18, 18, 19,&lt;br /&gt;
   20, 20, 21, 21, 22, 23, 23, 24, 25, 25, 26, 26, 27, 28, 28, 29,&lt;br /&gt;
   30, 30, 31, 31, 32, 33, 33, 34, 35, 35, 36, 36, 37, 38, 38, 39);&lt;br /&gt;
&lt;br /&gt;
This effect changes only the active volume, '''without modifying the stored volume.'''&lt;br /&gt;
&lt;br /&gt;
===Rxy (%)===&lt;br /&gt;
Tremolo. x*4 is speed, y*4 is depth. This effect is screwy, but not as screwy as previously documented.&lt;br /&gt;
&lt;br /&gt;
*Get xy from the '''latest nonzero effect parameter''' to appear in the channel.&lt;br /&gt;
*'''On tick 1''' (the '''second''' tick of the row) set the active volume to '''the stored volume plus''' (depth * value) / (max_amplitude * 2) (Rxy peaks at 32 in each direction), and for each '''nonzero''' tick increase the tremolo position by the speed. '''The stored volume is untouched.'''&lt;br /&gt;
*'''If the song speed (not tremolo speed, but song speed - ticks per row) is 1, the active volume is also untouched. It is not set to the stored volume!'''&lt;br /&gt;
*'''Tremolo will not work if the stored volume is 0 (or 64 - adlib only).'''&lt;br /&gt;
&lt;br /&gt;
===Sxy===&lt;br /&gt;
Miscellaneous effects.&lt;br /&gt;
&lt;br /&gt;
''TODO: check what value xy is taken for Sxy''&lt;br /&gt;
&lt;br /&gt;
====S0x====&lt;br /&gt;
Set filter. Not implemented in Scream Tracker 3.&lt;br /&gt;
&lt;br /&gt;
====S1x====&lt;br /&gt;
Set glissando control.&lt;br /&gt;
&lt;br /&gt;
====S2x====&lt;br /&gt;
Set finetune.&lt;br /&gt;
&lt;br /&gt;
====S3x====&lt;br /&gt;
Set vibrato waveform.&lt;br /&gt;
&lt;br /&gt;
====S4x====&lt;br /&gt;
Set tremolo waveform.&lt;br /&gt;
&lt;br /&gt;
====S8x====&lt;br /&gt;
Set panning position. Scream Tracker 3 supports this only on the Gravis Ultrasound.&lt;br /&gt;
&lt;br /&gt;
====SAx====&lt;br /&gt;
Old stereo control. This appears in PANIC.S3M, but may have been removed since Scream Tracker 3.01 BETA. libmodplug, and in turn SchismTracker, convert these to S8x effects.&lt;br /&gt;
&lt;br /&gt;
''TODO: work out how SAx converts to S8x effects.''&lt;br /&gt;
&lt;br /&gt;
====SBx====&lt;br /&gt;
Loop pattern.&lt;br /&gt;
&lt;br /&gt;
====SCx====&lt;br /&gt;
Note cut after x ticks.&lt;br /&gt;
&lt;br /&gt;
*If '''the argument is 0''', the effect '''is ignored'''.&lt;br /&gt;
*When the note is cut, the volume is '''not''' set to 0. Instead playback is temporarily '''frozen''' and may be '''resumed by a following Exx, Fxx, Gxx, Hxx, Jxx, Kxx, Lxx or Uxx command'''.&lt;br /&gt;
&lt;br /&gt;
====SDx====&lt;br /&gt;
Note delay for x ticks.&lt;br /&gt;
&lt;br /&gt;
====SEx====&lt;br /&gt;
Pattern delay for x rows.&lt;br /&gt;
&lt;br /&gt;
====SFx====&lt;br /&gt;
FunkRepeat. Not implemented in Scream Tracker 3.&lt;br /&gt;
&lt;br /&gt;
===Txx===&lt;br /&gt;
Set tempo. If the parameter is '''less than 33''', the effect is '''ignored'''.&lt;br /&gt;
&lt;br /&gt;
===Uxy (*)===&lt;br /&gt;
Fine vibrato. This effect '''shares memory''' with '''Hxy'''.&lt;br /&gt;
&lt;br /&gt;
===Vxx===&lt;br /&gt;
Set global volume. This effect has several quirks:&lt;br /&gt;
&lt;br /&gt;
*Normally, it does not affect events on the same row, where the effect is set. However, '''there are some exceptions to that rule''', read below for details.&lt;br /&gt;
*It does not affect past notes, that are still playing, unless '''their volume is changed''', which '''applies the new global volume to that voice''' as well.&lt;br /&gt;
*This effect '''is actually processed on tick 1 (that is the second tick)''' of the row. This has several consequences:&lt;br /&gt;
**The effect '''doesn't do anything''', if '''the current speed is 1'''.&lt;br /&gt;
**The effect '''is applied to notes on the current row, that have a note delay effect''' (SDx with x &amp;gt;= 1). For notes on the same row '''that have a note delay of 1 tick''', the effect is only applied to '''channels, that are processed after''' the channel with the set global volume effect. For notes on the same row that have a '''note delay of 2 ticks or more''', the effect is applied '''regardless of the relative position of the channel''' in the processing order. ''TODO: Document the processing order, since it isn't very obvious (I think it's L1, L2, ..., L8, R1, R2, ..., R8, but I'm not 100% sure).''&lt;br /&gt;
**The effect '''is also applied''' on the same row if anything updates the note volume '''on tick 1''' or '''tick 2''' (depends on processing order), like the '''Dxx effect''' (when doing a non-fine slide, of course).&lt;br /&gt;
*Vxx with parameter '''values higher than 0x40''' are '''ignored'''.&lt;br /&gt;
&lt;br /&gt;
[[Category: Music Pattern Formats]]&lt;/div&gt;</summary>
		<author><name>GreaseMonkey</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Scream_Tracker_3_Module&amp;diff=13384</id>
		<title>Scream Tracker 3 Module</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Scream_Tracker_3_Module&amp;diff=13384"/>
		<updated>2011-03-29T00:58:48Z</updated>

		<summary type="html">&lt;p&gt;GreaseMonkey: /* SAx */ panic.s3m, anyone?&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* Extension: s3m&lt;br /&gt;
A normally 16-channel module format for MS-DOS on the PC, it can also support OPL2 FM synthesis (9 melodic channels). While the format itself can technically support 32 channels, only the 25 mentioned have any meaning assigned to them, and they are usually not all used at the same time.&lt;br /&gt;
&lt;br /&gt;
Aspects which are easy to get wrong with this format are in '''bold text'''.&lt;br /&gt;
&lt;br /&gt;
Unless otherwise specified, this information pertains to Scream Tracker v3.21's play routine.&lt;br /&gt;
&lt;br /&gt;
==File Format==&lt;br /&gt;
&lt;br /&gt;
The format is little-endian (least significant byte first). A &amp;quot;byte&amp;quot; is 8 bits, a &amp;quot;word&amp;quot; is 16 bits, and a &amp;quot;dword&amp;quot; (double word) is 32 bits. Hex values will be denoted with &amp;quot;0x&amp;quot;. A parapointer points to pp*16 in the file due to the DOS nature of the format.&lt;br /&gt;
&lt;br /&gt;
Note that if some parts of the format are inconsistent, it's usually best to let it slip, as ST3 itself will allegedly for instance load instruments which don't have the &amp;quot;SCRS&amp;quot; / &amp;quot;SCRI&amp;quot; mark.&lt;br /&gt;
&lt;br /&gt;
*28 bytes: module name, NUL-terminated, NUL-padded.&lt;br /&gt;
*Byte: 0x1A.&lt;br /&gt;
*Byte: 16 (0x10) to indicate this is a Scream Tracker 3 module.&lt;br /&gt;
*2 reserved bytes, should be set to 0x00.&lt;br /&gt;
*6 words, denoting the following:&lt;br /&gt;
**Order count&lt;br /&gt;
**Instrument count&lt;br /&gt;
**Pattern count&lt;br /&gt;
**Flags&lt;br /&gt;
***Bit 0 (pre-3.01 ONLY): ST2 vibrato ''(effect unknown)''.&lt;br /&gt;
***Bit 1 (pre-3.01 ONLY): ST2 tempo ''(effect unknown)''.&lt;br /&gt;
***Bit 3 (pre-3.01 ONLY): Amiga slides ''(effect unknown)''.&lt;br /&gt;
***Bit 4: 0-vol optimisations - turn off looping notes which have a zero volume for more than(?) 2 rows.&lt;br /&gt;
***Bit 5: Amiga limits (limit periods to confine to 113 &amp;lt;= x &amp;lt;= 856).&lt;br /&gt;
***Bit 6 (pre-3.01 ONLY): Enable filter / sfx with SB ''(effect unknown)''.&lt;br /&gt;
***Bit 7: ST3.00 volume slides ('''automatically enabled if tracker version is &amp;lt;= 0x1300''') - if enabled, ''all'' volume slides occur ''every'' tick.&lt;br /&gt;
***Bit 8: Special custom data in file (uses &amp;quot;Special&amp;quot; field)&lt;br /&gt;
*Tracker version&lt;br /&gt;
**0x1xyy == Scream Tracker x.yy&lt;br /&gt;
**0x2xyy == Imago Orpheus x.yy&lt;br /&gt;
**0x3xyy == Impulse Tracker x.yy&lt;br /&gt;
**0x4xyy == Schism Tracker (version numbering scheme is different)&lt;br /&gt;
**0x5xyy == OpenMPT&lt;br /&gt;
*File format information&lt;br /&gt;
**1 == signed samples (horribly, horribly old)&lt;br /&gt;
**2 == unsigned samples&lt;br /&gt;
**Anything else is invalid and ST3 will not load the file(?).&lt;br /&gt;
*4 byte string: &amp;quot;SCRM&amp;quot;&lt;br /&gt;
*6 bytes, denoting the following:&lt;br /&gt;
**Global volume (range 0 &amp;lt;= x &amp;lt;= 64) which is used in calculating individual channel volumes '''and is nasty.'''&lt;br /&gt;
**Initial speed (ticks per row / TPR) - '''if 0 ''or 255'', it is ignored''' and 6 is used instead. The value of 255 is very unusual as AFF (set speed to 0xFF == 255) still works.&lt;br /&gt;
**Initial tempo - if '''less than 33, it is ignored''' and 125 is used instead.&lt;br /&gt;
**Mixing volume (range 16 &amp;lt;= x &amp;lt;= 127) which is only used for Sound Blaster. '''It is multiplied by 11/8 when stereo is on.'''&lt;br /&gt;
**Ultra-click removal which is only used for Gravis Ultrasound. ST3.21's interface only allows inputting of values 8, 12, or 16. Allegedly this is the number of GUS channels to allocate to guarantee that this value / 2 channels will play w/o clicks.&lt;br /&gt;
**Default pan value flag, if equal to 252 then load the default panning values at the end of the header, otherwise don't bother.&lt;br /&gt;
*8 reserved bytes, should be set to 0x00, although some trackers write stuff in here.&lt;br /&gt;
*1 parapointer: &amp;quot;Special&amp;quot;, used to point to &amp;quot;special custom data&amp;quot; which is not used in ST 3.01 or later. ST3.21's TECH.DOC refers to ExtHead which is not mentioned anywhere else. This should be safe to ignore.&lt;br /&gt;
*32 bytes indicating channel settings, as follows:&lt;br /&gt;
**If bit 8 is set, this channel is enabled.&lt;br /&gt;
**The lower 7 bits indicate the channel type:&lt;br /&gt;
***0 &amp;lt;= x &amp;lt;= 7: Left PCM channel 1-8 (Lx)&lt;br /&gt;
***8 &amp;lt;= x &amp;lt;= 15: Right PCM channel 1-8 (Rx)&lt;br /&gt;
***16 &amp;lt;= x &amp;lt;= 24: Adlib/OPL2 #1 melody (Ax)&lt;br /&gt;
***25 &amp;lt;= x &amp;lt;= 29: Adlib/OPL2 #1 drums (A_, where _ can be one of {''(TODO: look this up''}) - ''is this used?''&lt;br /&gt;
***Immediately after Adlib/OPL2 #1, there's some provision for a second OPL2 chip, although this does not appear to be supported / used.&lt;br /&gt;
**'''It is possible to map two pattern channels to the same output channel, which allows for some quirks. This is NOT supported by virtually any player other than ST3 itself.''' pys3m supports it, but is very obscure and quite slow. '''WARNING:''' Despite being less useful than you might expect, there ARE reasons why people would do this!&lt;br /&gt;
*Order list: series of bytes indicating pattern indices.&lt;br /&gt;
*Instrument parapointer list: series of parapointers pointing to instruments.&lt;br /&gt;
*Pattern parapointer list: series of parapointers pointing to patterns.&lt;br /&gt;
*OPTIONAL: Panning list: Entries are as follows:&lt;br /&gt;
**Bits 6 and 7 are reserved.&lt;br /&gt;
**Bit 5(?): If set, use the value specified, otherwise use default (7 for mono, 3(L) / C(R) for stereo).&lt;br /&gt;
**Bits 0-3: Specified panning value if default not used.&lt;br /&gt;
&lt;br /&gt;
''TODO: ST3.21's TECH.DOC should cover instruments.''&lt;br /&gt;
&lt;br /&gt;
==Playback Notes==&lt;br /&gt;
&lt;br /&gt;
Note w/o sample results in retriggering the note without resetting the volume.&lt;br /&gt;
&lt;br /&gt;
Sample w/o note results in resetting the volume and ''switching samples'' w/o retriggering the note. If the C4 speeds differ, this could potentially be out of tune as it does not convert the internal period values. If the note is off, it will stay off - it will not retrigger.&lt;br /&gt;
&lt;br /&gt;
Vibrato and tremolo have a full cycle length of 256, though Hxy and Rxy use x*4 and y*4 as their parameters.&lt;br /&gt;
&lt;br /&gt;
Base clock is '''14317456 Hz''' (documentation '''incorrectly says''' 14317056 Hz, correct value is the expected 8363*1712). When calculating a note's period, use the following table:&lt;br /&gt;
&lt;br /&gt;
  C    C#   D    D#   E    F    F#   G    G#   A   A#   A&lt;br /&gt;
 1712,1616,1524,1440,1356,1280,1208,1140,1076,1016,960,907&lt;br /&gt;
&lt;br /&gt;
and calculate the period like so:&lt;br /&gt;
&lt;br /&gt;
 period = 8363 * 16 * (note &amp;gt;&amp;gt; octave) / middle_c_frequency_of_instrument&lt;br /&gt;
&lt;br /&gt;
''Theoretically'', both the period and the volume have &amp;quot;stored&amp;quot; values and &amp;quot;active&amp;quot; values.&lt;br /&gt;
&lt;br /&gt;
'''Volumes actually peak at 63''', and not 64. Setting the volume to 64 will actually make it go to 63.&lt;br /&gt;
&lt;br /&gt;
However, on '''adlib channels''', if the default volume is 64, it will use 64. Any further operations on the volume will clip it to within the 0-63 range.&lt;br /&gt;
&lt;br /&gt;
Many effects use the '''latest nonzero effect parameter encountered''', as noted a bit further below.&lt;br /&gt;
&lt;br /&gt;
===Multiple channel mapping quirk===&lt;br /&gt;
'''It is possible to map two pattern channels to one output channel.''' However, it is rather quirky, but usable.&lt;br /&gt;
&lt;br /&gt;
Note that '''only the last pattern channel's effects are used'''.&lt;br /&gt;
&lt;br /&gt;
''TODO: document this quirk in detail.''&lt;br /&gt;
&lt;br /&gt;
==Effects==&lt;br /&gt;
&lt;br /&gt;
''TODO the rest''&lt;br /&gt;
&lt;br /&gt;
Effects marked with a % use '''the latest nonzero effect parameter to show up'''. Effects with a * have their own memory.&lt;br /&gt;
&lt;br /&gt;
===Axx===&lt;br /&gt;
Set speed. If the parameter '''is 0''', the effect is '''ignored'''.&lt;br /&gt;
&lt;br /&gt;
===Bxx===&lt;br /&gt;
Order jump.&lt;br /&gt;
&lt;br /&gt;
===Cxy===&lt;br /&gt;
Jump to row x*10 + y. The value provided is in '''decimal'''. If the row number specified '''is 64 or higher, the effect is ignored'''.&lt;br /&gt;
&lt;br /&gt;
===Dxy (%)===&lt;br /&gt;
Volume slide. If one of the values are 0, then we slide on all nonzero ticks. If one of the values are F, then we slide on all zero ticks. That means that '''D0F slides down 15 on all ticks and DF0 slides up 15 on all ticks'''.&lt;br /&gt;
&lt;br /&gt;
However, if fast slides are enabled (if they are set as a flag or the version is &amp;lt;= 0x1300), then, unless we're doing a fineslide, we slide on all ticks.&lt;br /&gt;
&lt;br /&gt;
When we do a volume slide, we slide the active volume '''without modifying the stored volume'''.&lt;br /&gt;
&lt;br /&gt;
The checking order is not the same as ImpulseTracker.&lt;br /&gt;
''TODO: Nail the checking order. D13 for instance slides down 3.''&lt;br /&gt;
&lt;br /&gt;
Here's a full detailed description of all possible cases (0x00..0xFF) and how both Scream Tracker and Impulse Tracker handle them:&lt;br /&gt;
*D0x, 1 &amp;lt;= x &amp;lt;= 0xE: slide down by x on all nonzero ticks. Also slide on tick 0, if fast slides are enabled.&lt;br /&gt;
*Dx0, 1 &amp;lt;= x &amp;lt;= 0xE: slide up by x on all nonzero ticks. Also slide on tick 0, if fast slides are enabled.&lt;br /&gt;
*DFx, 1 &amp;lt;= x &amp;lt;= 0xE: slide down by x on tick 0.&lt;br /&gt;
*DxF, 1 &amp;lt;= x &amp;lt;= 0xE: slide up by x on tick 0.&lt;br /&gt;
*DFF: slide up by 15 on tick 0.&lt;br /&gt;
*D0F: slide down by 15 on all ticks. Not affected at all by the fast slides flag.&lt;br /&gt;
*DF0: slide up by 15 on all ticks. Not affected at all by the fast slides flag.&lt;br /&gt;
*Dxy, 1 &amp;lt;= x &amp;lt;= 0xE, 1 &amp;lt;= y &amp;lt;= 0xE: Scream Tracker treats it as a slide down by y, i.e. equivalent to D0y. Impulse Tracker does nothing.&lt;br /&gt;
*D00: Scream Tracker uses the last nonzero effect parameter in the channel. Impulse Tracker uses the last nonzero value used for Dxx, Kxx or Lxx in the channel.&lt;br /&gt;
&lt;br /&gt;
===Exx (%)===&lt;br /&gt;
Slide down.&lt;br /&gt;
&lt;br /&gt;
===Fxx (%)===&lt;br /&gt;
Slide up.&lt;br /&gt;
&lt;br /&gt;
===Gxx (*)===&lt;br /&gt;
Slide to note.&lt;br /&gt;
&lt;br /&gt;
Peculiarities in the Scream Tracker implementation of this effect:&lt;br /&gt;
*If the current note is empty, the destination note is set to the '''last note''' to show up in the channel, '''even if it has occurred without the Gxx effect'''.&lt;br /&gt;
*Gxx '''doesn't clear the target note''' when it is reached, so any future Gxx with no note will keep sliding back to this particular note.&lt;br /&gt;
&lt;br /&gt;
===Hxy (*)===&lt;br /&gt;
Vibrato. This effect '''shares memory''' with '''Uxy'''.&lt;br /&gt;
&lt;br /&gt;
===Ixy (%)===&lt;br /&gt;
Tremor. ''TODO: this effect is weird.''&lt;br /&gt;
&lt;br /&gt;
(Looking through what's released of the ST3 playback source code, tremor is not retriggered if there's a Dxy effect, or something like that, but this needs to be clarified.)&lt;br /&gt;
&lt;br /&gt;
===Jxy (%)===&lt;br /&gt;
Arpeggio. ''TODO: this effect is weird.''&lt;br /&gt;
&lt;br /&gt;
===Kxy (%)===&lt;br /&gt;
H00 + Dxy.&lt;br /&gt;
&lt;br /&gt;
The volume slide, performed by this effect differs from Dxy in the following ways:&lt;br /&gt;
* '''The first tick of this effect is ignored.''' This is due to a no-op in the &amp;quot;first tick&amp;quot; pointer table.&lt;br /&gt;
&lt;br /&gt;
===Lxy (%)===&lt;br /&gt;
G00 + Dxy.&lt;br /&gt;
&lt;br /&gt;
The volume slide '''differs from Dxy'''. See '''Kxy''' for details.&lt;br /&gt;
&lt;br /&gt;
===Oxx (*)===&lt;br /&gt;
Set sample offset.&lt;br /&gt;
&lt;br /&gt;
===Qxy (%)===&lt;br /&gt;
Retrigger note every y ticks with volume modifier x.&lt;br /&gt;
&lt;br /&gt;
Values for x:&lt;br /&gt;
*0: 0&lt;br /&gt;
*1: -1&lt;br /&gt;
*2: -2&lt;br /&gt;
*3: -4&lt;br /&gt;
*4: -8&lt;br /&gt;
*5: -16&lt;br /&gt;
*6: *2/3&lt;br /&gt;
*7: *1/2&lt;br /&gt;
*8: ?&lt;br /&gt;
*9: 1&lt;br /&gt;
*A: 2&lt;br /&gt;
*B: 4&lt;br /&gt;
*C: 8&lt;br /&gt;
*D: 16&lt;br /&gt;
*E: *3/2&lt;br /&gt;
*F: *2&lt;br /&gt;
&lt;br /&gt;
'''6 isn't exactly *2/3.''' It seems to use the following table:&lt;br /&gt;
&lt;br /&gt;
  TwoThirds: array [0..63] of Byte =&lt;br /&gt;
  ( 0,  0,  1,  1,  2,  3,  3,  4,  5,  5,  6,  6,  7,  8,  8,  9,&lt;br /&gt;
   10, 10, 11, 11, 12, 13, 13, 14, 15, 15, 16, 16, 17, 18, 18, 19,&lt;br /&gt;
   20, 20, 21, 21, 22, 23, 23, 24, 25, 25, 26, 26, 27, 28, 28, 29,&lt;br /&gt;
   30, 30, 31, 31, 32, 33, 33, 34, 35, 35, 36, 36, 37, 38, 38, 39);&lt;br /&gt;
&lt;br /&gt;
This effect changes only the active volume, '''without modifying the stored volume.'''&lt;br /&gt;
&lt;br /&gt;
===Rxy (%)===&lt;br /&gt;
Tremolo. x*4 is speed, y*4 is depth. This effect is screwy, but not as screwy as previously documented.&lt;br /&gt;
&lt;br /&gt;
*Get xy from the '''latest nonzero effect parameter''' to appear in the channel.&lt;br /&gt;
*'''On tick 1''' (the '''second''' tick of the row) set the active volume to '''the stored volume plus''' (depth * value) / (max_amplitude * 2) (Rxy peaks at 32 in each direction), and for each '''nonzero''' tick increase the tremolo position by the speed. '''The stored volume is untouched.'''&lt;br /&gt;
*'''If the song speed (not tremolo speed, but song speed - ticks per row) is 1, the active volume is also untouched. It is not set to the stored volume!'''&lt;br /&gt;
*'''Tremolo will not work if the stored volume is 0 (or 64 - adlib only).'''&lt;br /&gt;
&lt;br /&gt;
===Sxy===&lt;br /&gt;
Miscellaneous effects.&lt;br /&gt;
&lt;br /&gt;
''TODO: check what value xy is taken for Sxy''&lt;br /&gt;
&lt;br /&gt;
====S0x====&lt;br /&gt;
Set filter. Not implemented in Scream Tracker 3.&lt;br /&gt;
&lt;br /&gt;
====S1x====&lt;br /&gt;
Set glissando control.&lt;br /&gt;
&lt;br /&gt;
====S2x====&lt;br /&gt;
Set finetune.&lt;br /&gt;
&lt;br /&gt;
====S3x====&lt;br /&gt;
Set vibrato waveform.&lt;br /&gt;
&lt;br /&gt;
====S4x====&lt;br /&gt;
Set tremolo waveform.&lt;br /&gt;
&lt;br /&gt;
====S8x====&lt;br /&gt;
Set panning position. Scream Tracker 3 supports this only on the Gravis Ultrasound.&lt;br /&gt;
&lt;br /&gt;
====SAx====&lt;br /&gt;
Old stereo control. This appears in PANIC.S3M, but may have been removed since Scream Tracker 3.01 BETA. libmodplug, and in turn SchismTracker, convert these to S8x effects.&lt;br /&gt;
&lt;br /&gt;
''TODO: work out how SAx converts to S8x effects.''&lt;br /&gt;
&lt;br /&gt;
====SBx====&lt;br /&gt;
Loop pattern.&lt;br /&gt;
&lt;br /&gt;
====SCx====&lt;br /&gt;
Note cut after x ticks.&lt;br /&gt;
&lt;br /&gt;
*If '''the argument is 0''', the effect '''is ignored'''.&lt;br /&gt;
*When the note is cut, the volume is '''not''' set to 0. Instead playback is temporarily '''frozen''' and may be '''resumed by a following Exx, Fxx, Gxx, Hxx, Jxx, Kxx, Lxx or Uxx command'''.&lt;br /&gt;
&lt;br /&gt;
====SDx====&lt;br /&gt;
Note delay for x ticks.&lt;br /&gt;
&lt;br /&gt;
====SEx====&lt;br /&gt;
Pattern delay for x rows.&lt;br /&gt;
&lt;br /&gt;
====SFx====&lt;br /&gt;
FunkRepeat. Not implemented in Scream Tracker 3.&lt;br /&gt;
&lt;br /&gt;
===Txx===&lt;br /&gt;
Set tempo. If the parameter is '''less than 33''', the effect is '''ignored'''.&lt;br /&gt;
&lt;br /&gt;
===Uxy (*)===&lt;br /&gt;
Fine vibrato. This effect '''shares memory''' with '''Hxy'''.&lt;br /&gt;
&lt;br /&gt;
===Vxx===&lt;br /&gt;
Set global volume. This effect has several quirks:&lt;br /&gt;
&lt;br /&gt;
*Normally, it does not affect events on the same row, where the effect is set. However, '''there are some exceptions to that rule''', read below for details.&lt;br /&gt;
*It does not affect past notes, that are still playing, unless '''their volume is changed''', which '''applies the new global volume to that voice''' as well.&lt;br /&gt;
*This effect '''is actually processed on tick 1 (that is the second tick)''' of the row. This has several consequences:&lt;br /&gt;
**The effect '''doesn't do anything''', if '''the current speed is 1'''.&lt;br /&gt;
**The effect '''is applied to notes on the current row, that have a note delay effect''' (SDx with x &amp;gt;= 1). For notes on the same row '''that have a note delay of 1 tick''', the effect is only applied to '''channels, that are processed after''' the channel with the set global volume effect. For notes on the same row that have a '''note delay of 2 ticks or more''', the effect is applied '''regardless of the relative position of the channel''' in the processing order. ''TODO: Document the processing order, since it isn't very obvious (I think it's L1, L2, ..., L8, R1, R2, ..., R8, but I'm not 100% sure).''&lt;br /&gt;
**The effect '''is also applied''' on the same row if anything updates the note volume '''on tick 1''' or '''tick 2''' (depends on processing order), like the '''Dxx effect''' (when doing a non-fine slide, of course).&lt;br /&gt;
*Vxx with parameter '''values higher than 0x40''' are '''ignored'''.&lt;br /&gt;
&lt;br /&gt;
[[Category: Music Pattern Formats]]&lt;/div&gt;</summary>
		<author><name>GreaseMonkey</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Scream_Tracker_3_Module&amp;diff=13383</id>
		<title>Scream Tracker 3 Module</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Scream_Tracker_3_Module&amp;diff=13383"/>
		<updated>2011-03-29T00:44:10Z</updated>

		<summary type="html">&lt;p&gt;GreaseMonkey: /* Vxx */ grammar got ran over by a reindeer&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* Extension: s3m&lt;br /&gt;
A normally 16-channel module format for MS-DOS on the PC, it can also support OPL2 FM synthesis (9 melodic channels). While the format itself can technically support 32 channels, only the 25 mentioned have any meaning assigned to them, and they are usually not all used at the same time.&lt;br /&gt;
&lt;br /&gt;
Aspects which are easy to get wrong with this format are in '''bold text'''.&lt;br /&gt;
&lt;br /&gt;
Unless otherwise specified, this information pertains to Scream Tracker v3.21's play routine.&lt;br /&gt;
&lt;br /&gt;
==File Format==&lt;br /&gt;
&lt;br /&gt;
The format is little-endian (least significant byte first). A &amp;quot;byte&amp;quot; is 8 bits, a &amp;quot;word&amp;quot; is 16 bits, and a &amp;quot;dword&amp;quot; (double word) is 32 bits. Hex values will be denoted with &amp;quot;0x&amp;quot;. A parapointer points to pp*16 in the file due to the DOS nature of the format.&lt;br /&gt;
&lt;br /&gt;
Note that if some parts of the format are inconsistent, it's usually best to let it slip, as ST3 itself will allegedly for instance load instruments which don't have the &amp;quot;SCRS&amp;quot; / &amp;quot;SCRI&amp;quot; mark.&lt;br /&gt;
&lt;br /&gt;
*28 bytes: module name, NUL-terminated, NUL-padded.&lt;br /&gt;
*Byte: 0x1A.&lt;br /&gt;
*Byte: 16 (0x10) to indicate this is a Scream Tracker 3 module.&lt;br /&gt;
*2 reserved bytes, should be set to 0x00.&lt;br /&gt;
*6 words, denoting the following:&lt;br /&gt;
**Order count&lt;br /&gt;
**Instrument count&lt;br /&gt;
**Pattern count&lt;br /&gt;
**Flags&lt;br /&gt;
***Bit 0 (pre-3.01 ONLY): ST2 vibrato ''(effect unknown)''.&lt;br /&gt;
***Bit 1 (pre-3.01 ONLY): ST2 tempo ''(effect unknown)''.&lt;br /&gt;
***Bit 3 (pre-3.01 ONLY): Amiga slides ''(effect unknown)''.&lt;br /&gt;
***Bit 4: 0-vol optimisations - turn off looping notes which have a zero volume for more than(?) 2 rows.&lt;br /&gt;
***Bit 5: Amiga limits (limit periods to confine to 113 &amp;lt;= x &amp;lt;= 856).&lt;br /&gt;
***Bit 6 (pre-3.01 ONLY): Enable filter / sfx with SB ''(effect unknown)''.&lt;br /&gt;
***Bit 7: ST3.00 volume slides ('''automatically enabled if tracker version is &amp;lt;= 0x1300''') - if enabled, ''all'' volume slides occur ''every'' tick.&lt;br /&gt;
***Bit 8: Special custom data in file (uses &amp;quot;Special&amp;quot; field)&lt;br /&gt;
*Tracker version&lt;br /&gt;
**0x1xyy == Scream Tracker x.yy&lt;br /&gt;
**0x2xyy == Imago Orpheus x.yy&lt;br /&gt;
**0x3xyy == Impulse Tracker x.yy&lt;br /&gt;
**0x4xyy == Schism Tracker (version numbering scheme is different)&lt;br /&gt;
**0x5xyy == OpenMPT&lt;br /&gt;
*File format information&lt;br /&gt;
**1 == signed samples (horribly, horribly old)&lt;br /&gt;
**2 == unsigned samples&lt;br /&gt;
**Anything else is invalid and ST3 will not load the file(?).&lt;br /&gt;
*4 byte string: &amp;quot;SCRM&amp;quot;&lt;br /&gt;
*6 bytes, denoting the following:&lt;br /&gt;
**Global volume (range 0 &amp;lt;= x &amp;lt;= 64) which is used in calculating individual channel volumes '''and is nasty.'''&lt;br /&gt;
**Initial speed (ticks per row / TPR) - '''if 0 ''or 255'', it is ignored''' and 6 is used instead. The value of 255 is very unusual as AFF (set speed to 0xFF == 255) still works.&lt;br /&gt;
**Initial tempo - if '''less than 33, it is ignored''' and 125 is used instead.&lt;br /&gt;
**Mixing volume (range 16 &amp;lt;= x &amp;lt;= 127) which is only used for Sound Blaster. '''It is multiplied by 11/8 when stereo is on.'''&lt;br /&gt;
**Ultra-click removal which is only used for Gravis Ultrasound. ST3.21's interface only allows inputting of values 8, 12, or 16. Allegedly this is the number of GUS channels to allocate to guarantee that this value / 2 channels will play w/o clicks.&lt;br /&gt;
**Default pan value flag, if equal to 252 then load the default panning values at the end of the header, otherwise don't bother.&lt;br /&gt;
*8 reserved bytes, should be set to 0x00, although some trackers write stuff in here.&lt;br /&gt;
*1 parapointer: &amp;quot;Special&amp;quot;, used to point to &amp;quot;special custom data&amp;quot; which is not used in ST 3.01 or later. ST3.21's TECH.DOC refers to ExtHead which is not mentioned anywhere else. This should be safe to ignore.&lt;br /&gt;
*32 bytes indicating channel settings, as follows:&lt;br /&gt;
**If bit 8 is set, this channel is enabled.&lt;br /&gt;
**The lower 7 bits indicate the channel type:&lt;br /&gt;
***0 &amp;lt;= x &amp;lt;= 7: Left PCM channel 1-8 (Lx)&lt;br /&gt;
***8 &amp;lt;= x &amp;lt;= 15: Right PCM channel 1-8 (Rx)&lt;br /&gt;
***16 &amp;lt;= x &amp;lt;= 24: Adlib/OPL2 #1 melody (Ax)&lt;br /&gt;
***25 &amp;lt;= x &amp;lt;= 29: Adlib/OPL2 #1 drums (A_, where _ can be one of {''(TODO: look this up''}) - ''is this used?''&lt;br /&gt;
***Immediately after Adlib/OPL2 #1, there's some provision for a second OPL2 chip, although this does not appear to be supported / used.&lt;br /&gt;
**'''It is possible to map two pattern channels to the same output channel, which allows for some quirks. This is NOT supported by virtually any player other than ST3 itself.''' pys3m supports it, but is very obscure and quite slow. '''WARNING:''' Despite being less useful than you might expect, there ARE reasons why people would do this!&lt;br /&gt;
*Order list: series of bytes indicating pattern indices.&lt;br /&gt;
*Instrument parapointer list: series of parapointers pointing to instruments.&lt;br /&gt;
*Pattern parapointer list: series of parapointers pointing to patterns.&lt;br /&gt;
*OPTIONAL: Panning list: Entries are as follows:&lt;br /&gt;
**Bits 6 and 7 are reserved.&lt;br /&gt;
**Bit 5(?): If set, use the value specified, otherwise use default (7 for mono, 3(L) / C(R) for stereo).&lt;br /&gt;
**Bits 0-3: Specified panning value if default not used.&lt;br /&gt;
&lt;br /&gt;
''TODO: ST3.21's TECH.DOC should cover instruments.''&lt;br /&gt;
&lt;br /&gt;
==Playback Notes==&lt;br /&gt;
&lt;br /&gt;
Note w/o sample results in retriggering the note without resetting the volume.&lt;br /&gt;
&lt;br /&gt;
Sample w/o note results in resetting the volume and ''switching samples'' w/o retriggering the note. If the C4 speeds differ, this could potentially be out of tune as it does not convert the internal period values. If the note is off, it will stay off - it will not retrigger.&lt;br /&gt;
&lt;br /&gt;
Vibrato and tremolo have a full cycle length of 256, though Hxy and Rxy use x*4 and y*4 as their parameters.&lt;br /&gt;
&lt;br /&gt;
Base clock is '''14317456 Hz''' (documentation '''incorrectly says''' 14317056 Hz, correct value is the expected 8363*1712). When calculating a note's period, use the following table:&lt;br /&gt;
&lt;br /&gt;
  C    C#   D    D#   E    F    F#   G    G#   A   A#   A&lt;br /&gt;
 1712,1616,1524,1440,1356,1280,1208,1140,1076,1016,960,907&lt;br /&gt;
&lt;br /&gt;
and calculate the period like so:&lt;br /&gt;
&lt;br /&gt;
 period = 8363 * 16 * (note &amp;gt;&amp;gt; octave) / middle_c_frequency_of_instrument&lt;br /&gt;
&lt;br /&gt;
''Theoretically'', both the period and the volume have &amp;quot;stored&amp;quot; values and &amp;quot;active&amp;quot; values.&lt;br /&gt;
&lt;br /&gt;
'''Volumes actually peak at 63''', and not 64. Setting the volume to 64 will actually make it go to 63.&lt;br /&gt;
&lt;br /&gt;
However, on '''adlib channels''', if the default volume is 64, it will use 64. Any further operations on the volume will clip it to within the 0-63 range.&lt;br /&gt;
&lt;br /&gt;
Many effects use the '''latest nonzero effect parameter encountered''', as noted a bit further below.&lt;br /&gt;
&lt;br /&gt;
===Multiple channel mapping quirk===&lt;br /&gt;
'''It is possible to map two pattern channels to one output channel.''' However, it is rather quirky, but usable.&lt;br /&gt;
&lt;br /&gt;
Note that '''only the last pattern channel's effects are used'''.&lt;br /&gt;
&lt;br /&gt;
''TODO: document this quirk in detail.''&lt;br /&gt;
&lt;br /&gt;
==Effects==&lt;br /&gt;
&lt;br /&gt;
''TODO the rest''&lt;br /&gt;
&lt;br /&gt;
Effects marked with a % use '''the latest nonzero effect parameter to show up'''. Effects with a * have their own memory.&lt;br /&gt;
&lt;br /&gt;
===Axx===&lt;br /&gt;
Set speed. If the parameter '''is 0''', the effect is '''ignored'''.&lt;br /&gt;
&lt;br /&gt;
===Bxx===&lt;br /&gt;
Order jump.&lt;br /&gt;
&lt;br /&gt;
===Cxy===&lt;br /&gt;
Jump to row x*10 + y. The value provided is in '''decimal'''. If the row number specified '''is 64 or higher, the effect is ignored'''.&lt;br /&gt;
&lt;br /&gt;
===Dxy (%)===&lt;br /&gt;
Volume slide. If one of the values are 0, then we slide on all nonzero ticks. If one of the values are F, then we slide on all zero ticks. That means that '''D0F slides down 15 on all ticks and DF0 slides up 15 on all ticks'''.&lt;br /&gt;
&lt;br /&gt;
However, if fast slides are enabled (if they are set as a flag or the version is &amp;lt;= 0x1300), then, unless we're doing a fineslide, we slide on all ticks.&lt;br /&gt;
&lt;br /&gt;
When we do a volume slide, we slide the active volume '''without modifying the stored volume'''.&lt;br /&gt;
&lt;br /&gt;
The checking order is not the same as ImpulseTracker.&lt;br /&gt;
''TODO: Nail the checking order. D13 for instance slides down 3.''&lt;br /&gt;
&lt;br /&gt;
Here's a full detailed description of all possible cases (0x00..0xFF) and how both Scream Tracker and Impulse Tracker handle them:&lt;br /&gt;
*D0x, 1 &amp;lt;= x &amp;lt;= 0xE: slide down by x on all nonzero ticks. Also slide on tick 0, if fast slides are enabled.&lt;br /&gt;
*Dx0, 1 &amp;lt;= x &amp;lt;= 0xE: slide up by x on all nonzero ticks. Also slide on tick 0, if fast slides are enabled.&lt;br /&gt;
*DFx, 1 &amp;lt;= x &amp;lt;= 0xE: slide down by x on tick 0.&lt;br /&gt;
*DxF, 1 &amp;lt;= x &amp;lt;= 0xE: slide up by x on tick 0.&lt;br /&gt;
*DFF: slide up by 15 on tick 0.&lt;br /&gt;
*D0F: slide down by 15 on all ticks. Not affected at all by the fast slides flag.&lt;br /&gt;
*DF0: slide up by 15 on all ticks. Not affected at all by the fast slides flag.&lt;br /&gt;
*Dxy, 1 &amp;lt;= x &amp;lt;= 0xE, 1 &amp;lt;= y &amp;lt;= 0xE: Scream Tracker treats it as a slide down by y, i.e. equivalent to D0y. Impulse Tracker does nothing.&lt;br /&gt;
*D00: Scream Tracker uses the last nonzero effect parameter in the channel. Impulse Tracker uses the last nonzero value used for Dxx, Kxx or Lxx in the channel.&lt;br /&gt;
&lt;br /&gt;
===Exx (%)===&lt;br /&gt;
Slide down.&lt;br /&gt;
&lt;br /&gt;
===Fxx (%)===&lt;br /&gt;
Slide up.&lt;br /&gt;
&lt;br /&gt;
===Gxx (*)===&lt;br /&gt;
Slide to note.&lt;br /&gt;
&lt;br /&gt;
Peculiarities in the Scream Tracker implementation of this effect:&lt;br /&gt;
*If the current note is empty, the destination note is set to the '''last note''' to show up in the channel, '''even if it has occurred without the Gxx effect'''.&lt;br /&gt;
*Gxx '''doesn't clear the target note''' when it is reached, so any future Gxx with no note will keep sliding back to this particular note.&lt;br /&gt;
&lt;br /&gt;
===Hxy (*)===&lt;br /&gt;
Vibrato. This effect '''shares memory''' with '''Uxy'''.&lt;br /&gt;
&lt;br /&gt;
===Ixy (%)===&lt;br /&gt;
Tremor. ''TODO: this effect is weird.''&lt;br /&gt;
&lt;br /&gt;
(Looking through what's released of the ST3 playback source code, tremor is not retriggered if there's a Dxy effect, or something like that, but this needs to be clarified.)&lt;br /&gt;
&lt;br /&gt;
===Jxy (%)===&lt;br /&gt;
Arpeggio. ''TODO: this effect is weird.''&lt;br /&gt;
&lt;br /&gt;
===Kxy (%)===&lt;br /&gt;
H00 + Dxy.&lt;br /&gt;
&lt;br /&gt;
The volume slide, performed by this effect differs from Dxy in the following ways:&lt;br /&gt;
* '''The first tick of this effect is ignored.''' This is due to a no-op in the &amp;quot;first tick&amp;quot; pointer table.&lt;br /&gt;
&lt;br /&gt;
===Lxy (%)===&lt;br /&gt;
G00 + Dxy.&lt;br /&gt;
&lt;br /&gt;
The volume slide '''differs from Dxy'''. See '''Kxy''' for details.&lt;br /&gt;
&lt;br /&gt;
===Oxx (*)===&lt;br /&gt;
Set sample offset.&lt;br /&gt;
&lt;br /&gt;
===Qxy (%)===&lt;br /&gt;
Retrigger note every y ticks with volume modifier x.&lt;br /&gt;
&lt;br /&gt;
Values for x:&lt;br /&gt;
*0: 0&lt;br /&gt;
*1: -1&lt;br /&gt;
*2: -2&lt;br /&gt;
*3: -4&lt;br /&gt;
*4: -8&lt;br /&gt;
*5: -16&lt;br /&gt;
*6: *2/3&lt;br /&gt;
*7: *1/2&lt;br /&gt;
*8: ?&lt;br /&gt;
*9: 1&lt;br /&gt;
*A: 2&lt;br /&gt;
*B: 4&lt;br /&gt;
*C: 8&lt;br /&gt;
*D: 16&lt;br /&gt;
*E: *3/2&lt;br /&gt;
*F: *2&lt;br /&gt;
&lt;br /&gt;
'''6 isn't exactly *2/3.''' It seems to use the following table:&lt;br /&gt;
&lt;br /&gt;
  TwoThirds: array [0..63] of Byte =&lt;br /&gt;
  ( 0,  0,  1,  1,  2,  3,  3,  4,  5,  5,  6,  6,  7,  8,  8,  9,&lt;br /&gt;
   10, 10, 11, 11, 12, 13, 13, 14, 15, 15, 16, 16, 17, 18, 18, 19,&lt;br /&gt;
   20, 20, 21, 21, 22, 23, 23, 24, 25, 25, 26, 26, 27, 28, 28, 29,&lt;br /&gt;
   30, 30, 31, 31, 32, 33, 33, 34, 35, 35, 36, 36, 37, 38, 38, 39);&lt;br /&gt;
&lt;br /&gt;
This effect changes only the active volume, '''without modifying the stored volume.'''&lt;br /&gt;
&lt;br /&gt;
===Rxy (%)===&lt;br /&gt;
Tremolo. x*4 is speed, y*4 is depth. This effect is screwy, but not as screwy as previously documented.&lt;br /&gt;
&lt;br /&gt;
*Get xy from the '''latest nonzero effect parameter''' to appear in the channel.&lt;br /&gt;
*'''On tick 1''' (the '''second''' tick of the row) set the active volume to '''the stored volume plus''' (depth * value) / (max_amplitude * 2) (Rxy peaks at 32 in each direction), and for each '''nonzero''' tick increase the tremolo position by the speed. '''The stored volume is untouched.'''&lt;br /&gt;
*'''If the song speed (not tremolo speed, but song speed - ticks per row) is 1, the active volume is also untouched. It is not set to the stored volume!'''&lt;br /&gt;
*'''Tremolo will not work if the stored volume is 0 (or 64 - adlib only).'''&lt;br /&gt;
&lt;br /&gt;
===Sxy===&lt;br /&gt;
Miscellaneous effects.&lt;br /&gt;
&lt;br /&gt;
''TODO: check what value xy is taken for Sxy''&lt;br /&gt;
&lt;br /&gt;
====S0x====&lt;br /&gt;
Set filter. Not implemented in Scream Tracker 3.&lt;br /&gt;
&lt;br /&gt;
====S1x====&lt;br /&gt;
Set glissando control.&lt;br /&gt;
&lt;br /&gt;
====S2x====&lt;br /&gt;
Set finetune.&lt;br /&gt;
&lt;br /&gt;
====S3x====&lt;br /&gt;
Set vibrato waveform.&lt;br /&gt;
&lt;br /&gt;
====S4x====&lt;br /&gt;
Set tremolo waveform.&lt;br /&gt;
&lt;br /&gt;
====S8x====&lt;br /&gt;
Set panning position. Scream Tracker 3 supports this only on the Gravis Ultrasound.&lt;br /&gt;
&lt;br /&gt;
====SAx====&lt;br /&gt;
Old stereo control? Not implemented in Scream Tracker 3.21?&lt;br /&gt;
&lt;br /&gt;
====SBx====&lt;br /&gt;
Loop pattern.&lt;br /&gt;
&lt;br /&gt;
====SCx====&lt;br /&gt;
Note cut after x ticks.&lt;br /&gt;
&lt;br /&gt;
*If '''the argument is 0''', the effect '''is ignored'''.&lt;br /&gt;
*When the note is cut, the volume is '''not''' set to 0. Instead playback is temporarily '''frozen''' and may be '''resumed by a following Exx, Fxx, Gxx, Hxx, Jxx, Kxx, Lxx or Uxx command'''.&lt;br /&gt;
&lt;br /&gt;
====SDx====&lt;br /&gt;
Note delay for x ticks.&lt;br /&gt;
&lt;br /&gt;
====SEx====&lt;br /&gt;
Pattern delay for x rows.&lt;br /&gt;
&lt;br /&gt;
====SFx====&lt;br /&gt;
FunkRepeat. Not implemented in Scream Tracker 3.&lt;br /&gt;
&lt;br /&gt;
===Txx===&lt;br /&gt;
Set tempo. If the parameter is '''less than 33''', the effect is '''ignored'''.&lt;br /&gt;
&lt;br /&gt;
===Uxy (*)===&lt;br /&gt;
Fine vibrato. This effect '''shares memory''' with '''Hxy'''.&lt;br /&gt;
&lt;br /&gt;
===Vxx===&lt;br /&gt;
Set global volume. This effect has several quirks:&lt;br /&gt;
&lt;br /&gt;
*Normally, it does not affect events on the same row, where the effect is set. However, '''there are some exceptions to that rule''', read below for details.&lt;br /&gt;
*It does not affect past notes, that are still playing, unless '''their volume is changed''', which '''applies the new global volume to that voice''' as well.&lt;br /&gt;
*This effect '''is actually processed on tick 1 (that is the second tick)''' of the row. This has several consequences:&lt;br /&gt;
**The effect '''doesn't do anything''', if '''the current speed is 1'''.&lt;br /&gt;
**The effect '''is applied to notes on the current row, that have a note delay effect''' (SDx with x &amp;gt;= 1). For notes on the same row '''that have a note delay of 1 tick''', the effect is only applied to '''channels, that are processed after''' the channel with the set global volume effect. For notes on the same row that have a '''note delay of 2 ticks or more''', the effect is applied '''regardless of the relative position of the channel''' in the processing order. ''TODO: Document the processing order, since it isn't very obvious (I think it's L1, L2, ..., L8, R1, R2, ..., R8, but I'm not 100% sure).''&lt;br /&gt;
**The effect '''is also applied''' on the same row if anything updates the note volume '''on tick 1''' or '''tick 2''' (depends on processing order), like the '''Dxx effect''' (when doing a non-fine slide, of course).&lt;br /&gt;
*Vxx with parameter '''values higher than 0x40''' are '''ignored'''.&lt;br /&gt;
&lt;br /&gt;
[[Category: Music Pattern Formats]]&lt;/div&gt;</summary>
		<author><name>GreaseMonkey</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Scream_Tracker_3_Module&amp;diff=13382</id>
		<title>Scream Tracker 3 Module</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Scream_Tracker_3_Module&amp;diff=13382"/>
		<updated>2011-03-29T00:39:46Z</updated>

		<summary type="html">&lt;p&gt;GreaseMonkey: /* Playback Notes */ documentation typo -- fixing base clock frequency&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* Extension: s3m&lt;br /&gt;
A normally 16-channel module format for MS-DOS on the PC, it can also support OPL2 FM synthesis (9 melodic channels). While the format itself can technically support 32 channels, only the 25 mentioned have any meaning assigned to them, and they are usually not all used at the same time.&lt;br /&gt;
&lt;br /&gt;
Aspects which are easy to get wrong with this format are in '''bold text'''.&lt;br /&gt;
&lt;br /&gt;
Unless otherwise specified, this information pertains to Scream Tracker v3.21's play routine.&lt;br /&gt;
&lt;br /&gt;
==File Format==&lt;br /&gt;
&lt;br /&gt;
The format is little-endian (least significant byte first). A &amp;quot;byte&amp;quot; is 8 bits, a &amp;quot;word&amp;quot; is 16 bits, and a &amp;quot;dword&amp;quot; (double word) is 32 bits. Hex values will be denoted with &amp;quot;0x&amp;quot;. A parapointer points to pp*16 in the file due to the DOS nature of the format.&lt;br /&gt;
&lt;br /&gt;
Note that if some parts of the format are inconsistent, it's usually best to let it slip, as ST3 itself will allegedly for instance load instruments which don't have the &amp;quot;SCRS&amp;quot; / &amp;quot;SCRI&amp;quot; mark.&lt;br /&gt;
&lt;br /&gt;
*28 bytes: module name, NUL-terminated, NUL-padded.&lt;br /&gt;
*Byte: 0x1A.&lt;br /&gt;
*Byte: 16 (0x10) to indicate this is a Scream Tracker 3 module.&lt;br /&gt;
*2 reserved bytes, should be set to 0x00.&lt;br /&gt;
*6 words, denoting the following:&lt;br /&gt;
**Order count&lt;br /&gt;
**Instrument count&lt;br /&gt;
**Pattern count&lt;br /&gt;
**Flags&lt;br /&gt;
***Bit 0 (pre-3.01 ONLY): ST2 vibrato ''(effect unknown)''.&lt;br /&gt;
***Bit 1 (pre-3.01 ONLY): ST2 tempo ''(effect unknown)''.&lt;br /&gt;
***Bit 3 (pre-3.01 ONLY): Amiga slides ''(effect unknown)''.&lt;br /&gt;
***Bit 4: 0-vol optimisations - turn off looping notes which have a zero volume for more than(?) 2 rows.&lt;br /&gt;
***Bit 5: Amiga limits (limit periods to confine to 113 &amp;lt;= x &amp;lt;= 856).&lt;br /&gt;
***Bit 6 (pre-3.01 ONLY): Enable filter / sfx with SB ''(effect unknown)''.&lt;br /&gt;
***Bit 7: ST3.00 volume slides ('''automatically enabled if tracker version is &amp;lt;= 0x1300''') - if enabled, ''all'' volume slides occur ''every'' tick.&lt;br /&gt;
***Bit 8: Special custom data in file (uses &amp;quot;Special&amp;quot; field)&lt;br /&gt;
*Tracker version&lt;br /&gt;
**0x1xyy == Scream Tracker x.yy&lt;br /&gt;
**0x2xyy == Imago Orpheus x.yy&lt;br /&gt;
**0x3xyy == Impulse Tracker x.yy&lt;br /&gt;
**0x4xyy == Schism Tracker (version numbering scheme is different)&lt;br /&gt;
**0x5xyy == OpenMPT&lt;br /&gt;
*File format information&lt;br /&gt;
**1 == signed samples (horribly, horribly old)&lt;br /&gt;
**2 == unsigned samples&lt;br /&gt;
**Anything else is invalid and ST3 will not load the file(?).&lt;br /&gt;
*4 byte string: &amp;quot;SCRM&amp;quot;&lt;br /&gt;
*6 bytes, denoting the following:&lt;br /&gt;
**Global volume (range 0 &amp;lt;= x &amp;lt;= 64) which is used in calculating individual channel volumes '''and is nasty.'''&lt;br /&gt;
**Initial speed (ticks per row / TPR) - '''if 0 ''or 255'', it is ignored''' and 6 is used instead. The value of 255 is very unusual as AFF (set speed to 0xFF == 255) still works.&lt;br /&gt;
**Initial tempo - if '''less than 33, it is ignored''' and 125 is used instead.&lt;br /&gt;
**Mixing volume (range 16 &amp;lt;= x &amp;lt;= 127) which is only used for Sound Blaster. '''It is multiplied by 11/8 when stereo is on.'''&lt;br /&gt;
**Ultra-click removal which is only used for Gravis Ultrasound. ST3.21's interface only allows inputting of values 8, 12, or 16. Allegedly this is the number of GUS channels to allocate to guarantee that this value / 2 channels will play w/o clicks.&lt;br /&gt;
**Default pan value flag, if equal to 252 then load the default panning values at the end of the header, otherwise don't bother.&lt;br /&gt;
*8 reserved bytes, should be set to 0x00, although some trackers write stuff in here.&lt;br /&gt;
*1 parapointer: &amp;quot;Special&amp;quot;, used to point to &amp;quot;special custom data&amp;quot; which is not used in ST 3.01 or later. ST3.21's TECH.DOC refers to ExtHead which is not mentioned anywhere else. This should be safe to ignore.&lt;br /&gt;
*32 bytes indicating channel settings, as follows:&lt;br /&gt;
**If bit 8 is set, this channel is enabled.&lt;br /&gt;
**The lower 7 bits indicate the channel type:&lt;br /&gt;
***0 &amp;lt;= x &amp;lt;= 7: Left PCM channel 1-8 (Lx)&lt;br /&gt;
***8 &amp;lt;= x &amp;lt;= 15: Right PCM channel 1-8 (Rx)&lt;br /&gt;
***16 &amp;lt;= x &amp;lt;= 24: Adlib/OPL2 #1 melody (Ax)&lt;br /&gt;
***25 &amp;lt;= x &amp;lt;= 29: Adlib/OPL2 #1 drums (A_, where _ can be one of {''(TODO: look this up''}) - ''is this used?''&lt;br /&gt;
***Immediately after Adlib/OPL2 #1, there's some provision for a second OPL2 chip, although this does not appear to be supported / used.&lt;br /&gt;
**'''It is possible to map two pattern channels to the same output channel, which allows for some quirks. This is NOT supported by virtually any player other than ST3 itself.''' pys3m supports it, but is very obscure and quite slow. '''WARNING:''' Despite being less useful than you might expect, there ARE reasons why people would do this!&lt;br /&gt;
*Order list: series of bytes indicating pattern indices.&lt;br /&gt;
*Instrument parapointer list: series of parapointers pointing to instruments.&lt;br /&gt;
*Pattern parapointer list: series of parapointers pointing to patterns.&lt;br /&gt;
*OPTIONAL: Panning list: Entries are as follows:&lt;br /&gt;
**Bits 6 and 7 are reserved.&lt;br /&gt;
**Bit 5(?): If set, use the value specified, otherwise use default (7 for mono, 3(L) / C(R) for stereo).&lt;br /&gt;
**Bits 0-3: Specified panning value if default not used.&lt;br /&gt;
&lt;br /&gt;
''TODO: ST3.21's TECH.DOC should cover instruments.''&lt;br /&gt;
&lt;br /&gt;
==Playback Notes==&lt;br /&gt;
&lt;br /&gt;
Note w/o sample results in retriggering the note without resetting the volume.&lt;br /&gt;
&lt;br /&gt;
Sample w/o note results in resetting the volume and ''switching samples'' w/o retriggering the note. If the C4 speeds differ, this could potentially be out of tune as it does not convert the internal period values. If the note is off, it will stay off - it will not retrigger.&lt;br /&gt;
&lt;br /&gt;
Vibrato and tremolo have a full cycle length of 256, though Hxy and Rxy use x*4 and y*4 as their parameters.&lt;br /&gt;
&lt;br /&gt;
Base clock is '''14317456 Hz''' (documentation '''incorrectly says''' 14317056 Hz, correct value is the expected 8363*1712). When calculating a note's period, use the following table:&lt;br /&gt;
&lt;br /&gt;
  C    C#   D    D#   E    F    F#   G    G#   A   A#   A&lt;br /&gt;
 1712,1616,1524,1440,1356,1280,1208,1140,1076,1016,960,907&lt;br /&gt;
&lt;br /&gt;
and calculate the period like so:&lt;br /&gt;
&lt;br /&gt;
 period = 8363 * 16 * (note &amp;gt;&amp;gt; octave) / middle_c_frequency_of_instrument&lt;br /&gt;
&lt;br /&gt;
''Theoretically'', both the period and the volume have &amp;quot;stored&amp;quot; values and &amp;quot;active&amp;quot; values.&lt;br /&gt;
&lt;br /&gt;
'''Volumes actually peak at 63''', and not 64. Setting the volume to 64 will actually make it go to 63.&lt;br /&gt;
&lt;br /&gt;
However, on '''adlib channels''', if the default volume is 64, it will use 64. Any further operations on the volume will clip it to within the 0-63 range.&lt;br /&gt;
&lt;br /&gt;
Many effects use the '''latest nonzero effect parameter encountered''', as noted a bit further below.&lt;br /&gt;
&lt;br /&gt;
===Multiple channel mapping quirk===&lt;br /&gt;
'''It is possible to map two pattern channels to one output channel.''' However, it is rather quirky, but usable.&lt;br /&gt;
&lt;br /&gt;
Note that '''only the last pattern channel's effects are used'''.&lt;br /&gt;
&lt;br /&gt;
''TODO: document this quirk in detail.''&lt;br /&gt;
&lt;br /&gt;
==Effects==&lt;br /&gt;
&lt;br /&gt;
''TODO the rest''&lt;br /&gt;
&lt;br /&gt;
Effects marked with a % use '''the latest nonzero effect parameter to show up'''. Effects with a * have their own memory.&lt;br /&gt;
&lt;br /&gt;
===Axx===&lt;br /&gt;
Set speed. If the parameter '''is 0''', the effect is '''ignored'''.&lt;br /&gt;
&lt;br /&gt;
===Bxx===&lt;br /&gt;
Order jump.&lt;br /&gt;
&lt;br /&gt;
===Cxy===&lt;br /&gt;
Jump to row x*10 + y. The value provided is in '''decimal'''. If the row number specified '''is 64 or higher, the effect is ignored'''.&lt;br /&gt;
&lt;br /&gt;
===Dxy (%)===&lt;br /&gt;
Volume slide. If one of the values are 0, then we slide on all nonzero ticks. If one of the values are F, then we slide on all zero ticks. That means that '''D0F slides down 15 on all ticks and DF0 slides up 15 on all ticks'''.&lt;br /&gt;
&lt;br /&gt;
However, if fast slides are enabled (if they are set as a flag or the version is &amp;lt;= 0x1300), then, unless we're doing a fineslide, we slide on all ticks.&lt;br /&gt;
&lt;br /&gt;
When we do a volume slide, we slide the active volume '''without modifying the stored volume'''.&lt;br /&gt;
&lt;br /&gt;
The checking order is not the same as ImpulseTracker.&lt;br /&gt;
''TODO: Nail the checking order. D13 for instance slides down 3.''&lt;br /&gt;
&lt;br /&gt;
Here's a full detailed description of all possible cases (0x00..0xFF) and how both Scream Tracker and Impulse Tracker handle them:&lt;br /&gt;
*D0x, 1 &amp;lt;= x &amp;lt;= 0xE: slide down by x on all nonzero ticks. Also slide on tick 0, if fast slides are enabled.&lt;br /&gt;
*Dx0, 1 &amp;lt;= x &amp;lt;= 0xE: slide up by x on all nonzero ticks. Also slide on tick 0, if fast slides are enabled.&lt;br /&gt;
*DFx, 1 &amp;lt;= x &amp;lt;= 0xE: slide down by x on tick 0.&lt;br /&gt;
*DxF, 1 &amp;lt;= x &amp;lt;= 0xE: slide up by x on tick 0.&lt;br /&gt;
*DFF: slide up by 15 on tick 0.&lt;br /&gt;
*D0F: slide down by 15 on all ticks. Not affected at all by the fast slides flag.&lt;br /&gt;
*DF0: slide up by 15 on all ticks. Not affected at all by the fast slides flag.&lt;br /&gt;
*Dxy, 1 &amp;lt;= x &amp;lt;= 0xE, 1 &amp;lt;= y &amp;lt;= 0xE: Scream Tracker treats it as a slide down by y, i.e. equivalent to D0y. Impulse Tracker does nothing.&lt;br /&gt;
*D00: Scream Tracker uses the last nonzero effect parameter in the channel. Impulse Tracker uses the last nonzero value used for Dxx, Kxx or Lxx in the channel.&lt;br /&gt;
&lt;br /&gt;
===Exx (%)===&lt;br /&gt;
Slide down.&lt;br /&gt;
&lt;br /&gt;
===Fxx (%)===&lt;br /&gt;
Slide up.&lt;br /&gt;
&lt;br /&gt;
===Gxx (*)===&lt;br /&gt;
Slide to note.&lt;br /&gt;
&lt;br /&gt;
Peculiarities in the Scream Tracker implementation of this effect:&lt;br /&gt;
*If the current note is empty, the destination note is set to the '''last note''' to show up in the channel, '''even if it has occurred without the Gxx effect'''.&lt;br /&gt;
*Gxx '''doesn't clear the target note''' when it is reached, so any future Gxx with no note will keep sliding back to this particular note.&lt;br /&gt;
&lt;br /&gt;
===Hxy (*)===&lt;br /&gt;
Vibrato. This effect '''shares memory''' with '''Uxy'''.&lt;br /&gt;
&lt;br /&gt;
===Ixy (%)===&lt;br /&gt;
Tremor. ''TODO: this effect is weird.''&lt;br /&gt;
&lt;br /&gt;
(Looking through what's released of the ST3 playback source code, tremor is not retriggered if there's a Dxy effect, or something like that, but this needs to be clarified.)&lt;br /&gt;
&lt;br /&gt;
===Jxy (%)===&lt;br /&gt;
Arpeggio. ''TODO: this effect is weird.''&lt;br /&gt;
&lt;br /&gt;
===Kxy (%)===&lt;br /&gt;
H00 + Dxy.&lt;br /&gt;
&lt;br /&gt;
The volume slide, performed by this effect differs from Dxy in the following ways:&lt;br /&gt;
* '''The first tick of this effect is ignored.''' This is due to a no-op in the &amp;quot;first tick&amp;quot; pointer table.&lt;br /&gt;
&lt;br /&gt;
===Lxy (%)===&lt;br /&gt;
G00 + Dxy.&lt;br /&gt;
&lt;br /&gt;
The volume slide '''differs from Dxy'''. See '''Kxy''' for details.&lt;br /&gt;
&lt;br /&gt;
===Oxx (*)===&lt;br /&gt;
Set sample offset.&lt;br /&gt;
&lt;br /&gt;
===Qxy (%)===&lt;br /&gt;
Retrigger note every y ticks with volume modifier x.&lt;br /&gt;
&lt;br /&gt;
Values for x:&lt;br /&gt;
*0: 0&lt;br /&gt;
*1: -1&lt;br /&gt;
*2: -2&lt;br /&gt;
*3: -4&lt;br /&gt;
*4: -8&lt;br /&gt;
*5: -16&lt;br /&gt;
*6: *2/3&lt;br /&gt;
*7: *1/2&lt;br /&gt;
*8: ?&lt;br /&gt;
*9: 1&lt;br /&gt;
*A: 2&lt;br /&gt;
*B: 4&lt;br /&gt;
*C: 8&lt;br /&gt;
*D: 16&lt;br /&gt;
*E: *3/2&lt;br /&gt;
*F: *2&lt;br /&gt;
&lt;br /&gt;
'''6 isn't exactly *2/3.''' It seems to use the following table:&lt;br /&gt;
&lt;br /&gt;
  TwoThirds: array [0..63] of Byte =&lt;br /&gt;
  ( 0,  0,  1,  1,  2,  3,  3,  4,  5,  5,  6,  6,  7,  8,  8,  9,&lt;br /&gt;
   10, 10, 11, 11, 12, 13, 13, 14, 15, 15, 16, 16, 17, 18, 18, 19,&lt;br /&gt;
   20, 20, 21, 21, 22, 23, 23, 24, 25, 25, 26, 26, 27, 28, 28, 29,&lt;br /&gt;
   30, 30, 31, 31, 32, 33, 33, 34, 35, 35, 36, 36, 37, 38, 38, 39);&lt;br /&gt;
&lt;br /&gt;
This effect changes only the active volume, '''without modifying the stored volume.'''&lt;br /&gt;
&lt;br /&gt;
===Rxy (%)===&lt;br /&gt;
Tremolo. x*4 is speed, y*4 is depth. This effect is screwy, but not as screwy as previously documented.&lt;br /&gt;
&lt;br /&gt;
*Get xy from the '''latest nonzero effect parameter''' to appear in the channel.&lt;br /&gt;
*'''On tick 1''' (the '''second''' tick of the row) set the active volume to '''the stored volume plus''' (depth * value) / (max_amplitude * 2) (Rxy peaks at 32 in each direction), and for each '''nonzero''' tick increase the tremolo position by the speed. '''The stored volume is untouched.'''&lt;br /&gt;
*'''If the song speed (not tremolo speed, but song speed - ticks per row) is 1, the active volume is also untouched. It is not set to the stored volume!'''&lt;br /&gt;
*'''Tremolo will not work if the stored volume is 0 (or 64 - adlib only).'''&lt;br /&gt;
&lt;br /&gt;
===Sxy===&lt;br /&gt;
Miscellaneous effects.&lt;br /&gt;
&lt;br /&gt;
''TODO: check what value xy is taken for Sxy''&lt;br /&gt;
&lt;br /&gt;
====S0x====&lt;br /&gt;
Set filter. Not implemented in Scream Tracker 3.&lt;br /&gt;
&lt;br /&gt;
====S1x====&lt;br /&gt;
Set glissando control.&lt;br /&gt;
&lt;br /&gt;
====S2x====&lt;br /&gt;
Set finetune.&lt;br /&gt;
&lt;br /&gt;
====S3x====&lt;br /&gt;
Set vibrato waveform.&lt;br /&gt;
&lt;br /&gt;
====S4x====&lt;br /&gt;
Set tremolo waveform.&lt;br /&gt;
&lt;br /&gt;
====S8x====&lt;br /&gt;
Set panning position. Scream Tracker 3 supports this only on the Gravis Ultrasound.&lt;br /&gt;
&lt;br /&gt;
====SAx====&lt;br /&gt;
Old stereo control? Not implemented in Scream Tracker 3.21?&lt;br /&gt;
&lt;br /&gt;
====SBx====&lt;br /&gt;
Loop pattern.&lt;br /&gt;
&lt;br /&gt;
====SCx====&lt;br /&gt;
Note cut after x ticks.&lt;br /&gt;
&lt;br /&gt;
*If '''the argument is 0''', the effect '''is ignored'''.&lt;br /&gt;
*When the note is cut, the volume is '''not''' set to 0. Instead playback is temporarily '''frozen''' and may be '''resumed by a following Exx, Fxx, Gxx, Hxx, Jxx, Kxx, Lxx or Uxx command'''.&lt;br /&gt;
&lt;br /&gt;
====SDx====&lt;br /&gt;
Note delay for x ticks.&lt;br /&gt;
&lt;br /&gt;
====SEx====&lt;br /&gt;
Pattern delay for x rows.&lt;br /&gt;
&lt;br /&gt;
====SFx====&lt;br /&gt;
FunkRepeat. Not implemented in Scream Tracker 3.&lt;br /&gt;
&lt;br /&gt;
===Txx===&lt;br /&gt;
Set tempo. If the parameter is '''less than 33''', the effect is '''ignored'''.&lt;br /&gt;
&lt;br /&gt;
===Uxy (*)===&lt;br /&gt;
Fine vibrato. This effect '''shares memory''' with '''Hxy'''.&lt;br /&gt;
&lt;br /&gt;
===Vxx===&lt;br /&gt;
Set global volume. This effect has several quirks:&lt;br /&gt;
&lt;br /&gt;
*Normally, it does not affect events on the same row, where the effect is set. However, '''there are some exceptions to that rule''', read below for details.&lt;br /&gt;
*It does not affect past notes, that are still playing, unless '''their volume is changed''', which '''applies the new global volume to that voice''' as well.&lt;br /&gt;
*This effect '''is actually processed on tick 1 (that is the second tick)''' of the row. This has several consequences:&lt;br /&gt;
**The effect '''doesn't do anything''', if '''the current speed is 1'''.&lt;br /&gt;
**The effect '''is applied to notes on the current row, that have a note delay effect''' (SDx with x &amp;gt;= 1). For notes on the same row '''that have a note delay of 1 tick''', the effect is only applied to '''channels, that are processed after''' the channel with the set global volume effect. For notes on the same row that have a '''note delay of 2 ticks or more''', the effect is applied '''regardless of the relative position of the channel''' in the processing order. ''TODO: Document the processing order, since it isn't very obvious (I think it's L1, L2, ..., L8, R1, R2, ..., R8, but I'm not 100% sure).''&lt;br /&gt;
**The effect '''is also applied''' on the same row if anything updates the note volume '''on tick 1''' or '''tick 2''' (depends on processing order), like the '''Dxx effect''' (when doing a non-fine slide, of course).&lt;br /&gt;
*Vxx with parameter '''values higher than 0x40''' is '''ignored'''.&lt;br /&gt;
&lt;br /&gt;
[[Category: Music Pattern Formats]]&lt;/div&gt;</summary>
		<author><name>GreaseMonkey</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Scream_Tracker_3_Module&amp;diff=13381</id>
		<title>Scream Tracker 3 Module</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Scream_Tracker_3_Module&amp;diff=13381"/>
		<updated>2011-03-29T00:38:24Z</updated>

		<summary type="html">&lt;p&gt;GreaseMonkey: /* Kxy (%) */ rewording: &amp;quot;perform once&amp;quot; -&amp;gt; &amp;quot;first tick&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* Extension: s3m&lt;br /&gt;
A normally 16-channel module format for MS-DOS on the PC, it can also support OPL2 FM synthesis (9 melodic channels). While the format itself can technically support 32 channels, only the 25 mentioned have any meaning assigned to them, and they are usually not all used at the same time.&lt;br /&gt;
&lt;br /&gt;
Aspects which are easy to get wrong with this format are in '''bold text'''.&lt;br /&gt;
&lt;br /&gt;
Unless otherwise specified, this information pertains to Scream Tracker v3.21's play routine.&lt;br /&gt;
&lt;br /&gt;
==File Format==&lt;br /&gt;
&lt;br /&gt;
The format is little-endian (least significant byte first). A &amp;quot;byte&amp;quot; is 8 bits, a &amp;quot;word&amp;quot; is 16 bits, and a &amp;quot;dword&amp;quot; (double word) is 32 bits. Hex values will be denoted with &amp;quot;0x&amp;quot;. A parapointer points to pp*16 in the file due to the DOS nature of the format.&lt;br /&gt;
&lt;br /&gt;
Note that if some parts of the format are inconsistent, it's usually best to let it slip, as ST3 itself will allegedly for instance load instruments which don't have the &amp;quot;SCRS&amp;quot; / &amp;quot;SCRI&amp;quot; mark.&lt;br /&gt;
&lt;br /&gt;
*28 bytes: module name, NUL-terminated, NUL-padded.&lt;br /&gt;
*Byte: 0x1A.&lt;br /&gt;
*Byte: 16 (0x10) to indicate this is a Scream Tracker 3 module.&lt;br /&gt;
*2 reserved bytes, should be set to 0x00.&lt;br /&gt;
*6 words, denoting the following:&lt;br /&gt;
**Order count&lt;br /&gt;
**Instrument count&lt;br /&gt;
**Pattern count&lt;br /&gt;
**Flags&lt;br /&gt;
***Bit 0 (pre-3.01 ONLY): ST2 vibrato ''(effect unknown)''.&lt;br /&gt;
***Bit 1 (pre-3.01 ONLY): ST2 tempo ''(effect unknown)''.&lt;br /&gt;
***Bit 3 (pre-3.01 ONLY): Amiga slides ''(effect unknown)''.&lt;br /&gt;
***Bit 4: 0-vol optimisations - turn off looping notes which have a zero volume for more than(?) 2 rows.&lt;br /&gt;
***Bit 5: Amiga limits (limit periods to confine to 113 &amp;lt;= x &amp;lt;= 856).&lt;br /&gt;
***Bit 6 (pre-3.01 ONLY): Enable filter / sfx with SB ''(effect unknown)''.&lt;br /&gt;
***Bit 7: ST3.00 volume slides ('''automatically enabled if tracker version is &amp;lt;= 0x1300''') - if enabled, ''all'' volume slides occur ''every'' tick.&lt;br /&gt;
***Bit 8: Special custom data in file (uses &amp;quot;Special&amp;quot; field)&lt;br /&gt;
*Tracker version&lt;br /&gt;
**0x1xyy == Scream Tracker x.yy&lt;br /&gt;
**0x2xyy == Imago Orpheus x.yy&lt;br /&gt;
**0x3xyy == Impulse Tracker x.yy&lt;br /&gt;
**0x4xyy == Schism Tracker (version numbering scheme is different)&lt;br /&gt;
**0x5xyy == OpenMPT&lt;br /&gt;
*File format information&lt;br /&gt;
**1 == signed samples (horribly, horribly old)&lt;br /&gt;
**2 == unsigned samples&lt;br /&gt;
**Anything else is invalid and ST3 will not load the file(?).&lt;br /&gt;
*4 byte string: &amp;quot;SCRM&amp;quot;&lt;br /&gt;
*6 bytes, denoting the following:&lt;br /&gt;
**Global volume (range 0 &amp;lt;= x &amp;lt;= 64) which is used in calculating individual channel volumes '''and is nasty.'''&lt;br /&gt;
**Initial speed (ticks per row / TPR) - '''if 0 ''or 255'', it is ignored''' and 6 is used instead. The value of 255 is very unusual as AFF (set speed to 0xFF == 255) still works.&lt;br /&gt;
**Initial tempo - if '''less than 33, it is ignored''' and 125 is used instead.&lt;br /&gt;
**Mixing volume (range 16 &amp;lt;= x &amp;lt;= 127) which is only used for Sound Blaster. '''It is multiplied by 11/8 when stereo is on.'''&lt;br /&gt;
**Ultra-click removal which is only used for Gravis Ultrasound. ST3.21's interface only allows inputting of values 8, 12, or 16. Allegedly this is the number of GUS channels to allocate to guarantee that this value / 2 channels will play w/o clicks.&lt;br /&gt;
**Default pan value flag, if equal to 252 then load the default panning values at the end of the header, otherwise don't bother.&lt;br /&gt;
*8 reserved bytes, should be set to 0x00, although some trackers write stuff in here.&lt;br /&gt;
*1 parapointer: &amp;quot;Special&amp;quot;, used to point to &amp;quot;special custom data&amp;quot; which is not used in ST 3.01 or later. ST3.21's TECH.DOC refers to ExtHead which is not mentioned anywhere else. This should be safe to ignore.&lt;br /&gt;
*32 bytes indicating channel settings, as follows:&lt;br /&gt;
**If bit 8 is set, this channel is enabled.&lt;br /&gt;
**The lower 7 bits indicate the channel type:&lt;br /&gt;
***0 &amp;lt;= x &amp;lt;= 7: Left PCM channel 1-8 (Lx)&lt;br /&gt;
***8 &amp;lt;= x &amp;lt;= 15: Right PCM channel 1-8 (Rx)&lt;br /&gt;
***16 &amp;lt;= x &amp;lt;= 24: Adlib/OPL2 #1 melody (Ax)&lt;br /&gt;
***25 &amp;lt;= x &amp;lt;= 29: Adlib/OPL2 #1 drums (A_, where _ can be one of {''(TODO: look this up''}) - ''is this used?''&lt;br /&gt;
***Immediately after Adlib/OPL2 #1, there's some provision for a second OPL2 chip, although this does not appear to be supported / used.&lt;br /&gt;
**'''It is possible to map two pattern channels to the same output channel, which allows for some quirks. This is NOT supported by virtually any player other than ST3 itself.''' pys3m supports it, but is very obscure and quite slow. '''WARNING:''' Despite being less useful than you might expect, there ARE reasons why people would do this!&lt;br /&gt;
*Order list: series of bytes indicating pattern indices.&lt;br /&gt;
*Instrument parapointer list: series of parapointers pointing to instruments.&lt;br /&gt;
*Pattern parapointer list: series of parapointers pointing to patterns.&lt;br /&gt;
*OPTIONAL: Panning list: Entries are as follows:&lt;br /&gt;
**Bits 6 and 7 are reserved.&lt;br /&gt;
**Bit 5(?): If set, use the value specified, otherwise use default (7 for mono, 3(L) / C(R) for stereo).&lt;br /&gt;
**Bits 0-3: Specified panning value if default not used.&lt;br /&gt;
&lt;br /&gt;
''TODO: ST3.21's TECH.DOC should cover instruments.''&lt;br /&gt;
&lt;br /&gt;
==Playback Notes==&lt;br /&gt;
&lt;br /&gt;
Note w/o sample results in retriggering the note without resetting the volume.&lt;br /&gt;
&lt;br /&gt;
Sample w/o note results in resetting the volume and ''switching samples'' w/o retriggering the note. If the C4 speeds differ, this could potentially be out of tune as it does not convert the internal period values. If the note is off, it will stay off - it will not retrigger.&lt;br /&gt;
&lt;br /&gt;
Vibrato and tremolo have a full cycle length of 256, though Hxy and Rxy use x*4 and y*4 as their parameters.&lt;br /&gt;
&lt;br /&gt;
Base clock is 14317056 Hz. When calculating a note's period, use the following table:&lt;br /&gt;
&lt;br /&gt;
  C    C#   D    D#   E    F    F#   G    G#   A   A#   A&lt;br /&gt;
 1712,1616,1524,1440,1356,1280,1208,1140,1076,1016,960,907&lt;br /&gt;
&lt;br /&gt;
and calculate the period like so:&lt;br /&gt;
&lt;br /&gt;
 period = 8363 * 16 * (note &amp;gt;&amp;gt; octave) / middle_c_frequency_of_instrument&lt;br /&gt;
&lt;br /&gt;
''Theoretically'', both the period and the volume have &amp;quot;stored&amp;quot; values and &amp;quot;active&amp;quot; values.&lt;br /&gt;
&lt;br /&gt;
'''Volumes actually peak at 63''', and not 64. Setting the volume to 64 will actually make it go to 63.&lt;br /&gt;
&lt;br /&gt;
However, on '''adlib channels''', if the default volume is 64, it will use 64. Any further operations on the volume will clip it to within the 0-63 range.&lt;br /&gt;
&lt;br /&gt;
Many effects use the '''latest nonzero effect parameter encountered''', as noted a bit further below.&lt;br /&gt;
&lt;br /&gt;
===Multiple channel mapping quirk===&lt;br /&gt;
'''It is possible to map two pattern channels to one output channel.''' However, it is rather quirky, but usable.&lt;br /&gt;
&lt;br /&gt;
Note that '''only the last pattern channel's effects are used'''.&lt;br /&gt;
&lt;br /&gt;
''TODO: document this quirk in detail.''&lt;br /&gt;
&lt;br /&gt;
==Effects==&lt;br /&gt;
&lt;br /&gt;
''TODO the rest''&lt;br /&gt;
&lt;br /&gt;
Effects marked with a % use '''the latest nonzero effect parameter to show up'''. Effects with a * have their own memory.&lt;br /&gt;
&lt;br /&gt;
===Axx===&lt;br /&gt;
Set speed. If the parameter '''is 0''', the effect is '''ignored'''.&lt;br /&gt;
&lt;br /&gt;
===Bxx===&lt;br /&gt;
Order jump.&lt;br /&gt;
&lt;br /&gt;
===Cxy===&lt;br /&gt;
Jump to row x*10 + y. The value provided is in '''decimal'''. If the row number specified '''is 64 or higher, the effect is ignored'''.&lt;br /&gt;
&lt;br /&gt;
===Dxy (%)===&lt;br /&gt;
Volume slide. If one of the values are 0, then we slide on all nonzero ticks. If one of the values are F, then we slide on all zero ticks. That means that '''D0F slides down 15 on all ticks and DF0 slides up 15 on all ticks'''.&lt;br /&gt;
&lt;br /&gt;
However, if fast slides are enabled (if they are set as a flag or the version is &amp;lt;= 0x1300), then, unless we're doing a fineslide, we slide on all ticks.&lt;br /&gt;
&lt;br /&gt;
When we do a volume slide, we slide the active volume '''without modifying the stored volume'''.&lt;br /&gt;
&lt;br /&gt;
The checking order is not the same as ImpulseTracker.&lt;br /&gt;
''TODO: Nail the checking order. D13 for instance slides down 3.''&lt;br /&gt;
&lt;br /&gt;
Here's a full detailed description of all possible cases (0x00..0xFF) and how both Scream Tracker and Impulse Tracker handle them:&lt;br /&gt;
*D0x, 1 &amp;lt;= x &amp;lt;= 0xE: slide down by x on all nonzero ticks. Also slide on tick 0, if fast slides are enabled.&lt;br /&gt;
*Dx0, 1 &amp;lt;= x &amp;lt;= 0xE: slide up by x on all nonzero ticks. Also slide on tick 0, if fast slides are enabled.&lt;br /&gt;
*DFx, 1 &amp;lt;= x &amp;lt;= 0xE: slide down by x on tick 0.&lt;br /&gt;
*DxF, 1 &amp;lt;= x &amp;lt;= 0xE: slide up by x on tick 0.&lt;br /&gt;
*DFF: slide up by 15 on tick 0.&lt;br /&gt;
*D0F: slide down by 15 on all ticks. Not affected at all by the fast slides flag.&lt;br /&gt;
*DF0: slide up by 15 on all ticks. Not affected at all by the fast slides flag.&lt;br /&gt;
*Dxy, 1 &amp;lt;= x &amp;lt;= 0xE, 1 &amp;lt;= y &amp;lt;= 0xE: Scream Tracker treats it as a slide down by y, i.e. equivalent to D0y. Impulse Tracker does nothing.&lt;br /&gt;
*D00: Scream Tracker uses the last nonzero effect parameter in the channel. Impulse Tracker uses the last nonzero value used for Dxx, Kxx or Lxx in the channel.&lt;br /&gt;
&lt;br /&gt;
===Exx (%)===&lt;br /&gt;
Slide down.&lt;br /&gt;
&lt;br /&gt;
===Fxx (%)===&lt;br /&gt;
Slide up.&lt;br /&gt;
&lt;br /&gt;
===Gxx (*)===&lt;br /&gt;
Slide to note.&lt;br /&gt;
&lt;br /&gt;
Peculiarities in the Scream Tracker implementation of this effect:&lt;br /&gt;
*If the current note is empty, the destination note is set to the '''last note''' to show up in the channel, '''even if it has occurred without the Gxx effect'''.&lt;br /&gt;
*Gxx '''doesn't clear the target note''' when it is reached, so any future Gxx with no note will keep sliding back to this particular note.&lt;br /&gt;
&lt;br /&gt;
===Hxy (*)===&lt;br /&gt;
Vibrato. This effect '''shares memory''' with '''Uxy'''.&lt;br /&gt;
&lt;br /&gt;
===Ixy (%)===&lt;br /&gt;
Tremor. ''TODO: this effect is weird.''&lt;br /&gt;
&lt;br /&gt;
(Looking through what's released of the ST3 playback source code, tremor is not retriggered if there's a Dxy effect, or something like that, but this needs to be clarified.)&lt;br /&gt;
&lt;br /&gt;
===Jxy (%)===&lt;br /&gt;
Arpeggio. ''TODO: this effect is weird.''&lt;br /&gt;
&lt;br /&gt;
===Kxy (%)===&lt;br /&gt;
H00 + Dxy.&lt;br /&gt;
&lt;br /&gt;
The volume slide, performed by this effect differs from Dxy in the following ways:&lt;br /&gt;
* '''The first tick of this effect is ignored.''' This is due to a no-op in the &amp;quot;first tick&amp;quot; pointer table.&lt;br /&gt;
&lt;br /&gt;
===Lxy (%)===&lt;br /&gt;
G00 + Dxy.&lt;br /&gt;
&lt;br /&gt;
The volume slide '''differs from Dxy'''. See '''Kxy''' for details.&lt;br /&gt;
&lt;br /&gt;
===Oxx (*)===&lt;br /&gt;
Set sample offset.&lt;br /&gt;
&lt;br /&gt;
===Qxy (%)===&lt;br /&gt;
Retrigger note every y ticks with volume modifier x.&lt;br /&gt;
&lt;br /&gt;
Values for x:&lt;br /&gt;
*0: 0&lt;br /&gt;
*1: -1&lt;br /&gt;
*2: -2&lt;br /&gt;
*3: -4&lt;br /&gt;
*4: -8&lt;br /&gt;
*5: -16&lt;br /&gt;
*6: *2/3&lt;br /&gt;
*7: *1/2&lt;br /&gt;
*8: ?&lt;br /&gt;
*9: 1&lt;br /&gt;
*A: 2&lt;br /&gt;
*B: 4&lt;br /&gt;
*C: 8&lt;br /&gt;
*D: 16&lt;br /&gt;
*E: *3/2&lt;br /&gt;
*F: *2&lt;br /&gt;
&lt;br /&gt;
'''6 isn't exactly *2/3.''' It seems to use the following table:&lt;br /&gt;
&lt;br /&gt;
  TwoThirds: array [0..63] of Byte =&lt;br /&gt;
  ( 0,  0,  1,  1,  2,  3,  3,  4,  5,  5,  6,  6,  7,  8,  8,  9,&lt;br /&gt;
   10, 10, 11, 11, 12, 13, 13, 14, 15, 15, 16, 16, 17, 18, 18, 19,&lt;br /&gt;
   20, 20, 21, 21, 22, 23, 23, 24, 25, 25, 26, 26, 27, 28, 28, 29,&lt;br /&gt;
   30, 30, 31, 31, 32, 33, 33, 34, 35, 35, 36, 36, 37, 38, 38, 39);&lt;br /&gt;
&lt;br /&gt;
This effect changes only the active volume, '''without modifying the stored volume.'''&lt;br /&gt;
&lt;br /&gt;
===Rxy (%)===&lt;br /&gt;
Tremolo. x*4 is speed, y*4 is depth. This effect is screwy, but not as screwy as previously documented.&lt;br /&gt;
&lt;br /&gt;
*Get xy from the '''latest nonzero effect parameter''' to appear in the channel.&lt;br /&gt;
*'''On tick 1''' (the '''second''' tick of the row) set the active volume to '''the stored volume plus''' (depth * value) / (max_amplitude * 2) (Rxy peaks at 32 in each direction), and for each '''nonzero''' tick increase the tremolo position by the speed. '''The stored volume is untouched.'''&lt;br /&gt;
*'''If the song speed (not tremolo speed, but song speed - ticks per row) is 1, the active volume is also untouched. It is not set to the stored volume!'''&lt;br /&gt;
*'''Tremolo will not work if the stored volume is 0 (or 64 - adlib only).'''&lt;br /&gt;
&lt;br /&gt;
===Sxy===&lt;br /&gt;
Miscellaneous effects.&lt;br /&gt;
&lt;br /&gt;
''TODO: check what value xy is taken for Sxy''&lt;br /&gt;
&lt;br /&gt;
====S0x====&lt;br /&gt;
Set filter. Not implemented in Scream Tracker 3.&lt;br /&gt;
&lt;br /&gt;
====S1x====&lt;br /&gt;
Set glissando control.&lt;br /&gt;
&lt;br /&gt;
====S2x====&lt;br /&gt;
Set finetune.&lt;br /&gt;
&lt;br /&gt;
====S3x====&lt;br /&gt;
Set vibrato waveform.&lt;br /&gt;
&lt;br /&gt;
====S4x====&lt;br /&gt;
Set tremolo waveform.&lt;br /&gt;
&lt;br /&gt;
====S8x====&lt;br /&gt;
Set panning position. Scream Tracker 3 supports this only on the Gravis Ultrasound.&lt;br /&gt;
&lt;br /&gt;
====SAx====&lt;br /&gt;
Old stereo control? Not implemented in Scream Tracker 3.21?&lt;br /&gt;
&lt;br /&gt;
====SBx====&lt;br /&gt;
Loop pattern.&lt;br /&gt;
&lt;br /&gt;
====SCx====&lt;br /&gt;
Note cut after x ticks.&lt;br /&gt;
&lt;br /&gt;
*If '''the argument is 0''', the effect '''is ignored'''.&lt;br /&gt;
*When the note is cut, the volume is '''not''' set to 0. Instead playback is temporarily '''frozen''' and may be '''resumed by a following Exx, Fxx, Gxx, Hxx, Jxx, Kxx, Lxx or Uxx command'''.&lt;br /&gt;
&lt;br /&gt;
====SDx====&lt;br /&gt;
Note delay for x ticks.&lt;br /&gt;
&lt;br /&gt;
====SEx====&lt;br /&gt;
Pattern delay for x rows.&lt;br /&gt;
&lt;br /&gt;
====SFx====&lt;br /&gt;
FunkRepeat. Not implemented in Scream Tracker 3.&lt;br /&gt;
&lt;br /&gt;
===Txx===&lt;br /&gt;
Set tempo. If the parameter is '''less than 33''', the effect is '''ignored'''.&lt;br /&gt;
&lt;br /&gt;
===Uxy (*)===&lt;br /&gt;
Fine vibrato. This effect '''shares memory''' with '''Hxy'''.&lt;br /&gt;
&lt;br /&gt;
===Vxx===&lt;br /&gt;
Set global volume. This effect has several quirks:&lt;br /&gt;
&lt;br /&gt;
*Normally, it does not affect events on the same row, where the effect is set. However, '''there are some exceptions to that rule''', read below for details.&lt;br /&gt;
*It does not affect past notes, that are still playing, unless '''their volume is changed''', which '''applies the new global volume to that voice''' as well.&lt;br /&gt;
*This effect '''is actually processed on tick 1 (that is the second tick)''' of the row. This has several consequences:&lt;br /&gt;
**The effect '''doesn't do anything''', if '''the current speed is 1'''.&lt;br /&gt;
**The effect '''is applied to notes on the current row, that have a note delay effect''' (SDx with x &amp;gt;= 1). For notes on the same row '''that have a note delay of 1 tick''', the effect is only applied to '''channels, that are processed after''' the channel with the set global volume effect. For notes on the same row that have a '''note delay of 2 ticks or more''', the effect is applied '''regardless of the relative position of the channel''' in the processing order. ''TODO: Document the processing order, since it isn't very obvious (I think it's L1, L2, ..., L8, R1, R2, ..., R8, but I'm not 100% sure).''&lt;br /&gt;
**The effect '''is also applied''' on the same row if anything updates the note volume '''on tick 1''' or '''tick 2''' (depends on processing order), like the '''Dxx effect''' (when doing a non-fine slide, of course).&lt;br /&gt;
*Vxx with parameter '''values higher than 0x40''' is '''ignored'''.&lt;br /&gt;
&lt;br /&gt;
[[Category: Music Pattern Formats]]&lt;/div&gt;</summary>
		<author><name>GreaseMonkey</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Scream_Tracker_3_Module&amp;diff=13380</id>
		<title>Scream Tracker 3 Module</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Scream_Tracker_3_Module&amp;diff=13380"/>
		<updated>2011-03-29T00:37:37Z</updated>

		<summary type="html">&lt;p&gt;GreaseMonkey: /* Kxy (%) */ simplifying this. source: partial ST3 source release.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* Extension: s3m&lt;br /&gt;
A normally 16-channel module format for MS-DOS on the PC, it can also support OPL2 FM synthesis (9 melodic channels). While the format itself can technically support 32 channels, only the 25 mentioned have any meaning assigned to them, and they are usually not all used at the same time.&lt;br /&gt;
&lt;br /&gt;
Aspects which are easy to get wrong with this format are in '''bold text'''.&lt;br /&gt;
&lt;br /&gt;
Unless otherwise specified, this information pertains to Scream Tracker v3.21's play routine.&lt;br /&gt;
&lt;br /&gt;
==File Format==&lt;br /&gt;
&lt;br /&gt;
The format is little-endian (least significant byte first). A &amp;quot;byte&amp;quot; is 8 bits, a &amp;quot;word&amp;quot; is 16 bits, and a &amp;quot;dword&amp;quot; (double word) is 32 bits. Hex values will be denoted with &amp;quot;0x&amp;quot;. A parapointer points to pp*16 in the file due to the DOS nature of the format.&lt;br /&gt;
&lt;br /&gt;
Note that if some parts of the format are inconsistent, it's usually best to let it slip, as ST3 itself will allegedly for instance load instruments which don't have the &amp;quot;SCRS&amp;quot; / &amp;quot;SCRI&amp;quot; mark.&lt;br /&gt;
&lt;br /&gt;
*28 bytes: module name, NUL-terminated, NUL-padded.&lt;br /&gt;
*Byte: 0x1A.&lt;br /&gt;
*Byte: 16 (0x10) to indicate this is a Scream Tracker 3 module.&lt;br /&gt;
*2 reserved bytes, should be set to 0x00.&lt;br /&gt;
*6 words, denoting the following:&lt;br /&gt;
**Order count&lt;br /&gt;
**Instrument count&lt;br /&gt;
**Pattern count&lt;br /&gt;
**Flags&lt;br /&gt;
***Bit 0 (pre-3.01 ONLY): ST2 vibrato ''(effect unknown)''.&lt;br /&gt;
***Bit 1 (pre-3.01 ONLY): ST2 tempo ''(effect unknown)''.&lt;br /&gt;
***Bit 3 (pre-3.01 ONLY): Amiga slides ''(effect unknown)''.&lt;br /&gt;
***Bit 4: 0-vol optimisations - turn off looping notes which have a zero volume for more than(?) 2 rows.&lt;br /&gt;
***Bit 5: Amiga limits (limit periods to confine to 113 &amp;lt;= x &amp;lt;= 856).&lt;br /&gt;
***Bit 6 (pre-3.01 ONLY): Enable filter / sfx with SB ''(effect unknown)''.&lt;br /&gt;
***Bit 7: ST3.00 volume slides ('''automatically enabled if tracker version is &amp;lt;= 0x1300''') - if enabled, ''all'' volume slides occur ''every'' tick.&lt;br /&gt;
***Bit 8: Special custom data in file (uses &amp;quot;Special&amp;quot; field)&lt;br /&gt;
*Tracker version&lt;br /&gt;
**0x1xyy == Scream Tracker x.yy&lt;br /&gt;
**0x2xyy == Imago Orpheus x.yy&lt;br /&gt;
**0x3xyy == Impulse Tracker x.yy&lt;br /&gt;
**0x4xyy == Schism Tracker (version numbering scheme is different)&lt;br /&gt;
**0x5xyy == OpenMPT&lt;br /&gt;
*File format information&lt;br /&gt;
**1 == signed samples (horribly, horribly old)&lt;br /&gt;
**2 == unsigned samples&lt;br /&gt;
**Anything else is invalid and ST3 will not load the file(?).&lt;br /&gt;
*4 byte string: &amp;quot;SCRM&amp;quot;&lt;br /&gt;
*6 bytes, denoting the following:&lt;br /&gt;
**Global volume (range 0 &amp;lt;= x &amp;lt;= 64) which is used in calculating individual channel volumes '''and is nasty.'''&lt;br /&gt;
**Initial speed (ticks per row / TPR) - '''if 0 ''or 255'', it is ignored''' and 6 is used instead. The value of 255 is very unusual as AFF (set speed to 0xFF == 255) still works.&lt;br /&gt;
**Initial tempo - if '''less than 33, it is ignored''' and 125 is used instead.&lt;br /&gt;
**Mixing volume (range 16 &amp;lt;= x &amp;lt;= 127) which is only used for Sound Blaster. '''It is multiplied by 11/8 when stereo is on.'''&lt;br /&gt;
**Ultra-click removal which is only used for Gravis Ultrasound. ST3.21's interface only allows inputting of values 8, 12, or 16. Allegedly this is the number of GUS channels to allocate to guarantee that this value / 2 channels will play w/o clicks.&lt;br /&gt;
**Default pan value flag, if equal to 252 then load the default panning values at the end of the header, otherwise don't bother.&lt;br /&gt;
*8 reserved bytes, should be set to 0x00, although some trackers write stuff in here.&lt;br /&gt;
*1 parapointer: &amp;quot;Special&amp;quot;, used to point to &amp;quot;special custom data&amp;quot; which is not used in ST 3.01 or later. ST3.21's TECH.DOC refers to ExtHead which is not mentioned anywhere else. This should be safe to ignore.&lt;br /&gt;
*32 bytes indicating channel settings, as follows:&lt;br /&gt;
**If bit 8 is set, this channel is enabled.&lt;br /&gt;
**The lower 7 bits indicate the channel type:&lt;br /&gt;
***0 &amp;lt;= x &amp;lt;= 7: Left PCM channel 1-8 (Lx)&lt;br /&gt;
***8 &amp;lt;= x &amp;lt;= 15: Right PCM channel 1-8 (Rx)&lt;br /&gt;
***16 &amp;lt;= x &amp;lt;= 24: Adlib/OPL2 #1 melody (Ax)&lt;br /&gt;
***25 &amp;lt;= x &amp;lt;= 29: Adlib/OPL2 #1 drums (A_, where _ can be one of {''(TODO: look this up''}) - ''is this used?''&lt;br /&gt;
***Immediately after Adlib/OPL2 #1, there's some provision for a second OPL2 chip, although this does not appear to be supported / used.&lt;br /&gt;
**'''It is possible to map two pattern channels to the same output channel, which allows for some quirks. This is NOT supported by virtually any player other than ST3 itself.''' pys3m supports it, but is very obscure and quite slow. '''WARNING:''' Despite being less useful than you might expect, there ARE reasons why people would do this!&lt;br /&gt;
*Order list: series of bytes indicating pattern indices.&lt;br /&gt;
*Instrument parapointer list: series of parapointers pointing to instruments.&lt;br /&gt;
*Pattern parapointer list: series of parapointers pointing to patterns.&lt;br /&gt;
*OPTIONAL: Panning list: Entries are as follows:&lt;br /&gt;
**Bits 6 and 7 are reserved.&lt;br /&gt;
**Bit 5(?): If set, use the value specified, otherwise use default (7 for mono, 3(L) / C(R) for stereo).&lt;br /&gt;
**Bits 0-3: Specified panning value if default not used.&lt;br /&gt;
&lt;br /&gt;
''TODO: ST3.21's TECH.DOC should cover instruments.''&lt;br /&gt;
&lt;br /&gt;
==Playback Notes==&lt;br /&gt;
&lt;br /&gt;
Note w/o sample results in retriggering the note without resetting the volume.&lt;br /&gt;
&lt;br /&gt;
Sample w/o note results in resetting the volume and ''switching samples'' w/o retriggering the note. If the C4 speeds differ, this could potentially be out of tune as it does not convert the internal period values. If the note is off, it will stay off - it will not retrigger.&lt;br /&gt;
&lt;br /&gt;
Vibrato and tremolo have a full cycle length of 256, though Hxy and Rxy use x*4 and y*4 as their parameters.&lt;br /&gt;
&lt;br /&gt;
Base clock is 14317056 Hz. When calculating a note's period, use the following table:&lt;br /&gt;
&lt;br /&gt;
  C    C#   D    D#   E    F    F#   G    G#   A   A#   A&lt;br /&gt;
 1712,1616,1524,1440,1356,1280,1208,1140,1076,1016,960,907&lt;br /&gt;
&lt;br /&gt;
and calculate the period like so:&lt;br /&gt;
&lt;br /&gt;
 period = 8363 * 16 * (note &amp;gt;&amp;gt; octave) / middle_c_frequency_of_instrument&lt;br /&gt;
&lt;br /&gt;
''Theoretically'', both the period and the volume have &amp;quot;stored&amp;quot; values and &amp;quot;active&amp;quot; values.&lt;br /&gt;
&lt;br /&gt;
'''Volumes actually peak at 63''', and not 64. Setting the volume to 64 will actually make it go to 63.&lt;br /&gt;
&lt;br /&gt;
However, on '''adlib channels''', if the default volume is 64, it will use 64. Any further operations on the volume will clip it to within the 0-63 range.&lt;br /&gt;
&lt;br /&gt;
Many effects use the '''latest nonzero effect parameter encountered''', as noted a bit further below.&lt;br /&gt;
&lt;br /&gt;
===Multiple channel mapping quirk===&lt;br /&gt;
'''It is possible to map two pattern channels to one output channel.''' However, it is rather quirky, but usable.&lt;br /&gt;
&lt;br /&gt;
Note that '''only the last pattern channel's effects are used'''.&lt;br /&gt;
&lt;br /&gt;
''TODO: document this quirk in detail.''&lt;br /&gt;
&lt;br /&gt;
==Effects==&lt;br /&gt;
&lt;br /&gt;
''TODO the rest''&lt;br /&gt;
&lt;br /&gt;
Effects marked with a % use '''the latest nonzero effect parameter to show up'''. Effects with a * have their own memory.&lt;br /&gt;
&lt;br /&gt;
===Axx===&lt;br /&gt;
Set speed. If the parameter '''is 0''', the effect is '''ignored'''.&lt;br /&gt;
&lt;br /&gt;
===Bxx===&lt;br /&gt;
Order jump.&lt;br /&gt;
&lt;br /&gt;
===Cxy===&lt;br /&gt;
Jump to row x*10 + y. The value provided is in '''decimal'''. If the row number specified '''is 64 or higher, the effect is ignored'''.&lt;br /&gt;
&lt;br /&gt;
===Dxy (%)===&lt;br /&gt;
Volume slide. If one of the values are 0, then we slide on all nonzero ticks. If one of the values are F, then we slide on all zero ticks. That means that '''D0F slides down 15 on all ticks and DF0 slides up 15 on all ticks'''.&lt;br /&gt;
&lt;br /&gt;
However, if fast slides are enabled (if they are set as a flag or the version is &amp;lt;= 0x1300), then, unless we're doing a fineslide, we slide on all ticks.&lt;br /&gt;
&lt;br /&gt;
When we do a volume slide, we slide the active volume '''without modifying the stored volume'''.&lt;br /&gt;
&lt;br /&gt;
The checking order is not the same as ImpulseTracker.&lt;br /&gt;
''TODO: Nail the checking order. D13 for instance slides down 3.''&lt;br /&gt;
&lt;br /&gt;
Here's a full detailed description of all possible cases (0x00..0xFF) and how both Scream Tracker and Impulse Tracker handle them:&lt;br /&gt;
*D0x, 1 &amp;lt;= x &amp;lt;= 0xE: slide down by x on all nonzero ticks. Also slide on tick 0, if fast slides are enabled.&lt;br /&gt;
*Dx0, 1 &amp;lt;= x &amp;lt;= 0xE: slide up by x on all nonzero ticks. Also slide on tick 0, if fast slides are enabled.&lt;br /&gt;
*DFx, 1 &amp;lt;= x &amp;lt;= 0xE: slide down by x on tick 0.&lt;br /&gt;
*DxF, 1 &amp;lt;= x &amp;lt;= 0xE: slide up by x on tick 0.&lt;br /&gt;
*DFF: slide up by 15 on tick 0.&lt;br /&gt;
*D0F: slide down by 15 on all ticks. Not affected at all by the fast slides flag.&lt;br /&gt;
*DF0: slide up by 15 on all ticks. Not affected at all by the fast slides flag.&lt;br /&gt;
*Dxy, 1 &amp;lt;= x &amp;lt;= 0xE, 1 &amp;lt;= y &amp;lt;= 0xE: Scream Tracker treats it as a slide down by y, i.e. equivalent to D0y. Impulse Tracker does nothing.&lt;br /&gt;
*D00: Scream Tracker uses the last nonzero effect parameter in the channel. Impulse Tracker uses the last nonzero value used for Dxx, Kxx or Lxx in the channel.&lt;br /&gt;
&lt;br /&gt;
===Exx (%)===&lt;br /&gt;
Slide down.&lt;br /&gt;
&lt;br /&gt;
===Fxx (%)===&lt;br /&gt;
Slide up.&lt;br /&gt;
&lt;br /&gt;
===Gxx (*)===&lt;br /&gt;
Slide to note.&lt;br /&gt;
&lt;br /&gt;
Peculiarities in the Scream Tracker implementation of this effect:&lt;br /&gt;
*If the current note is empty, the destination note is set to the '''last note''' to show up in the channel, '''even if it has occurred without the Gxx effect'''.&lt;br /&gt;
*Gxx '''doesn't clear the target note''' when it is reached, so any future Gxx with no note will keep sliding back to this particular note.&lt;br /&gt;
&lt;br /&gt;
===Hxy (*)===&lt;br /&gt;
Vibrato. This effect '''shares memory''' with '''Uxy'''.&lt;br /&gt;
&lt;br /&gt;
===Ixy (%)===&lt;br /&gt;
Tremor. ''TODO: this effect is weird.''&lt;br /&gt;
&lt;br /&gt;
(Looking through what's released of the ST3 playback source code, tremor is not retriggered if there's a Dxy effect, or something like that, but this needs to be clarified.)&lt;br /&gt;
&lt;br /&gt;
===Jxy (%)===&lt;br /&gt;
Arpeggio. ''TODO: this effect is weird.''&lt;br /&gt;
&lt;br /&gt;
===Kxy (%)===&lt;br /&gt;
H00 + Dxy.&lt;br /&gt;
&lt;br /&gt;
The volume slide, performed by this effect differs from Dxy in the following ways:&lt;br /&gt;
* '''The first tick of this effect is ignored.''' This is due to a no-op in the &amp;quot;perform once&amp;quot; pointer table.&lt;br /&gt;
&lt;br /&gt;
===Lxy (%)===&lt;br /&gt;
G00 + Dxy.&lt;br /&gt;
&lt;br /&gt;
The volume slide '''differs from Dxy'''. See '''Kxy''' for details.&lt;br /&gt;
&lt;br /&gt;
===Oxx (*)===&lt;br /&gt;
Set sample offset.&lt;br /&gt;
&lt;br /&gt;
===Qxy (%)===&lt;br /&gt;
Retrigger note every y ticks with volume modifier x.&lt;br /&gt;
&lt;br /&gt;
Values for x:&lt;br /&gt;
*0: 0&lt;br /&gt;
*1: -1&lt;br /&gt;
*2: -2&lt;br /&gt;
*3: -4&lt;br /&gt;
*4: -8&lt;br /&gt;
*5: -16&lt;br /&gt;
*6: *2/3&lt;br /&gt;
*7: *1/2&lt;br /&gt;
*8: ?&lt;br /&gt;
*9: 1&lt;br /&gt;
*A: 2&lt;br /&gt;
*B: 4&lt;br /&gt;
*C: 8&lt;br /&gt;
*D: 16&lt;br /&gt;
*E: *3/2&lt;br /&gt;
*F: *2&lt;br /&gt;
&lt;br /&gt;
'''6 isn't exactly *2/3.''' It seems to use the following table:&lt;br /&gt;
&lt;br /&gt;
  TwoThirds: array [0..63] of Byte =&lt;br /&gt;
  ( 0,  0,  1,  1,  2,  3,  3,  4,  5,  5,  6,  6,  7,  8,  8,  9,&lt;br /&gt;
   10, 10, 11, 11, 12, 13, 13, 14, 15, 15, 16, 16, 17, 18, 18, 19,&lt;br /&gt;
   20, 20, 21, 21, 22, 23, 23, 24, 25, 25, 26, 26, 27, 28, 28, 29,&lt;br /&gt;
   30, 30, 31, 31, 32, 33, 33, 34, 35, 35, 36, 36, 37, 38, 38, 39);&lt;br /&gt;
&lt;br /&gt;
This effect changes only the active volume, '''without modifying the stored volume.'''&lt;br /&gt;
&lt;br /&gt;
===Rxy (%)===&lt;br /&gt;
Tremolo. x*4 is speed, y*4 is depth. This effect is screwy, but not as screwy as previously documented.&lt;br /&gt;
&lt;br /&gt;
*Get xy from the '''latest nonzero effect parameter''' to appear in the channel.&lt;br /&gt;
*'''On tick 1''' (the '''second''' tick of the row) set the active volume to '''the stored volume plus''' (depth * value) / (max_amplitude * 2) (Rxy peaks at 32 in each direction), and for each '''nonzero''' tick increase the tremolo position by the speed. '''The stored volume is untouched.'''&lt;br /&gt;
*'''If the song speed (not tremolo speed, but song speed - ticks per row) is 1, the active volume is also untouched. It is not set to the stored volume!'''&lt;br /&gt;
*'''Tremolo will not work if the stored volume is 0 (or 64 - adlib only).'''&lt;br /&gt;
&lt;br /&gt;
===Sxy===&lt;br /&gt;
Miscellaneous effects.&lt;br /&gt;
&lt;br /&gt;
''TODO: check what value xy is taken for Sxy''&lt;br /&gt;
&lt;br /&gt;
====S0x====&lt;br /&gt;
Set filter. Not implemented in Scream Tracker 3.&lt;br /&gt;
&lt;br /&gt;
====S1x====&lt;br /&gt;
Set glissando control.&lt;br /&gt;
&lt;br /&gt;
====S2x====&lt;br /&gt;
Set finetune.&lt;br /&gt;
&lt;br /&gt;
====S3x====&lt;br /&gt;
Set vibrato waveform.&lt;br /&gt;
&lt;br /&gt;
====S4x====&lt;br /&gt;
Set tremolo waveform.&lt;br /&gt;
&lt;br /&gt;
====S8x====&lt;br /&gt;
Set panning position. Scream Tracker 3 supports this only on the Gravis Ultrasound.&lt;br /&gt;
&lt;br /&gt;
====SAx====&lt;br /&gt;
Old stereo control? Not implemented in Scream Tracker 3.21?&lt;br /&gt;
&lt;br /&gt;
====SBx====&lt;br /&gt;
Loop pattern.&lt;br /&gt;
&lt;br /&gt;
====SCx====&lt;br /&gt;
Note cut after x ticks.&lt;br /&gt;
&lt;br /&gt;
*If '''the argument is 0''', the effect '''is ignored'''.&lt;br /&gt;
*When the note is cut, the volume is '''not''' set to 0. Instead playback is temporarily '''frozen''' and may be '''resumed by a following Exx, Fxx, Gxx, Hxx, Jxx, Kxx, Lxx or Uxx command'''.&lt;br /&gt;
&lt;br /&gt;
====SDx====&lt;br /&gt;
Note delay for x ticks.&lt;br /&gt;
&lt;br /&gt;
====SEx====&lt;br /&gt;
Pattern delay for x rows.&lt;br /&gt;
&lt;br /&gt;
====SFx====&lt;br /&gt;
FunkRepeat. Not implemented in Scream Tracker 3.&lt;br /&gt;
&lt;br /&gt;
===Txx===&lt;br /&gt;
Set tempo. If the parameter is '''less than 33''', the effect is '''ignored'''.&lt;br /&gt;
&lt;br /&gt;
===Uxy (*)===&lt;br /&gt;
Fine vibrato. This effect '''shares memory''' with '''Hxy'''.&lt;br /&gt;
&lt;br /&gt;
===Vxx===&lt;br /&gt;
Set global volume. This effect has several quirks:&lt;br /&gt;
&lt;br /&gt;
*Normally, it does not affect events on the same row, where the effect is set. However, '''there are some exceptions to that rule''', read below for details.&lt;br /&gt;
*It does not affect past notes, that are still playing, unless '''their volume is changed''', which '''applies the new global volume to that voice''' as well.&lt;br /&gt;
*This effect '''is actually processed on tick 1 (that is the second tick)''' of the row. This has several consequences:&lt;br /&gt;
**The effect '''doesn't do anything''', if '''the current speed is 1'''.&lt;br /&gt;
**The effect '''is applied to notes on the current row, that have a note delay effect''' (SDx with x &amp;gt;= 1). For notes on the same row '''that have a note delay of 1 tick''', the effect is only applied to '''channels, that are processed after''' the channel with the set global volume effect. For notes on the same row that have a '''note delay of 2 ticks or more''', the effect is applied '''regardless of the relative position of the channel''' in the processing order. ''TODO: Document the processing order, since it isn't very obvious (I think it's L1, L2, ..., L8, R1, R2, ..., R8, but I'm not 100% sure).''&lt;br /&gt;
**The effect '''is also applied''' on the same row if anything updates the note volume '''on tick 1''' or '''tick 2''' (depends on processing order), like the '''Dxx effect''' (when doing a non-fine slide, of course).&lt;br /&gt;
*Vxx with parameter '''values higher than 0x40''' is '''ignored'''.&lt;br /&gt;
&lt;br /&gt;
[[Category: Music Pattern Formats]]&lt;/div&gt;</summary>
		<author><name>GreaseMonkey</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Scream_Tracker_3_Module&amp;diff=13147</id>
		<title>Scream Tracker 3 Module</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Scream_Tracker_3_Module&amp;diff=13147"/>
		<updated>2010-12-06T06:07:59Z</updated>

		<summary type="html">&lt;p&gt;GreaseMonkey: ok i found out a bit about the real reason why tremolo is weird&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* Extension: s3m&lt;br /&gt;
A normally 16-channel module format for MS-DOS on the PC, it can also support OPL2 FM synthesis (9 melodic channels + 5 drums). While the format itself can technically support 32 channels, only the 30 mentioned have any meaning assigned to them, and they are usually not all used at the same time.&lt;br /&gt;
&lt;br /&gt;
Aspects which are easy to get wrong with this format are in '''bold text'''.&lt;br /&gt;
&lt;br /&gt;
Unless otherwise specified, this information pertains to Scream Tracker v3.21's play routine.&lt;br /&gt;
&lt;br /&gt;
==File Format==&lt;br /&gt;
&lt;br /&gt;
The format is little-endian (least significant byte first). A &amp;quot;byte&amp;quot; is 8 bits, a &amp;quot;word&amp;quot; is 16 bits, and a &amp;quot;dword&amp;quot; (double word) is 32 bits. Hex values will be denoted with &amp;quot;0x&amp;quot;. A parapointer points to pp*16 in the file due to the DOS nature of the format.&lt;br /&gt;
&lt;br /&gt;
Note that if some parts of the format are inconsistent, it's usually best to let it slip, as ST3 itself will allegedly for instance load instruments which don't have the &amp;quot;SCRS&amp;quot; / &amp;quot;SCRI&amp;quot; mark.&lt;br /&gt;
&lt;br /&gt;
*28 bytes: module name, NUL-terminated, NUL-padded.&lt;br /&gt;
*Byte: 0x1A.&lt;br /&gt;
*Byte: 16 (0x10) to indicate this is a Scream Tracker 3 module.&lt;br /&gt;
*2 reserved bytes, should be set to 0x00.&lt;br /&gt;
*6 words, denoting the following:&lt;br /&gt;
**Order count&lt;br /&gt;
**Instrument count&lt;br /&gt;
**Pattern count&lt;br /&gt;
**Flags&lt;br /&gt;
***Bit 0 (pre-3.01 ONLY): ST2 vibrato ''(effect unknown)''.&lt;br /&gt;
***Bit 1 (pre-3.01 ONLY): ST2 tempo ''(effect unknown)''.&lt;br /&gt;
***Bit 3 (pre-3.01 ONLY): Amiga slides ''(effect unknown)''.&lt;br /&gt;
***Bit 4: 0-vol optimisations - turn off looping notes which have a zero volume for more than(?) 2 rows.&lt;br /&gt;
***Bit 5: Amiga limits (limit periods to confine to 113 &amp;lt;= x &amp;lt;= 856).&lt;br /&gt;
***Bit 6 (pre-3.01 ONLY): Enable filter / sfx with SB ''(effect unknown)''.&lt;br /&gt;
***Bit 7: ST3.00 volume slides ('''automatically enabled if tracker version is &amp;lt;= 0x1300''') - if enabled, ''all'' volume slides occur ''every'' tick.&lt;br /&gt;
***Bit 8: Special custom data in file (uses &amp;quot;Special&amp;quot; field)&lt;br /&gt;
*Tracker version&lt;br /&gt;
**0x1xyy == Scream Tracker x.yy&lt;br /&gt;
**0x2xyy == Imago Orpheus x.yy&lt;br /&gt;
**0x3xyy == Impulse Tracker x.yy&lt;br /&gt;
**0x4xyy == Schism Tracker (version numbering scheme is different)&lt;br /&gt;
**0x5xyy == OpenMPT&lt;br /&gt;
*File format information&lt;br /&gt;
**1 == signed samples (horribly, horribly old)&lt;br /&gt;
**2 == unsigned samples&lt;br /&gt;
**Anything else is invalid and ST3 will not load the file(?).&lt;br /&gt;
*4 byte string: &amp;quot;SCRM&amp;quot;&lt;br /&gt;
*6 bytes, denoting the following:&lt;br /&gt;
**Global volume (range 0 &amp;lt;= x &amp;lt;= 64) which is used in calculating individual channel volumes '''and is nasty.'''&lt;br /&gt;
**Initial speed (ticks per row / TPR) - '''if 0 ''or 255'', it is ignored''' and 6 is used instead. The value of 255 is very unusual as AFF (set speed to 0xFF == 255) still works.&lt;br /&gt;
**Initial tempo - if '''less than 33, it is ignored''' and 125 is used instead.&lt;br /&gt;
**Mixing volume (range 16 &amp;lt;= x &amp;lt;= 127) which is only used for Sound Blaster. '''It is multiplied by 11/8 when stereo is on.'''&lt;br /&gt;
**Ultra-click removal which is only used for Gravis Ultrasound. ST3.21's interface only allows inputting of values 8, 12, or 16. Allegedly this is the number of GUS channels to allocate to guarantee that this value / 2 channels will play w/o clicks.&lt;br /&gt;
**Default pan value flag, if equal to 252 then load the default panning values at the end of the header, otherwise don't bother.&lt;br /&gt;
*8 reserved bytes, should be set to 0x00, although some trackers write stuff in here.&lt;br /&gt;
*1 parapointer: &amp;quot;Special&amp;quot;, used to point to &amp;quot;special custom data&amp;quot; which is not used in ST 3.01 or later. ST3.21's TECH.DOC refers to ExtHead which is not mentioned anywhere else. This should be safe to ignore.&lt;br /&gt;
*32 bytes indicating channel settings, as follows:&lt;br /&gt;
**If bit 8 is set, this channel is enabled.&lt;br /&gt;
**The lower 7 bits indicate the channel type:&lt;br /&gt;
***0 &amp;lt;= x &amp;lt;= 7: Left PCM channel 1-8 (Lx)&lt;br /&gt;
***8 &amp;lt;= x &amp;lt;= 15: Right PCM channel 1-8 (Rx)&lt;br /&gt;
***16 &amp;lt;= x &amp;lt;= 24: Adlib/OPL2 #1 melody (Ax)&lt;br /&gt;
***25 &amp;lt;= x &amp;lt;= 29: Adlib/OPL2 #1 drums (A_, where _ can be one of {''(TODO: look this up''}) - ''is this used?''&lt;br /&gt;
***Immediately after Adlib/OPL2 #1, there's some provision for a second OPL2 chip, although this does not appear to be supported / used.&lt;br /&gt;
**'''It is possible to map two pattern channels to the same output channel, which allows for some quirks. This is NOT supported by virtually any player other than ST3 itself.''' pys3m supports it, but is very obscure and quite slow. '''WARNING:''' Despite being less useful than you might expect, there ARE reasons why people would do this!&lt;br /&gt;
*Order list: series of bytes indicating pattern indices.&lt;br /&gt;
*Instrument parapointer list: series of parapointers pointing to instruments.&lt;br /&gt;
*Pattern parapointer list: series of parapointers pointing to patterns.&lt;br /&gt;
*OPTIONAL: Panning list: Entries are as follows:&lt;br /&gt;
**Bits 6 and 7 are reserved.&lt;br /&gt;
**Bit 5(?): If set, use the value specified, otherwise use default (7 for mono, 3(L) / C(R) for stereo).&lt;br /&gt;
**Bits 0-3: Specified panning value if default not used.&lt;br /&gt;
&lt;br /&gt;
''TODO: ST3.21's TECH.DOC should cover instruments.''&lt;br /&gt;
&lt;br /&gt;
==Playback Notes==&lt;br /&gt;
&lt;br /&gt;
Note w/o sample results in retriggering the note without resetting the volume.&lt;br /&gt;
&lt;br /&gt;
Sample w/o note results in resetting the volume and ''switching samples'' w/o retriggering the note. If the C4 speeds differ, this could potentially be out of tune as it does not convert the internal period values. If the note is off, it will stay off - it will not retrigger.&lt;br /&gt;
&lt;br /&gt;
Vibrato and tremolo have a full cycle length of 256, though Hxy and Rxy use x*4 and y*4 as their parameters.&lt;br /&gt;
&lt;br /&gt;
Base clock is 14317056 Hz. When calculating a note's period, use the following table:&lt;br /&gt;
&lt;br /&gt;
  C    C#   D    D#   E    F    F#   G    G#   A   A#   A&lt;br /&gt;
 1712,1616,1524,1440,1356,1280,1208,1140,1076,1016,960,907&lt;br /&gt;
&lt;br /&gt;
and calculate the period like so:&lt;br /&gt;
&lt;br /&gt;
 period = 8363 * 16 * (note &amp;gt;&amp;gt; octave) / middle_c_frequency_of_instrument&lt;br /&gt;
&lt;br /&gt;
''Theoretically'', both the period and the volume have &amp;quot;stored&amp;quot; values and &amp;quot;active&amp;quot; values.&lt;br /&gt;
&lt;br /&gt;
'''Volumes actually peak at 63''', and not 64. Setting the volume to 64 will actually make it go to 63.&lt;br /&gt;
&lt;br /&gt;
However, on '''adlib channels''', if the default volume is 64, it will use 64. Any further operations on the volume will clip it to within the 0-63 range.&lt;br /&gt;
&lt;br /&gt;
Many effects use the '''latest nonzero effect parameter encountered''', as noted a bit further below.&lt;br /&gt;
&lt;br /&gt;
===Multiple channel mapping quirk===&lt;br /&gt;
'''It is possible to map two pattern channels to one output channel.''' However, it is rather quirky, but usable.&lt;br /&gt;
&lt;br /&gt;
Note that '''only the last pattern channel's effects are used'''.&lt;br /&gt;
&lt;br /&gt;
''TODO: document this quirk in detail.''&lt;br /&gt;
&lt;br /&gt;
==Effects==&lt;br /&gt;
&lt;br /&gt;
''TODO the rest''&lt;br /&gt;
&lt;br /&gt;
Effects marked with a % use '''the latest nonzero effect parameter to show up'''. Effects with a * have their own memory.&lt;br /&gt;
&lt;br /&gt;
===Axx===&lt;br /&gt;
Set speed.&lt;br /&gt;
&lt;br /&gt;
===Bxx===&lt;br /&gt;
Order jump.&lt;br /&gt;
&lt;br /&gt;
===Cxx===&lt;br /&gt;
Row jump.&lt;br /&gt;
&lt;br /&gt;
===Dxy (%)===&lt;br /&gt;
Volume slide. If one of the values are 0, then we slide on all nonzero ticks. If one of the values are F, then we slide on all zero ticks. That means that '''D0F slides down 15 on all ticks and DF0 slides up 15 on all ticks'''.&lt;br /&gt;
&lt;br /&gt;
However, if fast slides are enabled (if they are set as a flag or the version is &amp;lt;= 0x1300), then, unless we're doing a fineslide, we slide on all ticks.&lt;br /&gt;
&lt;br /&gt;
When we do a volume slide, we slide the active volume '''without modifying the stored volume'''.&lt;br /&gt;
&lt;br /&gt;
The checking order is not the same as ImpulseTracker.&lt;br /&gt;
''TODO: Nail the checking order. D13 for instance slides down 3.''&lt;br /&gt;
&lt;br /&gt;
===Exx (%)===&lt;br /&gt;
Slide down.&lt;br /&gt;
&lt;br /&gt;
===Fxx (%)===&lt;br /&gt;
Slide up.&lt;br /&gt;
&lt;br /&gt;
===Gxx (*)===&lt;br /&gt;
Slide to note.&lt;br /&gt;
&lt;br /&gt;
===Hxy (*)===&lt;br /&gt;
Vibrato.&lt;br /&gt;
&lt;br /&gt;
===Ixy (?)===&lt;br /&gt;
Tremor. ''TODO: this effect is weird.''&lt;br /&gt;
&lt;br /&gt;
(Looking through what's released of the ST3 playback source code, tremor is not retriggered if there's a Dxy effect, or something like that, but this needs to be clarified.)&lt;br /&gt;
&lt;br /&gt;
===Jxy (%)===&lt;br /&gt;
Arpeggio. ''TODO: this effect is weird.''&lt;br /&gt;
&lt;br /&gt;
===Kxy (%)===&lt;br /&gt;
H00 + Dxy.&lt;br /&gt;
&lt;br /&gt;
===Lxy (%)===&lt;br /&gt;
G00 + Dxy.&lt;br /&gt;
&lt;br /&gt;
===Oxx (*)===&lt;br /&gt;
Set sample offset.&lt;br /&gt;
&lt;br /&gt;
===Qxy (?)===&lt;br /&gt;
Retrigger note.&lt;br /&gt;
&lt;br /&gt;
===Rxy (%)===&lt;br /&gt;
Tremolo. x*4 is speed, y*4 is depth. This effect is screwy, but not as screwy as previously documented.&lt;br /&gt;
&lt;br /&gt;
*Get xy from the '''latest nonzero effect parameter''' to appear in the channel.&lt;br /&gt;
*Set the active volume to '''the stored volume plus''' (depth * value) / (max_amplitude * 2) (Rxy peaks at 32 in each direction), and for each '''nonzero''' tick increase the tremolo position by the speed. '''The stored volume is untouched.'''&lt;br /&gt;
*'''Tremolo will not work if the stored volume is 0 (or 64 - adlib only).'''&lt;br /&gt;
&lt;br /&gt;
===Sxy===&lt;br /&gt;
Miscellaneous effects.&lt;br /&gt;
&lt;br /&gt;
''TODO: check what value xy is taken for Sxy''&lt;br /&gt;
&lt;br /&gt;
===Txx===&lt;br /&gt;
Set tempo.&lt;br /&gt;
&lt;br /&gt;
===Uxy (%?)===&lt;br /&gt;
Fine vibrato.&lt;br /&gt;
&lt;br /&gt;
===Vxx===&lt;br /&gt;
Global volume. ''TODO: this effect is weird.''&lt;br /&gt;
&lt;br /&gt;
[[Category: Music Pattern Formats]]&lt;/div&gt;</summary>
		<author><name>GreaseMonkey</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Scream_Tracker_3_Module&amp;diff=13049</id>
		<title>Scream Tracker 3 Module</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Scream_Tracker_3_Module&amp;diff=13049"/>
		<updated>2010-10-18T22:40:20Z</updated>

		<summary type="html">&lt;p&gt;GreaseMonkey: /* Dxy */ oops&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* Extension: s3m&lt;br /&gt;
A normally 16-channel module format for MS-DOS on the PC, it can also support OPL2 FM synthesis (9 melodic channels + 5 drums). While the format itself can technically support 32 channels, only the 30 mentioned have any meaning assigned to them, and they are usually not all used at the same time.&lt;br /&gt;
&lt;br /&gt;
Aspects which are easy to get wrong with this format are in '''bold text'''.&lt;br /&gt;
&lt;br /&gt;
Unless otherwise specified, this information pertains to Scream Tracker v3.21's play routine.&lt;br /&gt;
&lt;br /&gt;
==File Format==&lt;br /&gt;
&lt;br /&gt;
The format is little-endian (least significant byte first). A &amp;quot;byte&amp;quot; is 8 bits, a &amp;quot;word&amp;quot; is 16 bits, and a &amp;quot;dword&amp;quot; (double word) is 32 bits. Hex values will be denoted with &amp;quot;0x&amp;quot;. A parapointer points to pp*16 in the file due to the DOS nature of the format.&lt;br /&gt;
&lt;br /&gt;
Note that if some parts of the format are inconsistent, it's usually best to let it slip, as ST3 itself will allegedly for instance load instruments which don't have the &amp;quot;SCRS&amp;quot; / &amp;quot;SCRI&amp;quot; mark.&lt;br /&gt;
&lt;br /&gt;
*28 bytes: module name, NUL-terminated, NUL-padded.&lt;br /&gt;
*Byte: 0x1A.&lt;br /&gt;
*Byte: 16 (0x10) to indicate this is a Scream Tracker 3 module.&lt;br /&gt;
*2 reserved bytes, should be set to 0x00.&lt;br /&gt;
*6 words, denoting the following:&lt;br /&gt;
**Order count&lt;br /&gt;
**Instrument count&lt;br /&gt;
**Pattern count&lt;br /&gt;
**Flags&lt;br /&gt;
***Bit 0 (pre-3.01 ONLY): ST2 vibrato ''(effect unknown)''.&lt;br /&gt;
***Bit 1 (pre-3.01 ONLY): ST2 tempo ''(effect unknown)''.&lt;br /&gt;
***Bit 3 (pre-3.01 ONLY): Amiga slides ''(effect unknown)''.&lt;br /&gt;
***Bit 4: 0-vol optimisations - turn off looping notes which have a zero volume for more than(?) 2 rows.&lt;br /&gt;
***Bit 5: Amiga limits (limit periods to confine to 113 &amp;lt;= x &amp;lt;= 856).&lt;br /&gt;
***Bit 6 (pre-3.01 ONLY): Enable filter / sfx with SB ''(effect unknown)''.&lt;br /&gt;
***Bit 7: ST3.00 volume slides ('''automatically enabled if tracker version is &amp;lt;= 0x1300''') - if enabled, ''all'' volume slides occur ''every'' tick.&lt;br /&gt;
***Bit 8: Special custom data in file (uses &amp;quot;Special&amp;quot; field)&lt;br /&gt;
*Tracker version&lt;br /&gt;
**0x1xyy == Scream Tracker x.yy&lt;br /&gt;
**0x2xyy == Imago Orpheus x.yy&lt;br /&gt;
**0x3xyy == Impulse Tracker x.yy&lt;br /&gt;
**0x4xyy == Schism Tracker (version numbering scheme is different)&lt;br /&gt;
**0x5xyy == OpenMPT&lt;br /&gt;
*File format information&lt;br /&gt;
**1 == signed samples (horribly, horribly old)&lt;br /&gt;
**2 == unsigned samples&lt;br /&gt;
**Anything else is invalid and ST3 will not load the file(?).&lt;br /&gt;
*4 byte string: &amp;quot;SCRM&amp;quot;&lt;br /&gt;
*6 bytes, denoting the following:&lt;br /&gt;
**Global volume (range 0 &amp;lt;= x &amp;lt;= 64) which is used in calculating individual channel volumes '''and is nasty.'''&lt;br /&gt;
**Initial speed (ticks per row / TPR) - '''if 0 ''or 255'', it is ignored''' and 6 is used instead. The value of 255 is very unusual as AFF (set speed to 0xFF == 255) still works.&lt;br /&gt;
**Initial tempo - if '''less than 33, it is ignored''' and 125 is used instead.&lt;br /&gt;
**Mixing volume (range 16 &amp;lt;= x &amp;lt;= 127) which is only used for Sound Blaster. '''It is multiplied by 11/8 when stereo is on.'''&lt;br /&gt;
**Ultra-click removal which is only used for Gravis Ultrasound. ST3.21's interface only allows inputting of values 8, 12, or 16. Allegedly this is the number of GUS channels to allocate to guarantee that this value / 2 channels will play w/o clicks.&lt;br /&gt;
**Default pan value flag, if equal to 252 then load the default panning values at the end of the header, otherwise don't bother.&lt;br /&gt;
*8 reserved bytes, should be set to 0x00, although some trackers write stuff in here.&lt;br /&gt;
*1 parapointer: &amp;quot;Special&amp;quot;, used to point to &amp;quot;special custom data&amp;quot; which is not used in ST 3.01 or later. ST3.21's TECH.DOC refers to ExtHead which is not mentioned anywhere else. This should be safe to ignore.&lt;br /&gt;
*32 bytes indicating channel settings, as follows:&lt;br /&gt;
**If bit 8 is set, this channel is enabled.&lt;br /&gt;
**The lower 7 bits indicate the channel type:&lt;br /&gt;
***0 &amp;lt;= x &amp;lt;= 7: Left PCM channel 1-8 (Lx)&lt;br /&gt;
***8 &amp;lt;= x &amp;lt;= 15: Right PCM channel 1-8 (Rx)&lt;br /&gt;
***16 &amp;lt;= x &amp;lt;= 24: Adlib/OPL2 #1 melody (Ax)&lt;br /&gt;
***25 &amp;lt;= x &amp;lt;= 29: Adlib/OPL2 #1 drums (A_, where _ can be one of {''(TODO: look this up''}) - ''is this used?''&lt;br /&gt;
***Immediately after Adlib/OPL2 #1, there's some provision for a second OPL2 chip, although this does not appear to be supported / used.&lt;br /&gt;
**'''It is possible to map two pattern channels to the same output channel, which allows for some quirks. This is NOT supported by virtually any player other than ST3 itself.''' pys3m supports it, but is very obscure and quite slow. '''WARNING:''' Despite being less useful than you might expect, there ARE reasons why people would do this!&lt;br /&gt;
*Order list: series of bytes indicating pattern indices.&lt;br /&gt;
*Instrument parapointer list: series of parapointers pointing to instruments.&lt;br /&gt;
*Pattern parapointer list: series of parapointers pointing to patterns.&lt;br /&gt;
*OPTIONAL: Panning list: Entries are as follows:&lt;br /&gt;
**Bits 6 and 7 are reserved.&lt;br /&gt;
**Bit 5(?): If set, use the value specified, otherwise use default (7 for mono, 3(L) / C(R) for stereo).&lt;br /&gt;
**Bits 0-3: Specified panning value if default not used.&lt;br /&gt;
&lt;br /&gt;
''TODO: ST3.21's TECH.DOC should cover instruments.''&lt;br /&gt;
&lt;br /&gt;
==Playback Notes==&lt;br /&gt;
&lt;br /&gt;
Note w/o sample results in retriggering the note without resetting the volume.&lt;br /&gt;
&lt;br /&gt;
Sample w/o note results in resetting the volume and ''switching samples'' w/o retriggering the note. If the C4 speeds differ, this could potentially be out of tune as it does not convert the internal period values. If the note is off, it will stay off - it will not retrigger.&lt;br /&gt;
&lt;br /&gt;
Vibrato and tremolo have a full cycle length of 256, though Hxy and Rxy use x*4 and y*4 as their parameters.&lt;br /&gt;
&lt;br /&gt;
Base clock is 14317056 Hz. When calculating a note's period, use the following table:&lt;br /&gt;
&lt;br /&gt;
  C    C#   D    D#   E    F    F#   G    G#   A   A#   A&lt;br /&gt;
 1712,1616,1524,1440,1356,1280,1208,1140,1076,1016,960,907&lt;br /&gt;
&lt;br /&gt;
and calculate the period like so:&lt;br /&gt;
&lt;br /&gt;
 period = 8363 * 16 * (note &amp;gt;&amp;gt; octave) / middle_c_frequency_of_instrument&lt;br /&gt;
&lt;br /&gt;
''Theoretically'', both the period and the volume have &amp;quot;stored&amp;quot; values and &amp;quot;active&amp;quot; values.&lt;br /&gt;
&lt;br /&gt;
'''Volumes actually peak at 63''', and not 64. Setting the volume to 64 will actually make it go to 63.&lt;br /&gt;
&lt;br /&gt;
However, on '''adlib channels''', if the default volume is 64, it will use 64. Any further operations on the volume will clip it to within the 0-63 range.&lt;br /&gt;
&lt;br /&gt;
When a '''note''' is selected, the tremolo '''position''' is retriggered if tremolo retriggering is enabled..&lt;br /&gt;
&lt;br /&gt;
===Multiple channel mapping quirk===&lt;br /&gt;
'''It is possible to map two pattern channels to one output channel.''' However, it is rather quirky, but usable.&lt;br /&gt;
&lt;br /&gt;
Note that '''only the last pattern channel's effects are used'''.&lt;br /&gt;
&lt;br /&gt;
''TODO: document this quirk in detail.''&lt;br /&gt;
&lt;br /&gt;
==Effects==&lt;br /&gt;
&lt;br /&gt;
''TODO the rest''&lt;br /&gt;
&lt;br /&gt;
===Dxy===&lt;br /&gt;
Volume slide. If one of the values are 0, then we slide on all nonzero ticks. If one of the values are F, then we slide on all zero ticks. That means that '''D0F slides down 15 on all ticks and DF0 slides up 15 on all ticks'''.&lt;br /&gt;
&lt;br /&gt;
However, if fast slides are enabled (if they are set as a flag or the version is &amp;lt;= 0x1300), then, unless we're doing a fineslide, we slide on all ticks.&lt;br /&gt;
&lt;br /&gt;
When we do a volume slide, we slide the active volume '''without modifying the stored volume''', and we '''retrigger tremolo for that channel'''.&lt;br /&gt;
&lt;br /&gt;
The checking order is as follows:&lt;br /&gt;
* Dx0 (slide up)&lt;br /&gt;
* D0x (slide down)&lt;br /&gt;
* DxF (fine slide up)&lt;br /&gt;
* DFx (fine slide down)&lt;br /&gt;
&lt;br /&gt;
So DFF slides the volume '''up 15 notches each nonzero tick'''.&lt;br /&gt;
&lt;br /&gt;
===Rxy===&lt;br /&gt;
Tremolo. x*4 is speed, y*4 is depth. This is possibly the screwiest effect of the lot. While XMPlay seems to be quite good with IT support these days after Storlek released his abuse tests, it gets several aspects of this S3M effect wrong.&lt;br /&gt;
&lt;br /&gt;
*If xy is nonzero, load up the speed and the depth into this channel's tremolo speed &amp;amp; depth values.&lt;br /&gt;
*Set the active volume to '''the stored volume plus''' (depth * value) / (max_amplitude * 2) (Rxy peaks at 32 in each direction), and for each '''nonzero''' tick increase the tremolo position by the speed. '''The stored volume is untouched.'''&lt;br /&gt;
*When this effect is retriggered, the depth and position are set to 0 '''while the speed remains unaltered'''.&lt;br /&gt;
*'''Tremolo will not work if the stored volume is 0 (or 64 - adlib only).'''&lt;br /&gt;
&lt;br /&gt;
[[Category: Music Pattern Formats]]&lt;/div&gt;</summary>
		<author><name>GreaseMonkey</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Scream_Tracker_3_Module&amp;diff=13048</id>
		<title>Scream Tracker 3 Module</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Scream_Tracker_3_Module&amp;diff=13048"/>
		<updated>2010-10-18T22:40:03Z</updated>

		<summary type="html">&lt;p&gt;GreaseMonkey: /* Dxy */ correcting a contradiction&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* Extension: s3m&lt;br /&gt;
A normally 16-channel module format for MS-DOS on the PC, it can also support OPL2 FM synthesis (9 melodic channels + 5 drums). While the format itself can technically support 32 channels, only the 30 mentioned have any meaning assigned to them, and they are usually not all used at the same time.&lt;br /&gt;
&lt;br /&gt;
Aspects which are easy to get wrong with this format are in '''bold text'''.&lt;br /&gt;
&lt;br /&gt;
Unless otherwise specified, this information pertains to Scream Tracker v3.21's play routine.&lt;br /&gt;
&lt;br /&gt;
==File Format==&lt;br /&gt;
&lt;br /&gt;
The format is little-endian (least significant byte first). A &amp;quot;byte&amp;quot; is 8 bits, a &amp;quot;word&amp;quot; is 16 bits, and a &amp;quot;dword&amp;quot; (double word) is 32 bits. Hex values will be denoted with &amp;quot;0x&amp;quot;. A parapointer points to pp*16 in the file due to the DOS nature of the format.&lt;br /&gt;
&lt;br /&gt;
Note that if some parts of the format are inconsistent, it's usually best to let it slip, as ST3 itself will allegedly for instance load instruments which don't have the &amp;quot;SCRS&amp;quot; / &amp;quot;SCRI&amp;quot; mark.&lt;br /&gt;
&lt;br /&gt;
*28 bytes: module name, NUL-terminated, NUL-padded.&lt;br /&gt;
*Byte: 0x1A.&lt;br /&gt;
*Byte: 16 (0x10) to indicate this is a Scream Tracker 3 module.&lt;br /&gt;
*2 reserved bytes, should be set to 0x00.&lt;br /&gt;
*6 words, denoting the following:&lt;br /&gt;
**Order count&lt;br /&gt;
**Instrument count&lt;br /&gt;
**Pattern count&lt;br /&gt;
**Flags&lt;br /&gt;
***Bit 0 (pre-3.01 ONLY): ST2 vibrato ''(effect unknown)''.&lt;br /&gt;
***Bit 1 (pre-3.01 ONLY): ST2 tempo ''(effect unknown)''.&lt;br /&gt;
***Bit 3 (pre-3.01 ONLY): Amiga slides ''(effect unknown)''.&lt;br /&gt;
***Bit 4: 0-vol optimisations - turn off looping notes which have a zero volume for more than(?) 2 rows.&lt;br /&gt;
***Bit 5: Amiga limits (limit periods to confine to 113 &amp;lt;= x &amp;lt;= 856).&lt;br /&gt;
***Bit 6 (pre-3.01 ONLY): Enable filter / sfx with SB ''(effect unknown)''.&lt;br /&gt;
***Bit 7: ST3.00 volume slides ('''automatically enabled if tracker version is &amp;lt;= 0x1300''') - if enabled, ''all'' volume slides occur ''every'' tick.&lt;br /&gt;
***Bit 8: Special custom data in file (uses &amp;quot;Special&amp;quot; field)&lt;br /&gt;
*Tracker version&lt;br /&gt;
**0x1xyy == Scream Tracker x.yy&lt;br /&gt;
**0x2xyy == Imago Orpheus x.yy&lt;br /&gt;
**0x3xyy == Impulse Tracker x.yy&lt;br /&gt;
**0x4xyy == Schism Tracker (version numbering scheme is different)&lt;br /&gt;
**0x5xyy == OpenMPT&lt;br /&gt;
*File format information&lt;br /&gt;
**1 == signed samples (horribly, horribly old)&lt;br /&gt;
**2 == unsigned samples&lt;br /&gt;
**Anything else is invalid and ST3 will not load the file(?).&lt;br /&gt;
*4 byte string: &amp;quot;SCRM&amp;quot;&lt;br /&gt;
*6 bytes, denoting the following:&lt;br /&gt;
**Global volume (range 0 &amp;lt;= x &amp;lt;= 64) which is used in calculating individual channel volumes '''and is nasty.'''&lt;br /&gt;
**Initial speed (ticks per row / TPR) - '''if 0 ''or 255'', it is ignored''' and 6 is used instead. The value of 255 is very unusual as AFF (set speed to 0xFF == 255) still works.&lt;br /&gt;
**Initial tempo - if '''less than 33, it is ignored''' and 125 is used instead.&lt;br /&gt;
**Mixing volume (range 16 &amp;lt;= x &amp;lt;= 127) which is only used for Sound Blaster. '''It is multiplied by 11/8 when stereo is on.'''&lt;br /&gt;
**Ultra-click removal which is only used for Gravis Ultrasound. ST3.21's interface only allows inputting of values 8, 12, or 16. Allegedly this is the number of GUS channels to allocate to guarantee that this value / 2 channels will play w/o clicks.&lt;br /&gt;
**Default pan value flag, if equal to 252 then load the default panning values at the end of the header, otherwise don't bother.&lt;br /&gt;
*8 reserved bytes, should be set to 0x00, although some trackers write stuff in here.&lt;br /&gt;
*1 parapointer: &amp;quot;Special&amp;quot;, used to point to &amp;quot;special custom data&amp;quot; which is not used in ST 3.01 or later. ST3.21's TECH.DOC refers to ExtHead which is not mentioned anywhere else. This should be safe to ignore.&lt;br /&gt;
*32 bytes indicating channel settings, as follows:&lt;br /&gt;
**If bit 8 is set, this channel is enabled.&lt;br /&gt;
**The lower 7 bits indicate the channel type:&lt;br /&gt;
***0 &amp;lt;= x &amp;lt;= 7: Left PCM channel 1-8 (Lx)&lt;br /&gt;
***8 &amp;lt;= x &amp;lt;= 15: Right PCM channel 1-8 (Rx)&lt;br /&gt;
***16 &amp;lt;= x &amp;lt;= 24: Adlib/OPL2 #1 melody (Ax)&lt;br /&gt;
***25 &amp;lt;= x &amp;lt;= 29: Adlib/OPL2 #1 drums (A_, where _ can be one of {''(TODO: look this up''}) - ''is this used?''&lt;br /&gt;
***Immediately after Adlib/OPL2 #1, there's some provision for a second OPL2 chip, although this does not appear to be supported / used.&lt;br /&gt;
**'''It is possible to map two pattern channels to the same output channel, which allows for some quirks. This is NOT supported by virtually any player other than ST3 itself.''' pys3m supports it, but is very obscure and quite slow. '''WARNING:''' Despite being less useful than you might expect, there ARE reasons why people would do this!&lt;br /&gt;
*Order list: series of bytes indicating pattern indices.&lt;br /&gt;
*Instrument parapointer list: series of parapointers pointing to instruments.&lt;br /&gt;
*Pattern parapointer list: series of parapointers pointing to patterns.&lt;br /&gt;
*OPTIONAL: Panning list: Entries are as follows:&lt;br /&gt;
**Bits 6 and 7 are reserved.&lt;br /&gt;
**Bit 5(?): If set, use the value specified, otherwise use default (7 for mono, 3(L) / C(R) for stereo).&lt;br /&gt;
**Bits 0-3: Specified panning value if default not used.&lt;br /&gt;
&lt;br /&gt;
''TODO: ST3.21's TECH.DOC should cover instruments.''&lt;br /&gt;
&lt;br /&gt;
==Playback Notes==&lt;br /&gt;
&lt;br /&gt;
Note w/o sample results in retriggering the note without resetting the volume.&lt;br /&gt;
&lt;br /&gt;
Sample w/o note results in resetting the volume and ''switching samples'' w/o retriggering the note. If the C4 speeds differ, this could potentially be out of tune as it does not convert the internal period values. If the note is off, it will stay off - it will not retrigger.&lt;br /&gt;
&lt;br /&gt;
Vibrato and tremolo have a full cycle length of 256, though Hxy and Rxy use x*4 and y*4 as their parameters.&lt;br /&gt;
&lt;br /&gt;
Base clock is 14317056 Hz. When calculating a note's period, use the following table:&lt;br /&gt;
&lt;br /&gt;
  C    C#   D    D#   E    F    F#   G    G#   A   A#   A&lt;br /&gt;
 1712,1616,1524,1440,1356,1280,1208,1140,1076,1016,960,907&lt;br /&gt;
&lt;br /&gt;
and calculate the period like so:&lt;br /&gt;
&lt;br /&gt;
 period = 8363 * 16 * (note &amp;gt;&amp;gt; octave) / middle_c_frequency_of_instrument&lt;br /&gt;
&lt;br /&gt;
''Theoretically'', both the period and the volume have &amp;quot;stored&amp;quot; values and &amp;quot;active&amp;quot; values.&lt;br /&gt;
&lt;br /&gt;
'''Volumes actually peak at 63''', and not 64. Setting the volume to 64 will actually make it go to 63.&lt;br /&gt;
&lt;br /&gt;
However, on '''adlib channels''', if the default volume is 64, it will use 64. Any further operations on the volume will clip it to within the 0-63 range.&lt;br /&gt;
&lt;br /&gt;
When a '''note''' is selected, the tremolo '''position''' is retriggered if tremolo retriggering is enabled..&lt;br /&gt;
&lt;br /&gt;
===Multiple channel mapping quirk===&lt;br /&gt;
'''It is possible to map two pattern channels to one output channel.''' However, it is rather quirky, but usable.&lt;br /&gt;
&lt;br /&gt;
Note that '''only the last pattern channel's effects are used'''.&lt;br /&gt;
&lt;br /&gt;
''TODO: document this quirk in detail.''&lt;br /&gt;
&lt;br /&gt;
==Effects==&lt;br /&gt;
&lt;br /&gt;
''TODO the rest''&lt;br /&gt;
&lt;br /&gt;
===Dxy===&lt;br /&gt;
Volume slide. If one of the values are 0, then we slide on all nonzero ticks. If one of the values are F, then we slide on all zero ticks. That means that '''D0F slides down 15 on all ticks and DF0 slides up 15 on all ticks'''.&lt;br /&gt;
&lt;br /&gt;
However, if fast slides are enabled (if they are set as a flag or the version is less than 0x1300), then, unless we're doing a fineslide, we slide on all ticks.&lt;br /&gt;
&lt;br /&gt;
When we do a volume slide, we slide the active volume '''without modifying the stored volume''', and we '''retrigger tremolo for that channel'''.&lt;br /&gt;
&lt;br /&gt;
The checking order is as follows:&lt;br /&gt;
* Dx0 (slide up)&lt;br /&gt;
* D0x (slide down)&lt;br /&gt;
* DxF (fine slide up)&lt;br /&gt;
* DFx (fine slide down)&lt;br /&gt;
&lt;br /&gt;
So DFF slides the volume '''up 15 notches each nonzero tick'''.&lt;br /&gt;
&lt;br /&gt;
===Rxy===&lt;br /&gt;
Tremolo. x*4 is speed, y*4 is depth. This is possibly the screwiest effect of the lot. While XMPlay seems to be quite good with IT support these days after Storlek released his abuse tests, it gets several aspects of this S3M effect wrong.&lt;br /&gt;
&lt;br /&gt;
*If xy is nonzero, load up the speed and the depth into this channel's tremolo speed &amp;amp; depth values.&lt;br /&gt;
*Set the active volume to '''the stored volume plus''' (depth * value) / (max_amplitude * 2) (Rxy peaks at 32 in each direction), and for each '''nonzero''' tick increase the tremolo position by the speed. '''The stored volume is untouched.'''&lt;br /&gt;
*When this effect is retriggered, the depth and position are set to 0 '''while the speed remains unaltered'''.&lt;br /&gt;
*'''Tremolo will not work if the stored volume is 0 (or 64 - adlib only).'''&lt;br /&gt;
&lt;br /&gt;
[[Category: Music Pattern Formats]]&lt;/div&gt;</summary>
		<author><name>GreaseMonkey</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Scream_Tracker_3_Module&amp;diff=13047</id>
		<title>Scream Tracker 3 Module</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Scream_Tracker_3_Module&amp;diff=13047"/>
		<updated>2010-10-18T22:38:22Z</updated>

		<summary type="html">&lt;p&gt;GreaseMonkey: /* File Format */ added some version IDs, thanks to Saga_Musix&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* Extension: s3m&lt;br /&gt;
A normally 16-channel module format for MS-DOS on the PC, it can also support OPL2 FM synthesis (9 melodic channels + 5 drums). While the format itself can technically support 32 channels, only the 30 mentioned have any meaning assigned to them, and they are usually not all used at the same time.&lt;br /&gt;
&lt;br /&gt;
Aspects which are easy to get wrong with this format are in '''bold text'''.&lt;br /&gt;
&lt;br /&gt;
Unless otherwise specified, this information pertains to Scream Tracker v3.21's play routine.&lt;br /&gt;
&lt;br /&gt;
==File Format==&lt;br /&gt;
&lt;br /&gt;
The format is little-endian (least significant byte first). A &amp;quot;byte&amp;quot; is 8 bits, a &amp;quot;word&amp;quot; is 16 bits, and a &amp;quot;dword&amp;quot; (double word) is 32 bits. Hex values will be denoted with &amp;quot;0x&amp;quot;. A parapointer points to pp*16 in the file due to the DOS nature of the format.&lt;br /&gt;
&lt;br /&gt;
Note that if some parts of the format are inconsistent, it's usually best to let it slip, as ST3 itself will allegedly for instance load instruments which don't have the &amp;quot;SCRS&amp;quot; / &amp;quot;SCRI&amp;quot; mark.&lt;br /&gt;
&lt;br /&gt;
*28 bytes: module name, NUL-terminated, NUL-padded.&lt;br /&gt;
*Byte: 0x1A.&lt;br /&gt;
*Byte: 16 (0x10) to indicate this is a Scream Tracker 3 module.&lt;br /&gt;
*2 reserved bytes, should be set to 0x00.&lt;br /&gt;
*6 words, denoting the following:&lt;br /&gt;
**Order count&lt;br /&gt;
**Instrument count&lt;br /&gt;
**Pattern count&lt;br /&gt;
**Flags&lt;br /&gt;
***Bit 0 (pre-3.01 ONLY): ST2 vibrato ''(effect unknown)''.&lt;br /&gt;
***Bit 1 (pre-3.01 ONLY): ST2 tempo ''(effect unknown)''.&lt;br /&gt;
***Bit 3 (pre-3.01 ONLY): Amiga slides ''(effect unknown)''.&lt;br /&gt;
***Bit 4: 0-vol optimisations - turn off looping notes which have a zero volume for more than(?) 2 rows.&lt;br /&gt;
***Bit 5: Amiga limits (limit periods to confine to 113 &amp;lt;= x &amp;lt;= 856).&lt;br /&gt;
***Bit 6 (pre-3.01 ONLY): Enable filter / sfx with SB ''(effect unknown)''.&lt;br /&gt;
***Bit 7: ST3.00 volume slides ('''automatically enabled if tracker version is &amp;lt;= 0x1300''') - if enabled, ''all'' volume slides occur ''every'' tick.&lt;br /&gt;
***Bit 8: Special custom data in file (uses &amp;quot;Special&amp;quot; field)&lt;br /&gt;
*Tracker version&lt;br /&gt;
**0x1xyy == Scream Tracker x.yy&lt;br /&gt;
**0x2xyy == Imago Orpheus x.yy&lt;br /&gt;
**0x3xyy == Impulse Tracker x.yy&lt;br /&gt;
**0x4xyy == Schism Tracker (version numbering scheme is different)&lt;br /&gt;
**0x5xyy == OpenMPT&lt;br /&gt;
*File format information&lt;br /&gt;
**1 == signed samples (horribly, horribly old)&lt;br /&gt;
**2 == unsigned samples&lt;br /&gt;
**Anything else is invalid and ST3 will not load the file(?).&lt;br /&gt;
*4 byte string: &amp;quot;SCRM&amp;quot;&lt;br /&gt;
*6 bytes, denoting the following:&lt;br /&gt;
**Global volume (range 0 &amp;lt;= x &amp;lt;= 64) which is used in calculating individual channel volumes '''and is nasty.'''&lt;br /&gt;
**Initial speed (ticks per row / TPR) - '''if 0 ''or 255'', it is ignored''' and 6 is used instead. The value of 255 is very unusual as AFF (set speed to 0xFF == 255) still works.&lt;br /&gt;
**Initial tempo - if '''less than 33, it is ignored''' and 125 is used instead.&lt;br /&gt;
**Mixing volume (range 16 &amp;lt;= x &amp;lt;= 127) which is only used for Sound Blaster. '''It is multiplied by 11/8 when stereo is on.'''&lt;br /&gt;
**Ultra-click removal which is only used for Gravis Ultrasound. ST3.21's interface only allows inputting of values 8, 12, or 16. Allegedly this is the number of GUS channels to allocate to guarantee that this value / 2 channels will play w/o clicks.&lt;br /&gt;
**Default pan value flag, if equal to 252 then load the default panning values at the end of the header, otherwise don't bother.&lt;br /&gt;
*8 reserved bytes, should be set to 0x00, although some trackers write stuff in here.&lt;br /&gt;
*1 parapointer: &amp;quot;Special&amp;quot;, used to point to &amp;quot;special custom data&amp;quot; which is not used in ST 3.01 or later. ST3.21's TECH.DOC refers to ExtHead which is not mentioned anywhere else. This should be safe to ignore.&lt;br /&gt;
*32 bytes indicating channel settings, as follows:&lt;br /&gt;
**If bit 8 is set, this channel is enabled.&lt;br /&gt;
**The lower 7 bits indicate the channel type:&lt;br /&gt;
***0 &amp;lt;= x &amp;lt;= 7: Left PCM channel 1-8 (Lx)&lt;br /&gt;
***8 &amp;lt;= x &amp;lt;= 15: Right PCM channel 1-8 (Rx)&lt;br /&gt;
***16 &amp;lt;= x &amp;lt;= 24: Adlib/OPL2 #1 melody (Ax)&lt;br /&gt;
***25 &amp;lt;= x &amp;lt;= 29: Adlib/OPL2 #1 drums (A_, where _ can be one of {''(TODO: look this up''}) - ''is this used?''&lt;br /&gt;
***Immediately after Adlib/OPL2 #1, there's some provision for a second OPL2 chip, although this does not appear to be supported / used.&lt;br /&gt;
**'''It is possible to map two pattern channels to the same output channel, which allows for some quirks. This is NOT supported by virtually any player other than ST3 itself.''' pys3m supports it, but is very obscure and quite slow. '''WARNING:''' Despite being less useful than you might expect, there ARE reasons why people would do this!&lt;br /&gt;
*Order list: series of bytes indicating pattern indices.&lt;br /&gt;
*Instrument parapointer list: series of parapointers pointing to instruments.&lt;br /&gt;
*Pattern parapointer list: series of parapointers pointing to patterns.&lt;br /&gt;
*OPTIONAL: Panning list: Entries are as follows:&lt;br /&gt;
**Bits 6 and 7 are reserved.&lt;br /&gt;
**Bit 5(?): If set, use the value specified, otherwise use default (7 for mono, 3(L) / C(R) for stereo).&lt;br /&gt;
**Bits 0-3: Specified panning value if default not used.&lt;br /&gt;
&lt;br /&gt;
''TODO: ST3.21's TECH.DOC should cover instruments.''&lt;br /&gt;
&lt;br /&gt;
==Playback Notes==&lt;br /&gt;
&lt;br /&gt;
Note w/o sample results in retriggering the note without resetting the volume.&lt;br /&gt;
&lt;br /&gt;
Sample w/o note results in resetting the volume and ''switching samples'' w/o retriggering the note. If the C4 speeds differ, this could potentially be out of tune as it does not convert the internal period values. If the note is off, it will stay off - it will not retrigger.&lt;br /&gt;
&lt;br /&gt;
Vibrato and tremolo have a full cycle length of 256, though Hxy and Rxy use x*4 and y*4 as their parameters.&lt;br /&gt;
&lt;br /&gt;
Base clock is 14317056 Hz. When calculating a note's period, use the following table:&lt;br /&gt;
&lt;br /&gt;
  C    C#   D    D#   E    F    F#   G    G#   A   A#   A&lt;br /&gt;
 1712,1616,1524,1440,1356,1280,1208,1140,1076,1016,960,907&lt;br /&gt;
&lt;br /&gt;
and calculate the period like so:&lt;br /&gt;
&lt;br /&gt;
 period = 8363 * 16 * (note &amp;gt;&amp;gt; octave) / middle_c_frequency_of_instrument&lt;br /&gt;
&lt;br /&gt;
''Theoretically'', both the period and the volume have &amp;quot;stored&amp;quot; values and &amp;quot;active&amp;quot; values.&lt;br /&gt;
&lt;br /&gt;
'''Volumes actually peak at 63''', and not 64. Setting the volume to 64 will actually make it go to 63.&lt;br /&gt;
&lt;br /&gt;
However, on '''adlib channels''', if the default volume is 64, it will use 64. Any further operations on the volume will clip it to within the 0-63 range.&lt;br /&gt;
&lt;br /&gt;
When a '''note''' is selected, the tremolo '''position''' is retriggered if tremolo retriggering is enabled..&lt;br /&gt;
&lt;br /&gt;
===Multiple channel mapping quirk===&lt;br /&gt;
'''It is possible to map two pattern channels to one output channel.''' However, it is rather quirky, but usable.&lt;br /&gt;
&lt;br /&gt;
Note that '''only the last pattern channel's effects are used'''.&lt;br /&gt;
&lt;br /&gt;
''TODO: document this quirk in detail.''&lt;br /&gt;
&lt;br /&gt;
==Effects==&lt;br /&gt;
&lt;br /&gt;
''TODO the rest''&lt;br /&gt;
&lt;br /&gt;
===Dxy===&lt;br /&gt;
Volume slide. If one of the values are 0, then we slide on all nonzero ticks. If one of the values are F, then we slide on all zero ticks. That means that '''D0F slides down 15 on all ticks and DF0 slides up 15 on all ticks'''.&lt;br /&gt;
&lt;br /&gt;
However, if fast slides are enabled (if they are set as a flag or the version is less than 0x1320), then, unless we're doing a fineslide, we slide on all ticks.&lt;br /&gt;
&lt;br /&gt;
When we do a volume slide, we slide the active volume '''without modifying the stored volume''', and we '''retrigger tremolo for that channel'''.&lt;br /&gt;
&lt;br /&gt;
The checking order is as follows:&lt;br /&gt;
* Dx0 (slide up)&lt;br /&gt;
* D0x (slide down)&lt;br /&gt;
* DxF (fine slide up)&lt;br /&gt;
* DFx (fine slide down)&lt;br /&gt;
&lt;br /&gt;
So DFF slides the volume '''up 15 notches each nonzero tick'''.&lt;br /&gt;
&lt;br /&gt;
===Rxy===&lt;br /&gt;
Tremolo. x*4 is speed, y*4 is depth. This is possibly the screwiest effect of the lot. While XMPlay seems to be quite good with IT support these days after Storlek released his abuse tests, it gets several aspects of this S3M effect wrong.&lt;br /&gt;
&lt;br /&gt;
*If xy is nonzero, load up the speed and the depth into this channel's tremolo speed &amp;amp; depth values.&lt;br /&gt;
*Set the active volume to '''the stored volume plus''' (depth * value) / (max_amplitude * 2) (Rxy peaks at 32 in each direction), and for each '''nonzero''' tick increase the tremolo position by the speed. '''The stored volume is untouched.'''&lt;br /&gt;
*When this effect is retriggered, the depth and position are set to 0 '''while the speed remains unaltered'''.&lt;br /&gt;
*'''Tremolo will not work if the stored volume is 0 (or 64 - adlib only).'''&lt;br /&gt;
&lt;br /&gt;
[[Category: Music Pattern Formats]]&lt;/div&gt;</summary>
		<author><name>GreaseMonkey</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Scream_Tracker_3_Module&amp;diff=13041</id>
		<title>Scream Tracker 3 Module</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Scream_Tracker_3_Module&amp;diff=13041"/>
		<updated>2010-10-13T02:50:23Z</updated>

		<summary type="html">&lt;p&gt;GreaseMonkey: /* File Format */ oops&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* Extension: s3m&lt;br /&gt;
A normally 16-channel module format for MS-DOS on the PC, it can also support OPL2 FM synthesis (9 melodic channels + 5 drums). While the format itself can technically support 32 channels, only the 30 mentioned have any meaning assigned to them, and they are usually not all used at the same time.&lt;br /&gt;
&lt;br /&gt;
Aspects which are easy to get wrong with this format are in '''bold text'''.&lt;br /&gt;
&lt;br /&gt;
Unless otherwise specified, this information pertains to Scream Tracker v3.21's play routine.&lt;br /&gt;
&lt;br /&gt;
==File Format==&lt;br /&gt;
&lt;br /&gt;
The format is little-endian (least significant byte first). A &amp;quot;byte&amp;quot; is 8 bits, a &amp;quot;word&amp;quot; is 16 bits, and a &amp;quot;dword&amp;quot; (double word) is 32 bits. Hex values will be denoted with &amp;quot;0x&amp;quot;. A parapointer points to pp*16 in the file due to the DOS nature of the format.&lt;br /&gt;
&lt;br /&gt;
Note that if some parts of the format are inconsistent, it's usually best to let it slip, as ST3 itself will allegedly for instance load instruments which don't have the &amp;quot;SCRS&amp;quot; / &amp;quot;SCRI&amp;quot; mark.&lt;br /&gt;
&lt;br /&gt;
*28 bytes: module name, NUL-terminated, NUL-padded.&lt;br /&gt;
*Byte: 0x1A.&lt;br /&gt;
*Byte: 16 (0x10) to indicate this is a Scream Tracker 3 module.&lt;br /&gt;
*2 reserved bytes, should be set to 0x00.&lt;br /&gt;
*6 words, denoting the following:&lt;br /&gt;
**Order count&lt;br /&gt;
**Instrument count&lt;br /&gt;
**Pattern count&lt;br /&gt;
**Flags&lt;br /&gt;
***Bit 0 (pre-3.01 ONLY): ST2 vibrato ''(effect unknown)''.&lt;br /&gt;
***Bit 1 (pre-3.01 ONLY): ST2 tempo ''(effect unknown)''.&lt;br /&gt;
***Bit 3 (pre-3.01 ONLY): Amiga slides ''(effect unknown)''.&lt;br /&gt;
***Bit 4: 0-vol optimisations - turn off looping notes which have a zero volume for more than(?) 2 rows.&lt;br /&gt;
***Bit 5: Amiga limits (limit periods to confine to 113 &amp;lt;= x &amp;lt;= 856).&lt;br /&gt;
***Bit 6 (pre-3.01 ONLY): Enable filter / sfx with SB ''(effect unknown)''.&lt;br /&gt;
***Bit 7: ST3.00 volume slides ('''automatically enabled if tracker version is &amp;lt;= 0x1300''') - if enabled, ''all'' volume slides occur ''every'' tick.&lt;br /&gt;
***Bit 8: Special custom data in file (uses &amp;quot;Special&amp;quot; field)&lt;br /&gt;
*Tracker version&lt;br /&gt;
**0x1xyy == Scream Tracker x.yy&lt;br /&gt;
**''TODO - look for other version numbers''&lt;br /&gt;
*File format information&lt;br /&gt;
**1 == signed samples (horribly, horribly old)&lt;br /&gt;
**2 == unsigned samples&lt;br /&gt;
**Anything else is invalid and ST3 will not load the file(?).&lt;br /&gt;
*4 byte string: &amp;quot;SCRM&amp;quot;&lt;br /&gt;
*6 bytes, denoting the following:&lt;br /&gt;
**Global volume (range 0 &amp;lt;= x &amp;lt;= 64) which is used in calculating individual channel volumes '''and is nasty.'''&lt;br /&gt;
**Initial speed (ticks per row / TPR) - '''if 0 ''or 255'', it is ignored''' and 6 is used instead. The value of 255 is very unusual as AFF (set speed to 0xFF == 255) still works.&lt;br /&gt;
**Initial tempo - if '''less than 33, it is ignored''' and 125 is used instead.&lt;br /&gt;
**Mixing volume (range 16 &amp;lt;= x &amp;lt;= 127) which is only used for Sound Blaster. '''It is multiplied by 11/8 when stereo is on.'''&lt;br /&gt;
**Ultra-click removal which is only used for Gravis Ultrasound. ST3.21's interface only allows inputting of values 8, 12, or 16. Allegedly this is the number of GUS channels to allocate to guarantee that this value / 2 channels will play w/o clicks.&lt;br /&gt;
**Default pan value flag, if equal to 252 then load the default panning values at the end of the header, otherwise don't bother.&lt;br /&gt;
*8 reserved bytes, should be set to 0x00, although some trackers write stuff in here.&lt;br /&gt;
*1 parapointer: &amp;quot;Special&amp;quot;, used to point to &amp;quot;special custom data&amp;quot; which is not used in ST 3.01 or later. ST3.21's TECH.DOC refers to ExtHead which is not mentioned anywhere else. This should be safe to ignore.&lt;br /&gt;
*32 bytes indicating channel settings, as follows:&lt;br /&gt;
**If bit 8 is set, this channel is enabled.&lt;br /&gt;
**The lower 7 bits indicate the channel type:&lt;br /&gt;
***0 &amp;lt;= x &amp;lt;= 7: Left PCM channel 1-8 (Lx)&lt;br /&gt;
***8 &amp;lt;= x &amp;lt;= 15: Right PCM channel 1-8 (Rx)&lt;br /&gt;
***16 &amp;lt;= x &amp;lt;= 24: Adlib/OPL2 #1 melody (Ax)&lt;br /&gt;
***25 &amp;lt;= x &amp;lt;= 29: Adlib/OPL2 #1 drums (A_, where _ can be one of {''(TODO: look this up''}) - ''is this used?''&lt;br /&gt;
***Immediately after Adlib/OPL2 #1, there's some provision for a second OPL2 chip, although this does not appear to be supported / used.&lt;br /&gt;
**'''It is possible to map two pattern channels to the same output channel, which allows for some quirks. This is NOT supported by virtually any player other than ST3 itself.''' pys3m supports it, but is very obscure and quite slow. '''WARNING:''' Despite being less useful than you might expect, there ARE reasons why people would do this!&lt;br /&gt;
*Order list: series of bytes indicating pattern indices.&lt;br /&gt;
*Instrument parapointer list: series of parapointers pointing to instruments.&lt;br /&gt;
*Pattern parapointer list: series of parapointers pointing to patterns.&lt;br /&gt;
*OPTIONAL: Panning list: Entries are as follows:&lt;br /&gt;
**Bits 6 and 7 are reserved.&lt;br /&gt;
**Bit 5(?): If set, use the value specified, otherwise use default (7 for mono, 3(L) / C(R) for stereo).&lt;br /&gt;
**Bits 0-3: Specified panning value if default not used.&lt;br /&gt;
&lt;br /&gt;
''TODO: ST3.21's TECH.DOC should cover instruments.''&lt;br /&gt;
&lt;br /&gt;
==Playback Notes==&lt;br /&gt;
&lt;br /&gt;
Note w/o sample results in retriggering the note without resetting the volume.&lt;br /&gt;
&lt;br /&gt;
Sample w/o note results in resetting the volume and ''switching samples'' w/o retriggering the note. If the C4 speeds differ, this could potentially be out of tune as it does not convert the internal period values. If the note is off, it will stay off - it will not retrigger.&lt;br /&gt;
&lt;br /&gt;
Vibrato and tremolo have a full cycle length of 256, though Hxy and Rxy use x*4 and y*4 as their parameters.&lt;br /&gt;
&lt;br /&gt;
Base clock is 14317056 Hz. When calculating a note's period, use the following table:&lt;br /&gt;
&lt;br /&gt;
  C    C#   D    D#   E    F    F#   G    G#   A   A#   A&lt;br /&gt;
 1712,1616,1524,1440,1356,1280,1208,1140,1076,1016,960,907&lt;br /&gt;
&lt;br /&gt;
and calculate the period like so:&lt;br /&gt;
&lt;br /&gt;
 period = 8363 * 16 * (note &amp;gt;&amp;gt; octave) / middle_c_frequency_of_instrument&lt;br /&gt;
&lt;br /&gt;
''Theoretically'', both the period and the volume have &amp;quot;stored&amp;quot; values and &amp;quot;active&amp;quot; values.&lt;br /&gt;
&lt;br /&gt;
'''Volumes actually peak at 63''', and not 64. Setting the volume to 64 will actually make it go to 63.&lt;br /&gt;
&lt;br /&gt;
However, on '''adlib channels''', if the default volume is 64, it will use 64. Any further operations on the volume will clip it to within the 0-63 range.&lt;br /&gt;
&lt;br /&gt;
When a '''note''' is selected, the tremolo '''position''' is retriggered if tremolo retriggering is enabled..&lt;br /&gt;
&lt;br /&gt;
===Multiple channel mapping quirk===&lt;br /&gt;
'''It is possible to map two pattern channels to one output channel.''' However, it is rather quirky, but usable.&lt;br /&gt;
&lt;br /&gt;
Note that '''only the last pattern channel's effects are used'''.&lt;br /&gt;
&lt;br /&gt;
''TODO: document this quirk in detail.''&lt;br /&gt;
&lt;br /&gt;
==Effects==&lt;br /&gt;
&lt;br /&gt;
''TODO the rest''&lt;br /&gt;
&lt;br /&gt;
===Dxy===&lt;br /&gt;
Volume slide. If one of the values are 0, then we slide on all nonzero ticks. If one of the values are F, then we slide on all zero ticks. That means that '''D0F slides down 15 on all ticks and DF0 slides up 15 on all ticks'''.&lt;br /&gt;
&lt;br /&gt;
However, if fast slides are enabled (if they are set as a flag or the version is less than 0x1320), then, unless we're doing a fineslide, we slide on all ticks.&lt;br /&gt;
&lt;br /&gt;
When we do a volume slide, we slide the active volume '''without modifying the stored volume''', and we '''retrigger tremolo for that channel'''.&lt;br /&gt;
&lt;br /&gt;
The checking order is as follows:&lt;br /&gt;
* Dx0 (slide up)&lt;br /&gt;
* D0x (slide down)&lt;br /&gt;
* DxF (fine slide up)&lt;br /&gt;
* DFx (fine slide down)&lt;br /&gt;
&lt;br /&gt;
So DFF slides the volume '''up 15 notches each nonzero tick'''.&lt;br /&gt;
&lt;br /&gt;
===Rxy===&lt;br /&gt;
Tremolo. x*4 is speed, y*4 is depth. This is possibly the screwiest effect of the lot. While XMPlay seems to be quite good with IT support these days after Storlek released his abuse tests, it gets several aspects of this S3M effect wrong.&lt;br /&gt;
&lt;br /&gt;
*If xy is nonzero, load up the speed and the depth into this channel's tremolo speed &amp;amp; depth values.&lt;br /&gt;
*Set the active volume to '''the stored volume plus''' (depth * value) / (max_amplitude * 2) (Rxy peaks at 32 in each direction), and for each '''nonzero''' tick increase the tremolo position by the speed. '''The stored volume is untouched.'''&lt;br /&gt;
*When this effect is retriggered, the depth and position are set to 0 '''while the speed remains unaltered'''.&lt;br /&gt;
*'''Tremolo will not work if the stored volume is 0 (or 64 - adlib only).'''&lt;br /&gt;
&lt;br /&gt;
[[Category: Music Pattern Formats]]&lt;/div&gt;</summary>
		<author><name>GreaseMonkey</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Scream_Tracker_3_Module&amp;diff=13040</id>
		<title>Scream Tracker 3 Module</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Scream_Tracker_3_Module&amp;diff=13040"/>
		<updated>2010-10-13T02:48:36Z</updated>

		<summary type="html">&lt;p&gt;GreaseMonkey: hey, here's some more&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* Extension: s3m&lt;br /&gt;
A normally 16-channel module format for MS-DOS on the PC, it can also support OPL2 FM synthesis (9 melodic channels + 5 drums). While the format itself can technically support 32 channels, only the 30 mentioned have any meaning assigned to them, and they are usually not all used at the same time.&lt;br /&gt;
&lt;br /&gt;
Aspects which are easy to get wrong with this format are in '''bold text'''.&lt;br /&gt;
&lt;br /&gt;
Unless otherwise specified, this information pertains to Scream Tracker v3.21's play routine.&lt;br /&gt;
&lt;br /&gt;
==File Format==&lt;br /&gt;
&lt;br /&gt;
The format is little-endian (least significant byte first). A &amp;quot;byte&amp;quot; is 8 bits, a &amp;quot;word&amp;quot; is 16 bits, and a &amp;quot;dword&amp;quot; (double word) is 32 bits. Hex values will be denoted with &amp;quot;0x&amp;quot;. A parapointer points to pp*16 in the file due to the DOS nature of the format.&lt;br /&gt;
&lt;br /&gt;
Note that if some parts of the format are inconsistent, it's usually best to let it slip, as ST3 itself will allegedly for instance load instruments which don't have the &amp;quot;SCRS&amp;quot; / &amp;quot;SCRI&amp;quot; mark.&lt;br /&gt;
&lt;br /&gt;
*28 bytes: module name, NUL-terminated, NUL-padded.&lt;br /&gt;
*Byte: 0x1A.&lt;br /&gt;
*Byte: 16 (0x10) to indicate this is a Scream Tracker 3 module.&lt;br /&gt;
*2 reserved bytes, should be set to 0x00.&lt;br /&gt;
*6 words, denoting the following:&lt;br /&gt;
**Order count&lt;br /&gt;
**Instrument count&lt;br /&gt;
**Pattern count&lt;br /&gt;
**Flags&lt;br /&gt;
***Bit 0 (pre-3.01 ONLY): ST2 vibrato ''(effect unknown)''.&lt;br /&gt;
***Bit 1 (pre-3.01 ONLY): ST2 tempo ''(effect unknown)''.&lt;br /&gt;
***Bit 3 (pre-3.01 ONLY): Amiga slides ''(effect unknown)''.&lt;br /&gt;
***Bit 4: 0-vol optimisations - turn off looping notes which have a zero volume for more than(?) 2 rows.&lt;br /&gt;
***Bit 5: Amiga limits (limit periods to confine to 113 &amp;lt;= x &amp;lt;= 856).&lt;br /&gt;
***Bit 6 (pre-3.01 ONLY): Enable filter / sfx with SB ''(effect unknown)''.&lt;br /&gt;
***Bit 7: ST3.00 volume slides ('''automatically enabled if tracker version is &amp;lt;= 0x1300''') - if enabled, bits &lt;br /&gt;
***Bit 8: Special custom data in file (uses &amp;quot;Special&amp;quot; field)&lt;br /&gt;
*Tracker version&lt;br /&gt;
**0x1xyy == Scream Tracker x.yy&lt;br /&gt;
**''TODO - look for other version numbers''&lt;br /&gt;
*File format information&lt;br /&gt;
**1 == signed samples (horribly, horribly old)&lt;br /&gt;
**2 == unsigned samples&lt;br /&gt;
**Anything else is invalid and ST3 will not load the file(?).&lt;br /&gt;
*4 byte string: &amp;quot;SCRM&amp;quot;&lt;br /&gt;
*6 bytes, denoting the following:&lt;br /&gt;
**Global volume (range 0 &amp;lt;= x &amp;lt;= 64) which is used in calculating individual channel volumes '''and is nasty.'''&lt;br /&gt;
**Initial speed (ticks per row / TPR) - '''if 0 ''or 255'', it is ignored''' and 6 is used instead. The value of 255 is very unusual as AFF (set speed to 0xFF == 255) still works.&lt;br /&gt;
**Initial tempo - if '''less than 33, it is ignored''' and 125 is used instead.&lt;br /&gt;
**Mixing volume (range 16 &amp;lt;= x &amp;lt;= 127) which is only used for Sound Blaster. '''It is multiplied by 11/8 when stereo is on.'''&lt;br /&gt;
**Ultra-click removal which is only used for Gravis Ultrasound. ST3.21's interface only allows inputting of values 8, 12, or 16. Allegedly this is the number of GUS channels to allocate to guarantee that this value / 2 channels will play w/o clicks.&lt;br /&gt;
**Default pan value flag, if equal to 252 then load the default panning values at the end of the header, otherwise don't bother.&lt;br /&gt;
*8 reserved bytes, should be set to 0x00, although some trackers write stuff in here.&lt;br /&gt;
*1 parapointer: &amp;quot;Special&amp;quot;, used to point to &amp;quot;special custom data&amp;quot; which is not used in ST 3.01 or later. ST3.21's TECH.DOC refers to ExtHead which is not mentioned anywhere else. This should be safe to ignore.&lt;br /&gt;
*32 bytes indicating channel settings, as follows:&lt;br /&gt;
**If bit 8 is set, this channel is enabled.&lt;br /&gt;
**The lower 7 bits indicate the channel type:&lt;br /&gt;
***0 &amp;lt;= x &amp;lt;= 7: Left PCM channel 1-8 (Lx)&lt;br /&gt;
***8 &amp;lt;= x &amp;lt;= 15: Right PCM channel 1-8 (Rx)&lt;br /&gt;
***16 &amp;lt;= x &amp;lt;= 24: Adlib/OPL2 #1 melody (Ax)&lt;br /&gt;
***25 &amp;lt;= x &amp;lt;= 29: Adlib/OPL2 #1 drums (A_, where _ can be one of {''(TODO: look this up''}) - ''is this used?''&lt;br /&gt;
***Immediately after Adlib/OPL2 #1, there's some provision for a second OPL2 chip, although this does not appear to be supported / used.&lt;br /&gt;
**'''It is possible to map two pattern channels to the same output channel, which allows for some quirks. This is NOT supported by virtually any player other than ST3 itself.''' pys3m supports it, but is very obscure and quite slow. '''WARNING:''' Despite being less useful than you might expect, there ARE reasons why people would do this!&lt;br /&gt;
*Order list: series of bytes indicating pattern indices.&lt;br /&gt;
*Instrument parapointer list: series of parapointers pointing to instruments.&lt;br /&gt;
*Pattern parapointer list: series of parapointers pointing to patterns.&lt;br /&gt;
*OPTIONAL: Panning list: Entries are as follows:&lt;br /&gt;
**Bits 6 and 7 are reserved.&lt;br /&gt;
**Bit 5(?): If set, use the value specified, otherwise use default (7 for mono, 3(L) / C(R) for stereo).&lt;br /&gt;
**Bits 0-3: Specified panning value if default not used.&lt;br /&gt;
&lt;br /&gt;
''TODO: ST3.21's TECH.DOC should cover instruments.''&lt;br /&gt;
&lt;br /&gt;
==Playback Notes==&lt;br /&gt;
&lt;br /&gt;
Note w/o sample results in retriggering the note without resetting the volume.&lt;br /&gt;
&lt;br /&gt;
Sample w/o note results in resetting the volume and ''switching samples'' w/o retriggering the note. If the C4 speeds differ, this could potentially be out of tune as it does not convert the internal period values. If the note is off, it will stay off - it will not retrigger.&lt;br /&gt;
&lt;br /&gt;
Vibrato and tremolo have a full cycle length of 256, though Hxy and Rxy use x*4 and y*4 as their parameters.&lt;br /&gt;
&lt;br /&gt;
Base clock is 14317056 Hz. When calculating a note's period, use the following table:&lt;br /&gt;
&lt;br /&gt;
  C    C#   D    D#   E    F    F#   G    G#   A   A#   A&lt;br /&gt;
 1712,1616,1524,1440,1356,1280,1208,1140,1076,1016,960,907&lt;br /&gt;
&lt;br /&gt;
and calculate the period like so:&lt;br /&gt;
&lt;br /&gt;
 period = 8363 * 16 * (note &amp;gt;&amp;gt; octave) / middle_c_frequency_of_instrument&lt;br /&gt;
&lt;br /&gt;
''Theoretically'', both the period and the volume have &amp;quot;stored&amp;quot; values and &amp;quot;active&amp;quot; values.&lt;br /&gt;
&lt;br /&gt;
'''Volumes actually peak at 63''', and not 64. Setting the volume to 64 will actually make it go to 63.&lt;br /&gt;
&lt;br /&gt;
However, on '''adlib channels''', if the default volume is 64, it will use 64. Any further operations on the volume will clip it to within the 0-63 range.&lt;br /&gt;
&lt;br /&gt;
When a '''note''' is selected, the tremolo '''position''' is retriggered if tremolo retriggering is enabled..&lt;br /&gt;
&lt;br /&gt;
===Multiple channel mapping quirk===&lt;br /&gt;
'''It is possible to map two pattern channels to one output channel.''' However, it is rather quirky, but usable.&lt;br /&gt;
&lt;br /&gt;
Note that '''only the last pattern channel's effects are used'''.&lt;br /&gt;
&lt;br /&gt;
''TODO: document this quirk in detail.''&lt;br /&gt;
&lt;br /&gt;
==Effects==&lt;br /&gt;
&lt;br /&gt;
''TODO the rest''&lt;br /&gt;
&lt;br /&gt;
===Dxy===&lt;br /&gt;
Volume slide. If one of the values are 0, then we slide on all nonzero ticks. If one of the values are F, then we slide on all zero ticks. That means that '''D0F slides down 15 on all ticks and DF0 slides up 15 on all ticks'''.&lt;br /&gt;
&lt;br /&gt;
However, if fast slides are enabled (if they are set as a flag or the version is less than 0x1320), then, unless we're doing a fineslide, we slide on all ticks.&lt;br /&gt;
&lt;br /&gt;
When we do a volume slide, we slide the active volume '''without modifying the stored volume''', and we '''retrigger tremolo for that channel'''.&lt;br /&gt;
&lt;br /&gt;
The checking order is as follows:&lt;br /&gt;
* Dx0 (slide up)&lt;br /&gt;
* D0x (slide down)&lt;br /&gt;
* DxF (fine slide up)&lt;br /&gt;
* DFx (fine slide down)&lt;br /&gt;
&lt;br /&gt;
So DFF slides the volume '''up 15 notches each nonzero tick'''.&lt;br /&gt;
&lt;br /&gt;
===Rxy===&lt;br /&gt;
Tremolo. x*4 is speed, y*4 is depth. This is possibly the screwiest effect of the lot. While XMPlay seems to be quite good with IT support these days after Storlek released his abuse tests, it gets several aspects of this S3M effect wrong.&lt;br /&gt;
&lt;br /&gt;
*If xy is nonzero, load up the speed and the depth into this channel's tremolo speed &amp;amp; depth values.&lt;br /&gt;
*Set the active volume to '''the stored volume plus''' (depth * value) / (max_amplitude * 2) (Rxy peaks at 32 in each direction), and for each '''nonzero''' tick increase the tremolo position by the speed. '''The stored volume is untouched.'''&lt;br /&gt;
*When this effect is retriggered, the depth and position are set to 0 '''while the speed remains unaltered'''.&lt;br /&gt;
*'''Tremolo will not work if the stored volume is 0 (or 64 - adlib only).'''&lt;br /&gt;
&lt;br /&gt;
[[Category: Music Pattern Formats]]&lt;/div&gt;</summary>
		<author><name>GreaseMonkey</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Scream_Tracker_3_Module&amp;diff=13039</id>
		<title>Scream Tracker 3 Module</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Scream_Tracker_3_Module&amp;diff=13039"/>
		<updated>2010-10-13T02:04:34Z</updated>

		<summary type="html">&lt;p&gt;GreaseMonkey: more stuff&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* Extension: s3m&lt;br /&gt;
A normally 16-channel module format for MS-DOS on the PC, it can also support OPL2 FM synthesis (9 melodic channels + 5 drums). While the format itself can technically support 32 channels, only the 30 mentioned have any meaning assigned to them, and they are usually not all used at the same time.&lt;br /&gt;
&lt;br /&gt;
Aspects which are easy to get wrong with this format are in '''bold text'''.&lt;br /&gt;
&lt;br /&gt;
==File Format==&lt;br /&gt;
&lt;br /&gt;
The format is little-endian (least significant byte first). A &amp;quot;byte&amp;quot; is 8 bits, and a &amp;quot;word&amp;quot; is 16 bits. Hex values will be denoted with &amp;quot;0x&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Note that if some parts of the format are inconsistent, it's usually best to let it slip, as ST3 itself will allegedly for instance load instruments which don't have the &amp;quot;SCRS&amp;quot; / &amp;quot;SCRI&amp;quot; mark.&lt;br /&gt;
&lt;br /&gt;
*28 bytes: module name, NUL-terminated, NUL-padded.&lt;br /&gt;
*Byte: 0x1A.&lt;br /&gt;
*Byte: 16 (0x10) to indicate this is a Scream Tracker 3 module.&lt;br /&gt;
*2 reserved bytes, should be 0x00.&lt;br /&gt;
*6 words, denoting the following:&lt;br /&gt;
**Order count&lt;br /&gt;
**Instrument count&lt;br /&gt;
**Pattern count&lt;br /&gt;
**Flags&lt;br /&gt;
***bit 0 (pre-3.01 ONLY): ST2 vibrato ''(effect unknown)''.&lt;br /&gt;
***bit 1 (pre-3.01 ONLY): ST2 tempo ''(effect unknown)''.&lt;br /&gt;
***bit 3 (pre-3.01 ONLY): Amiga slides ''(effect unknown)''.&lt;br /&gt;
***bit 4: 0-vol optimisations - turn off looping notes which have a zero volume for more than(?) 2 rows.&lt;br /&gt;
***bit 5: Amiga limits (limit periods to confine to 113 &amp;lt;= x &amp;lt;= 856).&lt;br /&gt;
***bit 6 (pre-3.01 ONLY): Enable filter / sfx with SB ''(effect unknown)''.&lt;br /&gt;
***bit 7: ST3.00 volume slides ('''automatically enabled if tracker version is &amp;lt;= 0x1300''') - if enabled, bits &lt;br /&gt;
***bit 8: Special custom data in file (uses &amp;quot;Special&amp;quot; field)&lt;br /&gt;
**Tracker version&lt;br /&gt;
***0x1xyy == Scream Tracker x.yy&lt;br /&gt;
***''TODO - look for other version numbers''&lt;br /&gt;
**File format information&lt;br /&gt;
***1 == signed samples (horribly, horribly old)&lt;br /&gt;
***2 == unsigned samples&lt;br /&gt;
***Anything else is invalid and ST3 will not load the file(?).&lt;br /&gt;
**4 byte string: &amp;quot;SCRM&amp;quot;&lt;br /&gt;
**6 bytes, denoting the following:&lt;br /&gt;
***Global volume (range 0 &amp;lt;= x &amp;lt;= 64) which is used in calculating individual channel volumes '''and is nasty.'''&lt;br /&gt;
***Initial speed&lt;br /&gt;
***Initial tempo&lt;br /&gt;
***Mixing volume&lt;br /&gt;
***Ultra-click removal&lt;br /&gt;
***Default pan value thing&lt;br /&gt;
&lt;br /&gt;
''WORK IN PROGRESS''&lt;br /&gt;
&lt;br /&gt;
==Playback Notes==&lt;br /&gt;
&lt;br /&gt;
Note w/o sample results in retriggering the note without resetting the volume.&lt;br /&gt;
&lt;br /&gt;
Sample w/o note results in resetting the volume and ''switching samples'' w/o retriggering the note. If the C4 speeds differ, this could potentially be out of tune as it does not convert the internal period values. If the note is off, it will stay off - it will not retrigger.&lt;br /&gt;
&lt;br /&gt;
Vibrato and tremolo have a full cycle length of 256, though Hxy and Rxy use x*4 and y*4 as their parameters.&lt;br /&gt;
&lt;br /&gt;
Base clock is 14317056 Hz. When calculating a note's period, use the following table:&lt;br /&gt;
&lt;br /&gt;
  C    C#   D    D#   E    F    F#   G    G#   A   A#   A&lt;br /&gt;
 1712,1616,1524,1440,1356,1280,1208,1140,1076,1016,960,907&lt;br /&gt;
&lt;br /&gt;
and calculate the period like so:&lt;br /&gt;
&lt;br /&gt;
 period = 8363 * 16 * (note &amp;gt;&amp;gt; octave) / middle_c_frequency_of_instrument&lt;br /&gt;
&lt;br /&gt;
''Theoretically'', both the period and the volume have &amp;quot;stored&amp;quot; values and &amp;quot;active&amp;quot; values.&lt;br /&gt;
&lt;br /&gt;
'''Volumes actually peak at 63''', and not 64. Setting the volume to 64 will actually make it go to 63.&lt;br /&gt;
&lt;br /&gt;
However, on '''adlib channels''', if the default volume is 64, it will use 64. Any further operations on the volume will clip it to within the 0-63 range.&lt;br /&gt;
&lt;br /&gt;
When a '''note''' is selected, the tremolo '''position''' is retriggered if tremolo retriggering is enabled..&lt;br /&gt;
&lt;br /&gt;
==Effects==&lt;br /&gt;
&lt;br /&gt;
''TODO the rest''&lt;br /&gt;
&lt;br /&gt;
===Dxy===&lt;br /&gt;
Volume slide. If one of the values are 0, then we slide on all nonzero ticks. If one of the values are F, then we slide on all zero ticks. That means that '''D0F slides down 15 on all ticks and DF0 slides up 15 on all ticks'''.&lt;br /&gt;
&lt;br /&gt;
However, if fast slides are enabled (if they are set as a flag or the version is less than 0x1320), then, unless we're doing a fineslide, we slide on all ticks.&lt;br /&gt;
&lt;br /&gt;
When we do a volume slide, we slide the active volume '''without modifying the stored volume''', and we '''retrigger tremolo for that channel'''.&lt;br /&gt;
&lt;br /&gt;
The checking order is as follows:&lt;br /&gt;
* Dx0 (slide up)&lt;br /&gt;
* D0x (slide down)&lt;br /&gt;
* DxF (fine slide up)&lt;br /&gt;
* DFx (fine slide down)&lt;br /&gt;
&lt;br /&gt;
So DFF slides the volume '''up 15 notches each nonzero tick'''.&lt;br /&gt;
&lt;br /&gt;
===Rxy===&lt;br /&gt;
Tremolo. x*4 is speed, y*4 is depth. This is possibly the screwiest effect of the lot. While XMPlay seems to be quite good with IT support these days after Storlek released his abuse tests, it gets several aspects of this S3M effect wrong.&lt;br /&gt;
&lt;br /&gt;
*If xy is nonzero, load up the speed and the depth into this channel's tremolo speed &amp;amp; depth values.&lt;br /&gt;
*Set the active volume to '''the stored volume plus''' (depth * value) / (max_amplitude * 2) (Rxy peaks at 32 in each direction), and for each '''nonzero''' tick increase the tremolo position by the speed. '''The stored volume is untouched.'''&lt;br /&gt;
*When this effect is retriggered, the depth and position are set to 0 '''while the speed remains unaltered'''.&lt;br /&gt;
*'''Tremolo will not work if the stored volume is 0 (or 64 - adlib only).'''&lt;br /&gt;
&lt;br /&gt;
[[Category: Music Pattern Formats]]&lt;/div&gt;</summary>
		<author><name>GreaseMonkey</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Scream_Tracker_3_Module&amp;diff=13038</id>
		<title>Scream Tracker 3 Module</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Scream_Tracker_3_Module&amp;diff=13038"/>
		<updated>2010-10-13T01:55:14Z</updated>

		<summary type="html">&lt;p&gt;GreaseMonkey: finally documenting the format itself&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* Extension: s3m&lt;br /&gt;
A normally 16-channel module format for MS-DOS on the PC, it can also support OPL2 FM synthesis (9 melodic channels + 5 drums). While the format itself can technically support 32 channels, only the 30 mentioned have any meaning assigned to them, and they are usually not all used at the same time.&lt;br /&gt;
&lt;br /&gt;
==File Format==&lt;br /&gt;
&lt;br /&gt;
The format is little-endian (least significant byte first). A &amp;quot;byte&amp;quot; is 8 bits, and a &amp;quot;word&amp;quot; is 16 bits. Hex values will be denoted with &amp;quot;0x&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Note that if some parts of the format are inconsistent, it's usually best to let it slip, as ST3 itself will allegedly for instance load instruments which don't have the &amp;quot;SCRS&amp;quot; / &amp;quot;SCRI&amp;quot; mark.&lt;br /&gt;
&lt;br /&gt;
*28 bytes: module name, NUL-terminated, NUL-padded.&lt;br /&gt;
*Byte: 0x1A.&lt;br /&gt;
*Byte: 16 (0x10) to indicate this is a Scream Tracker 3 module.&lt;br /&gt;
*2 reserved bytes, should be 0x00.&lt;br /&gt;
*6 words, denoting the following:&lt;br /&gt;
**Order count&lt;br /&gt;
**Instrument count&lt;br /&gt;
**Pattern count&lt;br /&gt;
**Flags&lt;br /&gt;
***bit 0 (pre-3.01 ONLY): ST2 vibrato ''(effect unknown)''.&lt;br /&gt;
***bit 1 (pre-3.01 ONLY): ST2 tempo ''(effect unknown)''.&lt;br /&gt;
***bit 3 (pre-3.01 ONLY): Amiga slides ''(effect unknown)''.&lt;br /&gt;
***bit 4: 0-vol optimisations - turn off looping notes which have a zero volume for more than(?) 2 rows.&lt;br /&gt;
***bit 5: Amiga limits (limit periods to confine to 113 &amp;lt;= x &amp;lt;= 856).&lt;br /&gt;
***bit 6 (pre-3.01 ONLY): Enable filter / sfx with SB ''(effect unknown)''.&lt;br /&gt;
***bit 7: ST3.00 volume slides (automatically enabled if tracker version is &amp;lt;= 0x1300) - if the tick&lt;br /&gt;
***bit 8: Special custom data in file (uses &amp;quot;Special&amp;quot; field)&lt;br /&gt;
**Tracker version&lt;br /&gt;
***0x1xyy == Scream Tracker x.yy&lt;br /&gt;
***''TODO - look for other version numbers''&lt;br /&gt;
**File format information&lt;br /&gt;
***1 == signed samples (horribly, horribly old)&lt;br /&gt;
***2 == unsigned samples&lt;br /&gt;
***Anything else is invalid and ST3 will not load the file(?).&lt;br /&gt;
**4 byte string: &amp;quot;SCRM&amp;quot;&lt;br /&gt;
**6 bytes, denoting the following:&lt;br /&gt;
&lt;br /&gt;
''WORK IN PROGRESS''&lt;br /&gt;
&lt;br /&gt;
==Playback Notes==&lt;br /&gt;
&lt;br /&gt;
Aspects which are easy to get wrong with this format are in '''bold text'''.&lt;br /&gt;
&lt;br /&gt;
Note w/o sample results in retriggering the note without resetting the volume.&lt;br /&gt;
&lt;br /&gt;
Sample w/o note results in resetting the volume and ''switching samples'' w/o retriggering the note. If the C4 speeds differ, this could potentially be out of tune as it does not convert the internal period values. If the note is off, it will stay off - it will not retrigger.&lt;br /&gt;
&lt;br /&gt;
Vibrato and tremolo have a full cycle length of 256, though Hxy and Rxy use x*4 and y*4 as their parameters.&lt;br /&gt;
&lt;br /&gt;
Base clock is 14317056 Hz. When calculating a note's period, use the following table:&lt;br /&gt;
&lt;br /&gt;
  C    C#   D    D#   E    F    F#   G    G#   A   A#   A&lt;br /&gt;
 1712,1616,1524,1440,1356,1280,1208,1140,1076,1016,960,907&lt;br /&gt;
&lt;br /&gt;
and calculate the period like so:&lt;br /&gt;
&lt;br /&gt;
 period = 8363 * 16 * (note &amp;gt;&amp;gt; octave) / middle_c_frequency_of_instrument&lt;br /&gt;
&lt;br /&gt;
''Theoretically'', both the period and the volume have &amp;quot;stored&amp;quot; values and &amp;quot;active&amp;quot; values.&lt;br /&gt;
&lt;br /&gt;
'''Volumes actually peak at 63''', and not 64. Setting the volume to 64 will actually make it go to 63.&lt;br /&gt;
&lt;br /&gt;
However, on '''adlib channels''', if the default volume is 64, it will use 64. Any further operations on the volume will clip it to within the 0-63 range.&lt;br /&gt;
&lt;br /&gt;
When a '''note''' is selected, the tremolo '''position''' is retriggered if tremolo retriggering is enabled..&lt;br /&gt;
&lt;br /&gt;
==Effects==&lt;br /&gt;
&lt;br /&gt;
''TODO the rest''&lt;br /&gt;
&lt;br /&gt;
===Dxy===&lt;br /&gt;
Volume slide. If one of the values are 0, then we slide on all nonzero ticks. If one of the values are F, then we slide on all zero ticks. That means that '''D0F slides down 15 on all ticks and DF0 slides up 15 on all ticks'''.&lt;br /&gt;
&lt;br /&gt;
However, if fast slides are enabled (if they are set as a flag or the version is less than 0x1320), then, unless we're doing a fineslide, we slide on all ticks.&lt;br /&gt;
&lt;br /&gt;
When we do a volume slide, we slide the active volume '''without modifying the stored volume''', and we '''retrigger tremolo for that channel'''.&lt;br /&gt;
&lt;br /&gt;
The checking order is as follows:&lt;br /&gt;
* Dx0 (slide up)&lt;br /&gt;
* D0x (slide down)&lt;br /&gt;
* DxF (fine slide up)&lt;br /&gt;
* DFx (fine slide down)&lt;br /&gt;
&lt;br /&gt;
So DFF slides the volume '''up 15 notches each nonzero tick'''.&lt;br /&gt;
&lt;br /&gt;
===Rxy===&lt;br /&gt;
Tremolo. x*4 is speed, y*4 is depth. This is possibly the screwiest effect of the lot. While XMPlay seems to be quite good with IT support these days after Storlek released his abuse tests, it gets several aspects of this S3M effect wrong.&lt;br /&gt;
&lt;br /&gt;
*If xy is nonzero, load up the speed and the depth into this channel's tremolo speed &amp;amp; depth values.&lt;br /&gt;
*Set the active volume to '''the stored volume plus''' (depth * value) / (max_amplitude * 2) (Rxy peaks at 32 in each direction), and for each '''nonzero''' tick increase the tremolo position by the speed. '''The stored volume is untouched.'''&lt;br /&gt;
*When this effect is retriggered, the depth and position are set to 0 '''while the speed remains unaltered'''.&lt;br /&gt;
*'''Tremolo will not work if the stored volume is 0 (or 64 - adlib only).'''&lt;br /&gt;
&lt;br /&gt;
[[Category: Music Pattern Formats]]&lt;/div&gt;</summary>
		<author><name>GreaseMonkey</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Scream_Tracker_3_Module&amp;diff=12197</id>
		<title>Scream Tracker 3 Module</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Scream_Tracker_3_Module&amp;diff=12197"/>
		<updated>2010-01-31T23:34:31Z</updated>

		<summary type="html">&lt;p&gt;GreaseMonkey: adlib vol 64 quirk&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* Extension: s3m&lt;br /&gt;
A normally 16-channel module format for MS-DOS on the PC, it can also support OPL2 FM synthesis (9 melodic channels + 5 drums). While the format itself can technically support 32 channels, only the 30 mentioned have any meaning assigned to them, and they are usually not all used at the same time.&lt;br /&gt;
&lt;br /&gt;
==File Format==&lt;br /&gt;
&lt;br /&gt;
''TODO this section - there's a file which comes with ST3.21, &amp;quot;TECH.DOC&amp;quot;, which gives you the info. Effects are A=1, B=2, et cetera.''&lt;br /&gt;
&lt;br /&gt;
==Playback Notes==&lt;br /&gt;
&lt;br /&gt;
Aspects which are easy to get wrong with this format are in '''bold text'''.&lt;br /&gt;
&lt;br /&gt;
Note w/o sample results in retriggering the note without resetting the volume.&lt;br /&gt;
&lt;br /&gt;
Sample w/o note results in resetting the volume and ''switching samples'' w/o retriggering the note. If the C4 speeds differ, this could potentially be out of tune as it does not convert the internal period values. If the note is off, it will stay off - it will not retrigger.&lt;br /&gt;
&lt;br /&gt;
Vibrato and tremolo have a full cycle length of 256.&lt;br /&gt;
&lt;br /&gt;
''Theoretically'', both the period and the volume have &amp;quot;stored&amp;quot; values and &amp;quot;active&amp;quot; values.&lt;br /&gt;
&lt;br /&gt;
'''Volumes actually peak at 63''', and not 64. Setting the volume to 64 will actually make it go to 63.&lt;br /&gt;
&lt;br /&gt;
However, on '''adlib channels''', if the default volume is 64, it will use 64. Any further operations on the volume will clip it to within the 0-63 range.&lt;br /&gt;
&lt;br /&gt;
When a '''note''' is selected, the tremolo '''position''' is retriggered if tremolo retriggering is enabled..&lt;br /&gt;
&lt;br /&gt;
==Effects==&lt;br /&gt;
&lt;br /&gt;
''TODO the rest''&lt;br /&gt;
&lt;br /&gt;
===Dxy===&lt;br /&gt;
Volume slide. If one of the values are 0, then we slide on all nonzero ticks. If one of the values are F, then we slide on all zero ticks. That means that '''D0F slides down 15 on all ticks and DF0 slides up 15 on all ticks'''.&lt;br /&gt;
&lt;br /&gt;
However, if fast slides are enabled (if they are set as a flag or the version is less than 0x1320), then, unless we're doing a fineslide, we slide on all ticks.&lt;br /&gt;
&lt;br /&gt;
When we do a volume slide, we slide the active volume '''without modifying the stored volume''', and we '''retrigger tremolo for that channel'''.&lt;br /&gt;
&lt;br /&gt;
The checking order is as follows:&lt;br /&gt;
* Dx0 (slide up)&lt;br /&gt;
* D0x (slide down)&lt;br /&gt;
* DxF (fine slide up)&lt;br /&gt;
* DFx (fine slide down)&lt;br /&gt;
&lt;br /&gt;
So DFF slides the volume '''up 15 notches each nonzero tick'''.&lt;br /&gt;
&lt;br /&gt;
===Rxy===&lt;br /&gt;
Tremolo. x*4 is speed, y*4 is depth. This is possibly the screwiest effect of the lot. While XMPlay seems to be quite good with IT support these days after Storlek released his abuse tests, it gets several aspects of this S3M effect wrong.&lt;br /&gt;
&lt;br /&gt;
*If xy is nonzero, load up the speed and the depth into this channel's tremolo speed &amp;amp; depth values.&lt;br /&gt;
*Set the active volume to '''the stored volume plus''' (depth * value) / (max_amplitude * 2) (Rxy peaks at 32 in each direction), and for each '''nonzero''' tick increase the tremolo position by the speed. '''The stored volume is untouched.'''&lt;br /&gt;
*When this effect is retriggered, the depth and position are set to 0 '''while the speed remains unaltered'''.&lt;br /&gt;
*'''Tremolo will not work if the stored volume is 0 (or 64 - adlib only).'''&lt;br /&gt;
&lt;br /&gt;
[[Category: Music Pattern Formats]]&lt;/div&gt;</summary>
		<author><name>GreaseMonkey</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Scream_Tracker_3_Module&amp;diff=12196</id>
		<title>Scream Tracker 3 Module</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Scream_Tracker_3_Module&amp;diff=12196"/>
		<updated>2010-01-31T23:11:35Z</updated>

		<summary type="html">&lt;p&gt;GreaseMonkey: another clarification&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* Extension: s3m&lt;br /&gt;
A normally 16-channel module format for MS-DOS on the PC, it can also support OPL2 FM synthesis (9 melodic channels + 5 drums). While the format itself can technically support 32 channels, only the 30 mentioned have any meaning assigned to them, and they are usually not all used at the same time.&lt;br /&gt;
&lt;br /&gt;
==File Format==&lt;br /&gt;
&lt;br /&gt;
''TODO this section - there's a file which comes with ST3.21, &amp;quot;TECH.DOC&amp;quot;, which gives you the info. Effects are A=1, B=2, et cetera.''&lt;br /&gt;
&lt;br /&gt;
==Playback Notes==&lt;br /&gt;
&lt;br /&gt;
Aspects which are easy to get wrong with this format are in '''bold text'''.&lt;br /&gt;
&lt;br /&gt;
Note w/o sample results in retriggering the note without resetting the volume.&lt;br /&gt;
&lt;br /&gt;
Sample w/o note results in resetting the volume and ''switching samples'' w/o retriggering the note. If the C4 speeds differ, this could potentially be out of tune as it does not convert the internal period values. If the note is off, it will stay off - it will not retrigger.&lt;br /&gt;
&lt;br /&gt;
Vibrato and tremolo have a full cycle length of 256.&lt;br /&gt;
&lt;br /&gt;
''Theoretically'', both the period and the volume have &amp;quot;stored&amp;quot; values and &amp;quot;active&amp;quot; values.&lt;br /&gt;
&lt;br /&gt;
'''Volumes actually peak at 63''', and not 64. Setting the volume to 64 will actually make it go to 63.&lt;br /&gt;
&lt;br /&gt;
When a '''note''' is selected, the tremolo '''position''' is retriggered if tremolo retriggering is enabled..&lt;br /&gt;
&lt;br /&gt;
==Effects==&lt;br /&gt;
&lt;br /&gt;
''TODO the rest''&lt;br /&gt;
&lt;br /&gt;
===Dxy===&lt;br /&gt;
Volume slide. If one of the values are 0, then we slide on all nonzero ticks. If one of the values are F, then we slide on all zero ticks. That means that '''D0F slides down 15 on all ticks and DF0 slides up 15 on all ticks'''.&lt;br /&gt;
&lt;br /&gt;
However, if fast slides are enabled (if they are set as a flag or the version is less than 0x1320), then, unless we're doing a fineslide, we slide on all ticks.&lt;br /&gt;
&lt;br /&gt;
When we do a volume slide, we slide the active volume '''without modifying the stored volume''', and we '''retrigger tremolo for that channel'''.&lt;br /&gt;
&lt;br /&gt;
The checking order is as follows:&lt;br /&gt;
* Dx0 (slide up)&lt;br /&gt;
* D0x (slide down)&lt;br /&gt;
* DxF (fine slide up)&lt;br /&gt;
* DFx (fine slide down)&lt;br /&gt;
&lt;br /&gt;
So DFF slides the volume '''up 15 notches each nonzero tick'''.&lt;br /&gt;
&lt;br /&gt;
===Rxy===&lt;br /&gt;
Tremolo. x*4 is speed, y*4 is depth. This is possibly the screwiest effect of the lot. While XMPlay seems to be quite good with IT support these days after Storlek released his abuse tests, it gets several aspects of this S3M effect wrong.&lt;br /&gt;
&lt;br /&gt;
*If xy is nonzero, load up the speed and the depth into this channel's tremolo speed &amp;amp; depth values.&lt;br /&gt;
*Set the active volume to '''the stored volume plus''' (depth * value) / (max_amplitude * 2) (Rxy peaks at 32 in each direction), and for each '''nonzero''' tick increase the tremolo position by the speed. '''The stored volume is untouched.'''&lt;br /&gt;
*When this effect is retriggered, the depth and position are set to 0 '''while the speed remains unaltered'''.&lt;br /&gt;
*'''Tremolo will not work if the stored volume is 0.'''&lt;br /&gt;
&lt;br /&gt;
[[Category: Music Pattern Formats]]&lt;/div&gt;</summary>
		<author><name>GreaseMonkey</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Scream_Tracker_3_Module&amp;diff=12195</id>
		<title>Scream Tracker 3 Module</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Scream_Tracker_3_Module&amp;diff=12195"/>
		<updated>2010-01-31T23:10:21Z</updated>

		<summary type="html">&lt;p&gt;GreaseMonkey: /* Rxy */ amp mistake&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* Extension: s3m&lt;br /&gt;
A normally 16-channel module format for MS-DOS on the PC, it can also support OPL2 FM synthesis (9 melodic channels + 5 drums). While the format itself can technically support 32 channels, only the 30 mentioned have any meaning assigned to them, and they are usually not all used at the same time.&lt;br /&gt;
&lt;br /&gt;
==File Format==&lt;br /&gt;
&lt;br /&gt;
''TODO this section - there's a file which comes with ST3.21, &amp;quot;TECH.DOC&amp;quot;, which gives you the info. Effects are A=1, B=2, et cetera.''&lt;br /&gt;
&lt;br /&gt;
==Playback Notes==&lt;br /&gt;
&lt;br /&gt;
Aspects which are easy to get wrong with this format are in '''bold text'''.&lt;br /&gt;
&lt;br /&gt;
Note w/o sample results in retriggering the note without resetting the volume.&lt;br /&gt;
&lt;br /&gt;
Sample w/o note results in resetting the volume and ''switching samples'' w/o retriggering the note. If the C4 speeds differ, this could potentially be out of tune as it does not convert the internal period values. If the note is off, it will stay off - it will not retrigger.&lt;br /&gt;
&lt;br /&gt;
Vibrato and tremolo have a full cycle length of 256.&lt;br /&gt;
&lt;br /&gt;
''Theoretically'', both the period and the volume have &amp;quot;stored&amp;quot; values and &amp;quot;active&amp;quot; values.&lt;br /&gt;
&lt;br /&gt;
'''Volumes actually peak at 63''', and not 64. Setting the volume to 64 will actually make it go to 63.&lt;br /&gt;
&lt;br /&gt;
When a '''note''' is selected, '''tremolo is retriggered'''.&lt;br /&gt;
&lt;br /&gt;
==Effects==&lt;br /&gt;
&lt;br /&gt;
''TODO the rest''&lt;br /&gt;
&lt;br /&gt;
===Dxy===&lt;br /&gt;
Volume slide. If one of the values are 0, then we slide on all nonzero ticks. If one of the values are F, then we slide on all zero ticks. That means that '''D0F slides down 15 on all ticks and DF0 slides up 15 on all ticks'''.&lt;br /&gt;
&lt;br /&gt;
However, if fast slides are enabled (if they are set as a flag or the version is less than 0x1320), then, unless we're doing a fineslide, we slide on all ticks.&lt;br /&gt;
&lt;br /&gt;
When we do a volume slide, we slide the active volume '''without modifying the stored volume''', and we '''retrigger tremolo for that channel'''.&lt;br /&gt;
&lt;br /&gt;
The checking order is as follows:&lt;br /&gt;
* Dx0 (slide up)&lt;br /&gt;
* D0x (slide down)&lt;br /&gt;
* DxF (fine slide up)&lt;br /&gt;
* DFx (fine slide down)&lt;br /&gt;
&lt;br /&gt;
So DFF slides the volume '''up 15 notches each nonzero tick'''.&lt;br /&gt;
&lt;br /&gt;
===Rxy===&lt;br /&gt;
Tremolo. x*4 is speed, y*4 is depth. This is possibly the screwiest effect of the lot. While XMPlay seems to be quite good with IT support these days after Storlek released his abuse tests, it gets several aspects of this S3M effect wrong.&lt;br /&gt;
&lt;br /&gt;
*If xy is nonzero, load up the speed and the depth into this channel's tremolo speed &amp;amp; depth values.&lt;br /&gt;
*Set the active volume to '''the stored volume plus''' (depth * value) / (max_amplitude * 2) (Rxy peaks at 32 in each direction), and for each '''nonzero''' tick increase the tremolo position by the speed. '''The stored volume is untouched.'''&lt;br /&gt;
*When this effect is retriggered, the depth and position are set to 0 '''while the speed remains unaltered'''.&lt;br /&gt;
*'''Tremolo will not work if the stored volume is 0.'''&lt;br /&gt;
&lt;br /&gt;
[[Category: Music Pattern Formats]]&lt;/div&gt;</summary>
		<author><name>GreaseMonkey</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Scream_Tracker_3_Module&amp;diff=12194</id>
		<title>Scream Tracker 3 Module</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Scream_Tracker_3_Module&amp;diff=12194"/>
		<updated>2010-01-31T23:07:21Z</updated>

		<summary type="html">&lt;p&gt;GreaseMonkey: basically, how tremolo works.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* Extension: s3m&lt;br /&gt;
A normally 16-channel module format for MS-DOS on the PC, it can also support OPL2 FM synthesis (9 melodic channels + 5 drums). While the format itself can technically support 32 channels, only the 30 mentioned have any meaning assigned to them, and they are usually not all used at the same time.&lt;br /&gt;
&lt;br /&gt;
==File Format==&lt;br /&gt;
&lt;br /&gt;
''TODO this section - there's a file which comes with ST3.21, &amp;quot;TECH.DOC&amp;quot;, which gives you the info. Effects are A=1, B=2, et cetera.''&lt;br /&gt;
&lt;br /&gt;
==Playback Notes==&lt;br /&gt;
&lt;br /&gt;
Aspects which are easy to get wrong with this format are in '''bold text'''.&lt;br /&gt;
&lt;br /&gt;
Note w/o sample results in retriggering the note without resetting the volume.&lt;br /&gt;
&lt;br /&gt;
Sample w/o note results in resetting the volume and ''switching samples'' w/o retriggering the note. If the C4 speeds differ, this could potentially be out of tune as it does not convert the internal period values. If the note is off, it will stay off - it will not retrigger.&lt;br /&gt;
&lt;br /&gt;
Vibrato and tremolo have a full cycle length of 256.&lt;br /&gt;
&lt;br /&gt;
''Theoretically'', both the period and the volume have &amp;quot;stored&amp;quot; values and &amp;quot;active&amp;quot; values.&lt;br /&gt;
&lt;br /&gt;
'''Volumes actually peak at 63''', and not 64. Setting the volume to 64 will actually make it go to 63.&lt;br /&gt;
&lt;br /&gt;
When a '''note''' is selected, '''tremolo is retriggered'''.&lt;br /&gt;
&lt;br /&gt;
==Effects==&lt;br /&gt;
&lt;br /&gt;
''TODO the rest''&lt;br /&gt;
&lt;br /&gt;
===Dxy===&lt;br /&gt;
Volume slide. If one of the values are 0, then we slide on all nonzero ticks. If one of the values are F, then we slide on all zero ticks. That means that '''D0F slides down 15 on all ticks and DF0 slides up 15 on all ticks'''.&lt;br /&gt;
&lt;br /&gt;
However, if fast slides are enabled (if they are set as a flag or the version is less than 0x1320), then, unless we're doing a fineslide, we slide on all ticks.&lt;br /&gt;
&lt;br /&gt;
When we do a volume slide, we slide the active volume '''without modifying the stored volume''', and we '''retrigger tremolo for that channel'''.&lt;br /&gt;
&lt;br /&gt;
The checking order is as follows:&lt;br /&gt;
* Dx0 (slide up)&lt;br /&gt;
* D0x (slide down)&lt;br /&gt;
* DxF (fine slide up)&lt;br /&gt;
* DFx (fine slide down)&lt;br /&gt;
&lt;br /&gt;
So DFF slides the volume '''up 15 notches each nonzero tick'''.&lt;br /&gt;
&lt;br /&gt;
===Rxy===&lt;br /&gt;
Tremolo. x*4 is speed, y*4 is depth. This is possibly the screwiest effect of the lot. While XMPlay seems to be quite good with IT support these days after Storlek released his abuse tests, it gets several aspects of this S3M effect wrong.&lt;br /&gt;
&lt;br /&gt;
*If xy is nonzero, load up the speed and the depth into this channel's tremolo speed &amp;amp; depth values.&lt;br /&gt;
*Set the active volume to '''the stored volume plus''' (depth * value) / max_amplitude, and for each '''nonzero''' tick increase the tremolo position by the speed. '''The stored volume is untouched.'''&lt;br /&gt;
*When this effect is retriggered, the depth and position are set to 0 '''while the speed remains unaltered'''.&lt;br /&gt;
*'''Tremolo will not work if the stored volume is 0.'''&lt;br /&gt;
&lt;br /&gt;
[[Category: Music Pattern Formats]]&lt;/div&gt;</summary>
		<author><name>GreaseMonkey</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Protracker_Module&amp;diff=12168</id>
		<title>Protracker Module</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Protracker_Module&amp;diff=12168"/>
		<updated>2010-01-22T21:24:09Z</updated>

		<summary type="html">&lt;p&gt;GreaseMonkey: /* EFx */ clarification&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* Extension: mod&lt;br /&gt;
Originally a 15-sample format, it was first used in Ultimate SoundTracker for the Amiga. Since then, it has been used in NoiseTracker and ProTracker, which both use the 31-sample &amp;quot;M.K.&amp;quot; version, as well as many other programs on many other platforms; for example, FastTracker 2 for MS-DOS on the PC, which can handle even numbers of channels from 2 to 32.&lt;br /&gt;
&lt;br /&gt;
==File Format==&lt;br /&gt;
The format is big-endian (most significant byte first). A &amp;quot;byte&amp;quot; is 8 bits, and a &amp;quot;word&amp;quot; is 16 bits. Hex values will be denoted with a $ sign.&lt;br /&gt;
&lt;br /&gt;
Amiga limits for periods are 113 &amp;lt;= x &amp;lt;= 856. The lower the period, the higher the pitch.&lt;br /&gt;
&lt;br /&gt;
*20 bytes: Module name, padded with NULs.&lt;br /&gt;
*31 samples (or 15 if we're dealing with a SoundTracker file):&lt;br /&gt;
**22 bytes: Sample name, padded with NULs.&lt;br /&gt;
**Word: Length of sample in words - multiply by 2 to get length in bytes.&lt;br /&gt;
**Byte: Finetune value ranging from $00 to $0F as a signed nybble. $01 is 1/8 of a semitone up, $0F is 1/8 of a semitone down, $08 is 8/8 of a semitone down (that is, a whole semitone). Periods should be clamped to within Amiga limits.&lt;br /&gt;
**Byte: Default volume of sample ranging from 0 to 64 ($00 to $40).&lt;br /&gt;
**Word: Loop start in words.&lt;br /&gt;
**Word: Loop length in words. If set to 1, don't loop. Allegedly, a value of 0 will crash an Amiga.&lt;br /&gt;
*Byte: Order list length.&lt;br /&gt;
*Byte: Traditionally $78 in SoundTracker. Was used in NoiseTracker as a restart point. ProTracker uses $7F. FastTracker uses it as a restart point, whereas ScreamTracker 3 uses $7F like ProTracker. You can use this to roughly detect which tracker made a MOD, and detection gets more accurate for more obscure MOD types.&lt;br /&gt;
*128 bytes: Order list. Only the first ''order list length'' orders are actually used when playing; however, we scan the WHOLE order list to find out what the highest-indexed pattern is, and that's how many patterns we load.&lt;br /&gt;
*4 bytes (31-sample version only): Sample tag. If this contains any non-ASCII ($20 to $7E (32 to 126) inclusive) characters, then we probably loaded a 15-sample MOD. The best way to detect this is to seek to this position (it's $438 / 1080) and check before you actually load any data (may not work for streams where you can't seek). Otherwise, it's probably a 31-sample MOD. Values include:&lt;br /&gt;
**'''M.K.''' - standard 4-channel, 64-pattern-max MOD.&lt;br /&gt;
**'''M!K!''' - ProTracker will write this if there's more than 64 patterns,&lt;br /&gt;
**'''6CHN''', '''8CHN''' - 6-channel and 8-channel MODs, respectively. These are common extensions, and many trackers will write these. Basically, you read like a 4 channel mod, but with 6 or 8 channels per row.&lt;br /&gt;
**'''CD81''', '''OKTA''', '''OCTA''' - other 8-channel MOD tags. First two are probably Oktalyzer for the Atari ST, the third is possibly OctaMED.&lt;br /&gt;
**'''xxCH''' - a 10+ channel MOD, xx being a decimal number. FastTracker will deal with these as long as x is an even number no greater than 32.&lt;br /&gt;
**'''2CHN''' - a 2 channel MOD. This is handled by FastTracker.&lt;br /&gt;
**'''xxCN''' - another 10+ channel MOD, xx being a decimal number. Allegedly TakeTracker writes these.&lt;br /&gt;
**'''TDZ1''', '''TDZ2''', '''TDZ3''' - allegedly this is a TakeTracker extension for 1, 2, and 3 channels respectively.&lt;br /&gt;
**'''5CHN''', '''7CHN''', '''9CHN''' - allegedly this is a TakeTracker extension for 5, 7, and 8 channels respectively.&lt;br /&gt;
**'''FLT4''' - StarTrekker 4-channel MOD.&lt;br /&gt;
**'''FLT8''' - StarTrekker 8-channel MOD. Load patterns in like a normal 4-channel MOD, and then play two patterns at the same time (e.g. if 8 appears on the order list, play patterns 8 and 9). You'd probably be best to merge the patterns together if you want to be consistent.&lt;br /&gt;
**'''M&amp;amp;K!''' - only sighted on echobea3.mod so far. This is just a standard MOD, but with a weird tag. ''I ([[User:GreaseMonkey|GreaseMonkey]]) cannot find the tracker it's referring to (&amp;quot;fleg's module train-er&amp;quot;), so it was probably only used once or something, and never released.''&lt;br /&gt;
*Pattern data:&lt;br /&gt;
**Read 4 bytes for a cell. Read ''channel count'' cells for a row. Read 64 of these rows for a pattern. Read ''pattern count'' of these patterns.&lt;br /&gt;
**You read cells as if they were big-endian 32-bit values.&lt;br /&gt;
**Cells are in the format $ipppjfxy:&lt;br /&gt;
***$ppp is the period value. No, not the note, the period.&lt;br /&gt;
***$ij is the sample number.&lt;br /&gt;
***$fxy is the effect, $f being the effect type, and $xy being the effect parameter.&lt;br /&gt;
*Signed 8-bit mono sample data. Remember those sample lengths? Now is the time to use them.&lt;br /&gt;
&lt;br /&gt;
==Playback notes==&lt;br /&gt;
&lt;br /&gt;
Amiga base clock is ''roughly'' 70ns, yielding an audio base clock of 280ns. The actual base clock differs. PAL Amigas have a slightly slower clock than NTSC Amigas. This value of 70ns is close to the NTSC clock, but not quite right. Some modules have large samples (known as &amp;quot;megasamples&amp;quot;) which require a certain type of Amiga - t_o_t.mod, for instance, requires a PAL Amiga, whereas cd_orbit.mod requires an NTSC Amiga. You can also use 8363*428 for another estimate.&lt;br /&gt;
&lt;br /&gt;
To get the actual note frequency, divide the Amiga base clock by the period number.&lt;br /&gt;
&lt;br /&gt;
There is a number of ticks per row, often just referred to as the speed.&lt;br /&gt;
&lt;br /&gt;
There is a number of &amp;quot;beats per minute&amp;quot;; however, this is a CIA clock speed (it's an Amiga thing). Often just referred to as the tempo. To convert to actual BPM, multiply by 4 and divide by 10. For clarity, we'll refer to it as BPM, even though it's not entirely correct.&lt;br /&gt;
&lt;br /&gt;
When a looped sample is played, the whole sample plays through once, and then, if it has a loop, the loop is repeated.&lt;br /&gt;
&lt;br /&gt;
On a real Amiga, when a nonlooped sample is played, the whole sample plays through once, and then doesn't play any further. If you then attempt a slide-to-note (3xx / 5xy), you won't hear anything.&lt;br /&gt;
&lt;br /&gt;
If a sample is supplied, then the sample is &amp;quot;latched&amp;quot;, the channel volume is reset to the sample's default volume, and the starting offset is reset to 0. ProTracker 1.1 (?) will change the sample, too, but other versions do not.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: which trackers do this?)''&lt;br /&gt;
&lt;br /&gt;
ImpulseTracker also changes the sample; however, if you're converting MOD to IT yourself and you don't want this, you can put a &amp;quot;note off&amp;quot; with the sample and it will just change the volume (unfortunately, this behaviour does not work correctly with libmodplug or SchismTracker at the moment).&lt;br /&gt;
&lt;br /&gt;
If a period is supplied, then the note plays from the starting offset of the current latched sample, unless there is a note slide (effect 3xx or 5xy).&lt;br /&gt;
&lt;br /&gt;
===Effects===&lt;br /&gt;
====0xy====&lt;br /&gt;
Arpeggio between 0,x,y semitones up, changing every tick, and retriggering every row. Basically, you select by using tick % 3 where % is the modulo operator.&lt;br /&gt;
&lt;br /&gt;
====1xx====&lt;br /&gt;
Slide up. For every nonzero tick, decrement the period by $xx, clamping to 113 (amiga limits).&lt;br /&gt;
&lt;br /&gt;
====2xx====&lt;br /&gt;
Slide down. For every nonzero tick, increment the period by $xx, clamping to 856 (amiga limits).&lt;br /&gt;
&lt;br /&gt;
====3xx====&lt;br /&gt;
Slide to note. For every nonzero tick, move the period $xx closer to the target period.&lt;br /&gt;
&lt;br /&gt;
If xx is 0, then use previous value for 3xx.&lt;br /&gt;
&lt;br /&gt;
====4xy====&lt;br /&gt;
Vibrato. x is speed, y is depth. You'll need to generate 3 waveforms beforehand, and spew out random numbers for the last choice of waveform. Each waveform other than the last has a full cycle of 64 steps, and the amplitude is somewhere between -y and y after calculating. When precalculating the waveform, an amplitude of 64 should be fine.&lt;br /&gt;
&lt;br /&gt;
*Waveform 0 is a sine wave. This is the default.&lt;br /&gt;
*Waveform 1 is a downwards saw wave.&lt;br /&gt;
*Waveform 2 is a square wave, starting from +y.&lt;br /&gt;
*Waveform 3 is random. The cycle of this is mostly irrelevant. In saying this, the speed value is irrelevant with this waveform type, too.&lt;br /&gt;
&lt;br /&gt;
You have a vibrato waveform position. By default, this retriggers for every note (?) you play by being reset to 0. This loops around a cycle of 64 positions.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: is it per note or per sample, or will either retrigger it?)''&lt;br /&gt;
&lt;br /&gt;
For each tick, we add y to the output period at the peak amplitude. For a waveform with peak amplitude of 64, for example, we would add (y*waveform[pos]/64). The period is clamped to Amiga limits.&lt;br /&gt;
&lt;br /&gt;
If xy is 0, then use previous value for 4xy.&lt;br /&gt;
&lt;br /&gt;
====5xy====&lt;br /&gt;
Volume slide + slide to note: Axy and 300 combined.&lt;br /&gt;
&lt;br /&gt;
====6xy====&lt;br /&gt;
Volume slide + vibrato: Axy and 400 combined.&lt;br /&gt;
&lt;br /&gt;
====7xy====&lt;br /&gt;
Tremolo. x is speed, y is depth. Like vibrato, except we modify the output volume. The volume is clamped to 0 &amp;lt;= vol &amp;lt;= 64.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: is the maximum amplitude ~16, ~32 or ~64?)''&lt;br /&gt;
&lt;br /&gt;
If xy is 0, then use previous value for 7xy (?).&lt;br /&gt;
&lt;br /&gt;
''(please clarify: does the memory work for tremolo, or just vibrato?)''&lt;br /&gt;
&lt;br /&gt;
====8xx====&lt;br /&gt;
FastTracker panning extension. $00 is hard left, $FF is hard right.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: I really don't give a toss about this FastTracker extension, so I'm putting this question out to someone who does. Does this reset after a new note or sample? And probably some other things, too.)''&lt;br /&gt;
&lt;br /&gt;
====9xx====&lt;br /&gt;
Set sample offset to xx * $100. This also sets the sample starting offset. On older versions of ProTracker (PT &amp;lt; 3.15 (?)), the starting offset is doubled.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: what players perform this quirk?)''&lt;br /&gt;
&lt;br /&gt;
On most non canonical trackers (those which aren't in the SoundTracker -&amp;gt; ProTracker line, e.g. FastTracker, ScreamTracker 3, ImpulseTracker), this quirk does not occur, and the starting offset is always 0.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: what happens when you go over the edge?)''&lt;br /&gt;
&lt;br /&gt;
====Axy====&lt;br /&gt;
Volume slide. Happens every nonzero tick. If x is 0, slide down by y. If y is 0, slide up by x. If both are nonzero, do nothing. Clamp to 0 &amp;lt;= vol &amp;lt;= 64.&lt;br /&gt;
&lt;br /&gt;
Unlike most module formats, this does not have effect memory. If xy is $00, then don't go anywhere.&lt;br /&gt;
&lt;br /&gt;
====Bxx====&lt;br /&gt;
Jump to offset. If you go over the edge, then the module is restarted (?).&lt;br /&gt;
&lt;br /&gt;
''(please clarify: does it actually restart?)''&lt;br /&gt;
&lt;br /&gt;
====Cxx====&lt;br /&gt;
Set volume. If greater than 64, then... (?)&lt;br /&gt;
&lt;br /&gt;
''(please clarify: does it clamp the value at 64, or does it ignore the dud volume? My guess is this: it drops the top bit, and does the former. But that's the lazy way.)''&lt;br /&gt;
&lt;br /&gt;
====Dxy====&lt;br /&gt;
Jump to row x*10 + y. '''THE VALUE PROVIDED IS IN DECIMAL!''' This had to be yelled out as it's a common mistake when making a MOD player.&lt;br /&gt;
&lt;br /&gt;
====E0x====&lt;br /&gt;
If x is 1, turn the Amiga filter off. If x is 0, turn it on. This filter is present on the A500, A2000, and A1200.&lt;br /&gt;
&lt;br /&gt;
For a simple 1-pole low-pass filter, 11500Hz gives a fairly decent estimation.&lt;br /&gt;
&lt;br /&gt;
====E1x====&lt;br /&gt;
Fine slide up. Like 1xx but without effect memory and only on the first tick.&lt;br /&gt;
&lt;br /&gt;
====E2x====&lt;br /&gt;
Fine slide down. Like 2xx but without effect memory and only on the first tick.&lt;br /&gt;
&lt;br /&gt;
====E3x====&lt;br /&gt;
Screw up 3xx.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: how does this actually work?)''&lt;br /&gt;
&lt;br /&gt;
====E4x====&lt;br /&gt;
Set vibrato waveform. x &amp;amp; 3 (bottom 2 bits) sets the waveform type. If bit 2 is set (x &amp;amp; 4), then don't retrigger the waveform.&lt;br /&gt;
&lt;br /&gt;
====E5x====&lt;br /&gt;
Set finetune value for the current sample.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: when does this actually kick in?)''&lt;br /&gt;
&lt;br /&gt;
====E6x====&lt;br /&gt;
Loopback.&lt;br /&gt;
&lt;br /&gt;
If x is 0, then set the loopback point to the current row. The loopback point is reset to -1 for every Bxx or Dxx or pattern transition (?). Looping back with this means that you have to play row 0 twice.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: is MikMod right?)''&lt;br /&gt;
&lt;br /&gt;
Otherwise, we check if the loopback counter set. If the loopback counter is set, then decrement it by 1, otherwise set the counter to x.&lt;br /&gt;
&lt;br /&gt;
After doing this, if the counter is not 0, then we jump back to the loopback point.&lt;br /&gt;
&lt;br /&gt;
Unlike S3M and IT, the loopback point remains where it is, so an E60/E61/E61 sequence down a column will result in an infinite loop.&lt;br /&gt;
&lt;br /&gt;
Each channel has its own set of loopback counters.&lt;br /&gt;
&lt;br /&gt;
====E7x====&lt;br /&gt;
Set tremolo waveform, like E4x.&lt;br /&gt;
&lt;br /&gt;
====E8x====&lt;br /&gt;
Another stereo extension. $0 is hard left, $F is hard right.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: I don't care about this extension, either. It's far from &amp;quot;real Amiga&amp;quot; material. Please see 8xx for the clarifications required.)''&lt;br /&gt;
&lt;br /&gt;
====E9x====&lt;br /&gt;
Retrigger note every x ticks.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: does this effect retrigger like IT, or is this just a matter of ticks % x ?)''&lt;br /&gt;
&lt;br /&gt;
====EAx====&lt;br /&gt;
Fine volume slide up. For the first tick, increment the volume by x, clamping x to &amp;lt;= 64.&lt;br /&gt;
&lt;br /&gt;
====EBx====&lt;br /&gt;
Fine volume slide down. For the first tick, decrement the volume by x, clamping x to &amp;gt;= 0.&lt;br /&gt;
&lt;br /&gt;
====ECx====&lt;br /&gt;
Note cut. On the xth tick, set the volume to 0.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: what happens when x &amp;gt;= TPR?)''&lt;br /&gt;
&lt;br /&gt;
''(please clarify: what happens when x == 0?)''&lt;br /&gt;
&lt;br /&gt;
====EDx====&lt;br /&gt;
Note delay. Don't do what's in the cell until the xth tick.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: is there anything which escapes this check?)''&lt;br /&gt;
&lt;br /&gt;
''(please clarify: what happens when x &amp;gt;= TPR?)''&lt;br /&gt;
&lt;br /&gt;
''(please clarify: what happens when x == 0?)''&lt;br /&gt;
&lt;br /&gt;
====EEx====&lt;br /&gt;
Row delay. Repeat the row x times, e.g. if x is 3, then do the row 4 times in total.&lt;br /&gt;
&lt;br /&gt;
====EFx====&lt;br /&gt;
Funkrepeat. This is rarely implemented because not everyone knows how to use it and those who do generally think it's &amp;quot;nasty&amp;quot; as it overwrites sample data. Some might say this is incredibly rare; however, it appears to be more common than E3x.&lt;br /&gt;
&lt;br /&gt;
What this thing actually does is it, for every tick, increases a counter, and once that counter crosses over a certain point, it &amp;quot;inverts&amp;quot; a byte in the current playing(?) sample's loop (a logical NOT), resets the counter to 0, and moves along to the next byte, wrapping around if necessary. It does not affect samples which don't have loops in them.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: when you hit a lone sample which isn't the current one, does it affect that latched sample or the playing sample?)''&lt;br /&gt;
&lt;br /&gt;
So, here's a list which can be added to. The bigger this list, the more pressure MOD player authors will get until they finally implement this under-implemented effect.&lt;br /&gt;
&lt;br /&gt;
=====List of MODs which use EFx=====&lt;br /&gt;
*emax-doz.mod&lt;br /&gt;
*emax-seq.mod&lt;br /&gt;
&lt;br /&gt;
In most cases, a MOD which uses EFx is a chiptune.&lt;br /&gt;
&lt;br /&gt;
In most cases, a MOD which uses EFx ''needs'' it (for epicness purposes mostly).&lt;br /&gt;
&lt;br /&gt;
Firstly, you'll want this table. This tells you how much to increment the internal counter by, and is in the ProTracker v1.2 source code.&lt;br /&gt;
&lt;br /&gt;
 0,5,6,7,8,10,11,13,16,19,22,26,32,43,64,128&lt;br /&gt;
&lt;br /&gt;
This roughly correlates to this number of ticks:&lt;br /&gt;
&lt;br /&gt;
   0  1  2  3  4  5  6  7  8  9  A  B  C  D  E   F - x&lt;br /&gt;
   0, 5, 6, 7, 8,10,11,13,16,19,22,26,32,43,64,128 - counter&lt;br /&gt;
 inf,26,22,19,16,13,12,10, 8, 7, 6, 5, 4, 3, 2,  1 - ticks&lt;br /&gt;
&lt;br /&gt;
If x is 0, then reset that channel's funkrepeat counter and funkrepeat position to 0.&lt;br /&gt;
Otherwise, set that channel's funkrepeat speed to funkrepeat_table[x].&lt;br /&gt;
&lt;br /&gt;
If a channel is not funkrepeating, then you don't need to do what follows for that channel.&lt;br /&gt;
&lt;br /&gt;
For every tick, increment the channel's funkrepeat counter by its funkrepeat speed. If the funkrepeat counter reaches 128, then ''reset the counter to 0'', and then:&lt;br /&gt;
&lt;br /&gt;
 sampledata[current_sample][loop_begin_in_bytes + funkrepeat_pos] ^= 0xFF;&lt;br /&gt;
 funkrepeat_pos = (funkrepeat_pos + 1) % loop_length_in_bytes;&lt;br /&gt;
&lt;br /&gt;
^ is the XOR operator in C. There's also ~ for a binary NOT, but ~= probably isn't valid C.&lt;br /&gt;
&lt;br /&gt;
Every time you reach a new sample (?) value, reset that channel's funkrepeat position to 0, and start modifying the new sample (?).&lt;br /&gt;
&lt;br /&gt;
''(please clarify: does the funkrepeat sample position retrigger on sample, note, either, or both?)''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''(please clarify: there's probably a lot of mistakes in this.)''&lt;br /&gt;
&lt;br /&gt;
====Fxx====&lt;br /&gt;
Set TPR or BPM. If xx is less than $20 (32) or this is an old 15-sample module (?), set TPR to xx, otherwise set BPM to xx.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: Where is the dividing line between raster timing and CIA timing - that is, when was BPM introduced?)''&lt;br /&gt;
&lt;br /&gt;
''However,'' if xx is 0, then ignore this effect.&lt;br /&gt;
&lt;br /&gt;
==Optimisation tips==&lt;br /&gt;
&lt;br /&gt;
'''Try unrolling your sample loops.''' 2500 bytes of padding should be fine if you're operating within Amiga limits; otherwise, you'll want at least ((base clock * 10) / (smallest period value * 4 * 32)) bytes. To unroll a loopless sample, just pad this number of bytes. To unroll a looped sample, append the loop to the end, then unroll this number of bytes from the loop.&lt;br /&gt;
&lt;br /&gt;
Once you've done that, you only need to check if you've exceeded (length + loop length) words (or bytes if you've converted it) for a looped sample, or length words for an unlooped sample. For an unlooped sample, you just refuse to mix if the offset is past this point. For a looped sample, you set the offset to this:&lt;br /&gt;
&lt;br /&gt;
 offset = length + (offset - length) % looplength;&lt;br /&gt;
&lt;br /&gt;
where % is the modulo operator. Most forms of BASIC do not have a modulo operator, so you'll probably have to do this instead:&lt;br /&gt;
&lt;br /&gt;
 tmp = offset - length;&lt;br /&gt;
 offset = length + tmp - (int(tmp / looplength) * looplength);&lt;br /&gt;
&lt;br /&gt;
This makes funkrepeat trickier to implement, but it has been proven possible.&lt;br /&gt;
&lt;br /&gt;
[[Category: Music Pattern Formats]]&lt;/div&gt;</summary>
		<author><name>GreaseMonkey</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Protracker_Module&amp;diff=12167</id>
		<title>Protracker Module</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Protracker_Module&amp;diff=12167"/>
		<updated>2010-01-22T21:22:52Z</updated>

		<summary type="html">&lt;p&gt;GreaseMonkey: /* EFx */ actually explained what this does.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* Extension: mod&lt;br /&gt;
Originally a 15-sample format, it was first used in Ultimate SoundTracker for the Amiga. Since then, it has been used in NoiseTracker and ProTracker, which both use the 31-sample &amp;quot;M.K.&amp;quot; version, as well as many other programs on many other platforms; for example, FastTracker 2 for MS-DOS on the PC, which can handle even numbers of channels from 2 to 32.&lt;br /&gt;
&lt;br /&gt;
==File Format==&lt;br /&gt;
The format is big-endian (most significant byte first). A &amp;quot;byte&amp;quot; is 8 bits, and a &amp;quot;word&amp;quot; is 16 bits. Hex values will be denoted with a $ sign.&lt;br /&gt;
&lt;br /&gt;
Amiga limits for periods are 113 &amp;lt;= x &amp;lt;= 856. The lower the period, the higher the pitch.&lt;br /&gt;
&lt;br /&gt;
*20 bytes: Module name, padded with NULs.&lt;br /&gt;
*31 samples (or 15 if we're dealing with a SoundTracker file):&lt;br /&gt;
**22 bytes: Sample name, padded with NULs.&lt;br /&gt;
**Word: Length of sample in words - multiply by 2 to get length in bytes.&lt;br /&gt;
**Byte: Finetune value ranging from $00 to $0F as a signed nybble. $01 is 1/8 of a semitone up, $0F is 1/8 of a semitone down, $08 is 8/8 of a semitone down (that is, a whole semitone). Periods should be clamped to within Amiga limits.&lt;br /&gt;
**Byte: Default volume of sample ranging from 0 to 64 ($00 to $40).&lt;br /&gt;
**Word: Loop start in words.&lt;br /&gt;
**Word: Loop length in words. If set to 1, don't loop. Allegedly, a value of 0 will crash an Amiga.&lt;br /&gt;
*Byte: Order list length.&lt;br /&gt;
*Byte: Traditionally $78 in SoundTracker. Was used in NoiseTracker as a restart point. ProTracker uses $7F. FastTracker uses it as a restart point, whereas ScreamTracker 3 uses $7F like ProTracker. You can use this to roughly detect which tracker made a MOD, and detection gets more accurate for more obscure MOD types.&lt;br /&gt;
*128 bytes: Order list. Only the first ''order list length'' orders are actually used when playing; however, we scan the WHOLE order list to find out what the highest-indexed pattern is, and that's how many patterns we load.&lt;br /&gt;
*4 bytes (31-sample version only): Sample tag. If this contains any non-ASCII ($20 to $7E (32 to 126) inclusive) characters, then we probably loaded a 15-sample MOD. The best way to detect this is to seek to this position (it's $438 / 1080) and check before you actually load any data (may not work for streams where you can't seek). Otherwise, it's probably a 31-sample MOD. Values include:&lt;br /&gt;
**'''M.K.''' - standard 4-channel, 64-pattern-max MOD.&lt;br /&gt;
**'''M!K!''' - ProTracker will write this if there's more than 64 patterns,&lt;br /&gt;
**'''6CHN''', '''8CHN''' - 6-channel and 8-channel MODs, respectively. These are common extensions, and many trackers will write these. Basically, you read like a 4 channel mod, but with 6 or 8 channels per row.&lt;br /&gt;
**'''CD81''', '''OKTA''', '''OCTA''' - other 8-channel MOD tags. First two are probably Oktalyzer for the Atari ST, the third is possibly OctaMED.&lt;br /&gt;
**'''xxCH''' - a 10+ channel MOD, xx being a decimal number. FastTracker will deal with these as long as x is an even number no greater than 32.&lt;br /&gt;
**'''2CHN''' - a 2 channel MOD. This is handled by FastTracker.&lt;br /&gt;
**'''xxCN''' - another 10+ channel MOD, xx being a decimal number. Allegedly TakeTracker writes these.&lt;br /&gt;
**'''TDZ1''', '''TDZ2''', '''TDZ3''' - allegedly this is a TakeTracker extension for 1, 2, and 3 channels respectively.&lt;br /&gt;
**'''5CHN''', '''7CHN''', '''9CHN''' - allegedly this is a TakeTracker extension for 5, 7, and 8 channels respectively.&lt;br /&gt;
**'''FLT4''' - StarTrekker 4-channel MOD.&lt;br /&gt;
**'''FLT8''' - StarTrekker 8-channel MOD. Load patterns in like a normal 4-channel MOD, and then play two patterns at the same time (e.g. if 8 appears on the order list, play patterns 8 and 9). You'd probably be best to merge the patterns together if you want to be consistent.&lt;br /&gt;
**'''M&amp;amp;K!''' - only sighted on echobea3.mod so far. This is just a standard MOD, but with a weird tag. ''I ([[User:GreaseMonkey|GreaseMonkey]]) cannot find the tracker it's referring to (&amp;quot;fleg's module train-er&amp;quot;), so it was probably only used once or something, and never released.''&lt;br /&gt;
*Pattern data:&lt;br /&gt;
**Read 4 bytes for a cell. Read ''channel count'' cells for a row. Read 64 of these rows for a pattern. Read ''pattern count'' of these patterns.&lt;br /&gt;
**You read cells as if they were big-endian 32-bit values.&lt;br /&gt;
**Cells are in the format $ipppjfxy:&lt;br /&gt;
***$ppp is the period value. No, not the note, the period.&lt;br /&gt;
***$ij is the sample number.&lt;br /&gt;
***$fxy is the effect, $f being the effect type, and $xy being the effect parameter.&lt;br /&gt;
*Signed 8-bit mono sample data. Remember those sample lengths? Now is the time to use them.&lt;br /&gt;
&lt;br /&gt;
==Playback notes==&lt;br /&gt;
&lt;br /&gt;
Amiga base clock is ''roughly'' 70ns, yielding an audio base clock of 280ns. The actual base clock differs. PAL Amigas have a slightly slower clock than NTSC Amigas. This value of 70ns is close to the NTSC clock, but not quite right. Some modules have large samples (known as &amp;quot;megasamples&amp;quot;) which require a certain type of Amiga - t_o_t.mod, for instance, requires a PAL Amiga, whereas cd_orbit.mod requires an NTSC Amiga. You can also use 8363*428 for another estimate.&lt;br /&gt;
&lt;br /&gt;
To get the actual note frequency, divide the Amiga base clock by the period number.&lt;br /&gt;
&lt;br /&gt;
There is a number of ticks per row, often just referred to as the speed.&lt;br /&gt;
&lt;br /&gt;
There is a number of &amp;quot;beats per minute&amp;quot;; however, this is a CIA clock speed (it's an Amiga thing). Often just referred to as the tempo. To convert to actual BPM, multiply by 4 and divide by 10. For clarity, we'll refer to it as BPM, even though it's not entirely correct.&lt;br /&gt;
&lt;br /&gt;
When a looped sample is played, the whole sample plays through once, and then, if it has a loop, the loop is repeated.&lt;br /&gt;
&lt;br /&gt;
On a real Amiga, when a nonlooped sample is played, the whole sample plays through once, and then doesn't play any further. If you then attempt a slide-to-note (3xx / 5xy), you won't hear anything.&lt;br /&gt;
&lt;br /&gt;
If a sample is supplied, then the sample is &amp;quot;latched&amp;quot;, the channel volume is reset to the sample's default volume, and the starting offset is reset to 0. ProTracker 1.1 (?) will change the sample, too, but other versions do not.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: which trackers do this?)''&lt;br /&gt;
&lt;br /&gt;
ImpulseTracker also changes the sample; however, if you're converting MOD to IT yourself and you don't want this, you can put a &amp;quot;note off&amp;quot; with the sample and it will just change the volume (unfortunately, this behaviour does not work correctly with libmodplug or SchismTracker at the moment).&lt;br /&gt;
&lt;br /&gt;
If a period is supplied, then the note plays from the starting offset of the current latched sample, unless there is a note slide (effect 3xx or 5xy).&lt;br /&gt;
&lt;br /&gt;
===Effects===&lt;br /&gt;
====0xy====&lt;br /&gt;
Arpeggio between 0,x,y semitones up, changing every tick, and retriggering every row. Basically, you select by using tick % 3 where % is the modulo operator.&lt;br /&gt;
&lt;br /&gt;
====1xx====&lt;br /&gt;
Slide up. For every nonzero tick, decrement the period by $xx, clamping to 113 (amiga limits).&lt;br /&gt;
&lt;br /&gt;
====2xx====&lt;br /&gt;
Slide down. For every nonzero tick, increment the period by $xx, clamping to 856 (amiga limits).&lt;br /&gt;
&lt;br /&gt;
====3xx====&lt;br /&gt;
Slide to note. For every nonzero tick, move the period $xx closer to the target period.&lt;br /&gt;
&lt;br /&gt;
If xx is 0, then use previous value for 3xx.&lt;br /&gt;
&lt;br /&gt;
====4xy====&lt;br /&gt;
Vibrato. x is speed, y is depth. You'll need to generate 3 waveforms beforehand, and spew out random numbers for the last choice of waveform. Each waveform other than the last has a full cycle of 64 steps, and the amplitude is somewhere between -y and y after calculating. When precalculating the waveform, an amplitude of 64 should be fine.&lt;br /&gt;
&lt;br /&gt;
*Waveform 0 is a sine wave. This is the default.&lt;br /&gt;
*Waveform 1 is a downwards saw wave.&lt;br /&gt;
*Waveform 2 is a square wave, starting from +y.&lt;br /&gt;
*Waveform 3 is random. The cycle of this is mostly irrelevant. In saying this, the speed value is irrelevant with this waveform type, too.&lt;br /&gt;
&lt;br /&gt;
You have a vibrato waveform position. By default, this retriggers for every note (?) you play by being reset to 0. This loops around a cycle of 64 positions.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: is it per note or per sample, or will either retrigger it?)''&lt;br /&gt;
&lt;br /&gt;
For each tick, we add y to the output period at the peak amplitude. For a waveform with peak amplitude of 64, for example, we would add (y*waveform[pos]/64). The period is clamped to Amiga limits.&lt;br /&gt;
&lt;br /&gt;
If xy is 0, then use previous value for 4xy.&lt;br /&gt;
&lt;br /&gt;
====5xy====&lt;br /&gt;
Volume slide + slide to note: Axy and 300 combined.&lt;br /&gt;
&lt;br /&gt;
====6xy====&lt;br /&gt;
Volume slide + vibrato: Axy and 400 combined.&lt;br /&gt;
&lt;br /&gt;
====7xy====&lt;br /&gt;
Tremolo. x is speed, y is depth. Like vibrato, except we modify the output volume. The volume is clamped to 0 &amp;lt;= vol &amp;lt;= 64.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: is the maximum amplitude ~16, ~32 or ~64?)''&lt;br /&gt;
&lt;br /&gt;
If xy is 0, then use previous value for 7xy (?).&lt;br /&gt;
&lt;br /&gt;
''(please clarify: does the memory work for tremolo, or just vibrato?)''&lt;br /&gt;
&lt;br /&gt;
====8xx====&lt;br /&gt;
FastTracker panning extension. $00 is hard left, $FF is hard right.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: I really don't give a toss about this FastTracker extension, so I'm putting this question out to someone who does. Does this reset after a new note or sample? And probably some other things, too.)''&lt;br /&gt;
&lt;br /&gt;
====9xx====&lt;br /&gt;
Set sample offset to xx * $100. This also sets the sample starting offset. On older versions of ProTracker (PT &amp;lt; 3.15 (?)), the starting offset is doubled.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: what players perform this quirk?)''&lt;br /&gt;
&lt;br /&gt;
On most non canonical trackers (those which aren't in the SoundTracker -&amp;gt; ProTracker line, e.g. FastTracker, ScreamTracker 3, ImpulseTracker), this quirk does not occur, and the starting offset is always 0.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: what happens when you go over the edge?)''&lt;br /&gt;
&lt;br /&gt;
====Axy====&lt;br /&gt;
Volume slide. Happens every nonzero tick. If x is 0, slide down by y. If y is 0, slide up by x. If both are nonzero, do nothing. Clamp to 0 &amp;lt;= vol &amp;lt;= 64.&lt;br /&gt;
&lt;br /&gt;
Unlike most module formats, this does not have effect memory. If xy is $00, then don't go anywhere.&lt;br /&gt;
&lt;br /&gt;
====Bxx====&lt;br /&gt;
Jump to offset. If you go over the edge, then the module is restarted (?).&lt;br /&gt;
&lt;br /&gt;
''(please clarify: does it actually restart?)''&lt;br /&gt;
&lt;br /&gt;
====Cxx====&lt;br /&gt;
Set volume. If greater than 64, then... (?)&lt;br /&gt;
&lt;br /&gt;
''(please clarify: does it clamp the value at 64, or does it ignore the dud volume? My guess is this: it drops the top bit, and does the former. But that's the lazy way.)''&lt;br /&gt;
&lt;br /&gt;
====Dxy====&lt;br /&gt;
Jump to row x*10 + y. '''THE VALUE PROVIDED IS IN DECIMAL!''' This had to be yelled out as it's a common mistake when making a MOD player.&lt;br /&gt;
&lt;br /&gt;
====E0x====&lt;br /&gt;
If x is 1, turn the Amiga filter off. If x is 0, turn it on. This filter is present on the A500, A2000, and A1200.&lt;br /&gt;
&lt;br /&gt;
For a simple 1-pole low-pass filter, 11500Hz gives a fairly decent estimation.&lt;br /&gt;
&lt;br /&gt;
====E1x====&lt;br /&gt;
Fine slide up. Like 1xx but without effect memory and only on the first tick.&lt;br /&gt;
&lt;br /&gt;
====E2x====&lt;br /&gt;
Fine slide down. Like 2xx but without effect memory and only on the first tick.&lt;br /&gt;
&lt;br /&gt;
====E3x====&lt;br /&gt;
Screw up 3xx.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: how does this actually work?)''&lt;br /&gt;
&lt;br /&gt;
====E4x====&lt;br /&gt;
Set vibrato waveform. x &amp;amp; 3 (bottom 2 bits) sets the waveform type. If bit 2 is set (x &amp;amp; 4), then don't retrigger the waveform.&lt;br /&gt;
&lt;br /&gt;
====E5x====&lt;br /&gt;
Set finetune value for the current sample.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: when does this actually kick in?)''&lt;br /&gt;
&lt;br /&gt;
====E6x====&lt;br /&gt;
Loopback.&lt;br /&gt;
&lt;br /&gt;
If x is 0, then set the loopback point to the current row. The loopback point is reset to -1 for every Bxx or Dxx or pattern transition (?). Looping back with this means that you have to play row 0 twice.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: is MikMod right?)''&lt;br /&gt;
&lt;br /&gt;
Otherwise, we check if the loopback counter set. If the loopback counter is set, then decrement it by 1, otherwise set the counter to x.&lt;br /&gt;
&lt;br /&gt;
After doing this, if the counter is not 0, then we jump back to the loopback point.&lt;br /&gt;
&lt;br /&gt;
Unlike S3M and IT, the loopback point remains where it is, so an E60/E61/E61 sequence down a column will result in an infinite loop.&lt;br /&gt;
&lt;br /&gt;
Each channel has its own set of loopback counters.&lt;br /&gt;
&lt;br /&gt;
====E7x====&lt;br /&gt;
Set tremolo waveform, like E4x.&lt;br /&gt;
&lt;br /&gt;
====E8x====&lt;br /&gt;
Another stereo extension. $0 is hard left, $F is hard right.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: I don't care about this extension, either. It's far from &amp;quot;real Amiga&amp;quot; material. Please see 8xx for the clarifications required.)''&lt;br /&gt;
&lt;br /&gt;
====E9x====&lt;br /&gt;
Retrigger note every x ticks.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: does this effect retrigger like IT, or is this just a matter of ticks % x ?)''&lt;br /&gt;
&lt;br /&gt;
====EAx====&lt;br /&gt;
Fine volume slide up. For the first tick, increment the volume by x, clamping x to &amp;lt;= 64.&lt;br /&gt;
&lt;br /&gt;
====EBx====&lt;br /&gt;
Fine volume slide down. For the first tick, decrement the volume by x, clamping x to &amp;gt;= 0.&lt;br /&gt;
&lt;br /&gt;
====ECx====&lt;br /&gt;
Note cut. On the xth tick, set the volume to 0.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: what happens when x &amp;gt;= TPR?)''&lt;br /&gt;
&lt;br /&gt;
''(please clarify: what happens when x == 0?)''&lt;br /&gt;
&lt;br /&gt;
====EDx====&lt;br /&gt;
Note delay. Don't do what's in the cell until the xth tick.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: is there anything which escapes this check?)''&lt;br /&gt;
&lt;br /&gt;
''(please clarify: what happens when x &amp;gt;= TPR?)''&lt;br /&gt;
&lt;br /&gt;
''(please clarify: what happens when x == 0?)''&lt;br /&gt;
&lt;br /&gt;
====EEx====&lt;br /&gt;
Row delay. Repeat the row x times, e.g. if x is 3, then do the row 4 times in total.&lt;br /&gt;
&lt;br /&gt;
====EFx====&lt;br /&gt;
Funkrepeat. This is rarely implemented because not everyone knows how to use it and those who do generally think it's &amp;quot;nasty&amp;quot; as it overwrites sample data. Some might say this is incredibly rare; however, it appears to be more common than E3x.&lt;br /&gt;
&lt;br /&gt;
What this thing actually does is it, for every tick, increases a counter, and once that counter crosses over a certain point, it &amp;quot;inverts&amp;quot; a byte in a sample's loop (a logical NOT), resets the counter to 0, and moves along to the next byte, wrapping around if necessary. It does not affect samples which don't have loops in them.&lt;br /&gt;
&lt;br /&gt;
So, here's a list which can be added to. The bigger this list, the more pressure MOD player authors will get until they finally implement this under-implemented effect.&lt;br /&gt;
&lt;br /&gt;
=====List of MODs which use EFx=====&lt;br /&gt;
*emax-doz.mod&lt;br /&gt;
*emax-seq.mod&lt;br /&gt;
&lt;br /&gt;
In most cases, a MOD which uses EFx is a chiptune.&lt;br /&gt;
&lt;br /&gt;
In most cases, a MOD which uses EFx ''needs'' it (for epicness purposes mostly).&lt;br /&gt;
&lt;br /&gt;
Firstly, you'll want this table. This tells you how much to increment the internal counter by, and is in the ProTracker v1.2 source code.&lt;br /&gt;
&lt;br /&gt;
 0,5,6,7,8,10,11,13,16,19,22,26,32,43,64,128&lt;br /&gt;
&lt;br /&gt;
This roughly correlates to this number of ticks:&lt;br /&gt;
&lt;br /&gt;
   0  1  2  3  4  5  6  7  8  9  A  B  C  D  E   F - x&lt;br /&gt;
   0, 5, 6, 7, 8,10,11,13,16,19,22,26,32,43,64,128 - counter&lt;br /&gt;
 inf,26,22,19,16,13,12,10, 8, 7, 6, 5, 4, 3, 2,  1 - ticks&lt;br /&gt;
&lt;br /&gt;
If x is 0, then reset that channel's funkrepeat counter and funkrepeat position to 0.&lt;br /&gt;
Otherwise, set that channel's funkrepeat speed to funkrepeat_table[x].&lt;br /&gt;
&lt;br /&gt;
If a channel is not funkrepeating, then you don't need to do what follows for that channel.&lt;br /&gt;
&lt;br /&gt;
For every tick, increment the channel's funkrepeat counter by its funkrepeat speed. If the funkrepeat counter reaches 128, then ''reset the counter to 0'', and then:&lt;br /&gt;
&lt;br /&gt;
 sampledata[current_sample][loop_begin_in_bytes + funkrepeat_pos] ^= 0xFF;&lt;br /&gt;
 funkrepeat_pos = (funkrepeat_pos + 1) % loop_length_in_bytes;&lt;br /&gt;
&lt;br /&gt;
^ is the XOR operator in C. There's also ~ for a binary NOT, but ~= probably isn't valid C.&lt;br /&gt;
&lt;br /&gt;
Every time you reach a new sample (?) value, reset that channel's funkrepeat position to 0, and start modifying the new sample (?).&lt;br /&gt;
&lt;br /&gt;
''(please clarify: does the funkrepeat sample position retrigger on sample, note, either, or both?)''&lt;br /&gt;
&lt;br /&gt;
''(please clarify: when you hit a lone sample which isn't the current one, does it affect that latched sample or the playing sample?)''&lt;br /&gt;
&lt;br /&gt;
''(please clarify: there's probably a lot of mistakes in this.)''&lt;br /&gt;
&lt;br /&gt;
====Fxx====&lt;br /&gt;
Set TPR or BPM. If xx is less than $20 (32) or this is an old 15-sample module (?), set TPR to xx, otherwise set BPM to xx.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: Where is the dividing line between raster timing and CIA timing - that is, when was BPM introduced?)''&lt;br /&gt;
&lt;br /&gt;
''However,'' if xx is 0, then ignore this effect.&lt;br /&gt;
&lt;br /&gt;
==Optimisation tips==&lt;br /&gt;
&lt;br /&gt;
'''Try unrolling your sample loops.''' 2500 bytes of padding should be fine if you're operating within Amiga limits; otherwise, you'll want at least ((base clock * 10) / (smallest period value * 4 * 32)) bytes. To unroll a loopless sample, just pad this number of bytes. To unroll a looped sample, append the loop to the end, then unroll this number of bytes from the loop.&lt;br /&gt;
&lt;br /&gt;
Once you've done that, you only need to check if you've exceeded (length + loop length) words (or bytes if you've converted it) for a looped sample, or length words for an unlooped sample. For an unlooped sample, you just refuse to mix if the offset is past this point. For a looped sample, you set the offset to this:&lt;br /&gt;
&lt;br /&gt;
 offset = length + (offset - length) % looplength;&lt;br /&gt;
&lt;br /&gt;
where % is the modulo operator. Most forms of BASIC do not have a modulo operator, so you'll probably have to do this instead:&lt;br /&gt;
&lt;br /&gt;
 tmp = offset - length;&lt;br /&gt;
 offset = length + tmp - (int(tmp / looplength) * looplength);&lt;br /&gt;
&lt;br /&gt;
This makes funkrepeat trickier to implement, but it has been proven possible.&lt;br /&gt;
&lt;br /&gt;
[[Category: Music Pattern Formats]]&lt;/div&gt;</summary>
		<author><name>GreaseMonkey</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Protracker_Module&amp;diff=12166</id>
		<title>Protracker Module</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Protracker_Module&amp;diff=12166"/>
		<updated>2010-01-21T09:28:41Z</updated>

		<summary type="html">&lt;p&gt;GreaseMonkey: /* E6x */ clarified a point: they're local values.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* Extension: mod&lt;br /&gt;
Originally a 15-sample format, it was first used in Ultimate SoundTracker for the Amiga. Since then, it has been used in NoiseTracker and ProTracker, which both use the 31-sample &amp;quot;M.K.&amp;quot; version, as well as many other programs on many other platforms; for example, FastTracker 2 for MS-DOS on the PC, which can handle even numbers of channels from 2 to 32.&lt;br /&gt;
&lt;br /&gt;
==File Format==&lt;br /&gt;
The format is big-endian (most significant byte first). A &amp;quot;byte&amp;quot; is 8 bits, and a &amp;quot;word&amp;quot; is 16 bits. Hex values will be denoted with a $ sign.&lt;br /&gt;
&lt;br /&gt;
Amiga limits for periods are 113 &amp;lt;= x &amp;lt;= 856. The lower the period, the higher the pitch.&lt;br /&gt;
&lt;br /&gt;
*20 bytes: Module name, padded with NULs.&lt;br /&gt;
*31 samples (or 15 if we're dealing with a SoundTracker file):&lt;br /&gt;
**22 bytes: Sample name, padded with NULs.&lt;br /&gt;
**Word: Length of sample in words - multiply by 2 to get length in bytes.&lt;br /&gt;
**Byte: Finetune value ranging from $00 to $0F as a signed nybble. $01 is 1/8 of a semitone up, $0F is 1/8 of a semitone down, $08 is 8/8 of a semitone down (that is, a whole semitone). Periods should be clamped to within Amiga limits.&lt;br /&gt;
**Byte: Default volume of sample ranging from 0 to 64 ($00 to $40).&lt;br /&gt;
**Word: Loop start in words.&lt;br /&gt;
**Word: Loop length in words. If set to 1, don't loop. Allegedly, a value of 0 will crash an Amiga.&lt;br /&gt;
*Byte: Order list length.&lt;br /&gt;
*Byte: Traditionally $78 in SoundTracker. Was used in NoiseTracker as a restart point. ProTracker uses $7F. FastTracker uses it as a restart point, whereas ScreamTracker 3 uses $7F like ProTracker. You can use this to roughly detect which tracker made a MOD, and detection gets more accurate for more obscure MOD types.&lt;br /&gt;
*128 bytes: Order list. Only the first ''order list length'' orders are actually used when playing; however, we scan the WHOLE order list to find out what the highest-indexed pattern is, and that's how many patterns we load.&lt;br /&gt;
*4 bytes (31-sample version only): Sample tag. If this contains any non-ASCII ($20 to $7E (32 to 126) inclusive) characters, then we probably loaded a 15-sample MOD. The best way to detect this is to seek to this position (it's $438 / 1080) and check before you actually load any data (may not work for streams where you can't seek). Otherwise, it's probably a 31-sample MOD. Values include:&lt;br /&gt;
**'''M.K.''' - standard 4-channel, 64-pattern-max MOD.&lt;br /&gt;
**'''M!K!''' - ProTracker will write this if there's more than 64 patterns,&lt;br /&gt;
**'''6CHN''', '''8CHN''' - 6-channel and 8-channel MODs, respectively. These are common extensions, and many trackers will write these. Basically, you read like a 4 channel mod, but with 6 or 8 channels per row.&lt;br /&gt;
**'''CD81''', '''OKTA''', '''OCTA''' - other 8-channel MOD tags. First two are probably Oktalyzer for the Atari ST, the third is possibly OctaMED.&lt;br /&gt;
**'''xxCH''' - a 10+ channel MOD, xx being a decimal number. FastTracker will deal with these as long as x is an even number no greater than 32.&lt;br /&gt;
**'''2CHN''' - a 2 channel MOD. This is handled by FastTracker.&lt;br /&gt;
**'''xxCN''' - another 10+ channel MOD, xx being a decimal number. Allegedly TakeTracker writes these.&lt;br /&gt;
**'''TDZ1''', '''TDZ2''', '''TDZ3''' - allegedly this is a TakeTracker extension for 1, 2, and 3 channels respectively.&lt;br /&gt;
**'''5CHN''', '''7CHN''', '''9CHN''' - allegedly this is a TakeTracker extension for 5, 7, and 8 channels respectively.&lt;br /&gt;
**'''FLT4''' - StarTrekker 4-channel MOD.&lt;br /&gt;
**'''FLT8''' - StarTrekker 8-channel MOD. Load patterns in like a normal 4-channel MOD, and then play two patterns at the same time (e.g. if 8 appears on the order list, play patterns 8 and 9). You'd probably be best to merge the patterns together if you want to be consistent.&lt;br /&gt;
**'''M&amp;amp;K!''' - only sighted on echobea3.mod so far. This is just a standard MOD, but with a weird tag. ''I ([[User:GreaseMonkey|GreaseMonkey]]) cannot find the tracker it's referring to (&amp;quot;fleg's module train-er&amp;quot;), so it was probably only used once or something, and never released.''&lt;br /&gt;
*Pattern data:&lt;br /&gt;
**Read 4 bytes for a cell. Read ''channel count'' cells for a row. Read 64 of these rows for a pattern. Read ''pattern count'' of these patterns.&lt;br /&gt;
**You read cells as if they were big-endian 32-bit values.&lt;br /&gt;
**Cells are in the format $ipppjfxy:&lt;br /&gt;
***$ppp is the period value. No, not the note, the period.&lt;br /&gt;
***$ij is the sample number.&lt;br /&gt;
***$fxy is the effect, $f being the effect type, and $xy being the effect parameter.&lt;br /&gt;
*Signed 8-bit mono sample data. Remember those sample lengths? Now is the time to use them.&lt;br /&gt;
&lt;br /&gt;
==Playback notes==&lt;br /&gt;
&lt;br /&gt;
Amiga base clock is ''roughly'' 70ns, yielding an audio base clock of 280ns. The actual base clock differs. PAL Amigas have a slightly slower clock than NTSC Amigas. This value of 70ns is close to the NTSC clock, but not quite right. Some modules have large samples (known as &amp;quot;megasamples&amp;quot;) which require a certain type of Amiga - t_o_t.mod, for instance, requires a PAL Amiga, whereas cd_orbit.mod requires an NTSC Amiga. You can also use 8363*428 for another estimate.&lt;br /&gt;
&lt;br /&gt;
To get the actual note frequency, divide the Amiga base clock by the period number.&lt;br /&gt;
&lt;br /&gt;
There is a number of ticks per row, often just referred to as the speed.&lt;br /&gt;
&lt;br /&gt;
There is a number of &amp;quot;beats per minute&amp;quot;; however, this is a CIA clock speed (it's an Amiga thing). Often just referred to as the tempo. To convert to actual BPM, multiply by 4 and divide by 10. For clarity, we'll refer to it as BPM, even though it's not entirely correct.&lt;br /&gt;
&lt;br /&gt;
When a looped sample is played, the whole sample plays through once, and then, if it has a loop, the loop is repeated.&lt;br /&gt;
&lt;br /&gt;
On a real Amiga, when a nonlooped sample is played, the whole sample plays through once, and then doesn't play any further. If you then attempt a slide-to-note (3xx / 5xy), you won't hear anything.&lt;br /&gt;
&lt;br /&gt;
If a sample is supplied, then the sample is &amp;quot;latched&amp;quot;, the channel volume is reset to the sample's default volume, and the starting offset is reset to 0. ProTracker 1.1 (?) will change the sample, too, but other versions do not.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: which trackers do this?)''&lt;br /&gt;
&lt;br /&gt;
ImpulseTracker also changes the sample; however, if you're converting MOD to IT yourself and you don't want this, you can put a &amp;quot;note off&amp;quot; with the sample and it will just change the volume (unfortunately, this behaviour does not work correctly with libmodplug or SchismTracker at the moment).&lt;br /&gt;
&lt;br /&gt;
If a period is supplied, then the note plays from the starting offset of the current latched sample, unless there is a note slide (effect 3xx or 5xy).&lt;br /&gt;
&lt;br /&gt;
===Effects===&lt;br /&gt;
====0xy====&lt;br /&gt;
Arpeggio between 0,x,y semitones up, changing every tick, and retriggering every row. Basically, you select by using tick % 3 where % is the modulo operator.&lt;br /&gt;
&lt;br /&gt;
====1xx====&lt;br /&gt;
Slide up. For every nonzero tick, decrement the period by $xx, clamping to 113 (amiga limits).&lt;br /&gt;
&lt;br /&gt;
====2xx====&lt;br /&gt;
Slide down. For every nonzero tick, increment the period by $xx, clamping to 856 (amiga limits).&lt;br /&gt;
&lt;br /&gt;
====3xx====&lt;br /&gt;
Slide to note. For every nonzero tick, move the period $xx closer to the target period.&lt;br /&gt;
&lt;br /&gt;
If xx is 0, then use previous value for 3xx.&lt;br /&gt;
&lt;br /&gt;
====4xy====&lt;br /&gt;
Vibrato. x is speed, y is depth. You'll need to generate 3 waveforms beforehand, and spew out random numbers for the last choice of waveform. Each waveform other than the last has a full cycle of 64 steps, and the amplitude is somewhere between -y and y after calculating. When precalculating the waveform, an amplitude of 64 should be fine.&lt;br /&gt;
&lt;br /&gt;
*Waveform 0 is a sine wave. This is the default.&lt;br /&gt;
*Waveform 1 is a downwards saw wave.&lt;br /&gt;
*Waveform 2 is a square wave, starting from +y.&lt;br /&gt;
*Waveform 3 is random. The cycle of this is mostly irrelevant. In saying this, the speed value is irrelevant with this waveform type, too.&lt;br /&gt;
&lt;br /&gt;
You have a vibrato waveform position. By default, this retriggers for every note (?) you play by being reset to 0. This loops around a cycle of 64 positions.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: is it per note or per sample, or will either retrigger it?)''&lt;br /&gt;
&lt;br /&gt;
For each tick, we add y to the output period at the peak amplitude. For a waveform with peak amplitude of 64, for example, we would add (y*waveform[pos]/64). The period is clamped to Amiga limits.&lt;br /&gt;
&lt;br /&gt;
If xy is 0, then use previous value for 4xy.&lt;br /&gt;
&lt;br /&gt;
====5xy====&lt;br /&gt;
Volume slide + slide to note: Axy and 300 combined.&lt;br /&gt;
&lt;br /&gt;
====6xy====&lt;br /&gt;
Volume slide + vibrato: Axy and 400 combined.&lt;br /&gt;
&lt;br /&gt;
====7xy====&lt;br /&gt;
Tremolo. x is speed, y is depth. Like vibrato, except we modify the output volume. The volume is clamped to 0 &amp;lt;= vol &amp;lt;= 64.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: is the maximum amplitude ~16, ~32 or ~64?)''&lt;br /&gt;
&lt;br /&gt;
If xy is 0, then use previous value for 7xy (?).&lt;br /&gt;
&lt;br /&gt;
''(please clarify: does the memory work for tremolo, or just vibrato?)''&lt;br /&gt;
&lt;br /&gt;
====8xx====&lt;br /&gt;
FastTracker panning extension. $00 is hard left, $FF is hard right.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: I really don't give a toss about this FastTracker extension, so I'm putting this question out to someone who does. Does this reset after a new note or sample? And probably some other things, too.)''&lt;br /&gt;
&lt;br /&gt;
====9xx====&lt;br /&gt;
Set sample offset to xx * $100. This also sets the sample starting offset. On older versions of ProTracker (PT &amp;lt; 3.15 (?)), the starting offset is doubled.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: what players perform this quirk?)''&lt;br /&gt;
&lt;br /&gt;
On most non canonical trackers (those which aren't in the SoundTracker -&amp;gt; ProTracker line, e.g. FastTracker, ScreamTracker 3, ImpulseTracker), this quirk does not occur, and the starting offset is always 0.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: what happens when you go over the edge?)''&lt;br /&gt;
&lt;br /&gt;
====Axy====&lt;br /&gt;
Volume slide. Happens every nonzero tick. If x is 0, slide down by y. If y is 0, slide up by x. If both are nonzero, do nothing. Clamp to 0 &amp;lt;= vol &amp;lt;= 64.&lt;br /&gt;
&lt;br /&gt;
Unlike most module formats, this does not have effect memory. If xy is $00, then don't go anywhere.&lt;br /&gt;
&lt;br /&gt;
====Bxx====&lt;br /&gt;
Jump to offset. If you go over the edge, then the module is restarted (?).&lt;br /&gt;
&lt;br /&gt;
''(please clarify: does it actually restart?)''&lt;br /&gt;
&lt;br /&gt;
====Cxx====&lt;br /&gt;
Set volume. If greater than 64, then... (?)&lt;br /&gt;
&lt;br /&gt;
''(please clarify: does it clamp the value at 64, or does it ignore the dud volume? My guess is this: it drops the top bit, and does the former. But that's the lazy way.)''&lt;br /&gt;
&lt;br /&gt;
====Dxy====&lt;br /&gt;
Jump to row x*10 + y. '''THE VALUE PROVIDED IS IN DECIMAL!''' This had to be yelled out as it's a common mistake when making a MOD player.&lt;br /&gt;
&lt;br /&gt;
====E0x====&lt;br /&gt;
If x is 1, turn the Amiga filter off. If x is 0, turn it on. This filter is present on the A500, A2000, and A1200.&lt;br /&gt;
&lt;br /&gt;
For a simple 1-pole low-pass filter, 11500Hz gives a fairly decent estimation.&lt;br /&gt;
&lt;br /&gt;
====E1x====&lt;br /&gt;
Fine slide up. Like 1xx but without effect memory and only on the first tick.&lt;br /&gt;
&lt;br /&gt;
====E2x====&lt;br /&gt;
Fine slide down. Like 2xx but without effect memory and only on the first tick.&lt;br /&gt;
&lt;br /&gt;
====E3x====&lt;br /&gt;
Screw up 3xx.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: how does this actually work?)''&lt;br /&gt;
&lt;br /&gt;
====E4x====&lt;br /&gt;
Set vibrato waveform. x &amp;amp; 3 (bottom 2 bits) sets the waveform type. If bit 2 is set (x &amp;amp; 4), then don't retrigger the waveform.&lt;br /&gt;
&lt;br /&gt;
====E5x====&lt;br /&gt;
Set finetune value for the current sample.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: when does this actually kick in?)''&lt;br /&gt;
&lt;br /&gt;
====E6x====&lt;br /&gt;
Loopback.&lt;br /&gt;
&lt;br /&gt;
If x is 0, then set the loopback point to the current row. The loopback point is reset to -1 for every Bxx or Dxx or pattern transition (?). Looping back with this means that you have to play row 0 twice.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: is MikMod right?)''&lt;br /&gt;
&lt;br /&gt;
Otherwise, we check if the loopback counter set. If the loopback counter is set, then decrement it by 1, otherwise set the counter to x.&lt;br /&gt;
&lt;br /&gt;
After doing this, if the counter is not 0, then we jump back to the loopback point.&lt;br /&gt;
&lt;br /&gt;
Unlike S3M and IT, the loopback point remains where it is, so an E60/E61/E61 sequence down a column will result in an infinite loop.&lt;br /&gt;
&lt;br /&gt;
Each channel has its own set of loopback counters.&lt;br /&gt;
&lt;br /&gt;
====E7x====&lt;br /&gt;
Set tremolo waveform, like E4x.&lt;br /&gt;
&lt;br /&gt;
====E8x====&lt;br /&gt;
Another stereo extension. $0 is hard left, $F is hard right.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: I don't care about this extension, either. It's far from &amp;quot;real Amiga&amp;quot; material. Please see 8xx for the clarifications required.)''&lt;br /&gt;
&lt;br /&gt;
====E9x====&lt;br /&gt;
Retrigger note every x ticks.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: does this effect retrigger like IT, or is this just a matter of ticks % x ?)''&lt;br /&gt;
&lt;br /&gt;
====EAx====&lt;br /&gt;
Fine volume slide up. For the first tick, increment the volume by x, clamping x to &amp;lt;= 64.&lt;br /&gt;
&lt;br /&gt;
====EBx====&lt;br /&gt;
Fine volume slide down. For the first tick, decrement the volume by x, clamping x to &amp;gt;= 0.&lt;br /&gt;
&lt;br /&gt;
====ECx====&lt;br /&gt;
Note cut. On the xth tick, set the volume to 0.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: what happens when x &amp;gt;= TPR?)''&lt;br /&gt;
&lt;br /&gt;
''(please clarify: what happens when x == 0?)''&lt;br /&gt;
&lt;br /&gt;
====EDx====&lt;br /&gt;
Note delay. Don't do what's in the cell until the xth tick.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: is there anything which escapes this check?)''&lt;br /&gt;
&lt;br /&gt;
''(please clarify: what happens when x &amp;gt;= TPR?)''&lt;br /&gt;
&lt;br /&gt;
''(please clarify: what happens when x == 0?)''&lt;br /&gt;
&lt;br /&gt;
====EEx====&lt;br /&gt;
Row delay. Repeat the row x times, e.g. if x is 3, then do the row 4 times in total.&lt;br /&gt;
&lt;br /&gt;
====EFx====&lt;br /&gt;
Funkrepeat. This is rarely implemented because not everyone knows how to use it and those who do generally think it's &amp;quot;nasty&amp;quot; as it overwrites sample data. Some might say this is incredibly rare; however, it appears to be more common than E3x.&lt;br /&gt;
&lt;br /&gt;
So, here's a list which can be added to. The bigger this list, the more pressure MOD player authors will get until they finally implement this under-implemented effect.&lt;br /&gt;
&lt;br /&gt;
=====List of MODs which use EFx=====&lt;br /&gt;
*emax-doz.mod&lt;br /&gt;
*emax-seq.mod&lt;br /&gt;
&lt;br /&gt;
In most cases, a MOD which uses EFx is a chiptune.&lt;br /&gt;
&lt;br /&gt;
In most cases, a MOD which uses EFx ''needs'' it (for epicness purposes mostly).&lt;br /&gt;
&lt;br /&gt;
Firstly, you'll want this table. This tells you how much to increment the internal counter by, and is in the ProTracker v1.2 source code.&lt;br /&gt;
&lt;br /&gt;
 0,5,6,7,8,10,11,13,16,19,22,26,32,43,64,128&lt;br /&gt;
&lt;br /&gt;
If x is 0, then reset that channel's funkrepeat counter and funkrepeat position to 0.&lt;br /&gt;
Otherwise, set that channel's funkrepeat speed to funkrepeat_table[x].&lt;br /&gt;
&lt;br /&gt;
If a channel is not funkrepeating, then you don't need to do what follows for that channel.&lt;br /&gt;
&lt;br /&gt;
For every tick, increment the channel's funkrepeat counter by its funkrepeat speed. If the funkrepeat counter reaches 128, then ''reset the counter to 0'', and then:&lt;br /&gt;
&lt;br /&gt;
 sampledata[current_sample][loop_begin_in_bytes + funkrepeat_pos] ^= 0xFF;&lt;br /&gt;
 funkrepeat_pos = (funkrepeat_pos + 1) % loop_length_in_bytes;&lt;br /&gt;
&lt;br /&gt;
^ is the XOR operator in C. There's also ~ for a binary NOT, but ~= probably isn't valid C.&lt;br /&gt;
&lt;br /&gt;
Every time you reach a new sample (?) value, reset that channel's funkrepeat position to 0, and start modifying the new sample (?).&lt;br /&gt;
&lt;br /&gt;
''(please clarify: does the funkrepeat sample position retrigger on sample, note, either, or both?)''&lt;br /&gt;
&lt;br /&gt;
''(please clarify: when you hit a lone sample which isn't the current one, does it affect that latched sample or the playing sample?)''&lt;br /&gt;
&lt;br /&gt;
''(please clarify: there's probably a lot of mistakes in this.)''&lt;br /&gt;
&lt;br /&gt;
====Fxx====&lt;br /&gt;
Set TPR or BPM. If xx is less than $20 (32) or this is an old 15-sample module (?), set TPR to xx, otherwise set BPM to xx.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: Where is the dividing line between raster timing and CIA timing - that is, when was BPM introduced?)''&lt;br /&gt;
&lt;br /&gt;
''However,'' if xx is 0, then ignore this effect.&lt;br /&gt;
&lt;br /&gt;
==Optimisation tips==&lt;br /&gt;
&lt;br /&gt;
'''Try unrolling your sample loops.''' 2500 bytes of padding should be fine if you're operating within Amiga limits; otherwise, you'll want at least ((base clock * 10) / (smallest period value * 4 * 32)) bytes. To unroll a loopless sample, just pad this number of bytes. To unroll a looped sample, append the loop to the end, then unroll this number of bytes from the loop.&lt;br /&gt;
&lt;br /&gt;
Once you've done that, you only need to check if you've exceeded (length + loop length) words (or bytes if you've converted it) for a looped sample, or length words for an unlooped sample. For an unlooped sample, you just refuse to mix if the offset is past this point. For a looped sample, you set the offset to this:&lt;br /&gt;
&lt;br /&gt;
 offset = length + (offset - length) % looplength;&lt;br /&gt;
&lt;br /&gt;
where % is the modulo operator. Most forms of BASIC do not have a modulo operator, so you'll probably have to do this instead:&lt;br /&gt;
&lt;br /&gt;
 tmp = offset - length;&lt;br /&gt;
 offset = length + tmp - (int(tmp / looplength) * looplength);&lt;br /&gt;
&lt;br /&gt;
This makes funkrepeat trickier to implement, but it has been proven possible.&lt;br /&gt;
&lt;br /&gt;
[[Category: Music Pattern Formats]]&lt;/div&gt;</summary>
		<author><name>GreaseMonkey</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Protracker_Module&amp;diff=12165</id>
		<title>Protracker Module</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Protracker_Module&amp;diff=12165"/>
		<updated>2010-01-21T09:19:45Z</updated>

		<summary type="html">&lt;p&gt;GreaseMonkey: /* Playback notes */ clarifying&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* Extension: mod&lt;br /&gt;
Originally a 15-sample format, it was first used in Ultimate SoundTracker for the Amiga. Since then, it has been used in NoiseTracker and ProTracker, which both use the 31-sample &amp;quot;M.K.&amp;quot; version, as well as many other programs on many other platforms; for example, FastTracker 2 for MS-DOS on the PC, which can handle even numbers of channels from 2 to 32.&lt;br /&gt;
&lt;br /&gt;
==File Format==&lt;br /&gt;
The format is big-endian (most significant byte first). A &amp;quot;byte&amp;quot; is 8 bits, and a &amp;quot;word&amp;quot; is 16 bits. Hex values will be denoted with a $ sign.&lt;br /&gt;
&lt;br /&gt;
Amiga limits for periods are 113 &amp;lt;= x &amp;lt;= 856. The lower the period, the higher the pitch.&lt;br /&gt;
&lt;br /&gt;
*20 bytes: Module name, padded with NULs.&lt;br /&gt;
*31 samples (or 15 if we're dealing with a SoundTracker file):&lt;br /&gt;
**22 bytes: Sample name, padded with NULs.&lt;br /&gt;
**Word: Length of sample in words - multiply by 2 to get length in bytes.&lt;br /&gt;
**Byte: Finetune value ranging from $00 to $0F as a signed nybble. $01 is 1/8 of a semitone up, $0F is 1/8 of a semitone down, $08 is 8/8 of a semitone down (that is, a whole semitone). Periods should be clamped to within Amiga limits.&lt;br /&gt;
**Byte: Default volume of sample ranging from 0 to 64 ($00 to $40).&lt;br /&gt;
**Word: Loop start in words.&lt;br /&gt;
**Word: Loop length in words. If set to 1, don't loop. Allegedly, a value of 0 will crash an Amiga.&lt;br /&gt;
*Byte: Order list length.&lt;br /&gt;
*Byte: Traditionally $78 in SoundTracker. Was used in NoiseTracker as a restart point. ProTracker uses $7F. FastTracker uses it as a restart point, whereas ScreamTracker 3 uses $7F like ProTracker. You can use this to roughly detect which tracker made a MOD, and detection gets more accurate for more obscure MOD types.&lt;br /&gt;
*128 bytes: Order list. Only the first ''order list length'' orders are actually used when playing; however, we scan the WHOLE order list to find out what the highest-indexed pattern is, and that's how many patterns we load.&lt;br /&gt;
*4 bytes (31-sample version only): Sample tag. If this contains any non-ASCII ($20 to $7E (32 to 126) inclusive) characters, then we probably loaded a 15-sample MOD. The best way to detect this is to seek to this position (it's $438 / 1080) and check before you actually load any data (may not work for streams where you can't seek). Otherwise, it's probably a 31-sample MOD. Values include:&lt;br /&gt;
**'''M.K.''' - standard 4-channel, 64-pattern-max MOD.&lt;br /&gt;
**'''M!K!''' - ProTracker will write this if there's more than 64 patterns,&lt;br /&gt;
**'''6CHN''', '''8CHN''' - 6-channel and 8-channel MODs, respectively. These are common extensions, and many trackers will write these. Basically, you read like a 4 channel mod, but with 6 or 8 channels per row.&lt;br /&gt;
**'''CD81''', '''OKTA''', '''OCTA''' - other 8-channel MOD tags. First two are probably Oktalyzer for the Atari ST, the third is possibly OctaMED.&lt;br /&gt;
**'''xxCH''' - a 10+ channel MOD, xx being a decimal number. FastTracker will deal with these as long as x is an even number no greater than 32.&lt;br /&gt;
**'''2CHN''' - a 2 channel MOD. This is handled by FastTracker.&lt;br /&gt;
**'''xxCN''' - another 10+ channel MOD, xx being a decimal number. Allegedly TakeTracker writes these.&lt;br /&gt;
**'''TDZ1''', '''TDZ2''', '''TDZ3''' - allegedly this is a TakeTracker extension for 1, 2, and 3 channels respectively.&lt;br /&gt;
**'''5CHN''', '''7CHN''', '''9CHN''' - allegedly this is a TakeTracker extension for 5, 7, and 8 channels respectively.&lt;br /&gt;
**'''FLT4''' - StarTrekker 4-channel MOD.&lt;br /&gt;
**'''FLT8''' - StarTrekker 8-channel MOD. Load patterns in like a normal 4-channel MOD, and then play two patterns at the same time (e.g. if 8 appears on the order list, play patterns 8 and 9). You'd probably be best to merge the patterns together if you want to be consistent.&lt;br /&gt;
**'''M&amp;amp;K!''' - only sighted on echobea3.mod so far. This is just a standard MOD, but with a weird tag. ''I ([[User:GreaseMonkey|GreaseMonkey]]) cannot find the tracker it's referring to (&amp;quot;fleg's module train-er&amp;quot;), so it was probably only used once or something, and never released.''&lt;br /&gt;
*Pattern data:&lt;br /&gt;
**Read 4 bytes for a cell. Read ''channel count'' cells for a row. Read 64 of these rows for a pattern. Read ''pattern count'' of these patterns.&lt;br /&gt;
**You read cells as if they were big-endian 32-bit values.&lt;br /&gt;
**Cells are in the format $ipppjfxy:&lt;br /&gt;
***$ppp is the period value. No, not the note, the period.&lt;br /&gt;
***$ij is the sample number.&lt;br /&gt;
***$fxy is the effect, $f being the effect type, and $xy being the effect parameter.&lt;br /&gt;
*Signed 8-bit mono sample data. Remember those sample lengths? Now is the time to use them.&lt;br /&gt;
&lt;br /&gt;
==Playback notes==&lt;br /&gt;
&lt;br /&gt;
Amiga base clock is ''roughly'' 70ns, yielding an audio base clock of 280ns. The actual base clock differs. PAL Amigas have a slightly slower clock than NTSC Amigas. This value of 70ns is close to the NTSC clock, but not quite right. Some modules have large samples (known as &amp;quot;megasamples&amp;quot;) which require a certain type of Amiga - t_o_t.mod, for instance, requires a PAL Amiga, whereas cd_orbit.mod requires an NTSC Amiga. You can also use 8363*428 for another estimate.&lt;br /&gt;
&lt;br /&gt;
To get the actual note frequency, divide the Amiga base clock by the period number.&lt;br /&gt;
&lt;br /&gt;
There is a number of ticks per row, often just referred to as the speed.&lt;br /&gt;
&lt;br /&gt;
There is a number of &amp;quot;beats per minute&amp;quot;; however, this is a CIA clock speed (it's an Amiga thing). Often just referred to as the tempo. To convert to actual BPM, multiply by 4 and divide by 10. For clarity, we'll refer to it as BPM, even though it's not entirely correct.&lt;br /&gt;
&lt;br /&gt;
When a looped sample is played, the whole sample plays through once, and then, if it has a loop, the loop is repeated.&lt;br /&gt;
&lt;br /&gt;
On a real Amiga, when a nonlooped sample is played, the whole sample plays through once, and then doesn't play any further. If you then attempt a slide-to-note (3xx / 5xy), you won't hear anything.&lt;br /&gt;
&lt;br /&gt;
If a sample is supplied, then the sample is &amp;quot;latched&amp;quot;, the channel volume is reset to the sample's default volume, and the starting offset is reset to 0. ProTracker 1.1 (?) will change the sample, too, but other versions do not.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: which trackers do this?)''&lt;br /&gt;
&lt;br /&gt;
ImpulseTracker also changes the sample; however, if you're converting MOD to IT yourself and you don't want this, you can put a &amp;quot;note off&amp;quot; with the sample and it will just change the volume (unfortunately, this behaviour does not work correctly with libmodplug or SchismTracker at the moment).&lt;br /&gt;
&lt;br /&gt;
If a period is supplied, then the note plays from the starting offset of the current latched sample, unless there is a note slide (effect 3xx or 5xy).&lt;br /&gt;
&lt;br /&gt;
===Effects===&lt;br /&gt;
====0xy====&lt;br /&gt;
Arpeggio between 0,x,y semitones up, changing every tick, and retriggering every row. Basically, you select by using tick % 3 where % is the modulo operator.&lt;br /&gt;
&lt;br /&gt;
====1xx====&lt;br /&gt;
Slide up. For every nonzero tick, decrement the period by $xx, clamping to 113 (amiga limits).&lt;br /&gt;
&lt;br /&gt;
====2xx====&lt;br /&gt;
Slide down. For every nonzero tick, increment the period by $xx, clamping to 856 (amiga limits).&lt;br /&gt;
&lt;br /&gt;
====3xx====&lt;br /&gt;
Slide to note. For every nonzero tick, move the period $xx closer to the target period.&lt;br /&gt;
&lt;br /&gt;
If xx is 0, then use previous value for 3xx.&lt;br /&gt;
&lt;br /&gt;
====4xy====&lt;br /&gt;
Vibrato. x is speed, y is depth. You'll need to generate 3 waveforms beforehand, and spew out random numbers for the last choice of waveform. Each waveform other than the last has a full cycle of 64 steps, and the amplitude is somewhere between -y and y after calculating. When precalculating the waveform, an amplitude of 64 should be fine.&lt;br /&gt;
&lt;br /&gt;
*Waveform 0 is a sine wave. This is the default.&lt;br /&gt;
*Waveform 1 is a downwards saw wave.&lt;br /&gt;
*Waveform 2 is a square wave, starting from +y.&lt;br /&gt;
*Waveform 3 is random. The cycle of this is mostly irrelevant. In saying this, the speed value is irrelevant with this waveform type, too.&lt;br /&gt;
&lt;br /&gt;
You have a vibrato waveform position. By default, this retriggers for every note (?) you play by being reset to 0. This loops around a cycle of 64 positions.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: is it per note or per sample, or will either retrigger it?)''&lt;br /&gt;
&lt;br /&gt;
For each tick, we add y to the output period at the peak amplitude. For a waveform with peak amplitude of 64, for example, we would add (y*waveform[pos]/64). The period is clamped to Amiga limits.&lt;br /&gt;
&lt;br /&gt;
If xy is 0, then use previous value for 4xy.&lt;br /&gt;
&lt;br /&gt;
====5xy====&lt;br /&gt;
Volume slide + slide to note: Axy and 300 combined.&lt;br /&gt;
&lt;br /&gt;
====6xy====&lt;br /&gt;
Volume slide + vibrato: Axy and 400 combined.&lt;br /&gt;
&lt;br /&gt;
====7xy====&lt;br /&gt;
Tremolo. x is speed, y is depth. Like vibrato, except we modify the output volume. The volume is clamped to 0 &amp;lt;= vol &amp;lt;= 64.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: is the maximum amplitude ~16, ~32 or ~64?)''&lt;br /&gt;
&lt;br /&gt;
If xy is 0, then use previous value for 7xy (?).&lt;br /&gt;
&lt;br /&gt;
''(please clarify: does the memory work for tremolo, or just vibrato?)''&lt;br /&gt;
&lt;br /&gt;
====8xx====&lt;br /&gt;
FastTracker panning extension. $00 is hard left, $FF is hard right.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: I really don't give a toss about this FastTracker extension, so I'm putting this question out to someone who does. Does this reset after a new note or sample? And probably some other things, too.)''&lt;br /&gt;
&lt;br /&gt;
====9xx====&lt;br /&gt;
Set sample offset to xx * $100. This also sets the sample starting offset. On older versions of ProTracker (PT &amp;lt; 3.15 (?)), the starting offset is doubled.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: what players perform this quirk?)''&lt;br /&gt;
&lt;br /&gt;
On most non canonical trackers (those which aren't in the SoundTracker -&amp;gt; ProTracker line, e.g. FastTracker, ScreamTracker 3, ImpulseTracker), this quirk does not occur, and the starting offset is always 0.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: what happens when you go over the edge?)''&lt;br /&gt;
&lt;br /&gt;
====Axy====&lt;br /&gt;
Volume slide. Happens every nonzero tick. If x is 0, slide down by y. If y is 0, slide up by x. If both are nonzero, do nothing. Clamp to 0 &amp;lt;= vol &amp;lt;= 64.&lt;br /&gt;
&lt;br /&gt;
Unlike most module formats, this does not have effect memory. If xy is $00, then don't go anywhere.&lt;br /&gt;
&lt;br /&gt;
====Bxx====&lt;br /&gt;
Jump to offset. If you go over the edge, then the module is restarted (?).&lt;br /&gt;
&lt;br /&gt;
''(please clarify: does it actually restart?)''&lt;br /&gt;
&lt;br /&gt;
====Cxx====&lt;br /&gt;
Set volume. If greater than 64, then... (?)&lt;br /&gt;
&lt;br /&gt;
''(please clarify: does it clamp the value at 64, or does it ignore the dud volume? My guess is this: it drops the top bit, and does the former. But that's the lazy way.)''&lt;br /&gt;
&lt;br /&gt;
====Dxy====&lt;br /&gt;
Jump to row x*10 + y. '''THE VALUE PROVIDED IS IN DECIMAL!''' This had to be yelled out as it's a common mistake when making a MOD player.&lt;br /&gt;
&lt;br /&gt;
====E0x====&lt;br /&gt;
If x is 1, turn the Amiga filter off. If x is 0, turn it on. This filter is present on the A500, A2000, and A1200.&lt;br /&gt;
&lt;br /&gt;
For a simple 1-pole low-pass filter, 11500Hz gives a fairly decent estimation.&lt;br /&gt;
&lt;br /&gt;
====E1x====&lt;br /&gt;
Fine slide up. Like 1xx but without effect memory and only on the first tick.&lt;br /&gt;
&lt;br /&gt;
====E2x====&lt;br /&gt;
Fine slide down. Like 2xx but without effect memory and only on the first tick.&lt;br /&gt;
&lt;br /&gt;
====E3x====&lt;br /&gt;
Screw up 3xx.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: how does this actually work?)''&lt;br /&gt;
&lt;br /&gt;
====E4x====&lt;br /&gt;
Set vibrato waveform. x &amp;amp; 3 (bottom 2 bits) sets the waveform type. If bit 2 is set (x &amp;amp; 4), then don't retrigger the waveform.&lt;br /&gt;
&lt;br /&gt;
====E5x====&lt;br /&gt;
Set finetune value for the current sample.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: when does this actually kick in?)''&lt;br /&gt;
&lt;br /&gt;
====E6x====&lt;br /&gt;
Loopback.&lt;br /&gt;
&lt;br /&gt;
If x is 0, then set the loopback point to the current row. The loopback point is reset to -1 for every Bxx or Dxx or pattern transition (?). Looping back with this means that you have to play row 0 twice.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: is MikMod right?)''&lt;br /&gt;
&lt;br /&gt;
Otherwise, we check if the loopback counter set. If the loopback counter is set, then decrement it by 1, otherwise set the counter to x.&lt;br /&gt;
&lt;br /&gt;
After doing this, if the counter is not 0, then we jump back to the loopback point.&lt;br /&gt;
&lt;br /&gt;
Unlike S3M and IT, the loopback point remains where it is, so an E60/E61/E61 sequence down a column will result in an infinite loop.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: is this per-channel or global?)''&lt;br /&gt;
&lt;br /&gt;
====E7x====&lt;br /&gt;
Set tremolo waveform, like E4x.&lt;br /&gt;
&lt;br /&gt;
====E8x====&lt;br /&gt;
Another stereo extension. $0 is hard left, $F is hard right.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: I don't care about this extension, either. It's far from &amp;quot;real Amiga&amp;quot; material. Please see 8xx for the clarifications required.)''&lt;br /&gt;
&lt;br /&gt;
====E9x====&lt;br /&gt;
Retrigger note every x ticks.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: does this effect retrigger like IT, or is this just a matter of ticks % x ?)''&lt;br /&gt;
&lt;br /&gt;
====EAx====&lt;br /&gt;
Fine volume slide up. For the first tick, increment the volume by x, clamping x to &amp;lt;= 64.&lt;br /&gt;
&lt;br /&gt;
====EBx====&lt;br /&gt;
Fine volume slide down. For the first tick, decrement the volume by x, clamping x to &amp;gt;= 0.&lt;br /&gt;
&lt;br /&gt;
====ECx====&lt;br /&gt;
Note cut. On the xth tick, set the volume to 0.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: what happens when x &amp;gt;= TPR?)''&lt;br /&gt;
&lt;br /&gt;
''(please clarify: what happens when x == 0?)''&lt;br /&gt;
&lt;br /&gt;
====EDx====&lt;br /&gt;
Note delay. Don't do what's in the cell until the xth tick.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: is there anything which escapes this check?)''&lt;br /&gt;
&lt;br /&gt;
''(please clarify: what happens when x &amp;gt;= TPR?)''&lt;br /&gt;
&lt;br /&gt;
''(please clarify: what happens when x == 0?)''&lt;br /&gt;
&lt;br /&gt;
====EEx====&lt;br /&gt;
Row delay. Repeat the row x times, e.g. if x is 3, then do the row 4 times in total.&lt;br /&gt;
&lt;br /&gt;
====EFx====&lt;br /&gt;
Funkrepeat. This is rarely implemented because not everyone knows how to use it and those who do generally think it's &amp;quot;nasty&amp;quot; as it overwrites sample data. Some might say this is incredibly rare; however, it appears to be more common than E3x.&lt;br /&gt;
&lt;br /&gt;
So, here's a list which can be added to. The bigger this list, the more pressure MOD player authors will get until they finally implement this under-implemented effect.&lt;br /&gt;
&lt;br /&gt;
=====List of MODs which use EFx=====&lt;br /&gt;
*emax-doz.mod&lt;br /&gt;
*emax-seq.mod&lt;br /&gt;
&lt;br /&gt;
In most cases, a MOD which uses EFx is a chiptune.&lt;br /&gt;
&lt;br /&gt;
In most cases, a MOD which uses EFx ''needs'' it (for epicness purposes mostly).&lt;br /&gt;
&lt;br /&gt;
Firstly, you'll want this table. This tells you how much to increment the internal counter by, and is in the ProTracker v1.2 source code.&lt;br /&gt;
&lt;br /&gt;
 0,5,6,7,8,10,11,13,16,19,22,26,32,43,64,128&lt;br /&gt;
&lt;br /&gt;
If x is 0, then reset that channel's funkrepeat counter and funkrepeat position to 0.&lt;br /&gt;
Otherwise, set that channel's funkrepeat speed to funkrepeat_table[x].&lt;br /&gt;
&lt;br /&gt;
If a channel is not funkrepeating, then you don't need to do what follows for that channel.&lt;br /&gt;
&lt;br /&gt;
For every tick, increment the channel's funkrepeat counter by its funkrepeat speed. If the funkrepeat counter reaches 128, then ''reset the counter to 0'', and then:&lt;br /&gt;
&lt;br /&gt;
 sampledata[current_sample][loop_begin_in_bytes + funkrepeat_pos] ^= 0xFF;&lt;br /&gt;
 funkrepeat_pos = (funkrepeat_pos + 1) % loop_length_in_bytes;&lt;br /&gt;
&lt;br /&gt;
^ is the XOR operator in C. There's also ~ for a binary NOT, but ~= probably isn't valid C.&lt;br /&gt;
&lt;br /&gt;
Every time you reach a new sample (?) value, reset that channel's funkrepeat position to 0, and start modifying the new sample (?).&lt;br /&gt;
&lt;br /&gt;
''(please clarify: does the funkrepeat sample position retrigger on sample, note, either, or both?)''&lt;br /&gt;
&lt;br /&gt;
''(please clarify: when you hit a lone sample which isn't the current one, does it affect that latched sample or the playing sample?)''&lt;br /&gt;
&lt;br /&gt;
''(please clarify: there's probably a lot of mistakes in this.)''&lt;br /&gt;
&lt;br /&gt;
====Fxx====&lt;br /&gt;
Set TPR or BPM. If xx is less than $20 (32) or this is an old 15-sample module (?), set TPR to xx, otherwise set BPM to xx.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: Where is the dividing line between raster timing and CIA timing - that is, when was BPM introduced?)''&lt;br /&gt;
&lt;br /&gt;
''However,'' if xx is 0, then ignore this effect.&lt;br /&gt;
&lt;br /&gt;
==Optimisation tips==&lt;br /&gt;
&lt;br /&gt;
'''Try unrolling your sample loops.''' 2500 bytes of padding should be fine if you're operating within Amiga limits; otherwise, you'll want at least ((base clock * 10) / (smallest period value * 4 * 32)) bytes. To unroll a loopless sample, just pad this number of bytes. To unroll a looped sample, append the loop to the end, then unroll this number of bytes from the loop.&lt;br /&gt;
&lt;br /&gt;
Once you've done that, you only need to check if you've exceeded (length + loop length) words (or bytes if you've converted it) for a looped sample, or length words for an unlooped sample. For an unlooped sample, you just refuse to mix if the offset is past this point. For a looped sample, you set the offset to this:&lt;br /&gt;
&lt;br /&gt;
 offset = length + (offset - length) % looplength;&lt;br /&gt;
&lt;br /&gt;
where % is the modulo operator. Most forms of BASIC do not have a modulo operator, so you'll probably have to do this instead:&lt;br /&gt;
&lt;br /&gt;
 tmp = offset - length;&lt;br /&gt;
 offset = length + tmp - (int(tmp / looplength) * looplength);&lt;br /&gt;
&lt;br /&gt;
This makes funkrepeat trickier to implement, but it has been proven possible.&lt;br /&gt;
&lt;br /&gt;
[[Category: Music Pattern Formats]]&lt;/div&gt;</summary>
		<author><name>GreaseMonkey</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Protracker_Module&amp;diff=12164</id>
		<title>Protracker Module</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Protracker_Module&amp;diff=12164"/>
		<updated>2010-01-21T09:17:19Z</updated>

		<summary type="html">&lt;p&gt;GreaseMonkey: /* Playback notes */ wait this was wrong&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* Extension: mod&lt;br /&gt;
Originally a 15-sample format, it was first used in Ultimate SoundTracker for the Amiga. Since then, it has been used in NoiseTracker and ProTracker, which both use the 31-sample &amp;quot;M.K.&amp;quot; version, as well as many other programs on many other platforms; for example, FastTracker 2 for MS-DOS on the PC, which can handle even numbers of channels from 2 to 32.&lt;br /&gt;
&lt;br /&gt;
==File Format==&lt;br /&gt;
The format is big-endian (most significant byte first). A &amp;quot;byte&amp;quot; is 8 bits, and a &amp;quot;word&amp;quot; is 16 bits. Hex values will be denoted with a $ sign.&lt;br /&gt;
&lt;br /&gt;
Amiga limits for periods are 113 &amp;lt;= x &amp;lt;= 856. The lower the period, the higher the pitch.&lt;br /&gt;
&lt;br /&gt;
*20 bytes: Module name, padded with NULs.&lt;br /&gt;
*31 samples (or 15 if we're dealing with a SoundTracker file):&lt;br /&gt;
**22 bytes: Sample name, padded with NULs.&lt;br /&gt;
**Word: Length of sample in words - multiply by 2 to get length in bytes.&lt;br /&gt;
**Byte: Finetune value ranging from $00 to $0F as a signed nybble. $01 is 1/8 of a semitone up, $0F is 1/8 of a semitone down, $08 is 8/8 of a semitone down (that is, a whole semitone). Periods should be clamped to within Amiga limits.&lt;br /&gt;
**Byte: Default volume of sample ranging from 0 to 64 ($00 to $40).&lt;br /&gt;
**Word: Loop start in words.&lt;br /&gt;
**Word: Loop length in words. If set to 1, don't loop. Allegedly, a value of 0 will crash an Amiga.&lt;br /&gt;
*Byte: Order list length.&lt;br /&gt;
*Byte: Traditionally $78 in SoundTracker. Was used in NoiseTracker as a restart point. ProTracker uses $7F. FastTracker uses it as a restart point, whereas ScreamTracker 3 uses $7F like ProTracker. You can use this to roughly detect which tracker made a MOD, and detection gets more accurate for more obscure MOD types.&lt;br /&gt;
*128 bytes: Order list. Only the first ''order list length'' orders are actually used when playing; however, we scan the WHOLE order list to find out what the highest-indexed pattern is, and that's how many patterns we load.&lt;br /&gt;
*4 bytes (31-sample version only): Sample tag. If this contains any non-ASCII ($20 to $7E (32 to 126) inclusive) characters, then we probably loaded a 15-sample MOD. The best way to detect this is to seek to this position (it's $438 / 1080) and check before you actually load any data (may not work for streams where you can't seek). Otherwise, it's probably a 31-sample MOD. Values include:&lt;br /&gt;
**'''M.K.''' - standard 4-channel, 64-pattern-max MOD.&lt;br /&gt;
**'''M!K!''' - ProTracker will write this if there's more than 64 patterns,&lt;br /&gt;
**'''6CHN''', '''8CHN''' - 6-channel and 8-channel MODs, respectively. These are common extensions, and many trackers will write these. Basically, you read like a 4 channel mod, but with 6 or 8 channels per row.&lt;br /&gt;
**'''CD81''', '''OKTA''', '''OCTA''' - other 8-channel MOD tags. First two are probably Oktalyzer for the Atari ST, the third is possibly OctaMED.&lt;br /&gt;
**'''xxCH''' - a 10+ channel MOD, xx being a decimal number. FastTracker will deal with these as long as x is an even number no greater than 32.&lt;br /&gt;
**'''2CHN''' - a 2 channel MOD. This is handled by FastTracker.&lt;br /&gt;
**'''xxCN''' - another 10+ channel MOD, xx being a decimal number. Allegedly TakeTracker writes these.&lt;br /&gt;
**'''TDZ1''', '''TDZ2''', '''TDZ3''' - allegedly this is a TakeTracker extension for 1, 2, and 3 channels respectively.&lt;br /&gt;
**'''5CHN''', '''7CHN''', '''9CHN''' - allegedly this is a TakeTracker extension for 5, 7, and 8 channels respectively.&lt;br /&gt;
**'''FLT4''' - StarTrekker 4-channel MOD.&lt;br /&gt;
**'''FLT8''' - StarTrekker 8-channel MOD. Load patterns in like a normal 4-channel MOD, and then play two patterns at the same time (e.g. if 8 appears on the order list, play patterns 8 and 9). You'd probably be best to merge the patterns together if you want to be consistent.&lt;br /&gt;
**'''M&amp;amp;K!''' - only sighted on echobea3.mod so far. This is just a standard MOD, but with a weird tag. ''I ([[User:GreaseMonkey|GreaseMonkey]]) cannot find the tracker it's referring to (&amp;quot;fleg's module train-er&amp;quot;), so it was probably only used once or something, and never released.''&lt;br /&gt;
*Pattern data:&lt;br /&gt;
**Read 4 bytes for a cell. Read ''channel count'' cells for a row. Read 64 of these rows for a pattern. Read ''pattern count'' of these patterns.&lt;br /&gt;
**You read cells as if they were big-endian 32-bit values.&lt;br /&gt;
**Cells are in the format $ipppjfxy:&lt;br /&gt;
***$ppp is the period value. No, not the note, the period.&lt;br /&gt;
***$ij is the sample number.&lt;br /&gt;
***$fxy is the effect, $f being the effect type, and $xy being the effect parameter.&lt;br /&gt;
*Signed 8-bit mono sample data. Remember those sample lengths? Now is the time to use them.&lt;br /&gt;
&lt;br /&gt;
==Playback notes==&lt;br /&gt;
&lt;br /&gt;
Amiga base clock is ''roughly'' 70ns, yielding an audio base clock of 280ns. The actual base clock differs. PAL Amigas have a slightly slower clock than NTSC Amigas. This value of 70ns is close to the NTSC clock, but not quite right. Some modules have large samples (known as &amp;quot;megasamples&amp;quot;) which require a certain type of Amiga - t_o_t.mod, for instance, requires a PAL Amiga, whereas cd_orbit.mod requires an NTSC Amiga. You can also use 8363*428 for another estimate.&lt;br /&gt;
&lt;br /&gt;
To get the actual note frequency, divide the Amiga base clock by the period number.&lt;br /&gt;
&lt;br /&gt;
There is a number of ticks per row, often just referred to as the speed.&lt;br /&gt;
&lt;br /&gt;
There is a number of &amp;quot;beats per minute&amp;quot;; however, this is a CIA clock speed (it's an Amiga thing). Often just referred to as the tempo. To convert to actual BPM, multiply by 4 and divide by 10. For clarity, we'll refer to it as BPM, even though it's not entirely correct.&lt;br /&gt;
&lt;br /&gt;
When a looped sample is played, the whole sample plays through once, and then, if it has a loop, the loop is repeated.&lt;br /&gt;
&lt;br /&gt;
On a real Amiga, when a nonlooped sample is played, the whole sample plays through once, and then doesn't play any further. If you then attempt a note slide, you won't hear anything.&lt;br /&gt;
&lt;br /&gt;
If a sample is supplied, then the sample is &amp;quot;latched&amp;quot;, the channel volume is reset to the sample's default volume, and the starting offset is reset to 0. ProTracker 1.1 (?) will change the sample, too, but other versions do not.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: which trackers do this?)''&lt;br /&gt;
&lt;br /&gt;
ImpulseTracker also changes the sample; however, if you're converting MOD to IT yourself and you don't want this, you can put a &amp;quot;note off&amp;quot; with the sample and it will just change the volume (unfortunately, this behaviour does not work correctly with libmodplug or SchismTracker at the moment).&lt;br /&gt;
&lt;br /&gt;
If a period is supplied, then the note plays from the starting offset of the current latched sample, unless there is a note slide (effect 3xx or 5xy).&lt;br /&gt;
&lt;br /&gt;
===Effects===&lt;br /&gt;
====0xy====&lt;br /&gt;
Arpeggio between 0,x,y semitones up, changing every tick, and retriggering every row. Basically, you select by using tick % 3 where % is the modulo operator.&lt;br /&gt;
&lt;br /&gt;
====1xx====&lt;br /&gt;
Slide up. For every nonzero tick, decrement the period by $xx, clamping to 113 (amiga limits).&lt;br /&gt;
&lt;br /&gt;
====2xx====&lt;br /&gt;
Slide down. For every nonzero tick, increment the period by $xx, clamping to 856 (amiga limits).&lt;br /&gt;
&lt;br /&gt;
====3xx====&lt;br /&gt;
Slide to note. For every nonzero tick, move the period $xx closer to the target period.&lt;br /&gt;
&lt;br /&gt;
If xx is 0, then use previous value for 3xx.&lt;br /&gt;
&lt;br /&gt;
====4xy====&lt;br /&gt;
Vibrato. x is speed, y is depth. You'll need to generate 3 waveforms beforehand, and spew out random numbers for the last choice of waveform. Each waveform other than the last has a full cycle of 64 steps, and the amplitude is somewhere between -y and y after calculating. When precalculating the waveform, an amplitude of 64 should be fine.&lt;br /&gt;
&lt;br /&gt;
*Waveform 0 is a sine wave. This is the default.&lt;br /&gt;
*Waveform 1 is a downwards saw wave.&lt;br /&gt;
*Waveform 2 is a square wave, starting from +y.&lt;br /&gt;
*Waveform 3 is random. The cycle of this is mostly irrelevant. In saying this, the speed value is irrelevant with this waveform type, too.&lt;br /&gt;
&lt;br /&gt;
You have a vibrato waveform position. By default, this retriggers for every note (?) you play by being reset to 0. This loops around a cycle of 64 positions.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: is it per note or per sample, or will either retrigger it?)''&lt;br /&gt;
&lt;br /&gt;
For each tick, we add y to the output period at the peak amplitude. For a waveform with peak amplitude of 64, for example, we would add (y*waveform[pos]/64). The period is clamped to Amiga limits.&lt;br /&gt;
&lt;br /&gt;
If xy is 0, then use previous value for 4xy.&lt;br /&gt;
&lt;br /&gt;
====5xy====&lt;br /&gt;
Volume slide + slide to note: Axy and 300 combined.&lt;br /&gt;
&lt;br /&gt;
====6xy====&lt;br /&gt;
Volume slide + vibrato: Axy and 400 combined.&lt;br /&gt;
&lt;br /&gt;
====7xy====&lt;br /&gt;
Tremolo. x is speed, y is depth. Like vibrato, except we modify the output volume. The volume is clamped to 0 &amp;lt;= vol &amp;lt;= 64.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: is the maximum amplitude ~16, ~32 or ~64?)''&lt;br /&gt;
&lt;br /&gt;
If xy is 0, then use previous value for 7xy (?).&lt;br /&gt;
&lt;br /&gt;
''(please clarify: does the memory work for tremolo, or just vibrato?)''&lt;br /&gt;
&lt;br /&gt;
====8xx====&lt;br /&gt;
FastTracker panning extension. $00 is hard left, $FF is hard right.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: I really don't give a toss about this FastTracker extension, so I'm putting this question out to someone who does. Does this reset after a new note or sample? And probably some other things, too.)''&lt;br /&gt;
&lt;br /&gt;
====9xx====&lt;br /&gt;
Set sample offset to xx * $100. This also sets the sample starting offset. On older versions of ProTracker (PT &amp;lt; 3.15 (?)), the starting offset is doubled.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: what players perform this quirk?)''&lt;br /&gt;
&lt;br /&gt;
On most non canonical trackers (those which aren't in the SoundTracker -&amp;gt; ProTracker line, e.g. FastTracker, ScreamTracker 3, ImpulseTracker), this quirk does not occur, and the starting offset is always 0.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: what happens when you go over the edge?)''&lt;br /&gt;
&lt;br /&gt;
====Axy====&lt;br /&gt;
Volume slide. Happens every nonzero tick. If x is 0, slide down by y. If y is 0, slide up by x. If both are nonzero, do nothing. Clamp to 0 &amp;lt;= vol &amp;lt;= 64.&lt;br /&gt;
&lt;br /&gt;
Unlike most module formats, this does not have effect memory. If xy is $00, then don't go anywhere.&lt;br /&gt;
&lt;br /&gt;
====Bxx====&lt;br /&gt;
Jump to offset. If you go over the edge, then the module is restarted (?).&lt;br /&gt;
&lt;br /&gt;
''(please clarify: does it actually restart?)''&lt;br /&gt;
&lt;br /&gt;
====Cxx====&lt;br /&gt;
Set volume. If greater than 64, then... (?)&lt;br /&gt;
&lt;br /&gt;
''(please clarify: does it clamp the value at 64, or does it ignore the dud volume? My guess is this: it drops the top bit, and does the former. But that's the lazy way.)''&lt;br /&gt;
&lt;br /&gt;
====Dxy====&lt;br /&gt;
Jump to row x*10 + y. '''THE VALUE PROVIDED IS IN DECIMAL!''' This had to be yelled out as it's a common mistake when making a MOD player.&lt;br /&gt;
&lt;br /&gt;
====E0x====&lt;br /&gt;
If x is 1, turn the Amiga filter off. If x is 0, turn it on. This filter is present on the A500, A2000, and A1200.&lt;br /&gt;
&lt;br /&gt;
For a simple 1-pole low-pass filter, 11500Hz gives a fairly decent estimation.&lt;br /&gt;
&lt;br /&gt;
====E1x====&lt;br /&gt;
Fine slide up. Like 1xx but without effect memory and only on the first tick.&lt;br /&gt;
&lt;br /&gt;
====E2x====&lt;br /&gt;
Fine slide down. Like 2xx but without effect memory and only on the first tick.&lt;br /&gt;
&lt;br /&gt;
====E3x====&lt;br /&gt;
Screw up 3xx.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: how does this actually work?)''&lt;br /&gt;
&lt;br /&gt;
====E4x====&lt;br /&gt;
Set vibrato waveform. x &amp;amp; 3 (bottom 2 bits) sets the waveform type. If bit 2 is set (x &amp;amp; 4), then don't retrigger the waveform.&lt;br /&gt;
&lt;br /&gt;
====E5x====&lt;br /&gt;
Set finetune value for the current sample.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: when does this actually kick in?)''&lt;br /&gt;
&lt;br /&gt;
====E6x====&lt;br /&gt;
Loopback.&lt;br /&gt;
&lt;br /&gt;
If x is 0, then set the loopback point to the current row. The loopback point is reset to -1 for every Bxx or Dxx or pattern transition (?). Looping back with this means that you have to play row 0 twice.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: is MikMod right?)''&lt;br /&gt;
&lt;br /&gt;
Otherwise, we check if the loopback counter set. If the loopback counter is set, then decrement it by 1, otherwise set the counter to x.&lt;br /&gt;
&lt;br /&gt;
After doing this, if the counter is not 0, then we jump back to the loopback point.&lt;br /&gt;
&lt;br /&gt;
Unlike S3M and IT, the loopback point remains where it is, so an E60/E61/E61 sequence down a column will result in an infinite loop.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: is this per-channel or global?)''&lt;br /&gt;
&lt;br /&gt;
====E7x====&lt;br /&gt;
Set tremolo waveform, like E4x.&lt;br /&gt;
&lt;br /&gt;
====E8x====&lt;br /&gt;
Another stereo extension. $0 is hard left, $F is hard right.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: I don't care about this extension, either. It's far from &amp;quot;real Amiga&amp;quot; material. Please see 8xx for the clarifications required.)''&lt;br /&gt;
&lt;br /&gt;
====E9x====&lt;br /&gt;
Retrigger note every x ticks.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: does this effect retrigger like IT, or is this just a matter of ticks % x ?)''&lt;br /&gt;
&lt;br /&gt;
====EAx====&lt;br /&gt;
Fine volume slide up. For the first tick, increment the volume by x, clamping x to &amp;lt;= 64.&lt;br /&gt;
&lt;br /&gt;
====EBx====&lt;br /&gt;
Fine volume slide down. For the first tick, decrement the volume by x, clamping x to &amp;gt;= 0.&lt;br /&gt;
&lt;br /&gt;
====ECx====&lt;br /&gt;
Note cut. On the xth tick, set the volume to 0.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: what happens when x &amp;gt;= TPR?)''&lt;br /&gt;
&lt;br /&gt;
''(please clarify: what happens when x == 0?)''&lt;br /&gt;
&lt;br /&gt;
====EDx====&lt;br /&gt;
Note delay. Don't do what's in the cell until the xth tick.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: is there anything which escapes this check?)''&lt;br /&gt;
&lt;br /&gt;
''(please clarify: what happens when x &amp;gt;= TPR?)''&lt;br /&gt;
&lt;br /&gt;
''(please clarify: what happens when x == 0?)''&lt;br /&gt;
&lt;br /&gt;
====EEx====&lt;br /&gt;
Row delay. Repeat the row x times, e.g. if x is 3, then do the row 4 times in total.&lt;br /&gt;
&lt;br /&gt;
====EFx====&lt;br /&gt;
Funkrepeat. This is rarely implemented because not everyone knows how to use it and those who do generally think it's &amp;quot;nasty&amp;quot; as it overwrites sample data. Some might say this is incredibly rare; however, it appears to be more common than E3x.&lt;br /&gt;
&lt;br /&gt;
So, here's a list which can be added to. The bigger this list, the more pressure MOD player authors will get until they finally implement this under-implemented effect.&lt;br /&gt;
&lt;br /&gt;
=====List of MODs which use EFx=====&lt;br /&gt;
*emax-doz.mod&lt;br /&gt;
*emax-seq.mod&lt;br /&gt;
&lt;br /&gt;
In most cases, a MOD which uses EFx is a chiptune.&lt;br /&gt;
&lt;br /&gt;
In most cases, a MOD which uses EFx ''needs'' it (for epicness purposes mostly).&lt;br /&gt;
&lt;br /&gt;
Firstly, you'll want this table. This tells you how much to increment the internal counter by, and is in the ProTracker v1.2 source code.&lt;br /&gt;
&lt;br /&gt;
 0,5,6,7,8,10,11,13,16,19,22,26,32,43,64,128&lt;br /&gt;
&lt;br /&gt;
If x is 0, then reset that channel's funkrepeat counter and funkrepeat position to 0.&lt;br /&gt;
Otherwise, set that channel's funkrepeat speed to funkrepeat_table[x].&lt;br /&gt;
&lt;br /&gt;
If a channel is not funkrepeating, then you don't need to do what follows for that channel.&lt;br /&gt;
&lt;br /&gt;
For every tick, increment the channel's funkrepeat counter by its funkrepeat speed. If the funkrepeat counter reaches 128, then ''reset the counter to 0'', and then:&lt;br /&gt;
&lt;br /&gt;
 sampledata[current_sample][loop_begin_in_bytes + funkrepeat_pos] ^= 0xFF;&lt;br /&gt;
 funkrepeat_pos = (funkrepeat_pos + 1) % loop_length_in_bytes;&lt;br /&gt;
&lt;br /&gt;
^ is the XOR operator in C. There's also ~ for a binary NOT, but ~= probably isn't valid C.&lt;br /&gt;
&lt;br /&gt;
Every time you reach a new sample (?) value, reset that channel's funkrepeat position to 0, and start modifying the new sample (?).&lt;br /&gt;
&lt;br /&gt;
''(please clarify: does the funkrepeat sample position retrigger on sample, note, either, or both?)''&lt;br /&gt;
&lt;br /&gt;
''(please clarify: when you hit a lone sample which isn't the current one, does it affect that latched sample or the playing sample?)''&lt;br /&gt;
&lt;br /&gt;
''(please clarify: there's probably a lot of mistakes in this.)''&lt;br /&gt;
&lt;br /&gt;
====Fxx====&lt;br /&gt;
Set TPR or BPM. If xx is less than $20 (32) or this is an old 15-sample module (?), set TPR to xx, otherwise set BPM to xx.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: Where is the dividing line between raster timing and CIA timing - that is, when was BPM introduced?)''&lt;br /&gt;
&lt;br /&gt;
''However,'' if xx is 0, then ignore this effect.&lt;br /&gt;
&lt;br /&gt;
==Optimisation tips==&lt;br /&gt;
&lt;br /&gt;
'''Try unrolling your sample loops.''' 2500 bytes of padding should be fine if you're operating within Amiga limits; otherwise, you'll want at least ((base clock * 10) / (smallest period value * 4 * 32)) bytes. To unroll a loopless sample, just pad this number of bytes. To unroll a looped sample, append the loop to the end, then unroll this number of bytes from the loop.&lt;br /&gt;
&lt;br /&gt;
Once you've done that, you only need to check if you've exceeded (length + loop length) words (or bytes if you've converted it) for a looped sample, or length words for an unlooped sample. For an unlooped sample, you just refuse to mix if the offset is past this point. For a looped sample, you set the offset to this:&lt;br /&gt;
&lt;br /&gt;
 offset = length + (offset - length) % looplength;&lt;br /&gt;
&lt;br /&gt;
where % is the modulo operator. Most forms of BASIC do not have a modulo operator, so you'll probably have to do this instead:&lt;br /&gt;
&lt;br /&gt;
 tmp = offset - length;&lt;br /&gt;
 offset = length + tmp - (int(tmp / looplength) * looplength);&lt;br /&gt;
&lt;br /&gt;
This makes funkrepeat trickier to implement, but it has been proven possible.&lt;br /&gt;
&lt;br /&gt;
[[Category: Music Pattern Formats]]&lt;/div&gt;</summary>
		<author><name>GreaseMonkey</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Protracker_Module&amp;diff=12163</id>
		<title>Protracker Module</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Protracker_Module&amp;diff=12163"/>
		<updated>2010-01-21T09:09:09Z</updated>

		<summary type="html">&lt;p&gt;GreaseMonkey: some amiga thing&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* Extension: mod&lt;br /&gt;
Originally a 15-sample format, it was first used in Ultimate SoundTracker for the Amiga. Since then, it has been used in NoiseTracker and ProTracker, which both use the 31-sample &amp;quot;M.K.&amp;quot; version, as well as many other programs on many other platforms; for example, FastTracker 2 for MS-DOS on the PC, which can handle even numbers of channels from 2 to 32.&lt;br /&gt;
&lt;br /&gt;
==File Format==&lt;br /&gt;
The format is big-endian (most significant byte first). A &amp;quot;byte&amp;quot; is 8 bits, and a &amp;quot;word&amp;quot; is 16 bits. Hex values will be denoted with a $ sign.&lt;br /&gt;
&lt;br /&gt;
Amiga limits for periods are 113 &amp;lt;= x &amp;lt;= 856. The lower the period, the higher the pitch.&lt;br /&gt;
&lt;br /&gt;
*20 bytes: Module name, padded with NULs.&lt;br /&gt;
*31 samples (or 15 if we're dealing with a SoundTracker file):&lt;br /&gt;
**22 bytes: Sample name, padded with NULs.&lt;br /&gt;
**Word: Length of sample in words - multiply by 2 to get length in bytes.&lt;br /&gt;
**Byte: Finetune value ranging from $00 to $0F as a signed nybble. $01 is 1/8 of a semitone up, $0F is 1/8 of a semitone down, $08 is 8/8 of a semitone down (that is, a whole semitone). Periods should be clamped to within Amiga limits.&lt;br /&gt;
**Byte: Default volume of sample ranging from 0 to 64 ($00 to $40).&lt;br /&gt;
**Word: Loop start in words.&lt;br /&gt;
**Word: Loop length in words. If set to 1, don't loop. Allegedly, a value of 0 will crash an Amiga.&lt;br /&gt;
*Byte: Order list length.&lt;br /&gt;
*Byte: Traditionally $78 in SoundTracker. Was used in NoiseTracker as a restart point. ProTracker uses $7F. FastTracker uses it as a restart point, whereas ScreamTracker 3 uses $7F like ProTracker. You can use this to roughly detect which tracker made a MOD, and detection gets more accurate for more obscure MOD types.&lt;br /&gt;
*128 bytes: Order list. Only the first ''order list length'' orders are actually used when playing; however, we scan the WHOLE order list to find out what the highest-indexed pattern is, and that's how many patterns we load.&lt;br /&gt;
*4 bytes (31-sample version only): Sample tag. If this contains any non-ASCII ($20 to $7E (32 to 126) inclusive) characters, then we probably loaded a 15-sample MOD. The best way to detect this is to seek to this position (it's $438 / 1080) and check before you actually load any data (may not work for streams where you can't seek). Otherwise, it's probably a 31-sample MOD. Values include:&lt;br /&gt;
**'''M.K.''' - standard 4-channel, 64-pattern-max MOD.&lt;br /&gt;
**'''M!K!''' - ProTracker will write this if there's more than 64 patterns,&lt;br /&gt;
**'''6CHN''', '''8CHN''' - 6-channel and 8-channel MODs, respectively. These are common extensions, and many trackers will write these. Basically, you read like a 4 channel mod, but with 6 or 8 channels per row.&lt;br /&gt;
**'''CD81''', '''OKTA''', '''OCTA''' - other 8-channel MOD tags. First two are probably Oktalyzer for the Atari ST, the third is possibly OctaMED.&lt;br /&gt;
**'''xxCH''' - a 10+ channel MOD, xx being a decimal number. FastTracker will deal with these as long as x is an even number no greater than 32.&lt;br /&gt;
**'''2CHN''' - a 2 channel MOD. This is handled by FastTracker.&lt;br /&gt;
**'''xxCN''' - another 10+ channel MOD, xx being a decimal number. Allegedly TakeTracker writes these.&lt;br /&gt;
**'''TDZ1''', '''TDZ2''', '''TDZ3''' - allegedly this is a TakeTracker extension for 1, 2, and 3 channels respectively.&lt;br /&gt;
**'''5CHN''', '''7CHN''', '''9CHN''' - allegedly this is a TakeTracker extension for 5, 7, and 8 channels respectively.&lt;br /&gt;
**'''FLT4''' - StarTrekker 4-channel MOD.&lt;br /&gt;
**'''FLT8''' - StarTrekker 8-channel MOD. Load patterns in like a normal 4-channel MOD, and then play two patterns at the same time (e.g. if 8 appears on the order list, play patterns 8 and 9). You'd probably be best to merge the patterns together if you want to be consistent.&lt;br /&gt;
**'''M&amp;amp;K!''' - only sighted on echobea3.mod so far. This is just a standard MOD, but with a weird tag. ''I ([[User:GreaseMonkey|GreaseMonkey]]) cannot find the tracker it's referring to (&amp;quot;fleg's module train-er&amp;quot;), so it was probably only used once or something, and never released.''&lt;br /&gt;
*Pattern data:&lt;br /&gt;
**Read 4 bytes for a cell. Read ''channel count'' cells for a row. Read 64 of these rows for a pattern. Read ''pattern count'' of these patterns.&lt;br /&gt;
**You read cells as if they were big-endian 32-bit values.&lt;br /&gt;
**Cells are in the format $ipppjfxy:&lt;br /&gt;
***$ppp is the period value. No, not the note, the period.&lt;br /&gt;
***$ij is the sample number.&lt;br /&gt;
***$fxy is the effect, $f being the effect type, and $xy being the effect parameter.&lt;br /&gt;
*Signed 8-bit mono sample data. Remember those sample lengths? Now is the time to use them.&lt;br /&gt;
&lt;br /&gt;
==Playback notes==&lt;br /&gt;
&lt;br /&gt;
Amiga base clock is ''roughly'' 70ns, yielding an audio base clock of 280ns. The actual base clock differs. PAL Amigas have a slightly slower clock than NTSC Amigas. This value of 70ns is close to the NTSC clock, but not quite right. Some modules have large samples (known as &amp;quot;megasamples&amp;quot;) which require a certain type of Amiga - t_o_t.mod, for instance, requires a PAL Amiga, whereas cd_orbit.mod requires an NTSC Amiga. You can also use 8363*428 for another estimate.&lt;br /&gt;
&lt;br /&gt;
To get the actual note frequency, divide the Amiga base clock by the period number.&lt;br /&gt;
&lt;br /&gt;
There is a number of ticks per row, often just referred to as the speed.&lt;br /&gt;
&lt;br /&gt;
There is a number of &amp;quot;beats per minute&amp;quot;; however, this is a CIA clock speed (it's an Amiga thing). Often just referred to as the tempo. To convert to actual BPM, multiply by 4 and divide by 10. For clarity, we'll refer to it as BPM, even though it's not entirely correct.&lt;br /&gt;
&lt;br /&gt;
When a looped sample is played, the whole sample plays through once, and then, if it has a loop, the loop is repeated.&lt;br /&gt;
&lt;br /&gt;
On a real Amiga, when a nonlooped sample is played, the whole sample plays through once, and then doesn't play any further. If you then do a sample without a note, you won't hear anything.&lt;br /&gt;
&lt;br /&gt;
If a sample is supplied, then the sample is &amp;quot;latched&amp;quot;, the channel volume is reset to the sample's default volume, and the starting offset is reset to 0. ProTracker 1.1 (?) will change the sample, too, but other versions do not.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: which trackers do this?)''&lt;br /&gt;
&lt;br /&gt;
ImpulseTracker also changes the sample; however, if you're converting MOD to IT yourself and you don't want this, you can put a &amp;quot;note off&amp;quot; with the sample and it will just change the volume (unfortunately, this behaviour does not work correctly with libmodplug or SchismTracker at the moment).&lt;br /&gt;
&lt;br /&gt;
If a period is supplied, then the note plays from the starting offset of the current latched sample, unless there is a note slide (effect 3xx or 5xy).&lt;br /&gt;
&lt;br /&gt;
===Effects===&lt;br /&gt;
====0xy====&lt;br /&gt;
Arpeggio between 0,x,y semitones up, changing every tick, and retriggering every row. Basically, you select by using tick % 3 where % is the modulo operator.&lt;br /&gt;
&lt;br /&gt;
====1xx====&lt;br /&gt;
Slide up. For every nonzero tick, decrement the period by $xx, clamping to 113 (amiga limits).&lt;br /&gt;
&lt;br /&gt;
====2xx====&lt;br /&gt;
Slide down. For every nonzero tick, increment the period by $xx, clamping to 856 (amiga limits).&lt;br /&gt;
&lt;br /&gt;
====3xx====&lt;br /&gt;
Slide to note. For every nonzero tick, move the period $xx closer to the target period.&lt;br /&gt;
&lt;br /&gt;
If xx is 0, then use previous value for 3xx.&lt;br /&gt;
&lt;br /&gt;
====4xy====&lt;br /&gt;
Vibrato. x is speed, y is depth. You'll need to generate 3 waveforms beforehand, and spew out random numbers for the last choice of waveform. Each waveform other than the last has a full cycle of 64 steps, and the amplitude is somewhere between -y and y after calculating. When precalculating the waveform, an amplitude of 64 should be fine.&lt;br /&gt;
&lt;br /&gt;
*Waveform 0 is a sine wave. This is the default.&lt;br /&gt;
*Waveform 1 is a downwards saw wave.&lt;br /&gt;
*Waveform 2 is a square wave, starting from +y.&lt;br /&gt;
*Waveform 3 is random. The cycle of this is mostly irrelevant. In saying this, the speed value is irrelevant with this waveform type, too.&lt;br /&gt;
&lt;br /&gt;
You have a vibrato waveform position. By default, this retriggers for every note (?) you play by being reset to 0. This loops around a cycle of 64 positions.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: is it per note or per sample, or will either retrigger it?)''&lt;br /&gt;
&lt;br /&gt;
For each tick, we add y to the output period at the peak amplitude. For a waveform with peak amplitude of 64, for example, we would add (y*waveform[pos]/64). The period is clamped to Amiga limits.&lt;br /&gt;
&lt;br /&gt;
If xy is 0, then use previous value for 4xy.&lt;br /&gt;
&lt;br /&gt;
====5xy====&lt;br /&gt;
Volume slide + slide to note: Axy and 300 combined.&lt;br /&gt;
&lt;br /&gt;
====6xy====&lt;br /&gt;
Volume slide + vibrato: Axy and 400 combined.&lt;br /&gt;
&lt;br /&gt;
====7xy====&lt;br /&gt;
Tremolo. x is speed, y is depth. Like vibrato, except we modify the output volume. The volume is clamped to 0 &amp;lt;= vol &amp;lt;= 64.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: is the maximum amplitude ~16, ~32 or ~64?)''&lt;br /&gt;
&lt;br /&gt;
If xy is 0, then use previous value for 7xy (?).&lt;br /&gt;
&lt;br /&gt;
''(please clarify: does the memory work for tremolo, or just vibrato?)''&lt;br /&gt;
&lt;br /&gt;
====8xx====&lt;br /&gt;
FastTracker panning extension. $00 is hard left, $FF is hard right.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: I really don't give a toss about this FastTracker extension, so I'm putting this question out to someone who does. Does this reset after a new note or sample? And probably some other things, too.)''&lt;br /&gt;
&lt;br /&gt;
====9xx====&lt;br /&gt;
Set sample offset to xx * $100. This also sets the sample starting offset. On older versions of ProTracker (PT &amp;lt; 3.15 (?)), the starting offset is doubled.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: what players perform this quirk?)''&lt;br /&gt;
&lt;br /&gt;
On most non canonical trackers (those which aren't in the SoundTracker -&amp;gt; ProTracker line, e.g. FastTracker, ScreamTracker 3, ImpulseTracker), this quirk does not occur, and the starting offset is always 0.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: what happens when you go over the edge?)''&lt;br /&gt;
&lt;br /&gt;
====Axy====&lt;br /&gt;
Volume slide. Happens every nonzero tick. If x is 0, slide down by y. If y is 0, slide up by x. If both are nonzero, do nothing. Clamp to 0 &amp;lt;= vol &amp;lt;= 64.&lt;br /&gt;
&lt;br /&gt;
Unlike most module formats, this does not have effect memory. If xy is $00, then don't go anywhere.&lt;br /&gt;
&lt;br /&gt;
====Bxx====&lt;br /&gt;
Jump to offset. If you go over the edge, then the module is restarted (?).&lt;br /&gt;
&lt;br /&gt;
''(please clarify: does it actually restart?)''&lt;br /&gt;
&lt;br /&gt;
====Cxx====&lt;br /&gt;
Set volume. If greater than 64, then... (?)&lt;br /&gt;
&lt;br /&gt;
''(please clarify: does it clamp the value at 64, or does it ignore the dud volume? My guess is this: it drops the top bit, and does the former. But that's the lazy way.)''&lt;br /&gt;
&lt;br /&gt;
====Dxy====&lt;br /&gt;
Jump to row x*10 + y. '''THE VALUE PROVIDED IS IN DECIMAL!''' This had to be yelled out as it's a common mistake when making a MOD player.&lt;br /&gt;
&lt;br /&gt;
====E0x====&lt;br /&gt;
If x is 1, turn the Amiga filter off. If x is 0, turn it on. This filter is present on the A500, A2000, and A1200.&lt;br /&gt;
&lt;br /&gt;
For a simple 1-pole low-pass filter, 11500Hz gives a fairly decent estimation.&lt;br /&gt;
&lt;br /&gt;
====E1x====&lt;br /&gt;
Fine slide up. Like 1xx but without effect memory and only on the first tick.&lt;br /&gt;
&lt;br /&gt;
====E2x====&lt;br /&gt;
Fine slide down. Like 2xx but without effect memory and only on the first tick.&lt;br /&gt;
&lt;br /&gt;
====E3x====&lt;br /&gt;
Screw up 3xx.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: how does this actually work?)''&lt;br /&gt;
&lt;br /&gt;
====E4x====&lt;br /&gt;
Set vibrato waveform. x &amp;amp; 3 (bottom 2 bits) sets the waveform type. If bit 2 is set (x &amp;amp; 4), then don't retrigger the waveform.&lt;br /&gt;
&lt;br /&gt;
====E5x====&lt;br /&gt;
Set finetune value for the current sample.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: when does this actually kick in?)''&lt;br /&gt;
&lt;br /&gt;
====E6x====&lt;br /&gt;
Loopback.&lt;br /&gt;
&lt;br /&gt;
If x is 0, then set the loopback point to the current row. The loopback point is reset to -1 for every Bxx or Dxx or pattern transition (?). Looping back with this means that you have to play row 0 twice.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: is MikMod right?)''&lt;br /&gt;
&lt;br /&gt;
Otherwise, we check if the loopback counter set. If the loopback counter is set, then decrement it by 1, otherwise set the counter to x.&lt;br /&gt;
&lt;br /&gt;
After doing this, if the counter is not 0, then we jump back to the loopback point.&lt;br /&gt;
&lt;br /&gt;
Unlike S3M and IT, the loopback point remains where it is, so an E60/E61/E61 sequence down a column will result in an infinite loop.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: is this per-channel or global?)''&lt;br /&gt;
&lt;br /&gt;
====E7x====&lt;br /&gt;
Set tremolo waveform, like E4x.&lt;br /&gt;
&lt;br /&gt;
====E8x====&lt;br /&gt;
Another stereo extension. $0 is hard left, $F is hard right.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: I don't care about this extension, either. It's far from &amp;quot;real Amiga&amp;quot; material. Please see 8xx for the clarifications required.)''&lt;br /&gt;
&lt;br /&gt;
====E9x====&lt;br /&gt;
Retrigger note every x ticks.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: does this effect retrigger like IT, or is this just a matter of ticks % x ?)''&lt;br /&gt;
&lt;br /&gt;
====EAx====&lt;br /&gt;
Fine volume slide up. For the first tick, increment the volume by x, clamping x to &amp;lt;= 64.&lt;br /&gt;
&lt;br /&gt;
====EBx====&lt;br /&gt;
Fine volume slide down. For the first tick, decrement the volume by x, clamping x to &amp;gt;= 0.&lt;br /&gt;
&lt;br /&gt;
====ECx====&lt;br /&gt;
Note cut. On the xth tick, set the volume to 0.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: what happens when x &amp;gt;= TPR?)''&lt;br /&gt;
&lt;br /&gt;
''(please clarify: what happens when x == 0?)''&lt;br /&gt;
&lt;br /&gt;
====EDx====&lt;br /&gt;
Note delay. Don't do what's in the cell until the xth tick.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: is there anything which escapes this check?)''&lt;br /&gt;
&lt;br /&gt;
''(please clarify: what happens when x &amp;gt;= TPR?)''&lt;br /&gt;
&lt;br /&gt;
''(please clarify: what happens when x == 0?)''&lt;br /&gt;
&lt;br /&gt;
====EEx====&lt;br /&gt;
Row delay. Repeat the row x times, e.g. if x is 3, then do the row 4 times in total.&lt;br /&gt;
&lt;br /&gt;
====EFx====&lt;br /&gt;
Funkrepeat. This is rarely implemented because not everyone knows how to use it and those who do generally think it's &amp;quot;nasty&amp;quot; as it overwrites sample data. Some might say this is incredibly rare; however, it appears to be more common than E3x.&lt;br /&gt;
&lt;br /&gt;
So, here's a list which can be added to. The bigger this list, the more pressure MOD player authors will get until they finally implement this under-implemented effect.&lt;br /&gt;
&lt;br /&gt;
=====List of MODs which use EFx=====&lt;br /&gt;
*emax-doz.mod&lt;br /&gt;
*emax-seq.mod&lt;br /&gt;
&lt;br /&gt;
In most cases, a MOD which uses EFx is a chiptune.&lt;br /&gt;
&lt;br /&gt;
In most cases, a MOD which uses EFx ''needs'' it (for epicness purposes mostly).&lt;br /&gt;
&lt;br /&gt;
Firstly, you'll want this table. This tells you how much to increment the internal counter by, and is in the ProTracker v1.2 source code.&lt;br /&gt;
&lt;br /&gt;
 0,5,6,7,8,10,11,13,16,19,22,26,32,43,64,128&lt;br /&gt;
&lt;br /&gt;
If x is 0, then reset that channel's funkrepeat counter and funkrepeat position to 0.&lt;br /&gt;
Otherwise, set that channel's funkrepeat speed to funkrepeat_table[x].&lt;br /&gt;
&lt;br /&gt;
If a channel is not funkrepeating, then you don't need to do what follows for that channel.&lt;br /&gt;
&lt;br /&gt;
For every tick, increment the channel's funkrepeat counter by its funkrepeat speed. If the funkrepeat counter reaches 128, then ''reset the counter to 0'', and then:&lt;br /&gt;
&lt;br /&gt;
 sampledata[current_sample][loop_begin_in_bytes + funkrepeat_pos] ^= 0xFF;&lt;br /&gt;
 funkrepeat_pos = (funkrepeat_pos + 1) % loop_length_in_bytes;&lt;br /&gt;
&lt;br /&gt;
^ is the XOR operator in C. There's also ~ for a binary NOT, but ~= probably isn't valid C.&lt;br /&gt;
&lt;br /&gt;
Every time you reach a new sample (?) value, reset that channel's funkrepeat position to 0, and start modifying the new sample (?).&lt;br /&gt;
&lt;br /&gt;
''(please clarify: does the funkrepeat sample position retrigger on sample, note, either, or both?)''&lt;br /&gt;
&lt;br /&gt;
''(please clarify: when you hit a lone sample which isn't the current one, does it affect that latched sample or the playing sample?)''&lt;br /&gt;
&lt;br /&gt;
''(please clarify: there's probably a lot of mistakes in this.)''&lt;br /&gt;
&lt;br /&gt;
====Fxx====&lt;br /&gt;
Set TPR or BPM. If xx is less than $20 (32) or this is an old 15-sample module (?), set TPR to xx, otherwise set BPM to xx.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: Where is the dividing line between raster timing and CIA timing - that is, when was BPM introduced?)''&lt;br /&gt;
&lt;br /&gt;
''However,'' if xx is 0, then ignore this effect.&lt;br /&gt;
&lt;br /&gt;
==Optimisation tips==&lt;br /&gt;
&lt;br /&gt;
'''Try unrolling your sample loops.''' 2500 bytes of padding should be fine if you're operating within Amiga limits; otherwise, you'll want at least ((base clock * 10) / (smallest period value * 4 * 32)) bytes. To unroll a loopless sample, just pad this number of bytes. To unroll a looped sample, append the loop to the end, then unroll this number of bytes from the loop.&lt;br /&gt;
&lt;br /&gt;
Once you've done that, you only need to check if you've exceeded (length + loop length) words (or bytes if you've converted it) for a looped sample, or length words for an unlooped sample. For an unlooped sample, you just refuse to mix if the offset is past this point. For a looped sample, you set the offset to this:&lt;br /&gt;
&lt;br /&gt;
 offset = length + (offset - length) % looplength;&lt;br /&gt;
&lt;br /&gt;
where % is the modulo operator. Most forms of BASIC do not have a modulo operator, so you'll probably have to do this instead:&lt;br /&gt;
&lt;br /&gt;
 tmp = offset - length;&lt;br /&gt;
 offset = length + tmp - (int(tmp / looplength) * looplength);&lt;br /&gt;
&lt;br /&gt;
This makes funkrepeat trickier to implement, but it has been proven possible.&lt;br /&gt;
&lt;br /&gt;
[[Category: Music Pattern Formats]]&lt;/div&gt;</summary>
		<author><name>GreaseMonkey</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Protracker_Module&amp;diff=12162</id>
		<title>Protracker Module</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Protracker_Module&amp;diff=12162"/>
		<updated>2010-01-21T08:50:54Z</updated>

		<summary type="html">&lt;p&gt;GreaseMonkey: ft2 handles 2CHN mods. forgot about that.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* Extension: mod&lt;br /&gt;
Originally a 15-sample format, it was first used in Ultimate SoundTracker for the Amiga. Since then, it has been used in NoiseTracker and ProTracker, which both use the 31-sample &amp;quot;M.K.&amp;quot; version, as well as many other programs on many other platforms; for example, FastTracker 2 for MS-DOS on the PC, which can handle even numbers of channels from 2 to 32.&lt;br /&gt;
&lt;br /&gt;
==File Format==&lt;br /&gt;
The format is big-endian (most significant byte first). A &amp;quot;byte&amp;quot; is 8 bits, and a &amp;quot;word&amp;quot; is 16 bits. Hex values will be denoted with a $ sign.&lt;br /&gt;
&lt;br /&gt;
Amiga limits for periods are 113 &amp;lt;= x &amp;lt;= 856. The lower the period, the higher the pitch.&lt;br /&gt;
&lt;br /&gt;
*20 bytes: Module name, padded with NULs.&lt;br /&gt;
*31 samples (or 15 if we're dealing with a SoundTracker file):&lt;br /&gt;
**22 bytes: Sample name, padded with NULs.&lt;br /&gt;
**Word: Length of sample in words - multiply by 2 to get length in bytes.&lt;br /&gt;
**Byte: Finetune value ranging from $00 to $0F as a signed nybble. $01 is 1/8 of a semitone up, $0F is 1/8 of a semitone down, $08 is 8/8 of a semitone down (that is, a whole semitone). Periods should be clamped to within Amiga limits.&lt;br /&gt;
**Byte: Default volume of sample ranging from 0 to 64 ($00 to $40).&lt;br /&gt;
**Word: Loop start in words.&lt;br /&gt;
**Word: Loop length in words. If set to 1, don't loop. Allegedly, a value of 0 will crash an Amiga.&lt;br /&gt;
*Byte: Order list length.&lt;br /&gt;
*Byte: Traditionally $78 in SoundTracker. Was used in NoiseTracker as a restart point. ProTracker uses $7F. FastTracker uses it as a restart point, whereas ScreamTracker 3 uses $7F like ProTracker. You can use this to roughly detect which tracker made a MOD, and detection gets more accurate for more obscure MOD types.&lt;br /&gt;
*128 bytes: Order list. Only the first ''order list length'' orders are actually used when playing; however, we scan the WHOLE order list to find out what the highest-indexed pattern is, and that's how many patterns we load.&lt;br /&gt;
*4 bytes (31-sample version only): Sample tag. If this contains any non-ASCII ($20 to $7E (32 to 126) inclusive) characters, then we probably loaded a 15-sample MOD. The best way to detect this is to seek to this position (it's $438 / 1080) and check before you actually load any data (may not work for streams where you can't seek). Otherwise, it's probably a 31-sample MOD. Values include:&lt;br /&gt;
**'''M.K.''' - standard 4-channel, 64-pattern-max MOD.&lt;br /&gt;
**'''M!K!''' - ProTracker will write this if there's more than 64 patterns,&lt;br /&gt;
**'''6CHN''', '''8CHN''' - 6-channel and 8-channel MODs, respectively. These are common extensions, and many trackers will write these. Basically, you read like a 4 channel mod, but with 6 or 8 channels per row.&lt;br /&gt;
**'''CD81''', '''OKTA''', '''OCTA''' - other 8-channel MOD tags. First two are probably Oktalyzer for the Atari ST, the third is possibly OctaMED.&lt;br /&gt;
**'''xxCH''' - a 10+ channel MOD, xx being a decimal number. FastTracker will deal with these as long as x is an even number no greater than 32.&lt;br /&gt;
**'''2CHN''' - a 2 channel MOD. This is handled by FastTracker.&lt;br /&gt;
**'''xxCN''' - another 10+ channel MOD, xx being a decimal number. Allegedly TakeTracker writes these.&lt;br /&gt;
**'''TDZ1''', '''TDZ2''', '''TDZ3''' - allegedly this is a TakeTracker extension for 1, 2, and 3 channels respectively.&lt;br /&gt;
**'''5CHN''', '''7CHN''', '''9CHN''' - allegedly this is a TakeTracker extension for 5, 7, and 8 channels respectively.&lt;br /&gt;
**'''FLT4''' - StarTrekker 4-channel MOD.&lt;br /&gt;
**'''FLT8''' - StarTrekker 8-channel MOD. Load patterns in like a normal 4-channel MOD, and then play two patterns at the same time (e.g. if 8 appears on the order list, play patterns 8 and 9). You'd probably be best to merge the patterns together if you want to be consistent.&lt;br /&gt;
**'''M&amp;amp;K!''' - only sighted on echobea3.mod so far. This is just a standard MOD, but with a weird tag. ''I ([[User:GreaseMonkey|GreaseMonkey]]) cannot find the tracker it's referring to (&amp;quot;fleg's module train-er&amp;quot;), so it was probably only used once or something, and never released.''&lt;br /&gt;
*Pattern data:&lt;br /&gt;
**Read 4 bytes for a cell. Read ''channel count'' cells for a row. Read 64 of these rows for a pattern. Read ''pattern count'' of these patterns.&lt;br /&gt;
**You read cells as if they were big-endian 32-bit values.&lt;br /&gt;
**Cells are in the format $ipppjfxy:&lt;br /&gt;
***$ppp is the period value. No, not the note, the period.&lt;br /&gt;
***$ij is the sample number.&lt;br /&gt;
***$fxy is the effect, $f being the effect type, and $xy being the effect parameter.&lt;br /&gt;
*Signed 8-bit mono sample data. Remember those sample lengths? Now is the time to use them.&lt;br /&gt;
&lt;br /&gt;
==Playback notes==&lt;br /&gt;
&lt;br /&gt;
Amiga base clock is ''roughly'' 70ns, yielding an audio base clock of 280ns. The actual base clock differs. PAL Amigas have a slightly slower clock than NTSC Amigas. This value of 70ns is close to the NTSC clock, but not quite right. Some modules have large samples (known as &amp;quot;megasamples&amp;quot;) which require a certain type of Amiga - t_o_t.mod, for instance, requires a PAL Amiga, whereas cd_orbit.mod requires an NTSC Amiga. You can also use 8363*428 for another estimate.&lt;br /&gt;
&lt;br /&gt;
To get the actual note frequency, divide the Amiga base clock by the period number.&lt;br /&gt;
&lt;br /&gt;
There is a number of ticks per row, often just referred to as the speed.&lt;br /&gt;
&lt;br /&gt;
There is a number of &amp;quot;beats per minute&amp;quot;; however, this is a CIA clock speed (it's an Amiga thing). Often just referred to as the tempo. To convert to actual BPM, multiply by 4 and divide by 10. For clarity, we'll refer to it as BPM, even though it's not entirely correct.&lt;br /&gt;
&lt;br /&gt;
When a looped sample is played, the whole sample plays through once, and then, if it has a loop, the loop is repeated.&lt;br /&gt;
&lt;br /&gt;
If a sample is supplied, then the sample is &amp;quot;latched&amp;quot;, the channel volume is reset to the sample's default volume, and the starting offset is reset to 0. ProTracker 1.1 (?) will change the sample, too, but other versions do not.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: which trackers do this?)''&lt;br /&gt;
&lt;br /&gt;
ImpulseTracker also changes the sample; however, if you're converting MOD to IT yourself and you don't want this, you can put a &amp;quot;note off&amp;quot; with the sample and it will just change the volume (unfortunately, this behaviour does not work correctly with libmodplug or SchismTracker at the moment).&lt;br /&gt;
&lt;br /&gt;
If a period is supplied, then the note plays from the starting offset of the current latched sample, unless there is a note slide (effect 3xx or 5xy).&lt;br /&gt;
&lt;br /&gt;
===Effects===&lt;br /&gt;
====0xy====&lt;br /&gt;
Arpeggio between 0,x,y semitones up, changing every tick, and retriggering every row. Basically, you select by using tick % 3 where % is the modulo operator.&lt;br /&gt;
&lt;br /&gt;
====1xx====&lt;br /&gt;
Slide up. For every nonzero tick, decrement the period by $xx, clamping to 113 (amiga limits).&lt;br /&gt;
&lt;br /&gt;
====2xx====&lt;br /&gt;
Slide down. For every nonzero tick, increment the period by $xx, clamping to 856 (amiga limits).&lt;br /&gt;
&lt;br /&gt;
====3xx====&lt;br /&gt;
Slide to note. For every nonzero tick, move the period $xx closer to the target period.&lt;br /&gt;
&lt;br /&gt;
If xx is 0, then use previous value for 3xx.&lt;br /&gt;
&lt;br /&gt;
====4xy====&lt;br /&gt;
Vibrato. x is speed, y is depth. You'll need to generate 3 waveforms beforehand, and spew out random numbers for the last choice of waveform. Each waveform other than the last has a full cycle of 64 steps, and the amplitude is somewhere between -y and y after calculating. When precalculating the waveform, an amplitude of 64 should be fine.&lt;br /&gt;
&lt;br /&gt;
*Waveform 0 is a sine wave. This is the default.&lt;br /&gt;
*Waveform 1 is a downwards saw wave.&lt;br /&gt;
*Waveform 2 is a square wave, starting from +y.&lt;br /&gt;
*Waveform 3 is random. The cycle of this is mostly irrelevant. In saying this, the speed value is irrelevant with this waveform type, too.&lt;br /&gt;
&lt;br /&gt;
You have a vibrato waveform position. By default, this retriggers for every note (?) you play by being reset to 0. This loops around a cycle of 64 positions.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: is it per note or per sample, or will either retrigger it?)''&lt;br /&gt;
&lt;br /&gt;
For each tick, we add y to the output period at the peak amplitude. For a waveform with peak amplitude of 64, for example, we would add (y*waveform[pos]/64). The period is clamped to Amiga limits.&lt;br /&gt;
&lt;br /&gt;
If xy is 0, then use previous value for 4xy.&lt;br /&gt;
&lt;br /&gt;
====5xy====&lt;br /&gt;
Volume slide + slide to note: Axy and 300 combined.&lt;br /&gt;
&lt;br /&gt;
====6xy====&lt;br /&gt;
Volume slide + vibrato: Axy and 400 combined.&lt;br /&gt;
&lt;br /&gt;
====7xy====&lt;br /&gt;
Tremolo. x is speed, y is depth. Like vibrato, except we modify the output volume. The volume is clamped to 0 &amp;lt;= vol &amp;lt;= 64.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: is the maximum amplitude ~16, ~32 or ~64?)''&lt;br /&gt;
&lt;br /&gt;
If xy is 0, then use previous value for 7xy (?).&lt;br /&gt;
&lt;br /&gt;
''(please clarify: does the memory work for tremolo, or just vibrato?)''&lt;br /&gt;
&lt;br /&gt;
====8xx====&lt;br /&gt;
FastTracker panning extension. $00 is hard left, $FF is hard right.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: I really don't give a toss about this FastTracker extension, so I'm putting this question out to someone who does. Does this reset after a new note or sample? And probably some other things, too.)''&lt;br /&gt;
&lt;br /&gt;
====9xx====&lt;br /&gt;
Set sample offset to xx * $100. This also sets the sample starting offset. On older versions of ProTracker (PT &amp;lt; 3.15 (?)), the starting offset is doubled.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: what players perform this quirk?)''&lt;br /&gt;
&lt;br /&gt;
On most non canonical trackers (those which aren't in the SoundTracker -&amp;gt; ProTracker line, e.g. FastTracker, ScreamTracker 3, ImpulseTracker), this quirk does not occur, and the starting offset is always 0.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: what happens when you go over the edge?)''&lt;br /&gt;
&lt;br /&gt;
====Axy====&lt;br /&gt;
Volume slide. Happens every nonzero tick. If x is 0, slide down by y. If y is 0, slide up by x. If both are nonzero, do nothing. Clamp to 0 &amp;lt;= vol &amp;lt;= 64.&lt;br /&gt;
&lt;br /&gt;
Unlike most module formats, this does not have effect memory. If xy is $00, then don't go anywhere.&lt;br /&gt;
&lt;br /&gt;
====Bxx====&lt;br /&gt;
Jump to offset. If you go over the edge, then the module is restarted (?).&lt;br /&gt;
&lt;br /&gt;
''(please clarify: does it actually restart?)''&lt;br /&gt;
&lt;br /&gt;
====Cxx====&lt;br /&gt;
Set volume. If greater than 64, then... (?)&lt;br /&gt;
&lt;br /&gt;
''(please clarify: does it clamp the value at 64, or does it ignore the dud volume? My guess is this: it drops the top bit, and does the former. But that's the lazy way.)''&lt;br /&gt;
&lt;br /&gt;
====Dxy====&lt;br /&gt;
Jump to row x*10 + y. '''THE VALUE PROVIDED IS IN DECIMAL!''' This had to be yelled out as it's a common mistake when making a MOD player.&lt;br /&gt;
&lt;br /&gt;
====E0x====&lt;br /&gt;
If x is 1, turn the Amiga filter off. If x is 0, turn it on. This filter is present on the A500, A2000, and A1200.&lt;br /&gt;
&lt;br /&gt;
For a simple 1-pole low-pass filter, 11500Hz gives a fairly decent estimation.&lt;br /&gt;
&lt;br /&gt;
====E1x====&lt;br /&gt;
Fine slide up. Like 1xx but without effect memory and only on the first tick.&lt;br /&gt;
&lt;br /&gt;
====E2x====&lt;br /&gt;
Fine slide down. Like 2xx but without effect memory and only on the first tick.&lt;br /&gt;
&lt;br /&gt;
====E3x====&lt;br /&gt;
Screw up 3xx.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: how does this actually work?)''&lt;br /&gt;
&lt;br /&gt;
====E4x====&lt;br /&gt;
Set vibrato waveform. x &amp;amp; 3 (bottom 2 bits) sets the waveform type. If bit 2 is set (x &amp;amp; 4), then don't retrigger the waveform.&lt;br /&gt;
&lt;br /&gt;
====E5x====&lt;br /&gt;
Set finetune value for the current sample.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: when does this actually kick in?)''&lt;br /&gt;
&lt;br /&gt;
====E6x====&lt;br /&gt;
Loopback.&lt;br /&gt;
&lt;br /&gt;
If x is 0, then set the loopback point to the current row. The loopback point is reset to -1 for every Bxx or Dxx or pattern transition (?). Looping back with this means that you have to play row 0 twice.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: is MikMod right?)''&lt;br /&gt;
&lt;br /&gt;
Otherwise, we check if the loopback counter set. If the loopback counter is set, then decrement it by 1, otherwise set the counter to x.&lt;br /&gt;
&lt;br /&gt;
After doing this, if the counter is not 0, then we jump back to the loopback point.&lt;br /&gt;
&lt;br /&gt;
Unlike S3M and IT, the loopback point remains where it is, so an E60/E61/E61 sequence down a column will result in an infinite loop.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: is this per-channel or global?)''&lt;br /&gt;
&lt;br /&gt;
====E7x====&lt;br /&gt;
Set tremolo waveform, like E4x.&lt;br /&gt;
&lt;br /&gt;
====E8x====&lt;br /&gt;
Another stereo extension. $0 is hard left, $F is hard right.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: I don't care about this extension, either. It's far from &amp;quot;real Amiga&amp;quot; material. Please see 8xx for the clarifications required.)''&lt;br /&gt;
&lt;br /&gt;
====E9x====&lt;br /&gt;
Retrigger note every x ticks.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: does this effect retrigger like IT, or is this just a matter of ticks % x ?)''&lt;br /&gt;
&lt;br /&gt;
====EAx====&lt;br /&gt;
Fine volume slide up. For the first tick, increment the volume by x, clamping x to &amp;lt;= 64.&lt;br /&gt;
&lt;br /&gt;
====EBx====&lt;br /&gt;
Fine volume slide down. For the first tick, decrement the volume by x, clamping x to &amp;gt;= 0.&lt;br /&gt;
&lt;br /&gt;
====ECx====&lt;br /&gt;
Note cut. On the xth tick, set the volume to 0.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: what happens when x &amp;gt;= TPR?)''&lt;br /&gt;
&lt;br /&gt;
''(please clarify: what happens when x == 0?)''&lt;br /&gt;
&lt;br /&gt;
====EDx====&lt;br /&gt;
Note delay. Don't do what's in the cell until the xth tick.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: is there anything which escapes this check?)''&lt;br /&gt;
&lt;br /&gt;
''(please clarify: what happens when x &amp;gt;= TPR?)''&lt;br /&gt;
&lt;br /&gt;
''(please clarify: what happens when x == 0?)''&lt;br /&gt;
&lt;br /&gt;
====EEx====&lt;br /&gt;
Row delay. Repeat the row x times, e.g. if x is 3, then do the row 4 times in total.&lt;br /&gt;
&lt;br /&gt;
====EFx====&lt;br /&gt;
Funkrepeat. This is rarely implemented because not everyone knows how to use it and those who do generally think it's &amp;quot;nasty&amp;quot; as it overwrites sample data. Some might say this is incredibly rare; however, it appears to be more common than E3x.&lt;br /&gt;
&lt;br /&gt;
So, here's a list which can be added to. The bigger this list, the more pressure MOD player authors will get until they finally implement this under-implemented effect.&lt;br /&gt;
&lt;br /&gt;
=====List of MODs which use EFx=====&lt;br /&gt;
*emax-doz.mod&lt;br /&gt;
*emax-seq.mod&lt;br /&gt;
&lt;br /&gt;
In most cases, a MOD which uses EFx is a chiptune.&lt;br /&gt;
&lt;br /&gt;
In most cases, a MOD which uses EFx ''needs'' it (for epicness purposes mostly).&lt;br /&gt;
&lt;br /&gt;
Firstly, you'll want this table. This tells you how much to increment the internal counter by, and is in the ProTracker v1.2 source code.&lt;br /&gt;
&lt;br /&gt;
 0,5,6,7,8,10,11,13,16,19,22,26,32,43,64,128&lt;br /&gt;
&lt;br /&gt;
If x is 0, then reset that channel's funkrepeat counter and funkrepeat position to 0.&lt;br /&gt;
Otherwise, set that channel's funkrepeat speed to funkrepeat_table[x].&lt;br /&gt;
&lt;br /&gt;
If a channel is not funkrepeating, then you don't need to do what follows for that channel.&lt;br /&gt;
&lt;br /&gt;
For every tick, increment the channel's funkrepeat counter by its funkrepeat speed. If the funkrepeat counter reaches 128, then ''reset the counter to 0'', and then:&lt;br /&gt;
&lt;br /&gt;
 sampledata[current_sample][loop_begin_in_bytes + funkrepeat_pos] ^= 0xFF;&lt;br /&gt;
 funkrepeat_pos = (funkrepeat_pos + 1) % loop_length_in_bytes;&lt;br /&gt;
&lt;br /&gt;
^ is the XOR operator in C. There's also ~ for a binary NOT, but ~= probably isn't valid C.&lt;br /&gt;
&lt;br /&gt;
Every time you reach a new sample (?) value, reset that channel's funkrepeat position to 0, and start modifying the new sample (?).&lt;br /&gt;
&lt;br /&gt;
''(please clarify: does the funkrepeat sample position retrigger on sample, note, either, or both?)''&lt;br /&gt;
&lt;br /&gt;
''(please clarify: when you hit a lone sample which isn't the current one, does it affect that latched sample or the playing sample?)''&lt;br /&gt;
&lt;br /&gt;
''(please clarify: there's probably a lot of mistakes in this.)''&lt;br /&gt;
&lt;br /&gt;
====Fxx====&lt;br /&gt;
Set TPR or BPM. If xx is less than $20 (32) or this is an old 15-sample module (?), set TPR to xx, otherwise set BPM to xx.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: Where is the dividing line between raster timing and CIA timing - that is, when was BPM introduced?)''&lt;br /&gt;
&lt;br /&gt;
''However,'' if xx is 0, then ignore this effect.&lt;br /&gt;
&lt;br /&gt;
==Optimisation tips==&lt;br /&gt;
&lt;br /&gt;
'''Try unrolling your sample loops.''' 2500 bytes of padding should be fine if you're operating within Amiga limits; otherwise, you'll want at least ((base clock * 10) / (smallest period value * 4 * 32)) bytes. To unroll a loopless sample, just pad this number of bytes. To unroll a looped sample, append the loop to the end, then unroll this number of bytes from the loop.&lt;br /&gt;
&lt;br /&gt;
Once you've done that, you only need to check if you've exceeded (length + loop length) words (or bytes if you've converted it) for a looped sample, or length words for an unlooped sample. For an unlooped sample, you just refuse to mix if the offset is past this point. For a looped sample, you set the offset to this:&lt;br /&gt;
&lt;br /&gt;
 offset = length + (offset - length) % looplength;&lt;br /&gt;
&lt;br /&gt;
where % is the modulo operator. Most forms of BASIC do not have a modulo operator, so you'll probably have to do this instead:&lt;br /&gt;
&lt;br /&gt;
 tmp = offset - length;&lt;br /&gt;
 offset = length + tmp - (int(tmp / looplength) * looplength);&lt;br /&gt;
&lt;br /&gt;
This makes funkrepeat trickier to implement, but it has been proven possible.&lt;br /&gt;
&lt;br /&gt;
[[Category: Music Pattern Formats]]&lt;/div&gt;</summary>
		<author><name>GreaseMonkey</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Protracker_Module&amp;diff=12161</id>
		<title>Protracker Module</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Protracker_Module&amp;diff=12161"/>
		<updated>2010-01-21T08:08:10Z</updated>

		<summary type="html">&lt;p&gt;GreaseMonkey: /* Playback notes */ forgot to mention what periods were for&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* Extension: mod&lt;br /&gt;
Originally a 15-sample format, it was first used in Ultimate SoundTracker for the Amiga. Since then, it has been used in NoiseTracker and ProTracker, which both use the 31-sample &amp;quot;M.K.&amp;quot; version, as well as many other programs on many other platforms; for example, FastTracker 2 for MS-DOS on the PC, which can handle even numbers of channels from 4 to 32.&lt;br /&gt;
&lt;br /&gt;
==File Format==&lt;br /&gt;
The format is big-endian (most significant byte first). A &amp;quot;byte&amp;quot; is 8 bits, and a &amp;quot;word&amp;quot; is 16 bits. Hex values will be denoted with a $ sign.&lt;br /&gt;
&lt;br /&gt;
Amiga limits for periods are 113 &amp;lt;= x &amp;lt;= 856. The lower the period, the higher the pitch.&lt;br /&gt;
&lt;br /&gt;
*20 bytes: Module name, padded with NULs.&lt;br /&gt;
*31 samples (or 15 if we're dealing with a SoundTracker file):&lt;br /&gt;
**22 bytes: Sample name, padded with NULs.&lt;br /&gt;
**Word: Length of sample in words - multiply by 2 to get length in bytes.&lt;br /&gt;
**Byte: Finetune value ranging from $00 to $0F as a signed nybble. $01 is 1/8 of a semitone up, $0F is 1/8 of a semitone down, $08 is 8/8 of a semitone down (that is, a whole semitone). Periods should be clamped to within Amiga limits.&lt;br /&gt;
**Byte: Default volume of sample ranging from 0 to 64 ($00 to $40).&lt;br /&gt;
**Word: Loop start in words.&lt;br /&gt;
**Word: Loop length in words. If set to 1, don't loop. Allegedly, a value of 0 will crash an Amiga.&lt;br /&gt;
*Byte: Order list length.&lt;br /&gt;
*Byte: Traditionally $78 in SoundTracker. Was used in NoiseTracker as a restart point. ProTracker uses $7F. FastTracker uses it as a restart point, whereas ScreamTracker 3 uses $7F like ProTracker. You can use this to roughly detect which tracker made a MOD, and detection gets more accurate for more obscure MOD types.&lt;br /&gt;
*128 bytes: Order list. Only the first ''order list length'' orders are actually used when playing; however, we scan the WHOLE order list to find out what the highest-indexed pattern is, and that's how many patterns we load.&lt;br /&gt;
*4 bytes (31-sample version only): Sample tag. If this contains any non-ASCII ($20 to $7E (32 to 126) inclusive) characters, then we probably loaded a 15-sample MOD. The best way to detect this is to seek to this position (it's $438 / 1080) and check before you actually load any data (may not work for streams where you can't seek). Otherwise, it's probably a 31-sample MOD. Values include:&lt;br /&gt;
**'''M.K.''' - standard 4-channel, 64-pattern-max MOD.&lt;br /&gt;
**'''M!K!''' - ProTracker will write this if there's more than 64 patterns,&lt;br /&gt;
**'''6CHN''', '''8CHN''' - 6-channel and 8-channel MODs, respectively. These are common extensions, and many trackers will write these. Basically, you read like a 4 channel mod, but with 6 or 8 channels per row.&lt;br /&gt;
**'''CD81''', '''OKTA''', '''OCTA''' - other 8-channel MOD tags. First two are probably Oktalyzer for the Atari ST, the third is possibly OctaMED.&lt;br /&gt;
**'''xxCH''' - a 10+ channel MOD, xx being a decimal number. FastTracker will deal with these as long as x is an even number no greater than 32.&lt;br /&gt;
**'''xxCN''' - another 10+ channel MOD, xx being a decimal number. Allegedly TakeTracker writes these.&lt;br /&gt;
**'''TDZ1''', '''TDZ2''', '''TDZ3''' - allegedly this is a TakeTracker extension for 1, 2, and 3 channels respectively.&lt;br /&gt;
**'''5CHN''', '''7CHN''', '''9CHN''' - allegedly this is a TakeTracker extension for 5, 7, and 8 channels respectively.&lt;br /&gt;
**'''FLT4''' - StarTrekker 4-channel MOD.&lt;br /&gt;
**'''FLT8''' - StarTrekker 8-channel MOD. Load patterns in like a normal 4-channel MOD, and then play two patterns at the same time (e.g. if 8 appears on the order list, play patterns 8 and 9). You'd probably be best to merge the patterns together if you want to be consistent.&lt;br /&gt;
**'''M&amp;amp;K!''' - only sighted on echobea3.mod so far. This is just a standard MOD, but with a weird tag. ''I ([[User:GreaseMonkey|GreaseMonkey]]) cannot find the tracker it's referring to (&amp;quot;fleg's module train-er&amp;quot;), so it was probably only used once or something, and never released.''&lt;br /&gt;
*Pattern data:&lt;br /&gt;
**Read 4 bytes for a cell. Read ''channel count'' cells for a row. Read 64 of these rows for a pattern. Read ''pattern count'' of these patterns.&lt;br /&gt;
**You read cells as if they were big-endian 32-bit values.&lt;br /&gt;
**Cells are in the format $ipppjfxy:&lt;br /&gt;
***$ppp is the period value. No, not the note, the period.&lt;br /&gt;
***$ij is the sample number.&lt;br /&gt;
***$fxy is the effect, $f being the effect type, and $xy being the effect parameter.&lt;br /&gt;
*Signed 8-bit mono sample data. Remember those sample lengths? Now is the time to use them.&lt;br /&gt;
&lt;br /&gt;
==Playback notes==&lt;br /&gt;
&lt;br /&gt;
Amiga base clock is ''roughly'' 70ns, yielding an audio base clock of 280ns. The actual base clock differs. PAL Amigas have a slightly slower clock than NTSC Amigas. This value of 70ns is close to the NTSC clock, but not quite right. Some modules have large samples (known as &amp;quot;megasamples&amp;quot;) which require a certain type of Amiga - t_o_t.mod, for instance, requires a PAL Amiga, whereas cd_orbit.mod requires an NTSC Amiga. You can also use 8363*428 for another estimate.&lt;br /&gt;
&lt;br /&gt;
To get the actual note frequency, divide the Amiga base clock by the period number.&lt;br /&gt;
&lt;br /&gt;
There is a number of ticks per row, often just referred to as the speed.&lt;br /&gt;
&lt;br /&gt;
There is a number of &amp;quot;beats per minute&amp;quot;; however, this is a CIA clock speed (it's an Amiga thing). Often just referred to as the tempo. To convert to actual BPM, multiply by 4 and divide by 10. For clarity, we'll refer to it as BPM, even though it's not entirely correct.&lt;br /&gt;
&lt;br /&gt;
When a looped sample is played, the whole sample plays through once, and then, if it has a loop, the loop is repeated.&lt;br /&gt;
&lt;br /&gt;
If a sample is supplied, then the sample is &amp;quot;latched&amp;quot;, the channel volume is reset to the sample's default volume, and the starting offset is reset to 0. ProTracker 1.1 (?) will change the sample, too, but other versions do not.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: which trackers do this?)''&lt;br /&gt;
&lt;br /&gt;
ImpulseTracker also changes the sample; however, if you're converting MOD to IT yourself and you don't want this, you can put a &amp;quot;note off&amp;quot; with the sample and it will just change the volume (unfortunately, this behaviour does not work correctly with libmodplug or SchismTracker at the moment).&lt;br /&gt;
&lt;br /&gt;
If a period is supplied, then the note plays from the starting offset of the current latched sample, unless there is a note slide (effect 3xx or 5xy).&lt;br /&gt;
&lt;br /&gt;
===Effects===&lt;br /&gt;
====0xy====&lt;br /&gt;
Arpeggio between 0,x,y semitones up, changing every tick, and retriggering every row. Basically, you select by using tick % 3 where % is the modulo operator.&lt;br /&gt;
&lt;br /&gt;
====1xx====&lt;br /&gt;
Slide up. For every nonzero tick, decrement the period by $xx, clamping to 113 (amiga limits).&lt;br /&gt;
&lt;br /&gt;
====2xx====&lt;br /&gt;
Slide down. For every nonzero tick, increment the period by $xx, clamping to 856 (amiga limits).&lt;br /&gt;
&lt;br /&gt;
====3xx====&lt;br /&gt;
Slide to note. For every nonzero tick, move the period $xx closer to the target period.&lt;br /&gt;
&lt;br /&gt;
If xx is 0, then use previous value for 3xx.&lt;br /&gt;
&lt;br /&gt;
====4xy====&lt;br /&gt;
Vibrato. x is speed, y is depth. You'll need to generate 3 waveforms beforehand, and spew out random numbers for the last choice of waveform. Each waveform other than the last has a full cycle of 64 steps, and the amplitude is somewhere between -y and y after calculating. When precalculating the waveform, an amplitude of 64 should be fine.&lt;br /&gt;
&lt;br /&gt;
*Waveform 0 is a sine wave. This is the default.&lt;br /&gt;
*Waveform 1 is a downwards saw wave.&lt;br /&gt;
*Waveform 2 is a square wave, starting from +y.&lt;br /&gt;
*Waveform 3 is random. The cycle of this is mostly irrelevant. In saying this, the speed value is irrelevant with this waveform type, too.&lt;br /&gt;
&lt;br /&gt;
You have a vibrato waveform position. By default, this retriggers for every note (?) you play by being reset to 0. This loops around a cycle of 64 positions.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: is it per note or per sample, or will either retrigger it?)''&lt;br /&gt;
&lt;br /&gt;
For each tick, we add y to the output period at the peak amplitude. For a waveform with peak amplitude of 64, for example, we would add (y*waveform[pos]/64). The period is clamped to Amiga limits.&lt;br /&gt;
&lt;br /&gt;
If xy is 0, then use previous value for 4xy.&lt;br /&gt;
&lt;br /&gt;
====5xy====&lt;br /&gt;
Volume slide + slide to note: Axy and 300 combined.&lt;br /&gt;
&lt;br /&gt;
====6xy====&lt;br /&gt;
Volume slide + vibrato: Axy and 400 combined.&lt;br /&gt;
&lt;br /&gt;
====7xy====&lt;br /&gt;
Tremolo. x is speed, y is depth. Like vibrato, except we modify the output volume. The volume is clamped to 0 &amp;lt;= vol &amp;lt;= 64.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: is the maximum amplitude ~16, ~32 or ~64?)''&lt;br /&gt;
&lt;br /&gt;
If xy is 0, then use previous value for 7xy (?).&lt;br /&gt;
&lt;br /&gt;
''(please clarify: does the memory work for tremolo, or just vibrato?)''&lt;br /&gt;
&lt;br /&gt;
====8xx====&lt;br /&gt;
FastTracker panning extension. $00 is hard left, $FF is hard right.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: I really don't give a toss about this FastTracker extension, so I'm putting this question out to someone who does. Does this reset after a new note or sample? And probably some other things, too.)''&lt;br /&gt;
&lt;br /&gt;
====9xx====&lt;br /&gt;
Set sample offset to xx * $100. This also sets the sample starting offset. On older versions of ProTracker (PT &amp;lt; 3.15 (?)), the starting offset is doubled.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: what players perform this quirk?)''&lt;br /&gt;
&lt;br /&gt;
On most non canonical trackers (those which aren't in the SoundTracker -&amp;gt; ProTracker line, e.g. FastTracker, ScreamTracker 3, ImpulseTracker), this quirk does not occur, and the starting offset is always 0.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: what happens when you go over the edge?)''&lt;br /&gt;
&lt;br /&gt;
====Axy====&lt;br /&gt;
Volume slide. Happens every nonzero tick. If x is 0, slide down by y. If y is 0, slide up by x. If both are nonzero, do nothing. Clamp to 0 &amp;lt;= vol &amp;lt;= 64.&lt;br /&gt;
&lt;br /&gt;
Unlike most module formats, this does not have effect memory. If xy is $00, then don't go anywhere.&lt;br /&gt;
&lt;br /&gt;
====Bxx====&lt;br /&gt;
Jump to offset. If you go over the edge, then the module is restarted (?).&lt;br /&gt;
&lt;br /&gt;
''(please clarify: does it actually restart?)''&lt;br /&gt;
&lt;br /&gt;
====Cxx====&lt;br /&gt;
Set volume. If greater than 64, then... (?)&lt;br /&gt;
&lt;br /&gt;
''(please clarify: does it clamp the value at 64, or does it ignore the dud volume? My guess is this: it drops the top bit, and does the former. But that's the lazy way.)''&lt;br /&gt;
&lt;br /&gt;
====Dxy====&lt;br /&gt;
Jump to row x*10 + y. '''THE VALUE PROVIDED IS IN DECIMAL!''' This had to be yelled out as it's a common mistake when making a MOD player.&lt;br /&gt;
&lt;br /&gt;
====E0x====&lt;br /&gt;
If x is 1, turn the Amiga filter off. If x is 0, turn it on. This filter is present on the A500, A2000, and A1200.&lt;br /&gt;
&lt;br /&gt;
For a simple 1-pole low-pass filter, 11500Hz gives a fairly decent estimation.&lt;br /&gt;
&lt;br /&gt;
====E1x====&lt;br /&gt;
Fine slide up. Like 1xx but without effect memory and only on the first tick.&lt;br /&gt;
&lt;br /&gt;
====E2x====&lt;br /&gt;
Fine slide down. Like 2xx but without effect memory and only on the first tick.&lt;br /&gt;
&lt;br /&gt;
====E3x====&lt;br /&gt;
Screw up 3xx.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: how does this actually work?)''&lt;br /&gt;
&lt;br /&gt;
====E4x====&lt;br /&gt;
Set vibrato waveform. x &amp;amp; 3 (bottom 2 bits) sets the waveform type. If bit 2 is set (x &amp;amp; 4), then don't retrigger the waveform.&lt;br /&gt;
&lt;br /&gt;
====E5x====&lt;br /&gt;
Set finetune value for the current sample.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: when does this actually kick in?)''&lt;br /&gt;
&lt;br /&gt;
====E6x====&lt;br /&gt;
Loopback.&lt;br /&gt;
&lt;br /&gt;
If x is 0, then set the loopback point to the current row. The loopback point is reset to -1 for every Bxx or Dxx or pattern transition (?). Looping back with this means that you have to play row 0 twice.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: is MikMod right?)''&lt;br /&gt;
&lt;br /&gt;
Otherwise, we check if the loopback counter set. If the loopback counter is set, then decrement it by 1, otherwise set the counter to x.&lt;br /&gt;
&lt;br /&gt;
After doing this, if the counter is not 0, then we jump back to the loopback point.&lt;br /&gt;
&lt;br /&gt;
Unlike S3M and IT, the loopback point remains where it is, so an E60/E61/E61 sequence down a column will result in an infinite loop.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: is this per-channel or global?)''&lt;br /&gt;
&lt;br /&gt;
====E7x====&lt;br /&gt;
Set tremolo waveform, like E4x.&lt;br /&gt;
&lt;br /&gt;
====E8x====&lt;br /&gt;
Another stereo extension. $0 is hard left, $F is hard right.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: I don't care about this extension, either. It's far from &amp;quot;real Amiga&amp;quot; material. Please see 8xx for the clarifications required.)''&lt;br /&gt;
&lt;br /&gt;
====E9x====&lt;br /&gt;
Retrigger note every x ticks.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: does this effect retrigger like IT, or is this just a matter of ticks % x ?)''&lt;br /&gt;
&lt;br /&gt;
====EAx====&lt;br /&gt;
Fine volume slide up. For the first tick, increment the volume by x, clamping x to &amp;lt;= 64.&lt;br /&gt;
&lt;br /&gt;
====EBx====&lt;br /&gt;
Fine volume slide down. For the first tick, decrement the volume by x, clamping x to &amp;gt;= 0.&lt;br /&gt;
&lt;br /&gt;
====ECx====&lt;br /&gt;
Note cut. On the xth tick, set the volume to 0.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: what happens when x &amp;gt;= TPR?)''&lt;br /&gt;
&lt;br /&gt;
''(please clarify: what happens when x == 0?)''&lt;br /&gt;
&lt;br /&gt;
====EDx====&lt;br /&gt;
Note delay. Don't do what's in the cell until the xth tick.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: is there anything which escapes this check?)''&lt;br /&gt;
&lt;br /&gt;
''(please clarify: what happens when x &amp;gt;= TPR?)''&lt;br /&gt;
&lt;br /&gt;
''(please clarify: what happens when x == 0?)''&lt;br /&gt;
&lt;br /&gt;
====EEx====&lt;br /&gt;
Row delay. Repeat the row x times, e.g. if x is 3, then do the row 4 times in total.&lt;br /&gt;
&lt;br /&gt;
====EFx====&lt;br /&gt;
Funkrepeat. This is rarely implemented because not everyone knows how to use it and those who do generally think it's &amp;quot;nasty&amp;quot; as it overwrites sample data. Some might say this is incredibly rare; however, it appears to be more common than E3x.&lt;br /&gt;
&lt;br /&gt;
So, here's a list which can be added to. The bigger this list, the more pressure MOD player authors will get until they finally implement this under-implemented effect.&lt;br /&gt;
&lt;br /&gt;
=====List of MODs which use EFx=====&lt;br /&gt;
*emax-doz.mod&lt;br /&gt;
*emax-seq.mod&lt;br /&gt;
&lt;br /&gt;
In most cases, a MOD which uses EFx is a chiptune.&lt;br /&gt;
&lt;br /&gt;
In most cases, a MOD which uses EFx ''needs'' it (for epicness purposes mostly).&lt;br /&gt;
&lt;br /&gt;
Firstly, you'll want this table. This tells you how much to increment the internal counter by, and is in the ProTracker v1.2 source code.&lt;br /&gt;
&lt;br /&gt;
 0,5,6,7,8,10,11,13,16,19,22,26,32,43,64,128&lt;br /&gt;
&lt;br /&gt;
If x is 0, then reset that channel's funkrepeat counter and funkrepeat position to 0.&lt;br /&gt;
Otherwise, set that channel's funkrepeat speed to funkrepeat_table[x].&lt;br /&gt;
&lt;br /&gt;
If a channel is not funkrepeating, then you don't need to do what follows for that channel.&lt;br /&gt;
&lt;br /&gt;
For every tick, increment the channel's funkrepeat counter by its funkrepeat speed. If the funkrepeat counter reaches 128, then ''reset the counter to 0'', and then:&lt;br /&gt;
&lt;br /&gt;
 sampledata[current_sample][loop_begin_in_bytes + funkrepeat_pos] ^= 0xFF;&lt;br /&gt;
 funkrepeat_pos = (funkrepeat_pos + 1) % loop_length_in_bytes;&lt;br /&gt;
&lt;br /&gt;
^ is the XOR operator in C. There's also ~ for a binary NOT, but ~= probably isn't valid C.&lt;br /&gt;
&lt;br /&gt;
Every time you reach a new sample (?) value, reset that channel's funkrepeat position to 0, and start modifying the new sample (?).&lt;br /&gt;
&lt;br /&gt;
''(please clarify: does the funkrepeat sample position retrigger on sample, note, either, or both?)''&lt;br /&gt;
&lt;br /&gt;
''(please clarify: when you hit a lone sample which isn't the current one, does it affect that latched sample or the playing sample?)''&lt;br /&gt;
&lt;br /&gt;
''(please clarify: there's probably a lot of mistakes in this.)''&lt;br /&gt;
&lt;br /&gt;
====Fxx====&lt;br /&gt;
Set TPR or BPM. If xx is less than $20 (32) or this is an old 15-sample module (?), set TPR to xx, otherwise set BPM to xx.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: Where is the dividing line between raster timing and CIA timing - that is, when was BPM introduced?)''&lt;br /&gt;
&lt;br /&gt;
''However,'' if xx is 0, then ignore this effect.&lt;br /&gt;
&lt;br /&gt;
==Optimisation tips==&lt;br /&gt;
&lt;br /&gt;
'''Try unrolling your sample loops.''' 2500 bytes of padding should be fine if you're operating within Amiga limits; otherwise, you'll want at least ((base clock * 10) / (smallest period value * 4 * 32)) bytes. To unroll a loopless sample, just pad this number of bytes. To unroll a looped sample, append the loop to the end, then unroll this number of bytes from the loop.&lt;br /&gt;
&lt;br /&gt;
Once you've done that, you only need to check if you've exceeded (length + loop length) words (or bytes if you've converted it) for a looped sample, or length words for an unlooped sample. For an unlooped sample, you just refuse to mix if the offset is past this point. For a looped sample, you set the offset to this:&lt;br /&gt;
&lt;br /&gt;
 offset = length + (offset - length) % looplength;&lt;br /&gt;
&lt;br /&gt;
where % is the modulo operator. Most forms of BASIC do not have a modulo operator, so you'll probably have to do this instead:&lt;br /&gt;
&lt;br /&gt;
 tmp = offset - length;&lt;br /&gt;
 offset = length + tmp - (int(tmp / looplength) * looplength);&lt;br /&gt;
&lt;br /&gt;
This makes funkrepeat trickier to implement, but it has been proven possible.&lt;br /&gt;
&lt;br /&gt;
[[Category: Music Pattern Formats]]&lt;/div&gt;</summary>
		<author><name>GreaseMonkey</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Protracker_Module&amp;diff=12160</id>
		<title>Protracker Module</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Protracker_Module&amp;diff=12160"/>
		<updated>2010-01-21T08:05:52Z</updated>

		<summary type="html">&lt;p&gt;GreaseMonkey: /* 0xy */ &amp;quot;steps&amp;quot; was a bit vague&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* Extension: mod&lt;br /&gt;
Originally a 15-sample format, it was first used in Ultimate SoundTracker for the Amiga. Since then, it has been used in NoiseTracker and ProTracker, which both use the 31-sample &amp;quot;M.K.&amp;quot; version, as well as many other programs on many other platforms; for example, FastTracker 2 for MS-DOS on the PC, which can handle even numbers of channels from 4 to 32.&lt;br /&gt;
&lt;br /&gt;
==File Format==&lt;br /&gt;
The format is big-endian (most significant byte first). A &amp;quot;byte&amp;quot; is 8 bits, and a &amp;quot;word&amp;quot; is 16 bits. Hex values will be denoted with a $ sign.&lt;br /&gt;
&lt;br /&gt;
Amiga limits for periods are 113 &amp;lt;= x &amp;lt;= 856. The lower the period, the higher the pitch.&lt;br /&gt;
&lt;br /&gt;
*20 bytes: Module name, padded with NULs.&lt;br /&gt;
*31 samples (or 15 if we're dealing with a SoundTracker file):&lt;br /&gt;
**22 bytes: Sample name, padded with NULs.&lt;br /&gt;
**Word: Length of sample in words - multiply by 2 to get length in bytes.&lt;br /&gt;
**Byte: Finetune value ranging from $00 to $0F as a signed nybble. $01 is 1/8 of a semitone up, $0F is 1/8 of a semitone down, $08 is 8/8 of a semitone down (that is, a whole semitone). Periods should be clamped to within Amiga limits.&lt;br /&gt;
**Byte: Default volume of sample ranging from 0 to 64 ($00 to $40).&lt;br /&gt;
**Word: Loop start in words.&lt;br /&gt;
**Word: Loop length in words. If set to 1, don't loop. Allegedly, a value of 0 will crash an Amiga.&lt;br /&gt;
*Byte: Order list length.&lt;br /&gt;
*Byte: Traditionally $78 in SoundTracker. Was used in NoiseTracker as a restart point. ProTracker uses $7F. FastTracker uses it as a restart point, whereas ScreamTracker 3 uses $7F like ProTracker. You can use this to roughly detect which tracker made a MOD, and detection gets more accurate for more obscure MOD types.&lt;br /&gt;
*128 bytes: Order list. Only the first ''order list length'' orders are actually used when playing; however, we scan the WHOLE order list to find out what the highest-indexed pattern is, and that's how many patterns we load.&lt;br /&gt;
*4 bytes (31-sample version only): Sample tag. If this contains any non-ASCII ($20 to $7E (32 to 126) inclusive) characters, then we probably loaded a 15-sample MOD. The best way to detect this is to seek to this position (it's $438 / 1080) and check before you actually load any data (may not work for streams where you can't seek). Otherwise, it's probably a 31-sample MOD. Values include:&lt;br /&gt;
**'''M.K.''' - standard 4-channel, 64-pattern-max MOD.&lt;br /&gt;
**'''M!K!''' - ProTracker will write this if there's more than 64 patterns,&lt;br /&gt;
**'''6CHN''', '''8CHN''' - 6-channel and 8-channel MODs, respectively. These are common extensions, and many trackers will write these. Basically, you read like a 4 channel mod, but with 6 or 8 channels per row.&lt;br /&gt;
**'''CD81''', '''OKTA''', '''OCTA''' - other 8-channel MOD tags. First two are probably Oktalyzer for the Atari ST, the third is possibly OctaMED.&lt;br /&gt;
**'''xxCH''' - a 10+ channel MOD, xx being a decimal number. FastTracker will deal with these as long as x is an even number no greater than 32.&lt;br /&gt;
**'''xxCN''' - another 10+ channel MOD, xx being a decimal number. Allegedly TakeTracker writes these.&lt;br /&gt;
**'''TDZ1''', '''TDZ2''', '''TDZ3''' - allegedly this is a TakeTracker extension for 1, 2, and 3 channels respectively.&lt;br /&gt;
**'''5CHN''', '''7CHN''', '''9CHN''' - allegedly this is a TakeTracker extension for 5, 7, and 8 channels respectively.&lt;br /&gt;
**'''FLT4''' - StarTrekker 4-channel MOD.&lt;br /&gt;
**'''FLT8''' - StarTrekker 8-channel MOD. Load patterns in like a normal 4-channel MOD, and then play two patterns at the same time (e.g. if 8 appears on the order list, play patterns 8 and 9). You'd probably be best to merge the patterns together if you want to be consistent.&lt;br /&gt;
**'''M&amp;amp;K!''' - only sighted on echobea3.mod so far. This is just a standard MOD, but with a weird tag. ''I ([[User:GreaseMonkey|GreaseMonkey]]) cannot find the tracker it's referring to (&amp;quot;fleg's module train-er&amp;quot;), so it was probably only used once or something, and never released.''&lt;br /&gt;
*Pattern data:&lt;br /&gt;
**Read 4 bytes for a cell. Read ''channel count'' cells for a row. Read 64 of these rows for a pattern. Read ''pattern count'' of these patterns.&lt;br /&gt;
**You read cells as if they were big-endian 32-bit values.&lt;br /&gt;
**Cells are in the format $ipppjfxy:&lt;br /&gt;
***$ppp is the period value. No, not the note, the period.&lt;br /&gt;
***$ij is the sample number.&lt;br /&gt;
***$fxy is the effect, $f being the effect type, and $xy being the effect parameter.&lt;br /&gt;
*Signed 8-bit mono sample data. Remember those sample lengths? Now is the time to use them.&lt;br /&gt;
&lt;br /&gt;
==Playback notes==&lt;br /&gt;
&lt;br /&gt;
Amiga base clock is ''roughly'' 70ns, yielding an audio base clock of 280ns. The actual base clock differs. PAL Amigas have a slightly slower clock than NTSC Amigas. This value of 70ns is close to the NTSC clock, but not quite right. Some modules have large samples (known as &amp;quot;megasamples&amp;quot;) which require a certain type of Amiga - t_o_t.mod, for instance, requires a PAL Amiga, whereas cd_orbit.mod requires an NTSC Amiga (not sure if this &lt;br /&gt;
&lt;br /&gt;
There is a number of ticks per row, often just referred to as the speed.&lt;br /&gt;
&lt;br /&gt;
There is a number of &amp;quot;beats per minute&amp;quot;; however, this is a CIA clock speed (it's an Amiga thing). Often just referred to as the tempo. To convert to actual BPM, multiply by 4 and divide by 10. For clarity, we'll refer to it as BPM, even though it's not entirely correct.&lt;br /&gt;
&lt;br /&gt;
When a looped sample is played, the whole sample plays through once, and then, if it has a loop, the loop is repeated.&lt;br /&gt;
&lt;br /&gt;
If a sample is supplied, then the sample is &amp;quot;latched&amp;quot;, the channel volume is reset to the sample's default volume, and the starting offset is reset to 0. ProTracker 1.1 (?) will change the sample, too, but other versions do not.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: which trackers do this?)''&lt;br /&gt;
&lt;br /&gt;
ImpulseTracker also changes the sample; however, if you're converting MOD to IT yourself and you don't want this, you can put a &amp;quot;note off&amp;quot; with the sample and it will just change the volume (unfortunately, this behaviour does not work correctly with libmodplug or SchismTracker at the moment).&lt;br /&gt;
&lt;br /&gt;
If a period is supplied, then the note plays from the starting offset of the current latched sample, unless there is a note slide (effect 3xx or 5xy).&lt;br /&gt;
&lt;br /&gt;
===Effects===&lt;br /&gt;
====0xy====&lt;br /&gt;
Arpeggio between 0,x,y semitones up, changing every tick, and retriggering every row. Basically, you select by using tick % 3 where % is the modulo operator.&lt;br /&gt;
&lt;br /&gt;
====1xx====&lt;br /&gt;
Slide up. For every nonzero tick, decrement the period by $xx, clamping to 113 (amiga limits).&lt;br /&gt;
&lt;br /&gt;
====2xx====&lt;br /&gt;
Slide down. For every nonzero tick, increment the period by $xx, clamping to 856 (amiga limits).&lt;br /&gt;
&lt;br /&gt;
====3xx====&lt;br /&gt;
Slide to note. For every nonzero tick, move the period $xx closer to the target period.&lt;br /&gt;
&lt;br /&gt;
If xx is 0, then use previous value for 3xx.&lt;br /&gt;
&lt;br /&gt;
====4xy====&lt;br /&gt;
Vibrato. x is speed, y is depth. You'll need to generate 3 waveforms beforehand, and spew out random numbers for the last choice of waveform. Each waveform other than the last has a full cycle of 64 steps, and the amplitude is somewhere between -y and y after calculating. When precalculating the waveform, an amplitude of 64 should be fine.&lt;br /&gt;
&lt;br /&gt;
*Waveform 0 is a sine wave. This is the default.&lt;br /&gt;
*Waveform 1 is a downwards saw wave.&lt;br /&gt;
*Waveform 2 is a square wave, starting from +y.&lt;br /&gt;
*Waveform 3 is random. The cycle of this is mostly irrelevant. In saying this, the speed value is irrelevant with this waveform type, too.&lt;br /&gt;
&lt;br /&gt;
You have a vibrato waveform position. By default, this retriggers for every note (?) you play by being reset to 0. This loops around a cycle of 64 positions.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: is it per note or per sample, or will either retrigger it?)''&lt;br /&gt;
&lt;br /&gt;
For each tick, we add y to the output period at the peak amplitude. For a waveform with peak amplitude of 64, for example, we would add (y*waveform[pos]/64). The period is clamped to Amiga limits.&lt;br /&gt;
&lt;br /&gt;
If xy is 0, then use previous value for 4xy.&lt;br /&gt;
&lt;br /&gt;
====5xy====&lt;br /&gt;
Volume slide + slide to note: Axy and 300 combined.&lt;br /&gt;
&lt;br /&gt;
====6xy====&lt;br /&gt;
Volume slide + vibrato: Axy and 400 combined.&lt;br /&gt;
&lt;br /&gt;
====7xy====&lt;br /&gt;
Tremolo. x is speed, y is depth. Like vibrato, except we modify the output volume. The volume is clamped to 0 &amp;lt;= vol &amp;lt;= 64.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: is the maximum amplitude ~16, ~32 or ~64?)''&lt;br /&gt;
&lt;br /&gt;
If xy is 0, then use previous value for 7xy (?).&lt;br /&gt;
&lt;br /&gt;
''(please clarify: does the memory work for tremolo, or just vibrato?)''&lt;br /&gt;
&lt;br /&gt;
====8xx====&lt;br /&gt;
FastTracker panning extension. $00 is hard left, $FF is hard right.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: I really don't give a toss about this FastTracker extension, so I'm putting this question out to someone who does. Does this reset after a new note or sample? And probably some other things, too.)''&lt;br /&gt;
&lt;br /&gt;
====9xx====&lt;br /&gt;
Set sample offset to xx * $100. This also sets the sample starting offset. On older versions of ProTracker (PT &amp;lt; 3.15 (?)), the starting offset is doubled.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: what players perform this quirk?)''&lt;br /&gt;
&lt;br /&gt;
On most non canonical trackers (those which aren't in the SoundTracker -&amp;gt; ProTracker line, e.g. FastTracker, ScreamTracker 3, ImpulseTracker), this quirk does not occur, and the starting offset is always 0.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: what happens when you go over the edge?)''&lt;br /&gt;
&lt;br /&gt;
====Axy====&lt;br /&gt;
Volume slide. Happens every nonzero tick. If x is 0, slide down by y. If y is 0, slide up by x. If both are nonzero, do nothing. Clamp to 0 &amp;lt;= vol &amp;lt;= 64.&lt;br /&gt;
&lt;br /&gt;
Unlike most module formats, this does not have effect memory. If xy is $00, then don't go anywhere.&lt;br /&gt;
&lt;br /&gt;
====Bxx====&lt;br /&gt;
Jump to offset. If you go over the edge, then the module is restarted (?).&lt;br /&gt;
&lt;br /&gt;
''(please clarify: does it actually restart?)''&lt;br /&gt;
&lt;br /&gt;
====Cxx====&lt;br /&gt;
Set volume. If greater than 64, then... (?)&lt;br /&gt;
&lt;br /&gt;
''(please clarify: does it clamp the value at 64, or does it ignore the dud volume? My guess is this: it drops the top bit, and does the former. But that's the lazy way.)''&lt;br /&gt;
&lt;br /&gt;
====Dxy====&lt;br /&gt;
Jump to row x*10 + y. '''THE VALUE PROVIDED IS IN DECIMAL!''' This had to be yelled out as it's a common mistake when making a MOD player.&lt;br /&gt;
&lt;br /&gt;
====E0x====&lt;br /&gt;
If x is 1, turn the Amiga filter off. If x is 0, turn it on. This filter is present on the A500, A2000, and A1200.&lt;br /&gt;
&lt;br /&gt;
For a simple 1-pole low-pass filter, 11500Hz gives a fairly decent estimation.&lt;br /&gt;
&lt;br /&gt;
====E1x====&lt;br /&gt;
Fine slide up. Like 1xx but without effect memory and only on the first tick.&lt;br /&gt;
&lt;br /&gt;
====E2x====&lt;br /&gt;
Fine slide down. Like 2xx but without effect memory and only on the first tick.&lt;br /&gt;
&lt;br /&gt;
====E3x====&lt;br /&gt;
Screw up 3xx.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: how does this actually work?)''&lt;br /&gt;
&lt;br /&gt;
====E4x====&lt;br /&gt;
Set vibrato waveform. x &amp;amp; 3 (bottom 2 bits) sets the waveform type. If bit 2 is set (x &amp;amp; 4), then don't retrigger the waveform.&lt;br /&gt;
&lt;br /&gt;
====E5x====&lt;br /&gt;
Set finetune value for the current sample.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: when does this actually kick in?)''&lt;br /&gt;
&lt;br /&gt;
====E6x====&lt;br /&gt;
Loopback.&lt;br /&gt;
&lt;br /&gt;
If x is 0, then set the loopback point to the current row. The loopback point is reset to -1 for every Bxx or Dxx or pattern transition (?). Looping back with this means that you have to play row 0 twice.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: is MikMod right?)''&lt;br /&gt;
&lt;br /&gt;
Otherwise, we check if the loopback counter set. If the loopback counter is set, then decrement it by 1, otherwise set the counter to x.&lt;br /&gt;
&lt;br /&gt;
After doing this, if the counter is not 0, then we jump back to the loopback point.&lt;br /&gt;
&lt;br /&gt;
Unlike S3M and IT, the loopback point remains where it is, so an E60/E61/E61 sequence down a column will result in an infinite loop.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: is this per-channel or global?)''&lt;br /&gt;
&lt;br /&gt;
====E7x====&lt;br /&gt;
Set tremolo waveform, like E4x.&lt;br /&gt;
&lt;br /&gt;
====E8x====&lt;br /&gt;
Another stereo extension. $0 is hard left, $F is hard right.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: I don't care about this extension, either. It's far from &amp;quot;real Amiga&amp;quot; material. Please see 8xx for the clarifications required.)''&lt;br /&gt;
&lt;br /&gt;
====E9x====&lt;br /&gt;
Retrigger note every x ticks.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: does this effect retrigger like IT, or is this just a matter of ticks % x ?)''&lt;br /&gt;
&lt;br /&gt;
====EAx====&lt;br /&gt;
Fine volume slide up. For the first tick, increment the volume by x, clamping x to &amp;lt;= 64.&lt;br /&gt;
&lt;br /&gt;
====EBx====&lt;br /&gt;
Fine volume slide down. For the first tick, decrement the volume by x, clamping x to &amp;gt;= 0.&lt;br /&gt;
&lt;br /&gt;
====ECx====&lt;br /&gt;
Note cut. On the xth tick, set the volume to 0.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: what happens when x &amp;gt;= TPR?)''&lt;br /&gt;
&lt;br /&gt;
''(please clarify: what happens when x == 0?)''&lt;br /&gt;
&lt;br /&gt;
====EDx====&lt;br /&gt;
Note delay. Don't do what's in the cell until the xth tick.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: is there anything which escapes this check?)''&lt;br /&gt;
&lt;br /&gt;
''(please clarify: what happens when x &amp;gt;= TPR?)''&lt;br /&gt;
&lt;br /&gt;
''(please clarify: what happens when x == 0?)''&lt;br /&gt;
&lt;br /&gt;
====EEx====&lt;br /&gt;
Row delay. Repeat the row x times, e.g. if x is 3, then do the row 4 times in total.&lt;br /&gt;
&lt;br /&gt;
====EFx====&lt;br /&gt;
Funkrepeat. This is rarely implemented because not everyone knows how to use it and those who do generally think it's &amp;quot;nasty&amp;quot; as it overwrites sample data. Some might say this is incredibly rare; however, it appears to be more common than E3x.&lt;br /&gt;
&lt;br /&gt;
So, here's a list which can be added to. The bigger this list, the more pressure MOD player authors will get until they finally implement this under-implemented effect.&lt;br /&gt;
&lt;br /&gt;
=====List of MODs which use EFx=====&lt;br /&gt;
*emax-doz.mod&lt;br /&gt;
*emax-seq.mod&lt;br /&gt;
&lt;br /&gt;
In most cases, a MOD which uses EFx is a chiptune.&lt;br /&gt;
&lt;br /&gt;
In most cases, a MOD which uses EFx ''needs'' it (for epicness purposes mostly).&lt;br /&gt;
&lt;br /&gt;
Firstly, you'll want this table. This tells you how much to increment the internal counter by, and is in the ProTracker v1.2 source code.&lt;br /&gt;
&lt;br /&gt;
 0,5,6,7,8,10,11,13,16,19,22,26,32,43,64,128&lt;br /&gt;
&lt;br /&gt;
If x is 0, then reset that channel's funkrepeat counter and funkrepeat position to 0.&lt;br /&gt;
Otherwise, set that channel's funkrepeat speed to funkrepeat_table[x].&lt;br /&gt;
&lt;br /&gt;
If a channel is not funkrepeating, then you don't need to do what follows for that channel.&lt;br /&gt;
&lt;br /&gt;
For every tick, increment the channel's funkrepeat counter by its funkrepeat speed. If the funkrepeat counter reaches 128, then ''reset the counter to 0'', and then:&lt;br /&gt;
&lt;br /&gt;
 sampledata[current_sample][loop_begin_in_bytes + funkrepeat_pos] ^= 0xFF;&lt;br /&gt;
 funkrepeat_pos = (funkrepeat_pos + 1) % loop_length_in_bytes;&lt;br /&gt;
&lt;br /&gt;
^ is the XOR operator in C. There's also ~ for a binary NOT, but ~= probably isn't valid C.&lt;br /&gt;
&lt;br /&gt;
Every time you reach a new sample (?) value, reset that channel's funkrepeat position to 0, and start modifying the new sample (?).&lt;br /&gt;
&lt;br /&gt;
''(please clarify: does the funkrepeat sample position retrigger on sample, note, either, or both?)''&lt;br /&gt;
&lt;br /&gt;
''(please clarify: when you hit a lone sample which isn't the current one, does it affect that latched sample or the playing sample?)''&lt;br /&gt;
&lt;br /&gt;
''(please clarify: there's probably a lot of mistakes in this.)''&lt;br /&gt;
&lt;br /&gt;
====Fxx====&lt;br /&gt;
Set TPR or BPM. If xx is less than $20 (32) or this is an old 15-sample module (?), set TPR to xx, otherwise set BPM to xx.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: Where is the dividing line between raster timing and CIA timing - that is, when was BPM introduced?)''&lt;br /&gt;
&lt;br /&gt;
''However,'' if xx is 0, then ignore this effect.&lt;br /&gt;
&lt;br /&gt;
==Optimisation tips==&lt;br /&gt;
&lt;br /&gt;
'''Try unrolling your sample loops.''' 2500 bytes of padding should be fine if you're operating within Amiga limits; otherwise, you'll want at least ((base clock * 10) / (smallest period value * 4 * 32)) bytes. To unroll a loopless sample, just pad this number of bytes. To unroll a looped sample, append the loop to the end, then unroll this number of bytes from the loop.&lt;br /&gt;
&lt;br /&gt;
Once you've done that, you only need to check if you've exceeded (length + loop length) words (or bytes if you've converted it) for a looped sample, or length words for an unlooped sample. For an unlooped sample, you just refuse to mix if the offset is past this point. For a looped sample, you set the offset to this:&lt;br /&gt;
&lt;br /&gt;
 offset = length + (offset - length) % looplength;&lt;br /&gt;
&lt;br /&gt;
where % is the modulo operator. Most forms of BASIC do not have a modulo operator, so you'll probably have to do this instead:&lt;br /&gt;
&lt;br /&gt;
 tmp = offset - length;&lt;br /&gt;
 offset = length + tmp - (int(tmp / looplength) * looplength);&lt;br /&gt;
&lt;br /&gt;
This makes funkrepeat trickier to implement, but it has been proven possible.&lt;br /&gt;
&lt;br /&gt;
[[Category: Music Pattern Formats]]&lt;/div&gt;</summary>
		<author><name>GreaseMonkey</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Protracker_Module&amp;diff=12159</id>
		<title>Protracker Module</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Protracker_Module&amp;diff=12159"/>
		<updated>2010-01-21T07:34:46Z</updated>

		<summary type="html">&lt;p&gt;GreaseMonkey: I think this is all I can do for now.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* Extension: mod&lt;br /&gt;
Originally a 15-sample format, it was first used in Ultimate SoundTracker for the Amiga. Since then, it has been used in NoiseTracker and ProTracker, which both use the 31-sample &amp;quot;M.K.&amp;quot; version, as well as many other programs on many other platforms; for example, FastTracker 2 for MS-DOS on the PC, which can handle even numbers of channels from 4 to 32.&lt;br /&gt;
&lt;br /&gt;
==File Format==&lt;br /&gt;
The format is big-endian (most significant byte first). A &amp;quot;byte&amp;quot; is 8 bits, and a &amp;quot;word&amp;quot; is 16 bits. Hex values will be denoted with a $ sign.&lt;br /&gt;
&lt;br /&gt;
Amiga limits for periods are 113 &amp;lt;= x &amp;lt;= 856. The lower the period, the higher the pitch.&lt;br /&gt;
&lt;br /&gt;
*20 bytes: Module name, padded with NULs.&lt;br /&gt;
*31 samples (or 15 if we're dealing with a SoundTracker file):&lt;br /&gt;
**22 bytes: Sample name, padded with NULs.&lt;br /&gt;
**Word: Length of sample in words - multiply by 2 to get length in bytes.&lt;br /&gt;
**Byte: Finetune value ranging from $00 to $0F as a signed nybble. $01 is 1/8 of a semitone up, $0F is 1/8 of a semitone down, $08 is 8/8 of a semitone down (that is, a whole semitone). Periods should be clamped to within Amiga limits.&lt;br /&gt;
**Byte: Default volume of sample ranging from 0 to 64 ($00 to $40).&lt;br /&gt;
**Word: Loop start in words.&lt;br /&gt;
**Word: Loop length in words. If set to 1, don't loop. Allegedly, a value of 0 will crash an Amiga.&lt;br /&gt;
*Byte: Order list length.&lt;br /&gt;
*Byte: Traditionally $78 in SoundTracker. Was used in NoiseTracker as a restart point. ProTracker uses $7F. FastTracker uses it as a restart point, whereas ScreamTracker 3 uses $7F like ProTracker. You can use this to roughly detect which tracker made a MOD, and detection gets more accurate for more obscure MOD types.&lt;br /&gt;
*128 bytes: Order list. Only the first ''order list length'' orders are actually used when playing; however, we scan the WHOLE order list to find out what the highest-indexed pattern is, and that's how many patterns we load.&lt;br /&gt;
*4 bytes (31-sample version only): Sample tag. If this contains any non-ASCII ($20 to $7E (32 to 126) inclusive) characters, then we probably loaded a 15-sample MOD. The best way to detect this is to seek to this position (it's $438 / 1080) and check before you actually load any data (may not work for streams where you can't seek). Otherwise, it's probably a 31-sample MOD. Values include:&lt;br /&gt;
**'''M.K.''' - standard 4-channel, 64-pattern-max MOD.&lt;br /&gt;
**'''M!K!''' - ProTracker will write this if there's more than 64 patterns,&lt;br /&gt;
**'''6CHN''', '''8CHN''' - 6-channel and 8-channel MODs, respectively. These are common extensions, and many trackers will write these. Basically, you read like a 4 channel mod, but with 6 or 8 channels per row.&lt;br /&gt;
**'''CD81''', '''OKTA''', '''OCTA''' - other 8-channel MOD tags. First two are probably Oktalyzer for the Atari ST, the third is possibly OctaMED.&lt;br /&gt;
**'''xxCH''' - a 10+ channel MOD, xx being a decimal number. FastTracker will deal with these as long as x is an even number no greater than 32.&lt;br /&gt;
**'''xxCN''' - another 10+ channel MOD, xx being a decimal number. Allegedly TakeTracker writes these.&lt;br /&gt;
**'''TDZ1''', '''TDZ2''', '''TDZ3''' - allegedly this is a TakeTracker extension for 1, 2, and 3 channels respectively.&lt;br /&gt;
**'''5CHN''', '''7CHN''', '''9CHN''' - allegedly this is a TakeTracker extension for 5, 7, and 8 channels respectively.&lt;br /&gt;
**'''FLT4''' - StarTrekker 4-channel MOD.&lt;br /&gt;
**'''FLT8''' - StarTrekker 8-channel MOD. Load patterns in like a normal 4-channel MOD, and then play two patterns at the same time (e.g. if 8 appears on the order list, play patterns 8 and 9). You'd probably be best to merge the patterns together if you want to be consistent.&lt;br /&gt;
**'''M&amp;amp;K!''' - only sighted on echobea3.mod so far. This is just a standard MOD, but with a weird tag. ''I ([[User:GreaseMonkey|GreaseMonkey]]) cannot find the tracker it's referring to (&amp;quot;fleg's module train-er&amp;quot;), so it was probably only used once or something, and never released.''&lt;br /&gt;
*Pattern data:&lt;br /&gt;
**Read 4 bytes for a cell. Read ''channel count'' cells for a row. Read 64 of these rows for a pattern. Read ''pattern count'' of these patterns.&lt;br /&gt;
**You read cells as if they were big-endian 32-bit values.&lt;br /&gt;
**Cells are in the format $ipppjfxy:&lt;br /&gt;
***$ppp is the period value. No, not the note, the period.&lt;br /&gt;
***$ij is the sample number.&lt;br /&gt;
***$fxy is the effect, $f being the effect type, and $xy being the effect parameter.&lt;br /&gt;
*Signed 8-bit mono sample data. Remember those sample lengths? Now is the time to use them.&lt;br /&gt;
&lt;br /&gt;
==Playback notes==&lt;br /&gt;
&lt;br /&gt;
Amiga base clock is ''roughly'' 70ns, yielding an audio base clock of 280ns. The actual base clock differs. PAL Amigas have a slightly slower clock than NTSC Amigas. This value of 70ns is close to the NTSC clock, but not quite right. Some modules have large samples (known as &amp;quot;megasamples&amp;quot;) which require a certain type of Amiga - t_o_t.mod, for instance, requires a PAL Amiga, whereas cd_orbit.mod requires an NTSC Amiga (not sure if this &lt;br /&gt;
&lt;br /&gt;
There is a number of ticks per row, often just referred to as the speed.&lt;br /&gt;
&lt;br /&gt;
There is a number of &amp;quot;beats per minute&amp;quot;; however, this is a CIA clock speed (it's an Amiga thing). Often just referred to as the tempo. To convert to actual BPM, multiply by 4 and divide by 10. For clarity, we'll refer to it as BPM, even though it's not entirely correct.&lt;br /&gt;
&lt;br /&gt;
When a looped sample is played, the whole sample plays through once, and then, if it has a loop, the loop is repeated.&lt;br /&gt;
&lt;br /&gt;
If a sample is supplied, then the sample is &amp;quot;latched&amp;quot;, the channel volume is reset to the sample's default volume, and the starting offset is reset to 0. ProTracker 1.1 (?) will change the sample, too, but other versions do not.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: which trackers do this?)''&lt;br /&gt;
&lt;br /&gt;
ImpulseTracker also changes the sample; however, if you're converting MOD to IT yourself and you don't want this, you can put a &amp;quot;note off&amp;quot; with the sample and it will just change the volume (unfortunately, this behaviour does not work correctly with libmodplug or SchismTracker at the moment).&lt;br /&gt;
&lt;br /&gt;
If a period is supplied, then the note plays from the starting offset of the current latched sample, unless there is a note slide (effect 3xx or 5xy).&lt;br /&gt;
&lt;br /&gt;
===Effects===&lt;br /&gt;
====0xy====&lt;br /&gt;
Arpeggio between 0,x,y steps up, changing every tick, and retriggering every row. Basically, you select by using tick % 3 where % is the modulo operator.&lt;br /&gt;
&lt;br /&gt;
====1xx====&lt;br /&gt;
Slide up. For every nonzero tick, decrement the period by $xx, clamping to 113 (amiga limits).&lt;br /&gt;
&lt;br /&gt;
====2xx====&lt;br /&gt;
Slide down. For every nonzero tick, increment the period by $xx, clamping to 856 (amiga limits).&lt;br /&gt;
&lt;br /&gt;
====3xx====&lt;br /&gt;
Slide to note. For every nonzero tick, move the period $xx closer to the target period.&lt;br /&gt;
&lt;br /&gt;
If xx is 0, then use previous value for 3xx.&lt;br /&gt;
&lt;br /&gt;
====4xy====&lt;br /&gt;
Vibrato. x is speed, y is depth. You'll need to generate 3 waveforms beforehand, and spew out random numbers for the last choice of waveform. Each waveform other than the last has a full cycle of 64 steps, and the amplitude is somewhere between -y and y after calculating. When precalculating the waveform, an amplitude of 64 should be fine.&lt;br /&gt;
&lt;br /&gt;
*Waveform 0 is a sine wave. This is the default.&lt;br /&gt;
*Waveform 1 is a downwards saw wave.&lt;br /&gt;
*Waveform 2 is a square wave, starting from +y.&lt;br /&gt;
*Waveform 3 is random. The cycle of this is mostly irrelevant. In saying this, the speed value is irrelevant with this waveform type, too.&lt;br /&gt;
&lt;br /&gt;
You have a vibrato waveform position. By default, this retriggers for every note (?) you play by being reset to 0. This loops around a cycle of 64 positions.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: is it per note or per sample, or will either retrigger it?)''&lt;br /&gt;
&lt;br /&gt;
For each tick, we add y to the output period at the peak amplitude. For a waveform with peak amplitude of 64, for example, we would add (y*waveform[pos]/64). The period is clamped to Amiga limits.&lt;br /&gt;
&lt;br /&gt;
If xy is 0, then use previous value for 4xy.&lt;br /&gt;
&lt;br /&gt;
====5xy====&lt;br /&gt;
Volume slide + slide to note: Axy and 300 combined.&lt;br /&gt;
&lt;br /&gt;
====6xy====&lt;br /&gt;
Volume slide + vibrato: Axy and 400 combined.&lt;br /&gt;
&lt;br /&gt;
====7xy====&lt;br /&gt;
Tremolo. x is speed, y is depth. Like vibrato, except we modify the output volume. The volume is clamped to 0 &amp;lt;= vol &amp;lt;= 64.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: is the maximum amplitude ~16, ~32 or ~64?)''&lt;br /&gt;
&lt;br /&gt;
If xy is 0, then use previous value for 7xy (?).&lt;br /&gt;
&lt;br /&gt;
''(please clarify: does the memory work for tremolo, or just vibrato?)''&lt;br /&gt;
&lt;br /&gt;
====8xx====&lt;br /&gt;
FastTracker panning extension. $00 is hard left, $FF is hard right.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: I really don't give a toss about this FastTracker extension, so I'm putting this question out to someone who does. Does this reset after a new note or sample? And probably some other things, too.)''&lt;br /&gt;
&lt;br /&gt;
====9xx====&lt;br /&gt;
Set sample offset to xx * $100. This also sets the sample starting offset. On older versions of ProTracker (PT &amp;lt; 3.15 (?)), the starting offset is doubled.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: what players perform this quirk?)''&lt;br /&gt;
&lt;br /&gt;
On most non canonical trackers (those which aren't in the SoundTracker -&amp;gt; ProTracker line, e.g. FastTracker, ScreamTracker 3, ImpulseTracker), this quirk does not occur, and the starting offset is always 0.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: what happens when you go over the edge?)''&lt;br /&gt;
&lt;br /&gt;
====Axy====&lt;br /&gt;
Volume slide. Happens every nonzero tick. If x is 0, slide down by y. If y is 0, slide up by x. If both are nonzero, do nothing. Clamp to 0 &amp;lt;= vol &amp;lt;= 64.&lt;br /&gt;
&lt;br /&gt;
Unlike most module formats, this does not have effect memory. If xy is $00, then don't go anywhere.&lt;br /&gt;
&lt;br /&gt;
====Bxx====&lt;br /&gt;
Jump to offset. If you go over the edge, then the module is restarted (?).&lt;br /&gt;
&lt;br /&gt;
''(please clarify: does it actually restart?)''&lt;br /&gt;
&lt;br /&gt;
====Cxx====&lt;br /&gt;
Set volume. If greater than 64, then... (?)&lt;br /&gt;
&lt;br /&gt;
''(please clarify: does it clamp the value at 64, or does it ignore the dud volume? My guess is this: it drops the top bit, and does the former. But that's the lazy way.)''&lt;br /&gt;
&lt;br /&gt;
====Dxy====&lt;br /&gt;
Jump to row x*10 + y. '''THE VALUE PROVIDED IS IN DECIMAL!''' This had to be yelled out as it's a common mistake when making a MOD player.&lt;br /&gt;
&lt;br /&gt;
====E0x====&lt;br /&gt;
If x is 1, turn the Amiga filter off. If x is 0, turn it on. This filter is present on the A500, A2000, and A1200.&lt;br /&gt;
&lt;br /&gt;
For a simple 1-pole low-pass filter, 11500Hz gives a fairly decent estimation.&lt;br /&gt;
&lt;br /&gt;
====E1x====&lt;br /&gt;
Fine slide up. Like 1xx but without effect memory and only on the first tick.&lt;br /&gt;
&lt;br /&gt;
====E2x====&lt;br /&gt;
Fine slide down. Like 2xx but without effect memory and only on the first tick.&lt;br /&gt;
&lt;br /&gt;
====E3x====&lt;br /&gt;
Screw up 3xx.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: how does this actually work?)''&lt;br /&gt;
&lt;br /&gt;
====E4x====&lt;br /&gt;
Set vibrato waveform. x &amp;amp; 3 (bottom 2 bits) sets the waveform type. If bit 2 is set (x &amp;amp; 4), then don't retrigger the waveform.&lt;br /&gt;
&lt;br /&gt;
====E5x====&lt;br /&gt;
Set finetune value for the current sample.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: when does this actually kick in?)''&lt;br /&gt;
&lt;br /&gt;
====E6x====&lt;br /&gt;
Loopback.&lt;br /&gt;
&lt;br /&gt;
If x is 0, then set the loopback point to the current row. The loopback point is reset to -1 for every Bxx or Dxx or pattern transition (?). Looping back with this means that you have to play row 0 twice.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: is MikMod right?)''&lt;br /&gt;
&lt;br /&gt;
Otherwise, we check if the loopback counter set. If the loopback counter is set, then decrement it by 1, otherwise set the counter to x.&lt;br /&gt;
&lt;br /&gt;
After doing this, if the counter is not 0, then we jump back to the loopback point.&lt;br /&gt;
&lt;br /&gt;
Unlike S3M and IT, the loopback point remains where it is, so an E60/E61/E61 sequence down a column will result in an infinite loop.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: is this per-channel or global?)''&lt;br /&gt;
&lt;br /&gt;
====E7x====&lt;br /&gt;
Set tremolo waveform, like E4x.&lt;br /&gt;
&lt;br /&gt;
====E8x====&lt;br /&gt;
Another stereo extension. $0 is hard left, $F is hard right.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: I don't care about this extension, either. It's far from &amp;quot;real Amiga&amp;quot; material. Please see 8xx for the clarifications required.)''&lt;br /&gt;
&lt;br /&gt;
====E9x====&lt;br /&gt;
Retrigger note every x ticks.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: does this effect retrigger like IT, or is this just a matter of ticks % x ?)''&lt;br /&gt;
&lt;br /&gt;
====EAx====&lt;br /&gt;
Fine volume slide up. For the first tick, increment the volume by x, clamping x to &amp;lt;= 64.&lt;br /&gt;
&lt;br /&gt;
====EBx====&lt;br /&gt;
Fine volume slide down. For the first tick, decrement the volume by x, clamping x to &amp;gt;= 0.&lt;br /&gt;
&lt;br /&gt;
====ECx====&lt;br /&gt;
Note cut. On the xth tick, set the volume to 0.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: what happens when x &amp;gt;= TPR?)''&lt;br /&gt;
&lt;br /&gt;
''(please clarify: what happens when x == 0?)''&lt;br /&gt;
&lt;br /&gt;
====EDx====&lt;br /&gt;
Note delay. Don't do what's in the cell until the xth tick.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: is there anything which escapes this check?)''&lt;br /&gt;
&lt;br /&gt;
''(please clarify: what happens when x &amp;gt;= TPR?)''&lt;br /&gt;
&lt;br /&gt;
''(please clarify: what happens when x == 0?)''&lt;br /&gt;
&lt;br /&gt;
====EEx====&lt;br /&gt;
Row delay. Repeat the row x times, e.g. if x is 3, then do the row 4 times in total.&lt;br /&gt;
&lt;br /&gt;
====EFx====&lt;br /&gt;
Funkrepeat. This is rarely implemented because not everyone knows how to use it and those who do generally think it's &amp;quot;nasty&amp;quot; as it overwrites sample data. Some might say this is incredibly rare; however, it appears to be more common than E3x.&lt;br /&gt;
&lt;br /&gt;
So, here's a list which can be added to. The bigger this list, the more pressure MOD player authors will get until they finally implement this under-implemented effect.&lt;br /&gt;
&lt;br /&gt;
=====List of MODs which use EFx=====&lt;br /&gt;
*emax-doz.mod&lt;br /&gt;
*emax-seq.mod&lt;br /&gt;
&lt;br /&gt;
In most cases, a MOD which uses EFx is a chiptune.&lt;br /&gt;
&lt;br /&gt;
In most cases, a MOD which uses EFx ''needs'' it (for epicness purposes mostly).&lt;br /&gt;
&lt;br /&gt;
Firstly, you'll want this table. This tells you how much to increment the internal counter by, and is in the ProTracker v1.2 source code.&lt;br /&gt;
&lt;br /&gt;
 0,5,6,7,8,10,11,13,16,19,22,26,32,43,64,128&lt;br /&gt;
&lt;br /&gt;
If x is 0, then reset that channel's funkrepeat counter and funkrepeat position to 0.&lt;br /&gt;
Otherwise, set that channel's funkrepeat speed to funkrepeat_table[x].&lt;br /&gt;
&lt;br /&gt;
If a channel is not funkrepeating, then you don't need to do what follows for that channel.&lt;br /&gt;
&lt;br /&gt;
For every tick, increment the channel's funkrepeat counter by its funkrepeat speed. If the funkrepeat counter reaches 128, then ''reset the counter to 0'', and then:&lt;br /&gt;
&lt;br /&gt;
 sampledata[current_sample][loop_begin_in_bytes + funkrepeat_pos] ^= 0xFF;&lt;br /&gt;
 funkrepeat_pos = (funkrepeat_pos + 1) % loop_length_in_bytes;&lt;br /&gt;
&lt;br /&gt;
^ is the XOR operator in C. There's also ~ for a binary NOT, but ~= probably isn't valid C.&lt;br /&gt;
&lt;br /&gt;
Every time you reach a new sample (?) value, reset that channel's funkrepeat position to 0, and start modifying the new sample (?).&lt;br /&gt;
&lt;br /&gt;
''(please clarify: does the funkrepeat sample position retrigger on sample, note, either, or both?)''&lt;br /&gt;
&lt;br /&gt;
''(please clarify: when you hit a lone sample which isn't the current one, does it affect that latched sample or the playing sample?)''&lt;br /&gt;
&lt;br /&gt;
''(please clarify: there's probably a lot of mistakes in this.)''&lt;br /&gt;
&lt;br /&gt;
====Fxx====&lt;br /&gt;
Set TPR or BPM. If xx is less than $20 (32) or this is an old 15-sample module (?), set TPR to xx, otherwise set BPM to xx.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: Where is the dividing line between raster timing and CIA timing - that is, when was BPM introduced?)''&lt;br /&gt;
&lt;br /&gt;
''However,'' if xx is 0, then ignore this effect.&lt;br /&gt;
&lt;br /&gt;
==Optimisation tips==&lt;br /&gt;
&lt;br /&gt;
'''Try unrolling your sample loops.''' 2500 bytes of padding should be fine if you're operating within Amiga limits; otherwise, you'll want at least ((base clock * 10) / (smallest period value * 4 * 32)) bytes. To unroll a loopless sample, just pad this number of bytes. To unroll a looped sample, append the loop to the end, then unroll this number of bytes from the loop.&lt;br /&gt;
&lt;br /&gt;
Once you've done that, you only need to check if you've exceeded (length + loop length) words (or bytes if you've converted it) for a looped sample, or length words for an unlooped sample. For an unlooped sample, you just refuse to mix if the offset is past this point. For a looped sample, you set the offset to this:&lt;br /&gt;
&lt;br /&gt;
 offset = length + (offset - length) % looplength;&lt;br /&gt;
&lt;br /&gt;
where % is the modulo operator. Most forms of BASIC do not have a modulo operator, so you'll probably have to do this instead:&lt;br /&gt;
&lt;br /&gt;
 tmp = offset - length;&lt;br /&gt;
 offset = length + tmp - (int(tmp / looplength) * looplength);&lt;br /&gt;
&lt;br /&gt;
This makes funkrepeat trickier to implement, but it has been proven possible.&lt;br /&gt;
&lt;br /&gt;
[[Category: Music Pattern Formats]]&lt;/div&gt;</summary>
		<author><name>GreaseMonkey</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Protracker_Module&amp;diff=12158</id>
		<title>Protracker Module</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Protracker_Module&amp;diff=12158"/>
		<updated>2010-01-21T07:21:40Z</updated>

		<summary type="html">&lt;p&gt;GreaseMonkey: Nearly there.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* Extension: mod&lt;br /&gt;
Originally a 15-sample format, it was used in Ultimate SoundTracker for the Amiga. Since then, it has been used in NoiseTracker and ProTracker, which both use the 31-sample &amp;quot;M.K.&amp;quot; version, as well as many other programs on many other platforms; for example, FastTracker 2 for MS-DOS on the PC, which can handle even numbers of channels from 4 to 32.&lt;br /&gt;
&lt;br /&gt;
==File Format==&lt;br /&gt;
The format is big-endian (most significant byte first). A &amp;quot;byte&amp;quot; is 8 bits, and a &amp;quot;word&amp;quot; is 16 bits. Hex values will be denoted with a $ sign.&lt;br /&gt;
&lt;br /&gt;
Amiga limits for periods are 113 &amp;lt;= x &amp;lt;= 856. The lower the period, the higher the pitch.&lt;br /&gt;
&lt;br /&gt;
*20 bytes: Module name, padded with NULs.&lt;br /&gt;
*31 samples (or 15 if we're dealing with a SoundTracker file):&lt;br /&gt;
**22 bytes: Sample name, padded with NULs.&lt;br /&gt;
**Word: Length of sample in words - multiply by 2 to get length in bytes.&lt;br /&gt;
**Byte: Finetune value ranging from $00 to $0F as a signed nybble. $01 is 1/8 of a semitone up, $0F is 1/8 of a semitone down, $08 is 8/8 of a semitone down (that is, a whole semitone). Periods should be clamped to within Amiga limits.&lt;br /&gt;
**Byte: Default volume of sample ranging from 0 to 64 ($00 to $40).&lt;br /&gt;
**Word: Loop start in words.&lt;br /&gt;
**Word: Loop length in words. If set to 1, don't loop. Allegedly, a value of 0 will crash an Amiga.&lt;br /&gt;
*Byte: Order list length.&lt;br /&gt;
*Byte: Traditionally $78 in SoundTracker. Was used in NoiseTracker as a restart point. ProTracker uses $7F. FastTracker uses it as a restart point, whereas ScreamTracker 3 uses $7F like ProTracker. You can use this to roughly detect which tracker made a MOD, and detection gets more accurate for more obscure MOD types.&lt;br /&gt;
*128 bytes: Order list. Only the first ''order list length'' orders are actually used when playing; however, we scan the WHOLE order list to find out what the highest-indexed pattern is, and that's how many patterns we load.&lt;br /&gt;
*4 bytes (31-sample version only): Sample tag. If this contains any non-ASCII ($20 to $7E (32 to 126) inclusive) characters, then we probably loaded a 15-sample MOD. The best way to detect this is to seek to this position (it's $438 / 1080) and check before you actually load any data (may not work for streams where you can't seek). Otherwise, it's probably a 31-sample MOD. Values include:&lt;br /&gt;
**'''M.K.''' - standard 4-channel, 64-pattern-max MOD.&lt;br /&gt;
**'''M!K!''' - ProTracker will write this if there's more than 64 patterns,&lt;br /&gt;
**'''6CHN''', '''8CHN''' - 6-channel and 8-channel MODs, respectively. These are common extensions, and many trackers will write these. Basically, you read like a 4 channel mod, but with 6 or 8 channels per row.&lt;br /&gt;
**'''CD81''', '''OKTA''', '''OCTA''' - other 8-channel MOD tags. First two are probably Oktalyzer for the Atari ST, the third is possibly OctaMED.&lt;br /&gt;
**'''xxCH''' - a 10+ channel MOD, xx being a decimal number. FastTracker will deal with these as long as x is an even number no greater than 32.&lt;br /&gt;
**'''xxCN''' - another 10+ channel MOD, xx being a decimal number. Allegedly TakeTracker writes these.&lt;br /&gt;
**'''TDZ1''', '''TDZ2''', '''TDZ3''' - allegedly this is a TakeTracker extension for 1, 2, and 3 channels respectively.&lt;br /&gt;
**'''5CHN''', '''7CHN''', '''9CHN''' - allegedly this is a TakeTracker extension for 5, 7, and 8 channels respectively.&lt;br /&gt;
**'''FLT4''' - StarTrekker 4-channel MOD.&lt;br /&gt;
**'''FLT8''' - StarTrekker 8-channel MOD. Load patterns in like a normal 4-channel MOD, and then play two patterns at the same time (e.g. if 8 appears on the order list, play patterns 8 and 9). You'd probably be best to merge the patterns together if you want to be consistent.&lt;br /&gt;
**'''M&amp;amp;K!''' - only sighted on echobea3.mod so far. This is just a standard MOD, but with a weird tag. ''I ([[User:GreaseMonkey|GreaseMonkey]]) cannot find the tracker it's referring to (&amp;quot;fleg's module train-er&amp;quot;), so it was probably only used once or something, and never released.''&lt;br /&gt;
*Pattern data:&lt;br /&gt;
**Read 4 bytes for a cell. Read ''channel count'' cells for a row. Read 64 of these rows for a pattern. Read ''pattern count'' of these patterns.&lt;br /&gt;
**You read cells as if they were big-endian 32-bit values.&lt;br /&gt;
**Cells are in the format $ipppjfxy:&lt;br /&gt;
***$ppp is the period value. No, not the note, the period.&lt;br /&gt;
***$ij is the sample number.&lt;br /&gt;
***$fxy is the effect, $f being the effect type, and $xy being the effect parameter.&lt;br /&gt;
*Signed 8-bit mono sample data. Remember those sample lengths? Now is the time to use them.&lt;br /&gt;
&lt;br /&gt;
==Playback notes==&lt;br /&gt;
&lt;br /&gt;
Amiga base clock is ''roughly'' 70ns, yielding an audio base clock of 280ns. The actual base clock differs. PAL Amigas have a slightly slower clock than NTSC Amigas. This value of 70ns is close to the NTSC clock, but not quite right. Some modules have large samples (known as &amp;quot;megasamples&amp;quot;) which require a certain type of Amiga - t_o_t.mod, for instance, requires a PAL Amiga, whereas cd_orbit.mod requires an NTSC Amiga (not sure if this &lt;br /&gt;
&lt;br /&gt;
There is a number of ticks per row, often just referred to as the speed.&lt;br /&gt;
&lt;br /&gt;
There is a number of &amp;quot;beats per minute&amp;quot;; however, this is a CIA clock speed (it's an Amiga thing). Often just referred to as the tempo. To convert to actual BPM, multiply by 4 and divide by 10. For clarity, we'll refer to it as BPM, even though it's not entirely correct.&lt;br /&gt;
&lt;br /&gt;
When a looped sample is played, the whole sample plays through once, and then, if it has a loop, the loop is repeated.&lt;br /&gt;
&lt;br /&gt;
===Effects===&lt;br /&gt;
&lt;br /&gt;
====0xy====&lt;br /&gt;
Arpeggio between 0,x,y steps up, changing every tick, and retriggering every row. Basically, you select by using tick % 3 where % is the modulo operator.&lt;br /&gt;
&lt;br /&gt;
====1xx====&lt;br /&gt;
Slide up. For every nonzero tick, decrement the period by $xx, clamping to 113 (amiga limits).&lt;br /&gt;
&lt;br /&gt;
====2xx====&lt;br /&gt;
Slide down. For every nonzero tick, increment the period by $xx, clamping to 856 (amiga limits).&lt;br /&gt;
&lt;br /&gt;
====3xx====&lt;br /&gt;
Slide to note. For every nonzero tick, move the period $xx closer to the target period.&lt;br /&gt;
&lt;br /&gt;
If xx is 0, then use previous value for 3xx.&lt;br /&gt;
&lt;br /&gt;
====4xy====&lt;br /&gt;
Vibrato. x is speed, y is depth. You'll need to generate 3 waveforms beforehand, and spew out random numbers for the last choice of waveform. Each waveform other than the last has a full cycle of 64 steps, and the amplitude is somewhere between -y and y after calculating. When precalculating the waveform, an amplitude of 64 should be fine.&lt;br /&gt;
&lt;br /&gt;
*Waveform 0 is a sine wave. This is the default.&lt;br /&gt;
*Waveform 1 is a downwards saw wave.&lt;br /&gt;
*Waveform 2 is a square wave, starting from +y.&lt;br /&gt;
*Waveform 3 is random. The cycle of this is mostly irrelevant. In saying this, the speed value is irrelevant with this waveform type, too.&lt;br /&gt;
&lt;br /&gt;
You have a vibrato waveform position. By default, this retriggers for every note (?) you play by being reset to 0. This loops around a cycle of 64 positions.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: is it per note or per sample, or will either retrigger it?)''&lt;br /&gt;
&lt;br /&gt;
For each tick, we add y to the output period at the peak amplitude. For a waveform with peak amplitude of 64, for example, we would add (y*waveform[pos]/64). The period is clamped to Amiga limits.&lt;br /&gt;
&lt;br /&gt;
If xy is 0, then use previous value for 4xy.&lt;br /&gt;
&lt;br /&gt;
====5xy====&lt;br /&gt;
Volume slide + slide to note: Axy and 300 combined.&lt;br /&gt;
&lt;br /&gt;
====6xy====&lt;br /&gt;
Volume slide + vibrato: Axy and 400 combined.&lt;br /&gt;
&lt;br /&gt;
====7xy====&lt;br /&gt;
Tremolo. x is speed, y is depth. Like vibrato, except we modify the output volume. The volume is clamped to 0 &amp;lt;= vol &amp;lt;= 64.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: is the maximum amplitude ~16, ~32 or ~64?)''&lt;br /&gt;
&lt;br /&gt;
If xy is 0, then use previous value for 7xy (?).&lt;br /&gt;
&lt;br /&gt;
''(please clarify: does the memory work for tremolo, or just vibrato?)''&lt;br /&gt;
&lt;br /&gt;
====8xx====&lt;br /&gt;
FastTracker panning extension. $00 is hard left, $FF is hard right.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: I really don't give a toss about this FastTracker extension, so I'm putting this question out to someone who does. Does this reset after a new note or sample? And probably some other things, too.)''&lt;br /&gt;
&lt;br /&gt;
====9xx====&lt;br /&gt;
Set sample offset to xx * $100.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: what happens when you go over the edge?)''&lt;br /&gt;
&lt;br /&gt;
''TODO: note w/o instrument retrigger quirk + PT1/2 offset doubling bug''&lt;br /&gt;
&lt;br /&gt;
====Axy====&lt;br /&gt;
Volume slide. Happens every nonzero tick. If x is 0, slide down by y. If y is 0, slide up by x. If both are nonzero, do nothing. Clamp to 0 &amp;lt;= vol &amp;lt;= 64.&lt;br /&gt;
&lt;br /&gt;
Unlike most module formats, this does not have effect memory. If xy is $00, then don't go anywhere.&lt;br /&gt;
&lt;br /&gt;
====Bxx====&lt;br /&gt;
Jump to offset. If you go over the edge, then the module is restarted (?).&lt;br /&gt;
&lt;br /&gt;
''(please clarify: does it actually restart?)''&lt;br /&gt;
&lt;br /&gt;
====Cxx====&lt;br /&gt;
Set volume. If greater than 64, then... (?)&lt;br /&gt;
&lt;br /&gt;
''(please clarify: does it clamp the value at 64, or does it ignore the dud volume? My guess is this: it drops the top bit, and does the former. But that's the lazy way.)''&lt;br /&gt;
&lt;br /&gt;
====Dxy====&lt;br /&gt;
Jump to row x*10 + y. '''THE VALUE PROVIDED IS IN DECIMAL!''' This had to be yelled out as it's a common mistake when making a MOD player.&lt;br /&gt;
&lt;br /&gt;
====E0x====&lt;br /&gt;
If x is 1, turn the Amiga filter off. If x is 0, turn it on. This filter is present on the A500, A2000, and A1200.&lt;br /&gt;
&lt;br /&gt;
For a simple 1-pole low-pass filter, 11500Hz gives a fairly decent estimation.&lt;br /&gt;
&lt;br /&gt;
====E1x====&lt;br /&gt;
Fine slide up. Like 1xx but without effect memory and only on the first tick.&lt;br /&gt;
&lt;br /&gt;
====E2x====&lt;br /&gt;
Fine slide down. Like 2xx but without effect memory and only on the first tick.&lt;br /&gt;
&lt;br /&gt;
====E3x====&lt;br /&gt;
Screw up 3xx.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: how does this actually work?)''&lt;br /&gt;
&lt;br /&gt;
====E4x====&lt;br /&gt;
Set vibrato waveform. x &amp;amp; 3 (bottom 2 bits) sets the waveform type. If bit 2 is set (x &amp;amp; 4), then don't retrigger the waveform.&lt;br /&gt;
&lt;br /&gt;
====E5x====&lt;br /&gt;
Set finetune value for the current sample.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: when does this actually kick in?)''&lt;br /&gt;
&lt;br /&gt;
====E6x====&lt;br /&gt;
Loopback.&lt;br /&gt;
&lt;br /&gt;
If x is 0, then set the loopback point to the current row. The loopback point is reset to -1 for every Bxx or Dxx or pattern transition (?). Looping back with this means that you have to play row 0 twice.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: is MikMod right?)''&lt;br /&gt;
&lt;br /&gt;
Otherwise, we check if the loopback counter set. If the loopback counter is set, then decrement it by 1, otherwise set the counter to x.&lt;br /&gt;
&lt;br /&gt;
After doing this, if the counter is not 0, then we jump back to the loopback point.&lt;br /&gt;
&lt;br /&gt;
Unlike S3M and IT, the loopback point remains where it is, so an E60/E61/E61 sequence down a column will result in an infinite loop.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: is this per-channel or global?)''&lt;br /&gt;
&lt;br /&gt;
====E7x====&lt;br /&gt;
Set tremolo waveform, like E4x.&lt;br /&gt;
&lt;br /&gt;
====E8x====&lt;br /&gt;
Another stereo extension. $0 is hard left, $F is hard right.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: I don't care about this extension, either. It's far from &amp;quot;real Amiga&amp;quot; material. Please see 8xx for the clarifications required.)''&lt;br /&gt;
&lt;br /&gt;
====E9x====&lt;br /&gt;
Retrigger note every x ticks.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: does this effect retrigger like IT, or is this just a matter of ticks % x ?)''&lt;br /&gt;
&lt;br /&gt;
====EAx====&lt;br /&gt;
Fine volume slide up. For the first tick, increment the volume by x, clamping x to &amp;lt;= 64.&lt;br /&gt;
&lt;br /&gt;
====EBx====&lt;br /&gt;
Fine volume slide down. For the first tick, decrement the volume by x, clamping x to &amp;gt;= 0.&lt;br /&gt;
&lt;br /&gt;
====ECx====&lt;br /&gt;
Note cut. On the xth tick, set the volume to 0.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: what happens when x &amp;gt;= TPR?)''&lt;br /&gt;
&lt;br /&gt;
''(please clarify: what happens when x == 0?)''&lt;br /&gt;
&lt;br /&gt;
====EDx====&lt;br /&gt;
Note delay. Don't do what's in the cell until the xth tick.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: is there anything which escapes this check?)''&lt;br /&gt;
&lt;br /&gt;
''(please clarify: what happens when x &amp;gt;= TPR?)''&lt;br /&gt;
&lt;br /&gt;
''(please clarify: what happens when x == 0?)''&lt;br /&gt;
&lt;br /&gt;
====EEx====&lt;br /&gt;
Row delay. Repeat the row x times, e.g. if x is 3, then do the row 4 times in total.&lt;br /&gt;
&lt;br /&gt;
====EFx====&lt;br /&gt;
Funkrepeat. This is rarely implemented because not everyone knows how to use it and those who do generally think it's &amp;quot;nasty&amp;quot; as it overwrites sample data. Some might say this is incredibly rare; however, it appears to be more common than E3x.&lt;br /&gt;
&lt;br /&gt;
So, here's a list which can be added to. The bigger this list, the more pressure MOD player authors will get until they finally implement this under-implemented effect.&lt;br /&gt;
&lt;br /&gt;
=====List of MODs which use EFx=====&lt;br /&gt;
*emax-doz.mod&lt;br /&gt;
*emax-seq.mod&lt;br /&gt;
&lt;br /&gt;
In most cases, a MOD which uses EFx is a chiptune.&lt;br /&gt;
&lt;br /&gt;
In most cases, a MOD which uses EFx ''needs'' it (for epicness purposes mostly).&lt;br /&gt;
&lt;br /&gt;
Firstly, you'll want this table. This tells you how much to increment the internal counter by, and is in the ProTracker v1.2 source code.&lt;br /&gt;
&lt;br /&gt;
 0,5,6,7,8,10,11,13,16,19,22,26,32,43,64,128&lt;br /&gt;
&lt;br /&gt;
If x is 0, then reset that channel's funkrepeat counter and funkrepeat position to 0.&lt;br /&gt;
Otherwise, set that channel's funkrepeat speed to funkrepeat_table[x].&lt;br /&gt;
&lt;br /&gt;
If a channel is not funkrepeating, then you don't need to do what follows for that channel.&lt;br /&gt;
&lt;br /&gt;
For every tick, increment the channel's funkrepeat counter by its funkrepeat speed. If the funkrepeat counter reaches 128, then ''reset the counter to 0'', and then:&lt;br /&gt;
&lt;br /&gt;
 sampledata[current_sample][loop_begin_in_bytes + funkrepeat_pos] ^= 0xFF;&lt;br /&gt;
 funkrepeat_pos = (funkrepeat_pos + 1) % loop_length_in_bytes;&lt;br /&gt;
&lt;br /&gt;
^ is the XOR operator in C. There's also ~ for a binary NOT, but ~= probably isn't valid C.&lt;br /&gt;
&lt;br /&gt;
Every time you reach a new sample (?) value, reset that channel's funkrepeat position to 0, and start modifying the new sample (?).&lt;br /&gt;
&lt;br /&gt;
''(please clarify: does the funkrepeat sample position retrigger on sample, note, either, or both?)''&lt;br /&gt;
&lt;br /&gt;
''(please clarify: when you hit a lone sample which isn't the current one, does it affect that latched sample or the playing sample?)''&lt;br /&gt;
&lt;br /&gt;
''(please clarify: there's probably a lot of mistakes in this.)''&lt;br /&gt;
&lt;br /&gt;
====Fxx====&lt;br /&gt;
Set TPR or BPM. If xx is less than $20 (32) or this is an old 15-sample module (?), set TPR to xx, otherwise set BPM to xx.&lt;br /&gt;
&lt;br /&gt;
''(please clarify: Where is the dividing line between raster timing and CIA timing - that is, when was BPM introduced?)''&lt;br /&gt;
&lt;br /&gt;
''However,'' if xx is 0, then ignore this effect.&lt;br /&gt;
&lt;br /&gt;
==Optimisation tips==&lt;br /&gt;
&lt;br /&gt;
'''Try unrolling your sample loops.''' 2500 bytes of padding should be fine if you're operating within Amiga limits; otherwise, you'll want at least ((base clock * 10) / (smallest period value * 4 * 32)) bytes. To unroll a loopless sample, just pad this number of bytes. To unroll a looped sample, append the loop to the end, then unroll this number of bytes from the loop.&lt;br /&gt;
&lt;br /&gt;
Once you've done that, you only need to check if you've exceeded (length + loop length) words (or bytes if you've converted it) for a looped sample, or length words for an unlooped sample. For an unlooped sample, you just refuse to mix if the offset is past this point. For a looped sample, you set the offset to this:&lt;br /&gt;
&lt;br /&gt;
 offset = length + (offset - length) % looplength;&lt;br /&gt;
&lt;br /&gt;
where % is the modulo operator. Most forms of BASIC do not have a modulo operator, so you'll probably have to do this instead:&lt;br /&gt;
&lt;br /&gt;
 tmp = offset - length;&lt;br /&gt;
 offset = length + tmp - (int(tmp / looplength) * looplength);&lt;br /&gt;
&lt;br /&gt;
This makes funkrepeat trickier to implement, but it has been proven possible.&lt;br /&gt;
&lt;br /&gt;
[[Category: Music Pattern Formats]]&lt;/div&gt;</summary>
		<author><name>GreaseMonkey</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=Protracker_Module&amp;diff=12157</id>
		<title>Protracker Module</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=Protracker_Module&amp;diff=12157"/>
		<updated>2010-01-21T05:41:25Z</updated>

		<summary type="html">&lt;p&gt;GreaseMonkey: still working on this thing, i need some food&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* Extension: mod&lt;br /&gt;
Originally a 15-sample format, it was used in Ultimate SoundTracker for the Amiga. Since then, it has been used in NoiseTracker and ProTracker, which both use the 31-sample &amp;quot;M.K.&amp;quot; version, as well as many other programs on many other platforms; for example, FastTracker 2 for MS-DOS on the PC, which can handle even numbers of channels from 4 to 32.&lt;br /&gt;
&lt;br /&gt;
==File Format==&lt;br /&gt;
The format is big-endian (most significant byte first). A &amp;quot;byte&amp;quot; is 8 bits, and a &amp;quot;word&amp;quot; is 16 bits. Hex values will be denoted with a $ sign.&lt;br /&gt;
&lt;br /&gt;
Amiga limits for periods are 113 &amp;lt;= x &amp;lt;= 856. The lower the period, the higher the pitch.&lt;br /&gt;
&lt;br /&gt;
*20 bytes: Module name, padded with NULs.&lt;br /&gt;
*31 samples (or 15 if we're dealing with a SoundTracker file):&lt;br /&gt;
**22 bytes: Sample name, padded with NULs.&lt;br /&gt;
**Word: Length of sample in words - multiply by 2 to get length in bytes.&lt;br /&gt;
**Byte: Finetune value ranging from $00 to $0F as a signed nybble. $01 is 1/8 of a semitone up, $0F is 1/8 of a semitone down, $08 is 8/8 of a semitone down (that is, a whole semitone). Periods should be clamped to within Amiga limits.&lt;br /&gt;
**Byte: Default volume of sample ranging from 0 to 64 ($00 to $40).&lt;br /&gt;
**Word: Loop start in words.&lt;br /&gt;
**Word: Loop length in words. If set to 1, don't loop. Allegedly, a value of 0 will crash an Amiga.&lt;br /&gt;
*Byte: Order list length.&lt;br /&gt;
*Byte: Traditionally $78 in SoundTracker. Was used in NoiseTracker as a restart point. ProTracker uses $7F. FastTracker uses it as a restart point, whereas ScreamTracker 3 uses $7F like ProTracker. You can use this to roughly detect which tracker made a MOD, and detection gets more accurate for more obscure MOD types.&lt;br /&gt;
*128 bytes: Order list. Only the first ''order list length'' orders are actually used when playing; however, we scan the WHOLE order list to find out what the highest-indexed pattern is, and that's how many patterns we load.&lt;br /&gt;
*4 bytes (31-sample version only): Sample tag. If this contains any non-ASCII ($20 to $7E (32 to 126) inclusive) characters, then we probably loaded a 15-sample MOD. The best way to detect this is to seek to this position (it's $438 / 1080) and check before you actually load any data (may not work for streams where you can't seek). Otherwise, it's probably a 31-sample MOD. Values include:&lt;br /&gt;
**'''M.K.''' - standard 4-channel, 64-pattern-max MOD.&lt;br /&gt;
**'''M!K!''' - ProTracker will write this if there's more than 64 patterns,&lt;br /&gt;
**'''6CHN''', '''8CHN''' - 6-channel and 8-channel MODs, respectively. These are common extensions, and many trackers will write these. Basically, you read like a 4 channel mod, but with 6 or 8 channels per row.&lt;br /&gt;
**'''CD81''', '''OKTA''', '''OCTA''' - other 8-channel MOD tags. First two are probably Oktalyzer for the Atari ST, the third is possibly OctaMED.&lt;br /&gt;
**'''xxCH''' - a 10+ channel MOD, xx being a decimal number. FastTracker will deal with these as long as x is an even number no greater than 32.&lt;br /&gt;
**'''xxCN''' - another 10+ channel MOD, xx being a decimal number. Allegedly TakeTracker writes these.&lt;br /&gt;
**'''TDZ1''', '''TDZ2''', '''TDZ3''' - allegedly this is a TakeTracker extension for 1, 2, and 3 channels respectively.&lt;br /&gt;
**'''5CHN''', '''7CHN''', '''9CHN''' - allegedly this is a TakeTracker extension for 5, 7, and 8 channels respectively.&lt;br /&gt;
**'''FLT4''' - StarTrekker 4-channel MOD.&lt;br /&gt;
**'''FLT8''' - StarTrekker 8-channel MOD. Load patterns in like a normal 4-channel MOD, and then play two patterns at the same time (e.g. if 8 appears on the order list, play patterns 8 and 9). You'd probably be best to merge the patterns together if you want to be consistent.&lt;br /&gt;
**'''M&amp;amp;K!''' - only sighted on echobea3.mod. This is just a standard MOD, but with a weird tag. ''[[User:GreaseMonkey|I]] cannot find the tracker it's referring to (&amp;quot;fleg's module train-er&amp;quot;), so it was probably only used once or something, and never released.''&lt;br /&gt;
&lt;br /&gt;
''under construction''&lt;br /&gt;
&lt;br /&gt;
*Signed 8-bit mono sample data.&lt;br /&gt;
&lt;br /&gt;
==Playback notes==&lt;br /&gt;
&lt;br /&gt;
Amiga base clock is ''roughly'' 70ns, yielding an audio base clock of 280ns.&lt;br /&gt;
&lt;br /&gt;
When a looped sample is played, the whole sample plays through once, and then, if it has a loop, the loop is repeated.&lt;br /&gt;
&lt;br /&gt;
==Optimisation tips==&lt;br /&gt;
&lt;br /&gt;
'''Try unrolling your sample loops.''' 2500 bytes of padding should be fine if you're operating within Amiga limits; otherwise, you'll want (largest ''frequency''&lt;br /&gt;
&lt;br /&gt;
''under construction''&lt;br /&gt;
&lt;br /&gt;
[[Category: Music Pattern Formats]]&lt;/div&gt;</summary>
		<author><name>GreaseMonkey</name></author>
	</entry>
	<entry>
		<id>https://wiki.multimedia.cx/index.php?title=User:GreaseMonkey&amp;diff=12156</id>
		<title>User:GreaseMonkey</title>
		<link rel="alternate" type="text/html" href="https://wiki.multimedia.cx/index.php?title=User:GreaseMonkey&amp;diff=12156"/>
		<updated>2010-01-21T05:40:35Z</updated>

		<summary type="html">&lt;p&gt;GreaseMonkey: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Hi. I'm Ben AKA GreaseMonkey. I do a lot of tracker module stuff and have made players for the big 4 (MOD/S3M/XM/IT), although my attempt at an XM player was a mess. I usually use SchismTracker and can every now and then be caught on IRC telling Storlek what he's done wrong and that he needs to fix it or else.&lt;/div&gt;</summary>
		<author><name>GreaseMonkey</name></author>
	</entry>
</feed>