1 /** 2 * This file is part of the Web Enabled Audio and Sound Enhancement Library (aka the Weasel audio library) Copyright 2011 - 2013 Warren Willmey. It is covered by the GNU General Public License version 3 as published by the Free Software Foundation, you should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. 3 */ 4 5 if( undefined == window.weasel ) window.weasel = {}; 6 7 // --------------------------------------------------------------------------- 8 /** Object containing constants that a Taketracker/Fastertracker module requires, in 9 * addition to those defined in FormatUltimateSoundTracker121, FormatDOCSoundTracker9 & FormatDOCSoundTracker22, FormatSpreadpointSoundTracker23, FormatNoiseTracker11, Protracker. 10 * 11 * @constructor 12 * @const 13 */ 14 weasel.FormatFSTModule = 15 { 16 /** TakeTracker/Fasttracker additional effect commands. 17 * 18 * @const 19 * @enum {int} 20 */ 21 Effects: { 22 // Fasttracker V1 is has 7 Bit panning command, by Fasttracker V2 it 23 // had become 8 Bit panning. 24 // Some FST modules (such as Necros' Ice River V4) contain Dolby Surround 25 // Sound command (8A4) - which is part of the DigiSound Module format 26 // by Pelusa and in turn DigiSound Interface Kit, but still use 7 Bit 27 // panning, which cause them to be detected incorrectly. 28 // 29 Panning : 8 30 31 , ExtendedCommands : 14 32 // Extended Commands. 33 // 34 // The origin of this command stems from Pentagons (Zwerg Zwack) ZZPlay 35 // routine for the GUS, which got adopted in MTM. 36 // 37 , CoarsePanning : 0x80 38 } 39 /** The size of the Taketracker/Fasttracker header plus the first pattern (which 40 * is always present BUT might only be two channels, not four). This represents 41 * the bare minimum amount of data needed for a Taketracker/Fasttracker module. 42 * 43 * @const 44 * @type {int} 45 */ 46 , MinimumHeaderSize: 1596 47 48 /** Fasttracker 2 period values extracted from an exported module. 49 * 50 */ 51 , FSTPeriodTable: [ 52 // C-0 to B-0 53 6848, 6464, 6096, 5760, 5424, 5120, 4832, 4560, 4304, 4064, 3840, 3624 54 // C-1 to B-1 55 , 3424, 3232, 3048, 2880, 2712, 2560, 2416, 2280, 2152, 2032, 1920, 1812 56 // C-2 to B-2 57 , 1712, 1616, 1524, 1440, 1356, 1280, 1208, 1140, 1076, 1016, 960, 906 58 // C-3 to B-3 59 , 856, 808, 762, 720, 678, 640, 604, 570, 538, 508, 480, 453 60 // C-4 to B-4 61 , 428, 404, 381, 360, 339, 320, 302, 285, 269, 254, 240, 226 62 // C-5 to B-5 63 , 214, 202, 190, 180, 170, 160, 151, 143, 135, 127, 120, 113 64 // C-6 to B-6 65 , 107, 101, 95, 90, 85, 80, 75, 71, 67, 63, 60, 56 66 // C-7 to B-7 67 , 53, 50, 47, 45, 42, 40, 37, 35, 33, 31, 30, 28 68 ] 69 70 71 /** Table to convert the period into the note and octave in human readable form. 72 * Taketracker originally added 3 octaves, 1 below the Amiga range and 2 above. 73 * Fastertracker 2 allows the export of 8 octaves into the M.K. format and 74 * their keyboard placement has changed to reflect that of a piano, so that 75 * now period value 856 is C-3 where as Ultimate sound track had it mapped to C-1. 76 * FT2 period value to Note table. 77 * 78 * @const 79 * @enum {string} 80 */ 81 , NoteTable: { 82 6848 : 'C-0' 83 , 6464 : 'C#0' 84 , 6096 : 'D-0' 85 , 5760 : 'D#0' 86 , 5424 : 'E-0' 87 , 5120 : 'F-0' 88 , 4832 : 'F#0' 89 , 4560 : 'G-0' 90 , 4304 : 'G#0' 91 , 4064 : 'A-0' 92 , 3840 : 'A#0' 93 , 3624 : 'B-0' 94 95 , 3424 : 'C-1' 96 , 3232 : 'C#1' 97 , 3048 : 'D-1' 98 , 2880 : 'D#1' 99 , 2712 : 'E-1' 100 , 2560 : 'F-1' 101 , 2416 : 'F#1' 102 , 2280 : 'G-1' 103 , 2152 : 'G#1' 104 , 2032 : 'A-1' 105 , 1920 : 'A#1' 106 , 1812 : 'B-1' 107 108 , 1712 : 'C-2' 109 , 1616 : 'C#2' 110 , 1524 : 'D-2' 111 , 1440 : 'D#2' 112 , 1356 : 'E-2' 113 , 1280 : 'F-2' 114 , 1208 : 'F#2' 115 , 1140 : 'G-2' 116 , 1076 : 'G#2' 117 , 1016 : 'A-2' 118 , 960 : 'A#2' 119 , 907 : 'B-2' 120 121 , 856 : 'C-3' 122 , 808 : 'C#3' 123 , 762 : 'D-3' 124 , 720 : 'D#3' 125 , 678 : 'E-3' 126 , 640 : 'F-3' 127 , 604 : 'F#3' 128 , 570 : 'G-3' 129 , 538 : 'G#3' 130 , 508 : 'A-3' 131 , 480 : 'A#3' 132 , 453 : 'B-3' 133 134 , 428 : 'C-4' 135 , 404 : 'C#4' 136 , 381 : 'D-4' 137 , 360 : 'D#4' 138 , 339 : 'E-4' 139 , 320 : 'F-4' 140 , 302 : 'F#4' 141 , 285 : 'G-4' 142 , 269 : 'G#4' 143 , 254 : 'A-4' 144 , 240 : 'A#4' 145 , 226 : 'B-4' 146 147 , 214 : 'C-5' 148 , 202 : 'C#5' 149 , 190 : 'D-5' 150 , 180 : 'D#5' 151 , 170 : 'E-5' 152 , 160 : 'F-5' 153 , 151 : 'F#5' 154 , 143 : 'G-5' 155 , 135 : 'G#5' 156 , 127 : 'A-5' 157 , 120 : 'A#5' 158 , 113 : 'B-5' 159 160 , 107 : 'C-6' 161 , 101 : 'C#6' 162 , 95 : 'D-6' 163 , 90 : 'D#6' 164 , 85 : 'E-6' 165 , 80 : 'F-6' 166 , 75 : 'F#6' 167 , 71 : 'G-6' 168 , 67 : 'G#6' 169 , 63 : 'A-6' 170 , 60 : 'A#6' 171 , 56 : 'B-6' 172 173 , 53 : 'C-7' 174 , 50 : 'C#7' 175 , 47 : 'D-7' 176 , 45 : 'D#7' 177 , 42 : 'E-7' 178 , 40 : 'F-7' 179 , 37 : 'F#7' 180 , 35 : 'G-7' 181 , 33 : 'G#7' 182 , 31 : 'A-7' 183 , 30 : 'A#7' 184 , 28 : 'B-7' 185 } 186 187 }; 188