Tranzcode: A windows console based (command line) utility to split multichannel wavs or dts files into mono wavs. Version Tracking: ---------------------- September 10 2005 (v0.30MOD) - performance optimized new compile by johnman May 6 2005: (v0.30) - Allow path name to be included as source file (note paste/use double quotes around path including filename). [Now it's possible to transcode from CDR or DVDR media, not sure about Network drives (not tested)]. - Changed how options are entered, to se[arete options which much begin with '/' character. This allows for easy implementation of future options. i.e. transzcode test.dts /n /+FL,FR (which allows the /n (no progress) and also the specified channels to be written) - Increased initial sync search from 10Kb to 100kb, till it gives up on dts (wav) decoding and determines the wav file to be a stereo wav for transcoding into 2 mono wavs. - Fixed sync word search so it checks for at least for 1 frame instead of just an initial sync word match - Added detection notice, when searching for dts sync word for dts transcoding, also handles properly when not found. - Changed dts attributes: show as 5.1 or 5.0 etc for number of channels, also fixed dts bit width of source file - Changed mono file tagging (i.e. channel identifying), for DTS which is not the same as multichannel for the same number of channels. DTS is based on the AMODE value detected in the stream (see: "DTS Transcoding" below). - Display shows only selected output filenames for output , not "User Cancelled" anymore (default is all channels). April 17 2005: (v0.20) - fixed dts out of sync related errors once transcoding begins. - added missing dtswav info (no frames) & corrected bit rate April 16 2005: (v0.10) (1st release) Description: --------------- A Windows Console (command line) utility used to transcode multichannel wav files into mono wavs by outputting the number of wavs depending on the number of channels read from the wav header. It will also decode/transcode .dts files (48kHz) and DTSWav (44.1kHz) directly into mono wavs depending on the number of channels detected (AMODE). DTS decoding is based libdts, source code written by Gildas Bazin with help from Sam Hocevar, also based on a52dec code with original credits going to Aaron Holtzman and Michel Lespinasse. Modifications were made to output mono wavs directly, including LFE output. Currently it does not support AC-3 (.ac3), but plans are in the works. Requires: Borland C++ single-thread Run-Time Library (RTL) redistributable dll file: CC3260.dll. Manually copy this dll into your Windows/System32 directory or else it should reside in the same directory as tranzcode.exe. Note: OUTPUT MONO FILES WILL OVERWRITE EXISTING FILES, so be sure to rename or move already transcoded files. Note: Before tanzcode starts transcoding dts, it reads dts header info at the beginning of the file which is initially used to displaying attributes about the source file. # of DTS frames is estimated and used for displaying of the transcode progress. Multichannel Transcoding: --------------------------------- Mono wav output will be PCM (non extensible), and have the same bit resolution and sample rate as the multichannel source wav. Supports very large wavs files (> 4GB), including wav extensible format. Supports 2-ch (stereo), up to 18 channels. If a mono wav is transcoded, the result will be an "empty" or blank wav with the same characteristics as the source wav. Suffix naming convention: Is the same as the output order (as displayed during transcoding): 2 channels: -L (Left) -R (Right) 3 channels: -L (Left) -R (Right) -C (Center) 4 channels: -FL (Front Left) -FR (Front Right) -BL (Back Left) -BR (Back Right) 5 channels: -FL (Front Left) -FR (Front Right) -C (Front Center) -SL (Surround/Back Left) -SR (Surround/Back Right) 6 channels: -FL (Front Left) -FR (Front Right) -C (Front Center) -LFE (Low Frequency Effect) -SL (Surround/Back Left) -SR (Surround/Back Right) 7 channels: -FL (Front Left) -FR (Front Right) -FC (Front Center) -LFE (Low Frequency Effect) -BL (Back Left) -BR (Back Right) -FLC (Front Left Center) 8-17 channels: [Just add the extra channel(s) to that of 7 channels accordingly (see 18 channels) ] 18 channels: -FL (Front Left) -FR (Front Right) -FC (Front Center) -LFE (Low Frequency Effect) -BL (Back Left) -BR (Back Right) -FLC (Front Left Center) -FRC (Front Right Center) -BC (Back Center) -LS (Left Side) -RS (Right Side) -TC Top Center) -TFL (Top Front Left) -TFC (Top Front Center) -TFR (Top Front Right) -TBL (Top Back Left) -TBC (Top Back Center) -TBR (Top Back Right) Note: For mono wav input, the resulting output wav will have "-(blank)" as the suffix. DTS Transcoding: ----------------------- Transcoded .dts (48kHz) and DTSWav (44.1kHz) files into 32 bit float mono wavs regardless of the bit resolution they were originally encoded with. The number of output mono wavs depends on the number of channels read. There is also a downmix option (/S) to output a 16 bit stereo wav. It does not support DTS ES The output order (is the same as displayed during transcoding): Usually as 6 or 5 channels, having the suffix name appended as follows: (note: SL & SR were used instead of BL (Back Left) & BR because I got accustomed to the naming convention) Suffix naming convention: Is the same as the output order (as displayed during transcoding) based on the DTS AMODE read and LFF Flag (presence of LFE) giving the number of channels total: 1 channel (1.0): [tested - works] -------------------- AMODE=0 [A] -C (Center) 2 channels (1.1) (with LFE): [untested] ------------------------------------ AMODE=0 [A] + LFE -C (Center) -LFE (Low Frequency Effect) 2 channels (2.0): [untested] ---------------------- AMODE=1 [A + B (Dual Mono)] AMODE=2 [L + R (Stereo)] AMODE=3 [(L + R) + (L - R) (Sum - Difference)] AMODE=4 [LT + RT (Left and Right Total)] -L (Left) -R (Right) 3 channels (2.1) (with LFE): [untested] ------------------------------------ AMODE=1 [A + B (Dual Mono)] + LFE AMODE=2 [L + R (Stereo)] + LFE AMODE=3 [(L + R) + (L - R) (Sum - Difference)] + LFE AMODE=4 [LT + RT (Left and Right Total)] + LFE -L (Left) -R (Right) -LFE (Low Frequency Effect) 3 channels (3.0): [untested] ---------------------- AMODE=5 [C + FL + FR] -L (Left) -R (Right) -C (Center) AMODE=6 [FL + FR + BC] -L (Left) -R (Right) -BC (Back Center) 4 channels (with LFE) (3.1): [untested] ------------------------------------ AMODE=5 [C + FL + FR] + LFE -L (Left) -R (Right) -C (Center) -LFE (Low Frequency Effect) AMODE=6 [FL + FR + BC] + LFE -L (Left) -R (Right) -BC (Back Center) -LFE (Low Frequency Effect) 4 channels (4.0): [untested] ---------------------- AMODE=7 [FC + FL + FR + BC] -FL (Front Left) -FR (Front Right) -FC (Front Center) -BC (Back Center) AMODE=8 [FL + FR + BL + BR] (Quad) -FL (Front Left) -FR (Front Right) -BL (Back Left) -BR (Back Right) 5 channels (4.1) (with LFE): [untested] ------------------------------------ AMODE=7 [FC + FL + FR + BC] + LFE -FL (Front Left) -FR (Front Right) -LFE (Low Frequency Effect) -FC (Front Center) -BC (Back Center) AMODE=8 [FL + FR + BL + BR] + LFE -FL (Front Left) -FR (Front Right) -LFE (Low Frequency Effect) -BL (Back Left) -BR (Back Right) 5 channels (5.0): (common) [untested] ---------------------- AMODE=9 [FL + FR + C + SL + SR] -FL (Front Left) -FR (Front Right) -C (Center) -SL (Surround/Back Left) -SR (Surround/Back Right) 6 channels (5.1) (with LFE): (most common) [tested - works] ------------------------------------ AMODE=9 [FL + FR + C + SL + SR] + LFE -FL (Front Left) -FR (Front Right) -C (Center) -LFE (Low Frequency Effect) -SL (Surround/Back Left) -SR (Surround/Back Right) 6 channels (6.0): (Not supported) [untested] ---------------------- AMODE=10 [FLC + FRC + FL + FR + BL + BR] -FL (Front Left) -FR (Front Right) -FLC (Front Left Center) -FRC (Front Right Center) -BL (Back Left) -BR (Back Right) AMODE=11 [FC + FL + FR + BL + BR + TC] -FL (Front Left) -FR (Front Right) -FC (Front Center) -TC (Top Center) -BL (Back Left) -BR (Back Right) AMODE=12 [FC + BC + FL + FR + BL + BR] -FL (Front Left) -FR (Front Right) -FC (Front Center) -BC (Back Center) -BL (Back Left) -BR (Back Right) 7 channels (6.1) (with LFE): (Not supported) [untested] ------------------------------------ AMODE=10 [FLC + FRC + FL + FR + BL + BR] + LFE -FL (Front Left) -FR (Front Right) -FLC (Front Left Center) -LFE (Low Frequency Effect) -BL (Back Left) -BR (Back Right) -FRC (Front Right Center) AMODE=11 [FC + FL + FR + BL + BR + TC] + LFE -FL (Front Left) -FR (Front Right) -FC (Front Center) -LFE (Low Frequency Effect) -BL (Back Left) -BR (Back Right) -TC (Top Center) AMODE=12 [FC + BC + FL + FR + BL + BR] + LFE -FL (Front Left) -FR (Front Right) -FC (Front Center) -LFE (Low Frequency Effect) -BL (Back Left) -BR (Back Right) -BC (Back Center) 7 channels (7.0): (Not supported) [untested] ---------------------- AMODE=13 [FLC + FC + FRC + FL + FR + BL + BR] -FL (Front Left) -FR (Front Right) -FC (Front Center) -BL (Back Left) -BR (Back Right) -FLC (Front Left Center) -FRC (Front Right Center) 8 channels (7.1): (with LFE) (Not supported) [untested] ------------------------------------ AMODE=13 [FLC + FC + FRC + FL + FR + BL + BR] + LFE -FL (Front Left) -FR (Front Right) -FC (Front Center) -BL (Back Left) -BR (Back Right) -FLC (Front Left Center) -FRC (Front Right Center) -LFE (Low Frequency Effect) 8 channels (8.0): (Not supported) [untested] ---------------------- AMODE=14 [FLC + FRC + FL + FR + TFL + TBL + TFR + TBR] -FL (Front Left) -FR (Front Right) -FLC (Front Left Center) -FRC (Front Right Center) -TFL (Top Front Left) -TFR (Top Front Right) -TBL (Top Back Left) -TBR (Top Back Right) AMODE=15 [FLC + FC + FRC + FL + FR + BL + BC + BR] -FL (Front Left) -FR (Front Right) -FC (Front Center) -BL (Back Left) -BR (Back Right) -BC (Back Center) -FLC (Front Left Center) -FRC (Front Right Center) 9 channels (8.1): (with LFE) (Not supported) [untested] ------------------------------------ AMODE=14 [FLC + FRC + FL + FR + TFL + TBL + TFR + TBR] + LFE -FL (Front Left) -FR (Front Right) -FLC (Front Left Center) -FRC (Front Right Center) -TFL (Top Front Left) -TFR (Top Front Right) -TBL (Top Back Left) -TBR (Top Back Right) -LFE (Low Frequency Effect) AMODE=15 [FLC + FC + FRC + FL + FR + BL + BC + BR] + LFE -FL (Front Left) -FR (Front Right) -FC (Front Center) -BL (Back Left) -BR (Back Right) -BC (Back Center) -FLC (Front Left Center) -FRC (Front Right Center) -LFE (Low Frequency Effect) Usage: Command line options: --------------------------------------- Usage: tranzcode Where: (the following are accepted): '-h' or '-H' [to show the Help Screen] or '-i' or 'I' [to show the Info Screen] or [being either .wav (Multichannel wav file or DTSWav), or .dts (dts file)] Note: Filename containing space characters require double quotes ("") around the whole file name, including the optional prefix name. Including paths with filenames is not accepted with filenames. All source files must reside in the same directory as the tranzcode executable. The output wavs will also be created in that same directory. (used to specify the output prefix filename which will have the suffix append to it). Note: If (prefix filename) is not used, then the original source file name will be used as the prefix for the output wavs. (always begins with a '/' character, followed with an option. Note: Currently only 1 command line () cammand is allowed, and you cannot append commands together (i.e. /n+LFE will ignore the "+LFE" part, or "/+LFEn" or "/+LFE/n" will say they are not valid channel selecting options) Note: if is not used, but (with the '/') is, the original source file name will be used as the prefix for the output wavs, and all valid options will be processed. Valid options: '/S' or '/s' - DTS Stereo Downmix used ONLY FOR .dts FILES or DTSWav to output a 16 bit stereo wav. - The output wav will have the (stereo) suffix appended to the prefix name. An extended option for adjusting the gain to avoid clipping is featuerd: (example): /S@25% will reduce the gain by .25%. (example): /S@155% will increase the gain by 1.55%. Format: Use the '@' char after the /S option, followed with a number (gain factor) up to 3 char long (i.e. 100) The number will be divided by 100 and multiplied to each of the output samples to adjust the gain. I included this because while downmixing dts to stereo, I would have clipping on some outputs while other not. Thus I allowed the user to adjust the gain thru command line. Not professional [i.e.dB factor, but effective :-) ] '/N' or '/n' - For disabling Estimated time for display progress) used mostly for testing, this will not show "Estimated Time Remaining", not much of a gain in transcoding speed, used testing purposes only. +(Channel Identifier1),(Channel Identifier2),(Channel Identifier3)... - A means to cancel selected channels for output -(Channel Identifier1),(Channel Identifier2),(Channel Identifier3)... - A means to cancel selected channels for output The above Channel Identifier method (newer) is a much easier method of selecting/canceling output wavs as required. The older method outlined below (Hex Value) may seem too obscure, and impractical for those not familiar with Hex numbers. The Hex Value method may have its advantage of less typing on many selected channels for i.e. > 10 channels, but requires some caluculation as outlined below. The Channel Identifier method uses descriptive channel identifiers (i.e. FL), the available identifiers are listed above for each channel scenario (see Suffix naming convention above - exclude the '-' character) [i.e. FL (Front Left channel), LFE (Low Freq Effect channel), C (Center channel)] Note: selecting Channel Identifiers which are above the number of channels found in either dts or multichannel wavs has no effect. e.i. using 'TBR' on a 6 channel wav for example, has no effect. Examples: "/+SL,C,LFE" would cancel all other channels except for the SL (Souround Left), C (Center) and LFE channels. Examples: "/-SL,C,LFE" would cancel the specified channels: SL (Surround Left), C (Center) and LFE channels. Note: Channel Identifiers MUST BE UPPERCASE! The reason being, I left the other older method of Hex Value which needs to discriminate between a Channel Identifier and a Hex Value, where "/+c" (Hex Value) is not the same channel selection output, as /+C (center channel). The Hex Value for "c" (0x0c) is binary 1100, which with the '+" option would cancel all channels except for FL & FR. Compare that with the 'C' which with the "+" option would cancel all channels except for the Center channel. This is the reason for case sensitive Channel Identifiers. All other options are NOT case sensitive. +(Hex Value) - This may seem strange or difficult to follow, but it allows the user to specify which channels to output only -(Hex Value) - Same as above just the inverse, which means there are 2 ways of specifying the same channel output option. Note: The "Hex Value" method was my 1st means of selecting specified channels (canceling the default - all channels for output) Both methods work, some may find 1 method easier than the other. The "Channel Identifier" method is the easiest, I didn't mean to intimidate users with complicated math of number systems such as hexadecimal or binary, so it may be best to ignore the Hex Value method. Note: Separate Channel Identifiers with a comma (,) , no spaces are allowed! Also Channel Identifier order does not matter! i.e. tranzcode "My Guitar Gently Weeps.dts" temp /-LFE,C would output: temp-FL, temp-FR, temp-SL, temp-SR only (i.e. quad) i.e. tranzcode "My Guitar Gently Weeps.dts" temp /+LFE,C would output: temp-LFE and temp-C only. Note: The Channel Identifiers BL and BR can also be used for 5 and 6 channel files to identify SL and SR respectively, however SL and SR cannot be used to identify BL or BR on channels other than 5 or 6. Note1: Careful when using Channel Identifiers beyond the channel scope of the source file, along with the "+" option, since specifing only a channel output which isn't available will cancel all outputs. (i.e. /+R on any other file besides a stereo and 3 channel wav will cancel all outputs) Explaining: (Hex Value) Note: By default, without using the +(Hex Value) or -(Hex Value) options, all detected channels will output a mono wav file. But to be able to select only specific output wav(s), lets say for example [TFR (Top Front Right) and also BL (Back Left) channels only of an 18 channel wav (not very realistic but as an example anyway). How would you be able to easily put this in a command line? The method is basically using a binary bit for each of the maximum 18 channels, where a '1' in the correct position will output the specific channel and a '0' will cancel the channel output. But if the '-' option is used instead of '+', then the inverse effect will occur. Meaning for the '-(Hex Value)' option will output the channel only is it is '0', and cancel the specific channel if it is '1'. Now going back to the example: For TFR & BL channels only out, using the '+(Hex Value)' we need to put '1''s for these 2 channels only, in the order as the channels are decoded (displayed - top down), but we need to put the '1' starting from Right (LSB least significant bit) to Left (MSB most significant bit): <-------------------------------- Order of channel decoding <----------------------------------------- TBR TBC TBL TFR TFC TFL TC RS LS BC FRC FLC BR BL LFE FC FR FL 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 (put '1' for output channels only) Now that we have our binary value, which is too long, we can convert it to a Hexadecimal value. Binary (base 2) Hexadecimal (base 16) Decimal (base 10) ---------------------------------- ------------------------------- ------------------------ 0000 0 0 0001 1 1 0010 2 2 0011 3 3 0100 4 4 0101 5 5 0110 6 6 0111 7 7 1000 8 8 1001 9 9 1010 a 10 1011 b 11 1100 c 12 1101 d 13 1110 e 14 1111 f 15 0001 0000 0 0 0001 0001 1 1 0001 0010 2 2 0001 0011 3 3 0001 0100 4 4 0001 0101 5 5 0001 0110 6 6 0001 0111 7 7 0001 1000 8 8 0001 1001 9 9 0001 1010 a 10 0001 1011 b 11 0001 1100 c 12 0001 1101 d 13 0001 1110 e 14 0001 1111 f 15 Well I can't show all of the binary equivalent, it would be too long, but this should give you an idea. Binary is not easy to write or follow, but Hexadecimal is a lot easier, to determine which channels, you wish to specify specifically for output, just write a binary string with '1's where the channels you want, then space arrange them into groups of 4 bits to get your Hexadecimal value. So for out example above (grouping the bits together in 4's): 00 0100 0000 0000 1000 Converting each 4 bit group into a Hexadecimal number: 0 4 0 0 8 = 04008 or 4008 Thus our command line option to output only TFR & BL channels from an 18 channel wav is /+4008 18 channel wavs are not used too much, but 6 channels wavs are, the following is a table which you can select the more common channel selections to easily output specific channel wavs. For 6 Channels Only (i.e. 6 bit positions) Channel Output Combination /+(Hex Value Option) or /-(Hex Value Option) -------------------------------------------------------------------------------------------------------------------------------------- FL only /+1 /-3e FR only ......................................................... /+2 ..................................... /-3d C only /+4 /-3b LFE only ....................................................... /+8 ..................................... /-37 SL only /+10 /-2f SR only .......................................................... /+20 .................................... /-1f all channels except: FL /+3e /-1 all channels except: FR ................................ /+3d .................................... /-2 all channels except: C /+3b /-4 all channels except: LFE .............................. /+37 ..................................... /-8 all channels except: SL /+2f /-10 all channels except: SR ................................. /+1f ................................... /-20 FL + FR (fronts only) ..................................... /+3 ...................................... /-3c SL + SR (rears only) /+30 /-0f C + LFE only ................................................. /+c ..................................... /-33 FL + SL (left side) ......................................... /+11..................................... /-2e FR + SR (right side) /+22 /-1d FL + FR + SL + SR (quad) ........................... /+33 ..................................... /-C FL + C + FR (fronts with center) /+7 /-38 SL + C + SR (rears with center) .................... /+34 ..................................... /-B FL + C + FR + LFE (fronts, center & LFE) .... /+f ...................................... /-30 SL + C + SR + LFE (rears, center & LFE) /+3c /-3 FL + FR + LFE (fronts with LFE) ................. /+B ...................................... /-34 SL + SR + LFE (rears with LFE) /+38 /-7 FL + SL + LFE (lefts with LFE) .................... /+19 ...................................... /-26 FR + SR + LFE (rights with LFE) /+2a /-15 FL + SL + C (lefts with C) ............................ /+15 ..................................... /-2a FR + SR + C (rights with C) /+26 /-19 Note1: Careful when using a Hex Value beyond the channel scope of the source file, along with the "+" option, since specifing only a channel output which isn't available will cancel all outputs. (i.e. /+F on any file except a stereo wav will cancel all outputs) Note2: Use lowercase characters for the "Hex value" method so it doesn't produce surprising results (i.e. C is for Center Channel) Aborting Transcoding & Output wav Previewing: -------------------------------------------------------------- To cancel transcoding, use the usual console key combination. The process will halt transcoding, but has the option to resume. You can use this opportunity to preview your outputted mono wavs before they have completed. If you open written wavs while transcode process is halted, please close them all before resuming, otherwise it can't write to the files, and the transcoding process is halted. I don't think you can resume after that. Resuming does not introduce any gliches or loss of samples, even if you continue transcoding even after previewing the unfinished wavs. Well that just about wraps it up, unless I forgot to mention anything else. Enjoy transcoding, or should I say tranzcoding :-) - Austin Forgotten