[X-BtF] A fix for the distorted speech on modern Windows

Ask here if you experience technical problems with X³: Reunion, X²: The Threat, X-Tension or X-Beyond The Frontier

Moderators: timon37, Moderators for English X Forum

Post Reply
saber7007h
Posts: 4
Joined: Tue, 3. Nov 20, 00:10

[X-BtF] A fix for the distorted speech on modern Windows

Post by saber7007h » Tue, 3. Nov 20, 01:50

The distorted speech bug has been fixed. See post 4 for the solution.

Original post:
Hi.

I really want to try to figure out the speech distortion problem in X-BTF on Win10. It's got something to do with the windows audio/video codecs, users have to revert to default codecs for it to work apparently. According to the X2 Modding Tools (which seem to work on X-BTF also, at least for decompressing the 01.cat/dat), the "mov" folder contains the "Streams containing either speech or movies (the face animations)". It's full of .dat files but no .cat files. Looking at the files in a hex editor there seems to be a header of a few bytes on the files but it's not instantly recognizable. I'm out of time today but I'm gonna try to take a deeper look tomorrow, but I thought I'd ask...

Does anyone here know how to decode/decrypt/decompress these mov\*.dat files?
Last edited by saber7007h on Wed, 4. Nov 20, 20:08, edited 2 times in total.

User avatar
X2-Illuminatus
Moderator (Deutsch)
Moderator (Deutsch)
Posts: 22336
Joined: Sun, 2. Apr 06, 16:38
x4

Re: Trying to figure out file formats in the original game

Post by X2-Illuminatus » Tue, 3. Nov 20, 18:50

.dat is a generic file format. In constrast to the catalog files in the main directory, files in the mov folder are usually either .wma or mpeg files. Normally, the Windows Media Player should be able to play these files without having to convert anything. You can try changing the file ending to .wma for the main voice files (00144.dat and 00244.dat for English), if it doesn't work right away.
Nun verfügbar! X3: Farnham's Legacy - Ein neues Kapitel für einen alten Favoriten

Die komplette X-Roman-Reihe jetzt als Kindle E-Books! (Farnhams Legende, Nopileos, X3: Yoshiko, X3: Hüter der Tore, X3: Wächter der Erde)

Neuauflage der fünf X-Romane als Taschenbuch

The official X-novels Farnham's Legend, Nopileos, X3: Yoshiko as Kindle e-books!

saber7007h
Posts: 4
Joined: Tue, 3. Nov 20, 00:10

Re: Trying to figure out file formats in the original game

Post by saber7007h » Wed, 4. Nov 20, 00:32

Thanks Illuminatus! :thumb_up:

So I've gone through the files and this is it

Code: Select all

00001.dat - MPEG-1 video containing facial expressions (.m1v)
00002.dat - MPEG-1 video containing the end credits (.m1v)
00003.dat - MPEG-1 video containing a "turning off" effect (.m1v)
00010.dat - MPEG-2 Layer 3 audio containing the main menu music (.mp3)
00011.dat - MPEG-2 Layer 3 audio containing the pre-menu intro music (.mp3)
00012.dat - MPEG-2 Layer 3 audio containing music (.mp3)
00013.dat - MPEG-2 Layer 3 audio containing the game over music jingle (.mp3)
00014.dat - MPEG-2 Layer 3 audio containing music (.mp3)
00015.dat - MPEG-2 Layer 3 audio containing music (.mp3)
00020.dat - MPEG-2 Layer 3 audio containing music (.mp3)
00021.dat - MPEG-2 Layer 3 audio containing music (.mp3)
00022.dat - MPEG-2 Layer 3 audio containing music (.mp3)
00023.dat - MPEG-2 Layer 3 audio containing music (.mp3)
00024.dat - MPEG-2 Layer 3 audio containing music (.mp3)
00025.dat - MPEG-2 Layer 3 audio containing music (.mp3)
00026.dat - MPEG-2 Layer 3 audio containing music (.mp3)
00027.dat - MPEG-2 Layer 3 audio containing music (.mp3)
00028.dat - MPEG-2 Layer 3 audio containing music (.mp3)
00030.dat - MPEG-2 Layer 3 audio containing music (.mp3)
00031.dat - MPEG-2 Layer 3 audio containing music (.mp3)
00032.dat - MPEG-2 Layer 3 audio containing a music jingle (.mp3)
00033.dat - MPEG-2 Layer 3 audio containing the Egosoft logo music jingle (.mp3)
00144.dat - MPEG-2 Layer 2 audio containing the in-game speech in english (.mp2)
00149.dat - MPEG-2 Layer 2 audio containing the in-game speech in german (.mp2)
00244.dat - MPEG-2 Layer 2 audio containing the pre-menu intro speech in english (.mp2)
00249.dat - MPEG-2 Layer 2 audio containing the pre-menu intro speech in german (.mp2)


So it seems that the Layer 2 audio is the culprit. I'm hopeful that if we're able to convert it to either WAV or MP3 (Layer 3) format, that will fix the problem. Now to test that...

EDIT: I converted the Layer 2 audio to WAV and listened through the intro and the start of the game and IT WORKS! No more ear bleeding distortion and no need to uninstall your favorite codecs any longer. I'll put together a layman's guide on how to convert the files tomorrow.

saber7007h
Posts: 4
Joined: Tue, 3. Nov 20, 00:10

Re: Trying to figure out file formats in the original game

Post by saber7007h » Wed, 4. Nov 20, 19:46

EDIT: I originally posted a fix converting the speech to MP3s but that introduced a random offset error causing incorrect speech sometimes. Since then I've tested and confirmed that MPEG-4 AAC audio works. I've updated the post and the code for using this format.

Alright here's a fix that "modernises" the game's speech, so you don't need to uninstall any codecs. I decided to convert to M4A instead of WAV to save some space (WAVs also introduce stutters because of the file sizes). This operation will expand the size of your X BtF installation by 220 MB.

Step 1: Download Lame from RareWares.org and extract into the 'mov' folder within your X installation folder. On my computer it's 'Steam\steamapps\common\X Beyond the Frontier\mov'. You only need 'lame.exe' from the zip file.
(If the link dies in the future you should be able to find Lame binaries somewhere on www.rarewares.org. Lame is an open source MP3 encoder.)

Step 2: Download FAAC from RareWares.org and extract into the same 'mov' folder within your X installation folder. You only need 'faac.exe' from the zip file.
(If the link dies in the future you should be able to find FAAC binaries somewhere on www.rarewares.org. FAAC is an open source AAC encoder.)

Step 3: Copy the following code into Notepad and save as "xbtf_codecfix.cmd" within the 'mov' folder. Make sure to put the quotation marks around the name when saving, otherwise Notepad will save it as xbtf_codecfix.cmd.txt.

Code: Select all

@echo off
echo Script for converting MPEG Layer 2 audio into Advanced Audio Coding format for X Beyond the Frontier
echo Written by saber7007h
echo.
echo This will make your game installation require 220 MB more space.
echo Press CTRL+C to stop or any other key to continue...
pause >nul

REM PRE OP CHECK
if not exist lame.exe (
	echo lame.exe not found. You need to put the Lame encoder/decoder in the same folder as this script.
	echo Press any key to exit.
	pause >nul
	exit /b
)

if not exist faac.exe (
	echo faac.exe not found. You need to put the FAAC encoder in the same folder as this script.
	echo Press any key to exit.
	pause >nul
	exit /b
)

if exist codecfixtemp.mp2 (
	echo Temporary file found. Either the script is already running or you need to revert the folder to it's original state.
	echo Press any key to exit.
	pause >nul
	exit /b
)

if exist codecfixtemp.wav (
	echo Temporary file found. Either the script is already running or you need to revert the folder to it's original state.
	echo Press any key to exit.
	pause >nul
	exit /b
)

REM OPERATION
if exist 00144.dat.original (
	echo 00144.dat.original found. Script has already been run.
	echo If you want to revert to before the script, you need to delete 00144.dat and rename 00144.dat.original to 00144.dat.
) else (
	if exist 00144.dat (
		echo 00144.dat found. Converting...
		ren 00144.dat codecfixtemp.mp2
		lame.exe --decode codecfixtemp.mp2 codecfixtemp.wav
		faac.exe -b 48 -o codecfixtemp.m4a codecfixtemp.wav
		ren codecfixtemp.mp2 00144.dat.original
		ren codecfixtemp.m4a 00144.dat
		del codecfixtemp.wav
		echo 00144.dat has been converted.
	) else (
		echo 00144.dat not found. This script needs to be put into the 'mov' folder within the X Beyond the Frontier folder.
	)
)

if exist 00149.dat.original (
	echo 00149.dat.original found. Script has already been run.
	echo If you want to revert to before the script, you need to delete 00149.dat and rename 00149.dat.original to 00149.dat.
) else (
	if exist 00149.dat (
		echo 00149.dat found. Converting...
		ren 00149.dat codecfixtemp.mp2
		lame.exe --decode codecfixtemp.mp2 codecfixtemp.wav
		faac.exe -b 48 -o codecfixtemp.m4a codecfixtemp.wav
		ren codecfixtemp.mp2 00149.dat.original
		ren codecfixtemp.m4a 00149.dat
		del codecfixtemp.wav
		echo 00149.dat has been converted.
	) else (
		echo 00149.dat not found. This script needs to be put into the 'mov' folder within the X Beyond the Frontier folder.
	)
)

if exist 00244.dat.original (
	echo 00244.dat.original found. Script has already been run.
	echo If you want to revert to before the script, you need to delete 00244.dat and rename 00244.dat.original to 00244.dat.
) else (
	if exist 00244.dat (
		echo 00244.dat found. Converting...
		ren 00244.dat codecfixtemp.mp2
		lame.exe --decode codecfixtemp.mp2 codecfixtemp.wav
		faac.exe -b 48 -o codecfixtemp.m4a codecfixtemp.wav
		ren codecfixtemp.mp2 00244.dat.original
		ren codecfixtemp.m4a 00244.dat
		del codecfixtemp.wav
		echo 00244.dat has been converted.
	) else (
		echo 00244.dat not found. This script needs to be put into the 'mov' folder within the X Beyond the Frontier folder.
	)
)

if exist 00249.dat.original (
	echo 00249.dat.original found. Script has already been run.
	echo If you want to revert to before the script, you need to delete 00249.dat and rename 00249.dat.original to 00249.dat.
) else (
	if exist 00249.dat (
		echo 00249.dat found. Converting...
		ren 00249.dat codecfixtemp.mp2
		lame.exe --decode codecfixtemp.mp2 codecfixtemp.wav
		faac.exe -b 48 -o codecfixtemp.m4a codecfixtemp.wav
		ren codecfixtemp.mp2 00249.dat.original
		ren codecfixtemp.m4a 00249.dat
		del codecfixtemp.wav
		echo 00249.dat has been converted.
	) else (
		echo 00249.dat not found. This script needs to be put into the 'mov' folder within the X Beyond the Frontier folder.
	)
)

REM POST OP CHECK
if exist 00144.dat if exist 00144.dat.original if exist 00149.dat if exist 00149.dat.original if exist 00244.dat if exist 00244.dat.original if exist 00249.dat if exist 00249.dat.original (
	echo.
	echo Everything seems to be in order. You should now have distortion free speech in X Beyond the Frontier.
) else (
	echo.
	echo Not all expected files were found. There might be a problem. Either some files are missing or there was a encoder/decoder error.
)

echo Press any key to exit.
pause >nul
exit /b

Step 4: Double click on the 'xbtf_codecfix.cmd' file you just created. It will check if everything looks correct and then convert your files into M4As.

Now the next question; Do higher quality versions of the music tracks exist anywhere?

Post Reply

Return to “X³: Reunion, X²: The Threat, X-T and X-BTF - Technical Support”