[]------------------------------------------------------------------------[] | AUDIO MANAGER 4 MODULE FORMAT by TechnoMaestro/RDG | | (c) Copyright Kenneth Foo, 1995. All Rights Reserved. | |--------------------------------------------------------------------------| | Text contains only suggestions and hints of what might be in the next | | Audio Manager format, which, when fully implemented, allow compatibility | | with almost ANY existing music format, and probably future formats. | | Note that this is NOT THE FINAL format! | []------------------------------------------------------------------------[] Sidenotes: þ Uses a newer special delta encoding for even more compressible samples! I will release the specs on this later. By the way, anybody has better methods of encoding/compressing samples? þ Samples can be copied and inverted during run time, for surround effects. This enables space-saving methods, and avoids the 16-channel limit most players face when enabling surround sound. Info on this will be inside the instrument header. þ Many more things have been left out, and effect numbering is wrong. More news when progress is made. ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± AMM: AUDIO MANAGER MODULE (AMM)±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± OFFSET LENGTH TYPE STUFF ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ HEADER (FIXED SIZE) ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ 4 char 'RIFF' 4 ulong Size of chunk (file) 4 char 'AMM2' ========================================================================== SONG INFO ========================================================================== 4 char 'INFO' 4 ulong Size of chunk=68 bytes Note! Size can range from 20 to 20+256, where the song name can be extended! 2 short Song info (flags) Bit 0 0=No frequency limit 1=Octave 1-6 limit. (Protracker MOD limit) 1 0=Ignore overflow in periods. But catch underflows (S3M) 1=Catch both overflows and underflows. 2 0='Amiga' frequency table 1=Linear frequency Table 3 1=Format's native tracker bug emulation 4 0=Mono mode 1=Stereo mmode 5 Reserved : Reserved 15 Reserved 2 ushort Master volume (S3M's Global Volume), 0-256. 2 ushort Amplification volume (S3M's Global Volume). 0-65534 Amplification values Final waveform = Amplification x WaveForm / 256 Or, for 16-bits, x 256 to amplify... Final waveform = Amplification x WaveForm 65535 Use dynamic mixing mode (lowest quality) 1 char Song source 0=Unknown 1=AM Tracker 2=MOD/NST 3=S3M 4=XM 5=MIDI 6=MTM 7=669 8=PSM 9=DSM 1 char Reserved 2 short Song-source-specific flags AM: Does not use this flag MOD: S3M: Bit 0 1=Emulate early S3M's slightly faster volume slides XM: 2 word Native tracker version (HI:LO) 1 char Startup speed 1 char Startup tempo 40 char Song name ========================================================================== SEQUENCE LIST ========================================================================== 4 char 'SEQS' 4 ulong Size of chunk 2 short Number of orders x short Pattern numbers. 65534 Skip this order 65535 End of song ========================================================================== TRACK/CHANNEL SETTINGS ========================================================================== 4 char 'TRAK' 4 ulong Size of chunk 1 char Number of tracks x char Channel pan settings 0 (Left most) 64 (Middle) 128 (Right) 255=Disabled track 254=Surround (not supported yet?) Others: Planned for Adlib? ========================================================================== PATTERNS ========================================================================== 4 char 'LIST' 4 ulong Size of chunk (used also in memory allocation) 4 char 'PATS' 2 ushort Number of patterns 4 char 'PAT0' or 'PAT1' (subchunk) 4 ulong Size of chunk 2 ushort Pattern number (65534,65535=Undefined) 2 ushort Number of rows x ? Pattern data... ... more pattern sub-chunks and data... ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ±PATTERN ENCODING FOR PAT0 CHUNKS: ± ± [Note][NewInst][Volume][EfxNum][EfxData] ± Length of Efx data is ALWAYS 2 bytes. ± Music is also limited to only 1 effect. ± Pretty useless, if you ask me. It's just like MOD/S3M! ± In fact, I don't even support it. ± ±PATTERN ENCODING FOR PAT1 CHUNKS: ± ± When loaded into memory, we also create a table for each ± patterns. These tables contains the offset of the rows in ± memory. They are linear offset (LOFF). (Run-time generated) ± SHIT! NEED AN END-OF-ROW MARKER! ± ± Each row is composed of a collection of channel notes, etc... ± They are arranged in the following order... ± ± Flag [Trak][Note][NewSmp][Volume][EfxNum][EfxLen][EfxData]... ± ± The and the trailing effects and stuffs has the general struc of ± ± [EfxNum][EfxLen][EfxData] ... ± ± Effects can be connected in a series of chains to provide ± virtually unlimited number of effects (!). ± Here are detailed description of each field: ± ±FLAG:------------------------------------------------ ± Bit ± 0 1=Track number present ± 1 1=Note present ± 2 1=NEW sample ± 3 1=Volume present ± 4 1=Efx number present ± 5 1=Efx param present ± 6 1=WORD for sample number! (Not BYTE!) ± 7 0 ± ± When bit 7 is set, the flag is given a whole new meaning, that is, ± Bit ± 0 1=Global effect follows? (Here just for a nice separation of global stuffs and channel-specific stuffs -- but not used) ± 1 ± 2 ± 3 ± 4 ± 5 ± 6 ± 7 1 ± ±TRAK:------------------------------------------------- ± Ranges from 0-255. A practical range is 1-31 (0 is not ± required, as the default value on start of each row = 0). ± Useful to skip empty tracks if there are more than 1 ± empty tracks in between 2 used tracks. (First track is 0) ± ±NOTE:------------------------------------------------- ± xxxxyyyy ± xxxx = Octave (0-15) (!) ± yyyy = Note (0-11) ± 255 = Key off ± ±SAMPLE:----------------------------------------------- ± Ranges from 1-255. ± However, if bit 2 of the Flag is set, value ranges from ± 1-65535. ± 0=Use previous sample and reset sample param ± ±VOLUME:----------------------------------------------- ± Value ranges from 0-255. ± ±EFFECT NUMBER:---------------------------------------- ± Ranges from 1-127. 0=No efx (It IS not an effect anyway...) ± If bit 7 is set, extended effect follows after this efx. ± ±EFFECT DATA:------------------------------------------ ± Usually a 1-byte value. But can be more or variable sized, ± depending on the effect itself. ± ± ±NOTE: Though it may not seem to be 100% compatible with other ± formats (noticable, the volume setting column), AMM2's ± ability to chain effects make it possible for the conversion ± process to mimic all the effects and the happenings rather ± faithfully. This actually means the compatibility issue ± is more on the converter rather than the music interpreter. ± Saves me loads of shitaches... ± ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ========================================================================== INSTRUMENT STRUCTURES ========================================================================== 4 char 'LIST' 4 ulong Size of chunk 4 char 'INST' ? AMI Instrument0, followed by envelopes and samples ? AMI Instrument1, followed by envelopes and samples : : : : : : *NOTE: *Each instrument is actually a collection of instrument info *(including envelopes), and samples *END OF AMM MODULE* ²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²² E F F E C T S ²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²² EACH EFFECT CONTAINS A TABLE OF FLAGS AND LENGTH OF PARAMETER. FLAGS: 0=Use value AS IT IS (even 00) 1= 00=Use previous (same efx, same channel) effect's param 2= 00=Use previous (whatever, but same channel!) effect's param LENGTH: 0-249 = Length 250 Rsvd 251 Rsvd 252 Rsvd 253 = BYTE length flag present 254 = WORD Length flag present 255 = DWORD Length flag present ²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²² GLOBAL/OVERALL/MUSIC SYSTEM/PATTERN/SPEED ²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²² 00±±±±±±NO EFFECT 01±±±±±±SET SPEED xx[2] 00 Use previous value ?? Set speed. Default is 6. 02±±±±±±SET TEMPO (BPM) xx[2] 00 Use previous value ?? Set tempo (BPM) to xx. Default is 125. 04±±±±±±JUMP TO ORDER xxxx[0] Jump to order xxxx (ushort), at row 0 (that is, if Pattern Break wasn't set. If pat break has set the row, we don't modify it!). 05±±±±±±PATTERN BREAK xxxx[0] Pattern break to row xxxx (ushort). Jumps to next order (if JUMP TO ORDER was not used to set the next target orderr), at row xxxx. 16±±±±±±PATTERN LOOP xy[0] 00 Set start of loop as current row. ?? Set end of loop and number of repetitions. 17±±±±±±PATTERN DELAY xx[0] 00 No delay ?? Repeats current row x times without triggering the notes again, but applying the effects. 03±±±±±±SET MASTER VOLUME xx[0] Varies from 0 to 64. (or 0-255?) ! Internally, it is multiplied by 4 for range of 0-256 used in AM3. 1E±±±±±±MASTER VOLUME SLIDE xy[1] 00 Continue previous master volume slide x0 Slide up volume, with speed x. 0y Slide down volume, with speed y. 23±±±±±±SET EVENT xx[0] Set the event flag (Music engine only) on and it's value to xx. Useful for programmers only. ²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²² NOTE VOLUME ²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²² 21±±±±±±SET VOLUME xx[0] Sets volume of channel's note to xx. 06±±±±±±VOLUME SLIDE xy[2] 00 Continue previous (fine/slide) x0 Volume slide up by x 0y Volume slide down by y xF Fine volume slide up by x Fy Fine volume slide down by y FF Fine volume slide up by F (slide up has more priority). * EARLY S3M BUG: Faster by 1 tick (perform volume slide on first tick). 0B±±±±±±TREMOLO (VOLUME MODULATION) xy[1] 00 Continue previous. [2]? xy Vibrate pitch using active waveform with speed x and depth y. 0y Retains speed. Sets depth to y. Vibration wave used is based upon type selected. Set 'SET TRERMOLO WAVEFORM'. 1F±±±±±±KEY OFF Turns off note (no parameter) ²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²² NOTE PITCH ²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²² 07±±±±±±SLIDE UP (PORTAMENTO UP) xy[2] 00 Continue previous (extra/fine/slide) Ey Extra fine slide up with speed y. Fy Fine slide up with speed y. ?? Slide up with speed xy (if xy not [extra] fine). Checked last? Normal slides changes period by units of 4 on every tick. Fine slides changes period by units of 4, once. Extra fine slides are like fine slides, except they're in 1 units. 08±±±±±±SLIDE DOWN (PORTAMENTO DOWN) xy[2] 00 Continue previous (extra/fine/slide) Ey Extra fine slide down with speed y. Fy Fine slide down with speed y. ?? Slide down with speed xy (if xy not [extra] fine). Checked last? Normal slides changes period by units of 4 on every tick. Fine slides changes period by units of 4, once. Extra fine slides are like fine slides, except they're in 1 units. 09±±±±±±SLIDE TO NOTE (PORTAMENTO TO NOTE) xx[1] 00 Continue slide with previous *slide to note* speed. ?? Slide to note by with speed xx. Apparently, there is a small difference between S3M and MOD at handling this situation. (Most module players fail here). If previously, there wasn't a note played and you try to issue a slide to note, S3M (The original Scream Tracker) will assume that you start from C-4. However, MOD implementation is not so. It will not play the sound at all. 0A±±±±±±VIBRATO (PITCH MODULATION) xy[1] 00 Continue previous. xy Vibrate pitch using active waveform with speed x and depth y. 0y Retains speed. Sets depth to y. Vibration wave used is based upon type selected. Set 'SET VIBRATO WAVEFORM'. 1D±±±±±±FINE VIBRATO xy[1] 00 Continue previous. xy Vibrate pitch using active waveform with speed x and depth y. 0y Retains speed. Sets depth to y. Vibration wave used is based upon type selected. Set 'SET VIBRATO WAVEFORM'. Similar to Vibrato, but 4x finer. ²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²² NOTE PANNING ²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²² 12±±±±±±SET PANNING xx[0] Set panning 00-128 Left(0) Middle(64) Right(128) 254 Surround (Not supported yet) 255 Disable channel 20±±±±±±PANNING SLIDE xy[1] 00 Continue previous panning slide x0 Pan left, speed x. 0y Pan right, speed y. Values are clipped and kept within range of 0-128! General note: GUS only allows 16 pan values, and thus, values are quantized from 128 to 16. ²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²² SAMPLE ²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²² 0F±±±±±±SET SAMPLE OFFSET xx[0] Set sample offset Sets sample offset to xx*256. 10±±±±±±SET LONG SAMPLE OFFSET xxxx[0] Set sample offset Sets sample offset to xxxx*256. (Up to 65536x256!) That is, 16 megs! (In future, we might need set FINE sample offset :-) Byte granularity!) 11±±±±±±SET FINE SAMPLE OFFSET xxxxxxxx[0] Set fine sample offset This special feature enables users to create 'true stereophonic' sounds, by doing a small delay...but it's usually unnecessary. !NO USE! 1B±±±±±±SET SAMPLE FINE TUNE (SET C4 RATE) 0x[0] Values for x: 0 - 7895 Hz 1 - 7941 Hz 2 - 7985 Hz 3 - 8046 Hz 4 - 8107 Hz 5 - 8169 Hz 6 - 8232 Hz 7 - 8280 Hz 8 - 8363 Hz (No finetune) 9 - 8413 Hz A - 8463 Hz B - 8529 Hz C - 8581 Hz D - 8651 Hz E - 8723 Hz F - 8757 Hz To convert old amiga fine tunes to current fine tune value, perform [(ADD 8) AND 1111b]. Maintained for MOD/S3M compatibility! 1C±±±±±±SET SAMPLE C4 FREQUENCY xxxxxxxx[0] Set C4 frequency to xxxxxxxx (ulong) 24±±±±±±INVERT SAMPLE LOOP (NOT THE AMIGA INVERT LOOP) 0x[0] 0 Normal forward loop 1 Reverse the loop (for backward loops (eg, ping pong,etc.., reverse it to forward!) 2 Ping Pong loop 22±±±±±±SET ENVELOPE POSITION xxxx[0] Sets volume of channel's note to xxxx. ²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²² MISCELLANEOUS EFFECTS ²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²² !NO USE! 0D±±±±±±CONTINUE VIBRATO AND DO VOLUME SLIDE xy[2] 00 Continue previous volume slide speed. ?? Volume slide, with the same parameters as the normal volume slide. !NO USE! 0E±±±±±±CONTINUE SLIDE TO NOTE AND DO VOLUME SLIDE xy[2] 00 Continue previous volume slide speed. Others Volume slide, with the same parameters as the normal volume slide. But if planning to write a tracker, it will be quite useful as it simplifies some jobs. 0C±±±±±±ARPEGGIO xy[1] 00 Continue previous. ?? Switch between 3 notes, including the current note quickly at every tick. Plays in the order... Current Note, Current Note+x semitones, Current Note+y semitones. 11±±±±±±RETRIGGER NOTE [+ OPTIONAL VOLUME CHANGE] xy[2?] Retriggers note and optionally do volume slide too. x=Volume slide type 0: 0 (No volumeslide) 1: -1 2: -2 3: -4 4: -8 5: -16 6: 2/3 times the current volume 7: 1/2 times the current volume 8: ? 9: +1 A: +2 B: +4 C: +8 D: +16 E: 3/2 times the current volume F: 2 times the current volume After changing volume, set the volume as current volume. y=Retrigger note at every y ticks. 15±±±±±±TREMOR xy[2] 00 Continue use of previous values. NOTE! S3M BUG: If previous values are undefined, use param of 00!! ?? Turns sound on for x+1 ticks and off for y+1 ticks throughout the row. Tremor counter is retriggered upon reaching a new note. 13±±±±±±CUT NOTE xx[0] 00 No cut ?? Cut notes after xx ticks. 14±±±±±±DELAY NOTE xx[0] Delay note 00 Note not played. ?? Delays note and triggers it only after xx ticks. 18±±±±±±SET VIBRATO WAVEFORM xx[0] xx VALUES Waveform Name Retriggered No Retrigger ---------- ------------------- ----------- ------------ /\ /\ Sine (default) 0 4 \/ \/ |\ |\ Ramp down 1 5 \| \| ,-, ,-, Square 2 6 '-' '-' ????????? Random 3 7 Use any one of the above! Retrigger means that it will reset the position within the sine table everytime a new note is encountered. Usually, when a new note is encountered, the waveform-table-counter is reset to 0. By default, the waveform is 0. 19±±±±±±SET TREMOLO WAVEFORM xx[0] See SET VIBRATO WAVEFORM. Has similar effects. 1A±±±±±±SET GLISSANDO FLAG xx[0] 00 Disable glissando ?? Enable glissando. Usually, value 1 is used to enable it. 25±±±±±±MISCELLANEOUS DATA PRESENT Size Length of data, in ushort follows. After that, is the data itself. Data Note: This one is used to store other stuffs! Dunno what, though!) NOT PROCESSED. 26±±±±±±SET LYRIC FOR CURRENT CHANNEL'S CURRENT ROW. Size Length of lyric Lyric Lyric ??±±±±±±FINE DELAY NOTE xxxx[0] Fine delay note Note is delayed 1/xxxxth of a second. Note that this might not be the exact value, as the hardware limitation or software routine might just round them to a certain value. Using set fine sample offset is a much better approach at this. ??±±±±±±SET STEREOPHONIC POSITION xxzz[0] Set stereophonic position xx Signed X coordinates, in metres zz Signed Z coordinates, in metres Note: Delay is performed only for one side. On the other side, sound is heard immediately CANNOT WORK BECAUSE 2 CHANNELS REQUIRED! ²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²² UNSUPPORTED ²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²² XX±±±±±±SET FILTER xx An old Amiga hardware stuff. NOT IMPLEMENTED. YY±±±±±±SET STEREO CONTROL xx An old Scream Tracker command. NOT IMPLEMENTED. YY±±±±±±SELECT SOUND DEVICE INTERPOLATION/FILTERING METHOD xx 00 No interpolation/filtering (raw sound) 01 1/4 low pass filter 02 1/2 low pass filter 03 (others -- selects effect type) * Note: Valid for software mixing devices only * ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± BELOW IS THE 'OLDER' SUGGESTED FORMAT, WHICH IS NOW OBSOLETE, BUT IT CONTAINS SEVERAL INFO ON ENVELOPES, AND STUFFS...MAINLY TAKEN FROM XM. Basically, the idea is, ignore everything below this line :) ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ 00 NO EFFECT ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ Find method of encoding! [x] = Flag WHOOPSSS!! SET ALSO THE FLAGS! CHECK SOURCE CODEZ! SET PERIOD! SET FREQUENCY? Another effect -- set volume to sample/instrument default -- set pan to sample/instrument default -- set offset to start of sample (?) ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ INSTRUMENT STRUCTURES (VARIABLE SIZED) ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ? ? struc Instrument1 structure with sample headers ? ? struc Instrument2 structure with sample headers : : : : : : : : ? ? struc InstrumentX structure with sample headers Instrument structures are similar to the AMI header. ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ SAMPLE DATA (VARIABLE SIZED) ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ? ? ? Sample data stored in sequential order Instrument 1:Smp1,2,3.... Instrument 2:Smp1,2,3.... : : Instrument X:Smp1,2,3.... ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ SPECIAL DATA (VARIABLE SIZED) ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ? ? ? Special data (ignored by AM4) Actual data here is NOT PART of the AMM module. *END OF AMM MODULE* MAKE SAMPLE LIBRARY POSSIBLE! (MODS WITHOUT SAMPLES...!) Byte BIT 0 1=Note & instrument present 1 1=Volume present 2 1=Change in effect number 3 1=Change in effect data 4 \ Number empty rows after events (post-event RLE) 5 }--- This function is available only if PACKING METHOD 2 6 / is used. 7 1=Event present (lower 4-bits has events) 0=Packed patterns PACKING METHOD 1 or 2: Bit 0-6 = Number empty rows-1 58 2 short Song length (number patterns) 60 2 word Master volume (S3M's Global Volume) (0-64) 62 2 word Amplification/Mixing mode (S3M's Master volume) 0-32767 Amplification. FinalWaveForm = (Amplification x WaveForm) /256 32768 Quality SHIFT mode. The final resultant waveform -32775 is shifted x-32768 bits to the right (averaging). Valid only for 8-bit sound output. 65535 Standard mixing mode. Lowest quality, but ensures no clipping is done. 64 1 byte Song source 0=Unknown 1=AM Tracker 2=MOD/NST 3=S3M 4=MTM 5=669 6=XM 65 1 byte Song-source-specific flags AM: Does not use this flag MOD: S3M: Bit 0 XM: 66 4 dword Number of bytes in extra data section 70 2 word Native tracker version (HI:LO) 72 6 byte Reserved 78 1 byte Startup speed 79 1 byte Startup tempo TRAK Tracks... 60 2 short Number of tracks (channels) (Max 32) 62 2 short Number of patterns (Max 128) 52 2 word Number Tracks 54 2 word Number Patterns (Max 128) 56 2 word Number Instruments (Max 128) PAT0 Unpacked pattern PAT1 Packed pattern PAT2 Extra-packed pattern 50 1 byte Pattern packing type 0 Not packed 1 RLE encoded 2 RLE encoded + Extra RLE 51 1 byte Reserved 52 2 word Number Tracks (Max 32) 54 2 word Number Patterns (Max 128) 56 2 word Number Instruments (Max 128) 58 2 word Song length (number patterns) 60 2 word Master volume (S3M's Global Volume) (0-64) 62 2 word Amplification/Mixing mode (S3M's Master volume) 0-32767 Amplification. FinalWaveForm = (Amplification x WaveForm) /256 32768 Quality SHIFT mode. The final resultant waveform -32775 is shifted x-32768 bits to the right (averaging). Valid only for 8-bit sound output. 65535 Standard mixing mode. Lowest quality, but ensures no clipping is done. 64 1 byte Song source 0=Unknown 1=AM Tracker 2=MOD/NST 3=S3M 4=MTM 5=669 6=XM 65 1 byte Song-source-specific flags AM: Does not use this flag MOD: S3M: Bit 0 XM: 66 4 dword Number of bytes in extra data section 70 2 word Native tracker version (HI:LO) 72 6 byte Reserved 78 1 byte Startup speed 79 1 byte Startup tempo TOTAL 80 bytes for header ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ EXTRA DATA SECTION (HEADER EXTENSION) ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ? ? ? Extra data (new extension to file format) ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ VARIABLE-SIZED INFO AFTER FIXED-SIZE HEADER ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ NOT=Number Of Tracks NOP=Number of Patterns NOS=Number of sequences 80 NOT byte Track startup pan/info flags. 0 (Left most) 64 (Middle) 128 (Right) 255=Disabled track 254=Surround (not supported yet) Others: Planned for Adlib? 80+NOT NOS word Pattern sequence. Contains pattern numbers. 65535=End of song marker 65534=Skipped order (as in S3M) Note! This marker will not be used...it will, however, be present in the order list. 80+NOT NOP word Number rows in pattern +NOS ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ PATTERNS (VARIABLE SIZED) ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ 80+NOT ? ? Patterns for Track 1 +NOS +NOP ? ? ? Patterns for Track x (Repeated for each tracks) All patterns for one track are grouped together into one chunk, sort of like the way MTM handles music? -------------------------------------------------------------------- RAW PATTERN STRUC: (Used when loaded into memory or in unpacked pat) -------------------------------------------------------------------- TotalNumberRowsInSong=Total of rows in all patterns. FOR 1 TO TotalNumberRowsInSong Byte Note (Upper nibble=Octave Lower nibble=Note) 255 = No note 254 = Key off Valid values: Octave 0-8 Note 0-11 (0=C, 1=C#... 11=B) Byte Sample number 255 = No sample number Byte Volume effect (or other special effect) 00h-40h = Volume 41h-4Fh = Reserved 50h-5Fh = Volume slide down 60h-6Fh = Volume slide up 70h-7Fh = Fine volume slide down 80h-8Fh = Fine volume slide up 90h-9Fh = Set vibrato speed A0h-AFh = Vibrato B0h-BFh = Set panning C0h-CFh = Panning slide left D0h-DFh = Panning slide right E0h-EFh = Tone porta FFh = Nothing Byte Effect number (Please see list of effects). 255 = No effect Else, if bit 7 set, it means that there is another effect after this one, but ON THE SAME ROW. Byte Effect value ENDLOOP ------------------------------------------- PACKED PATTERN FORMAT STRUC: (Used in file) ------------------------------------------- dword Length of compressed block excluding this 4-byte value. ? Event ? Event Events are coded in a one-byte header. Byte BIT 0 1=Note & instrument present 1 1=Volume present 2 1=Change in effect number 3 1=Change in effect data 4 \ Number empty rows after events (post-event RLE) 5 }--- This function is available only if PACKING METHOD 2 6 / is used. 7 1=Event present (lower 4-bits has events) 0=Packed patterns PACKING METHOD 1 or 2: Bit 0-6 = Number empty rows-1 IF THERE ARE EVENT(S) PRESENT, THESE BYTE(S) FOLLOW... Byte Note & Instrument (if present) Byte Volume column data (if present) Byte New effect number (if present) Byte New effect data (if present) I used change in effect number as opposed to present effect because I notice many songs, particularly S3Ms by Purple Motion/Skaven uses a same effect for more than 1 row. (Esp. Vibrato,etc...) Thus, I took advantage of this to create smaller files. For each track, by startup, the previous effect and effect data are assumed to be 255 (no efx). The RLE, however, *DOES NOT FALL INTO THIS CONTEXT*. It is purely meant for really empty tracks, with all it's values 255 in memory. ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ INSTRUMENT STRUCTURES (VARIABLE SIZED) ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ? ? struc Instrument1 structure with sample headers ? ? struc Instrument2 structure with sample headers : : : : : : : : ? ? struc InstrumentX structure with sample headers Instrument structures are similar to the AMI header. ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ SAMPLE DATA (VARIABLE SIZED) ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ? ? ? Sample data stored in sequential order Instrument 1:Smp1,2,3.... Instrument 2:Smp1,2,3.... : : Instrument X:Smp1,2,3.... ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ SPECIAL DATA (VARIABLE SIZED) ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ? ? ? Special data (ignored by AM4) Actual data here is NOT PART of the AMM module. *END OF AMM MODULE* ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ INSTRUMENT SAMPLE STRUCTURES ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ? 80 struc Sample1 structure ? 80 struc Sample2 structure ? 80 struc Sample2 structure : : : : : : : : ? 80 struc SampleX structure Sample structures are similar to the AMS header. ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ SAMPLE DATA ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ? ? ? Sample data stored in sequential order SELECT ENVELOPE NUMBER ETC.. WAH! ± ± We cannot use change in efx number/param because the loader is ± an optimizing loader. Take for example, in a row, we have 4 ± effects places. ± Efx1 Efx2 Efx3 Efx4 ± Now, suppose that Efx1 and Efx3 are used. But Efx2 and Efx4 are ± not. Out optimizing loader will move Efx3 to Efx2s place. And ± we'll need only to chain 2. SHIT...WHY NOT LIMIT IT TO 4 EFFECTS (OR IF RERALLY NECESSARY, 8) DON'T FORGET *GLOBAL EFFECTS* !! ± ± This could pose problems when Efx3 requires that we use the ± previous Efx3's parameter! One solution is to make the import ± loader in such a way that, it checks the previous Efx3's value, ± and poke in the value itself (that is, replace 00 with the ± ACTUAL value). This is rather inefficient where file size is ± concerned. ± ± A probably easier (but memory/disk inefficient) method, is to ± chain even empty Efx2 (But not Efx4, as it's the last Efx and ± it's unused). And our music player would probably keep track of ± up to 4 effects per channel. That way, we can keep track of ± the 'previous value'. But this method has several limitations. ± Namely, ± þ Some flag state/etc... stuffs are shared by the same ± channel. For example, slide to note speed. We only ± have one of it...that is, for that particular channel. ± However, if there are 2 slide to notes (not necessarily ± on the same row), we'll only keep track of the last one's ± speed. (really stupid to use 2 slide to notes anyway. But ± problems *could* arise...hmmm...maybe not). ± We could increase them...buthmmm...inefficient... ± redundant! ± þ ± ± AM4 currently uses the latter approach. (We'll just ignore the ± 2 slide to notes). It's much easier...and not very memory ± consuming! (Sort of!) 1=Xtended effects present ± ±TRAK:------------------------------------------------- ± Ranges from 0-255. A prractical range is 1-15 (0 is not ± required, as the default value on start of each row = 0). ± Useful to skip empty tracks if there are more than 1 ± empty tracks in between 2 used tracks. ± ±NOTE:------------------------------------------------- ± xxxxyyyy ± xxxx = Octave (0-15) (!) ± yyyy = Note (0-11) ± 255 = Key off ± ±INSTRUMENT:------------------------------------------- ± Ranges from 1-255. 0=Use previous instrument!????? ± ±EFFECT NUMBER:---------------------------------------- ± Ranges from 1-127. 0=No efx (It IS not effect anyway...) ± If bit 7 is set, extended effect follows after this efx. ± (Only set in extended effects. Normal main effects doesn't ± use this flag, but one in the main flag.) ± ±EFFECT DATA:------------------------------------------ ± Usually a 1-byte value. But can be more or variable sized, ± depending on the effect itself. ± ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ========================================================================== PATTERNS ========================================================================== ********************************************************************* ********************************************************************* ********************************************************************* ********************************************************************* ********************************************************************* ********************************************************************* ********************************************************************* ********************************************************************* ********************************************************************* ********************************************************************* PROBLEM!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1 WE CAN'T USE PARAMETER 0 IN EXTENDED COMMANDS TO CONTINUE PREVIOUS! THIS IS BECAUSE WE DON'T KNOW WHAT'S IN THE PREVIOUS CHANNEL'S PARAM! WE CAN'T KEEP TRACK OF ALL EFFECTS. SO, THE DECODER ROUTINE WILL SET EFFECT PARAM 00 TO THE PREV EFFECT IS REQUIRED?? NO NEED THAT FOR THE MAIN PARAM... No effect parameter size is present. All of that is done by the music player. Players does that by keeping a table of parameter length for all effects. If set to 255, it means that a it's a variable-sized parameter, and a word follows after the effect number. This word contains the number of bytes in parameter. (0-65535 bytes for param!) ********************************************************************* ********************************************************************* ********************************************************************* ********************************************************************* ********************************************************************* ********************************************************************* ********************************************************************* ********************************************************************* ********************************************************************* ********************************************************************* xxxxxx = Effect number 0 Note 1 Inst changed(? Probably not good -- empty rows!) 2 Vol 3 Efx num 4 Efx param 5 x 6 x xx=Number of extra effects (Must have both num and param) 7 1 OR ... 0 Note 1 Inst 2 Vol 3 Efx num 4 Efx param 5 x 6 1=Extended data present. If set, the bytes after [note][inst][vol][efxnum][efxparam] will be another flag. It is shown below... 7 1 Extended data flag: 0 x 1 x 2 x 3 x 4 x 5 x 6 1=8-bit Length of follows 7 1=Another extended data flag after this data (Chains - UNLiMiTED!!) xxxxx = Efx number Followed after that is the effect data (might not be an effect...could be a lyric/etc...) Then, if another extended data flag is present, it will be here, and the whole process repeats...etc...blah blah... Note: xyyyzzzz x = Note/Flag bit. 0=Note 1=Flags yyy = Octave zzzz= Note 7Fh = Stop sound