The Ur-Quan Masters Discussion Forum

The Ur-Quan Masters Re-Release => Technical Issues => Topic started by: Serosis on March 04, 2006, 12:39:18 am



Title: ABX and AIF help
Post by: Serosis on March 04, 2006, 12:39:18 am
i wanna ask a favor to the dev team or whoever handled the audio for UQM...

could you build abx2raw and aif2raw so i can compare it to the ones i've built, i believe the ones that i have compiled didn't compile correctly.

thanks


Title: Re: ABX and AIF help
Post by: meep-eep on March 04, 2006, 02:53:00 am
http://www.stack.nl/~svdb/sc2/abx2raw and http://www.stack.nl/~svdb/sc2/aif2raw


Title: Re: ABX and AIF help
Post by: Serosis on March 04, 2006, 03:57:56 am
yeah mine are way different than what they're supposed to be, my files are like 10 times the size of these and mine don't even work  :P

how would i compile these tools in MSYS/mingw?

this is just for future reference


Title: Re: ABX and AIF help
Post by: meep-eep on March 04, 2006, 04:48:18 am
I don't think mine will work for you either. I was just having a bit of fun; these files I posted were Linux binaries, and I expect you'll want Windows binaries (which I don't have).
How big executables get depend on a lot of things. Statically/dynamically linked, with or without debug info, with or without optimisation, optimising for speed or size, and what compiler you're using.
In what way are your executables not working? Do they cause a runtime error? Do they produce bad output files?
As for how to compile using MinGW: There's a makefile supplied. You just type 'make' (or 'gmake'). 'make' will do 'gcc -W -Wall -g -O0 abx2raw.c -o abx2raw' for you.


Title: Re: ABX and AIF help
Post by: Serosis on March 04, 2006, 05:13:14 am
well i'm using dev-C++ to compile them and i get a bad output file that is basically nothing but a named 0 kb file

that's why i suspect a bad compile
i've even tried getting VS 2003 and 2005 to compile it but they refuse to.


.:: EDIT ::.
do these tools even work in windows?


Title: Re: ABX and AIF help
Post by: meep-eep on March 04, 2006, 08:48:45 am
No warnings or error messages?

Quote
do these tools even work in windows?
I personally haven't tried them in Windows. But I think someone had, at some point.
Note that the scripts that convert to .wav use sox, which I doubt will compile on Windows. So you can only convert to .abx and .aif. But any sound program that can import raw files can be used to turn those into .wavs. All you have to know is the type of data.
abx is 11025 Hz mono, 8 bits signed linear data.
aif is 44100 Hz stereo, 16 bits signed linear data.
You'll hear it if you get it wrong.



Title: Re: ABX and AIF help
Post by: Novus on March 04, 2006, 11:02:09 am
abx2raw works fine with MinGW, just run "make" in the abx directory under MSYS to compile. aif2raw, however, just says "No sound data chunk found." and exits, leaving a zero-size RAW file (tested on the HyperSpace music). Investigating.


Title: Re: ABX and AIF help
Post by: Novus on March 04, 2006, 03:27:32 pm
aif2raw suffers quite badly from "the-world-is-my-Linux-box-itis". Both the input and output files are opened in text mode and the entire output file (several megabytes!) is stored on the stack.  The result is that the file is truncated at the DOS EOF character (0x1A) and carriage returns (0x0A) are converted to DOS format (0x0D 0x0A). Obviously, this is bad. Windows also objects to having a 32 MB stack frame for some reason.

Solution: change the fopen calls to use modes "rb" and "wb" instead of "r" and "w" respectively. Then change all the calls to alloca to use malloc instead (and add some corresponding frees if you feel pedantic).


Title: Re: ABX and AIF help
Post by: meep-eep on March 04, 2006, 09:10:10 pm
Oh, I thought I fixed that ages ago. I hope you didn't spend too much time figuring this out; it was the first thing in my mind when I read your previous posting.
Anyhow, these progs were created to convert the abx and aif files once, and never be run again. Portability was not an issue.


Title: Re: ABX and AIF help
Post by: Novus on March 04, 2006, 10:41:05 pm
Oh, I thought I fixed that ages ago. I hope you didn't spend too much time figuring this out; it was the first thing in my mind when I read your previous posting.
Not really. The time-consuming part was downloading Emacs for Windows.

Quote
Anyhow, these progs were created to convert the abx and aif files once, and never be run again. Portability was not an issue.
Any code you put in the public CVS tree of a well-known project will eventually be scrutinised by someone. ;)

One reason for running these programs could be to extract the original music and speech from the 3DO CD without the quality loss caused by the Vorbis compression (not that I can hear any difference). Any audiophiles here want FLAC support for music/speech? ;D

BTW, aifc2wav (http://sed.free.fr/aifc2wav.html) may also interest you.

Just to hear what I've been missing, I'm listening to the difference between the UQM OGG and the 3DO SC2 AIF of the Hyperspace music. I can't really hear the tune itself; mostly I hear a lot of wooshing sounds and the upper part of the snare drums. Trippy.


Title: Re: ABX and AIF help
Post by: Serosis on March 05, 2006, 12:04:33 am
abx2raw works fine with MinGW, just run "make" in the abx directory under MSYS to compile. aif2raw, however, just says "No sound data chunk found." and exits, leaving a zero-size RAW file (tested on the HyperSpace music). Investigating.

yeah, i never got an error message when i tried aif2raw, it just opened and closed (yes i did input the right commands), but i havent really tried to convert the abx files yet so maybe i'll test that out...

oh and the 'pkg' tool, what exactly do i need to compile that?
both dev-c++ and mingw can't compile it...

the only reason i try these tools is just that i'm VERY curious, and a few other 3DO games have the same formats that i want to convert.


Title: Re: ABX and AIF help
Post by: Serosis on March 05, 2006, 12:25:49 am
Solution: change the fopen calls to use modes "rb" and "wb" instead of "r" and "w" respectively. Then change all the calls to alloca to use malloc instead (and add some corresponding frees if you feel pedantic).

well i did that but i get

Code:
[Linker error] undefined reference to 'stderr'

both in MSYS and Dev-C++
i think it might be an error on my part though, so i'll report back when i fix my include directories  ;D

.:: EDIT ::.
Got it to work now, but i still have troubles with the 'pkg' tool...
i hope i'm not annoying you guys with all this :)


Title: Re: ABX and AIF help
Post by: Novus on March 05, 2006, 10:05:33 am
Got it to work now, but i still have troubles with the 'pkg' tool...
i hope i'm not annoying you guys with all this :)
You did notice that the makefile has two different relevant targets, unpkg and parseres, didn't you? Either way, unpkg looks like it contains a lot more Unix-specific stuff than the others, so you may have to rewrite some stuff. Cygwin might work better than MinGW. I'll take a look at it next time I boot Windows...

Edit: MinGW doesn't have a proper mmap implementation, so you'll have to rewrite the file read code to create a buffer and read the file into that instead (or try to figure out Windows' equivalent to mmap).


Title: Re: ABX and AIF help
Post by: Serosis on March 05, 2006, 10:03:05 pm
Got it to work now, but i still have troubles with the 'pkg' tool...
i hope i'm not annoying you guys with all this :)
You did notice that the makefile has two different relevant targets, unpkg and parseres, didn't you? Either way, unpkg looks like it contains a lot more Unix-specific stuff than the others, so you may have to rewrite some stuff. Cygwin might work better than MinGW. I'll take a look at it next time I boot Windows...

Edit: MinGW doesn't have a proper mmap implementation, so you'll have to rewrite the file read code to create a buffer and read the file into that instead (or try to figure out Windows' equivalent to mmap).

well i fixed most of it with some tips from the MSDN and i fixed 'parseres' so that no errors or warnings are generated, but the 'mmap' is giving me the most trouble.


.:: EDIT ::.
right now out of sheer boredom i'm gonna optimize aif2raw or aif2wav to be simply just drag and drop, maybe later i'll add a simple GUI. NOTE: nevermind  i just did a test on wether the converted raw files are any different from the .ogg files and they have no difference whatsoever, so it would be pointless :D


Title: Re: ABX and AIF help
Post by: Halleck on March 05, 2006, 11:34:56 pm
Cool.

BTW, I just remembered I have an aif2raw.exe here (http://eliot.bambi.net/dump/aif2raw.exe)... I think I compiled it with Dev-C++ but it might have been VC7.


Title: Re: ABX and AIF help
Post by: Novus on March 06, 2006, 09:34:34 am
NOTE: nevermind  i just did a test on wether the converted raw files are any different from the .ogg files and they have no difference whatsoever, so it would be pointless :D
There is a difference, but you can't hear it. Try subtracting the AIF version from the OGG and see what you get. :)


Title: Re: ABX and AIF help
Post by: Serosis on March 06, 2006, 07:10:15 pm
Cool.

BTW, I just remembered I have an aif2raw.exe here (http://eliot.bambi.net/dump/aif2raw.exe)... I think I compiled it with Dev-C++ but it might have been VC7.

yeah your aif2raw has that same problem mine did except your makes an extra file called gmon.out which i have no idea what it is.


Title: Re: ABX and AIF help
Post by: Novus on March 06, 2006, 07:44:20 pm
an extra file called gmon.out which i have no idea what it is.
That would be profiling data for gprof (http://www.gnu.org/software/binutils/manual/gprof-2.9.1/gprof.html).


Title: Re: ABX and AIF help
Post by: Serosis on March 06, 2006, 07:55:20 pm
NOTE: nevermind  i just did a test on wether the converted raw files are any different from the .ogg files and they have no difference whatsoever, so it would be pointless :D
There is a difference, but you can't hear it. Try subtracting the AIF version from the OGG and see what you get. :)

and how would you do that?


Title: Re: ABX and AIF help
Post by: Novus on March 07, 2006, 09:41:09 am
There is a difference, but you can't hear it. Try subtracting the AIF version from the OGG and see what you get. :)
and how would you do that?
Load OGG and RAW files into suitable wave editor (e.g. Audacity (http://audacity.sourceforge.net/)), invert one of them and mix them together at the same volume level.


Title: Re: ABX and AIF help
Post by: Serosis on March 07, 2006, 07:28:02 pm
There is a difference, but you can't hear it. Try subtracting the AIF version from the OGG and see what you get. :)
and how would you do that?
Load OGG and RAW files into suitable wave editor (e.g. Audacity (http://audacity.sourceforge.net/)), invert one of them and mix them together at the same volume level.


wow, thats a neat little trick there  8)


Title: Re: ABX and AIF help
Post by: Halleck on March 07, 2006, 08:09:45 pm
In stereo tracks where the vocals are mixed dead center, you can use that method to produce instrumental versions.  ;D


Title: Re: ABX and AIF help
Post by: Serosis on March 07, 2006, 08:52:38 pm
In stereo tracks where the vocals are mixed dead center, you can use that method to produce instrumental versions.  ;D

thanks, i'll check that out, there are a few songs that i think would be better instrumental  ;D