Jump to content

[WIP] San Andreas Audio Toolkit (SAAT)


pdescobar

Recommended Posts

Current SAAT Release: 1.10

Update: version 1.10 released 12 January 2006; no new features, just a couple of bugfixes.

 

Download Locations

3rd-party GUI InterfacesDocumentation
  • Manual (Online version; also see the README quoted below)
  • SFX Directory (Brief Descriptions of the contents of the various sound banks)

    Changes in the current version:

12 Jan 2006 - Version 1.10  - Fixed problem with SFX tool not closing files properly when importing  - Fixed integer size issue when creating import INIs  - Fixed bad copy&paste error in sfx export example in MANUAL.txt  - Updated docs; still need to do more.

 

 

Known issues in the current release: (Major, Minor, Trivial)

  • While the program can export multiple archives at once, the Windows command prompt is so bad at wildcard expansion that it's not particularly easy. I'd like to do something about that, although I don't know if I can.
  • The interface could be better; it's strictly commandline but there are some 3rd-party GUI options available
  • More SFX import formats should be supported; I need to look into why 32-bit float WAVs and AIFFs don't import properly and also would like to be able to handle rudimentary conversion between mono and stereo.
  • Documentation still needs stronger "Backup your files first!" warning
  • A pointer to the SFX Directory should be included in the documentation somewhere, but I really need to move it to the wiki first.
  • The metadata-generic.ini file is broken (it works but I forgot to finish actually making it generic before I put up the distribution.) Luckily, I don't expect anyone to actually use it so I'm going ahead with the release.
  • Tip from tzesun: Use a high sample rate (e.g. 44100) when importing new gun sounds as it will work noticeably better in-game.
What is SAAT?

Quoting a modified version of the README.txt:

 

The San Andreas Audio Toolkit is a set of commandine tools useful for modding the PC version of the video game Grand Theft Auto: San Andreas. SAAT allows the importing of music files into SA audio streams and the importing of WAVe files into SA sfx archives. It will also necessarily allow exporting from each type of archive into individual files.

 

The official SAAT homepage, containing an HTML version of the README.txt can be found at http://pdescobar.home.comcast.net/gta/saat/

 

The current SAAT distribution can be downloaded from http://pdescobar.home.comcast.net/gta/saat...elease_1_10.zip

 

Discussion and feedback on SAAT takes place on its GTAForums thread http://www.gtaforums.com/index.php?showtopic=225049

 

BRIEF DOCUMENTATION

(See file MANUAL.txt for more detail and examples)

 

Installation (Windows Binaries):

- Unzip the two executables and any ini files into a useful location such as the GTASA main directory.

- Open a command prompt window and cd to the install directory.

 

Usage (stream tool):

 

saat_stream.exe -e <stream_file(s)> <target_dir>

  Simple export mode; exports all tracks from <stream_file(s)>, storing the Ogg

  Vorbis files in an appropriately named subdirectory of <target_dir>.

 

saat_stream.exe -r <stream_file(s)> <target_dir> <metadata_file>

  RFSA export mode; like -e but uses contents of <metadata_file> for additional

  descriptive information to tag and name the exported files.

  Note: running RFSA mode on modified streams could lead to confusion.

 

saat_stream.exe -i <target_stream> <import_ini> <lookup_file>

  Import mode; creates <target_stream> based on the information and filename

  references in <import_ini>. Also updates <lookup_file> to reflect the changes

 

Usage (sfx tool):

 

saat_sfx.exe -e <archive_file(s)> <target_dir> <lookup_file>

  Export mode; exports all sounds from <archive_file(s)>, storing the WAVe

  files in an appropriately named subdirectory of <target_dir>.

  Uses <lookup_file> to help locate sounds within the archive.

 

saat_sfx.exe -i <target_archive> <import_ini> <lookup_file>

  Import mode; creates <target_archive> based on the information and filename

  references in <import_ini>. Also updates <lookup_file> to reflect the changes

 

ACKNOWLEDGEMENTS

 

SAAT is based on the stream export program Radio Free San Andreas (RFSA) by Karl-Johan Karlsson, which was released under the GPL. It also uses and/or modifies other open source code from Marcus Eriksson (RFSA), Ondra Hosek (RFSA for 32-bit Windows), and Michael Smith & Ralph Giles (vorbiscomment program from the vorbis-tools distribution.) Additional contributions to this project (whether they know it or not) were made by Simon El�n (credited by RFSA authors for breaking the stream encoding), Eddie Edwards (author of San Andreas Radio and supplier of most of the original RFSA metadata), and Steve M (GTA Modder Extraordinaire who posted the format of sound effects bank headers to GTA Forums).

 

SAAT uses the open-source libraries libogg and libvorbis for Ogg Vorbis processing and libsndfile for other sound processing.

 

LICENSING

(Please see the file COPYING.txt for full details)

 

The San Andreas Audio Toolkit is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

 

The San Andreas Audio Toolkit is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

 

You should have received a copy of the GNU General Public License along with the San Andreas Audio Toolkit; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

 

What follows is the rest of the initial Work-in-Progress post. I will probably be editing out the no longer useful bits soon but I wanted to preserve it for the moment.

 

====================================

What will SAAT do?

 

 

Stream tools

 

 

Export (simple): Takes an audio stream and exports all the embedded Ogg Vorbis tracks into individual files so that they can be replaced and/or modifed. Also creates an INI file which will control certain aspects of re-importation. The most important INI uses currently are determining the order the files will have in the stream and allowing the modification of the dance moves on the BEATS tracks.

 

 

Export (RFSA): Same as the simple export mode with the addition of naming the files descriptively and adding appropriate comment tags to the exported files. SAAT will include a meta-information file similar to that supplied in Radio Free San Andreas and possibly a more generic meta-information file as well.

 

 

Import: Reads a list of files and meta-information from an INI file and creates an audio stream ready for use in SA. Also updates the TrakLkup.dat file to reflect the changes, although I have some suspicion that this might be unnecessary.

 

 

 

 

SFX tools

 

 

Export: Takes a sfx archive and exports all the embedded raw sound effects into individual WAVe files so that they can be replaced and/or modifed. Also creates an INI file which will control certain aspects of re-importation. The most important INI uses currently are determining the order the files will have in the archive.

 

 

Import: Reads a list of files and meta-information from an INI file and creates a sfx archive ready for use in SA. Also updates the BankLkup.dat file to reflect the changes.

 

 

 

 

How will SAAT work?

SAAT will be a few commands that are run from inside a Command Prompt window. WIN32 binaries and full source code will be released (under GNU GPL.) A simple session might look like this:

 

 

 

 

Export a stream:

 

c:> saat_stream -e "C:\Program Files\Rockstar Games\GTA San Andreas\audio\streams\BEATS" .\test\export

 

 

 

Replace an Ogg Vorbis file with a new song

 

c:> copy c:\MyNewMusic.ogg .\test\export\BEATS\Track_001.ogg /Y

 

 

 

Edit the saat_import.ini file in notepad to change the dance moves for Track 1. (Note the filename reference doesn't need to be changed because I overwrote the old file above, but I could have left the old file alone and instead changed the reference here.)

 

 

Import changes back into game:

 

c:> saat_stream -i "C:\Program Files\Rockstar Games\GTA San Andreas\audio\streams\BEATS" .\test\export\BEATS\saat_import.ini "C:\Program Files\Rockstar Games\GTA San Andreas\audio\CONFIG\TrakLkup.dat"

 

 

 

Play!

 

 

What is the current status of the project?

SAAT is still pre-release, but an initial release is planned in the next couple of weeks. The current version can successfully export a stream from SA into a directory full of Ogg Vorbis files and then reimport those files back into a new stream. In testing so far, a new stream made from unmodified export output is identical to the original stream and so is the TrakLkup file. (There is an exception regarding the TrakLkup file -- the lengths of the final 6 Police Band tracks in stream AA are wrong in the original game TrakLkup file; for this reason I have begun to suspect that the TrakLkup file might not always be used by the game.) I have also successfully run the game with a modified stream. (Note: in-game testing was done on PC v1.0)

 

I want to clean up the stream tool a little bit and add some more robust error-checking of the saat_import INI file and then write the sfx tool before release. Fortunately, a large portion of the stream code can be reused for the sfx tools as many of the processing procedures are the same.

 

How can you help?

For now, if you would be interested in modifying SA audio for whatever reason, you can give me feedback on what I've said so far and also on the following design issues/questions. Once it's stable enough for release, you can try it out and let me know what you like and don't like about it and how it could be better.

 

Current design questions/issues:

  • Interface: A GUI is not even under consideration for the initial release as I have zero experience with such things. It'll be open source, though, so if someone wants to contribute such an interface later on, they are welcome. That said, the current commandline design specifies almost everything via arguments. A possible change might be the ability to specify certain details (like the location of the game install directory and/or lookup files) in an INI file. Does anyone have a preference on the "arguments vs config file" issue?
  • Dance beats: The beat information is stored in the stream and will be placed in the saat_import.ini file on export. Currently it looks something like this:

     

    [Track_001]beat_0000.control = 4beat_0000.timing = 18328beat_0001.control = 4beat_0001.timing = 18891[... A whole bunch more ...]beat_0171.control = 3beat_0171.timing = 138219beat_0172.control = 2beat_0172.timing = 138750beat_0173.control = 33beat_0173.timing = 140750beat_total = 174

     

    The timings are in absolute milliseconds and the controls are integers which correspond to button presses. Possible enhancements would be allowing human-readable control definitions and using relative timing rather than absolute. So the above might look something like this:

     

    [Track_001]beat_0000.control = RIGHTbeat_0000.timing = 18328beat_0001.control = RIGHTbeat_0001.timing = 563[... A whole bunch more ...]beat_0171.control = UPbeat_0171.timing = 547beat_0172.control = LEFTbeat_0172.timing = 531beat_0173.control = ENDbeat_0173.timing = 2000beat_total = 174

     

    (Note, dance tracks use controls 1-4 (Down/Left/Up/Right on PC) and Lowrider tracks use 9-16 (some of which are also Down/Left/Up/Right) so there would need to be some way to differentiate which "Up" one meant if some kind of human-readable shortcut was used...) Any preferences on relative vs absolute timings or comments on control references?

  • Tagging: The RFSA export mode tags/names the exported tracks. A question is what happens to these tags when the files are re-imported? Currently, nothing is done to imported Ogg Vorbis files. The advantage of this is that the tags will be preserved if the stream is later exported via simple export mode. The disadvantage is that comments do take up space and the comments are meaningless to the game. Possible future changes would be allowing stripping of comments when imported. Any comments on how you would like this stuff to be handled?
  • Backups: The current pre-release version doesn't back up anything. It might be a good idea to auto-backup the lookup files on import since they are small, but the streams/archives can get huge and I'm hesitant to make humongous backups without the user asking first. An alternative would be some sort of specification (config file or switch, probably config file) to backup the lookup and/or archive files. Any comments here?
  • SFX export layout: (Edited in 03Dec05.) The sound effects archives are made up of "sound banks" which are collections of between 1 and 400 sounds. So, for instance the smallest archive, FEET, looks like this:

     

    FEET Archive (7 banks, 38 total sounds)\--Bank 0 (9 sounds)|  \--Sound 0 ... Sound 8|  \--Bank 1 (5 sounds)|  \--Sound 0 ... Sound 4|  \--Bank 2 (5 sounds)|  \--Sound 0 ... Sound 4|  \--Bank 3 (5 sounds)|  \--Sound 0 ... Sound 4|  \--Bank 4 (4 sounds)|  \--Sound 0 ... Sound 3|  \--Bank 5 (5 sounds)|  \--Sound 0 ... Sound 4|  \--Bank 6 (5 sounds)   \--Sound 0 ... Sound 4

     

    The two obvious approaches to exportation are:

    • a) Create subdirectories for each bank so that the directory structure looks very much like the ASCII picture above (with a single INI file in the root directory) or
    • b) Save all the files in a single directory (with filenames like BankXXX_SoundYYY.wav or perhaps simply SoundXXXXX.wav)
    The idea of bank subdirectories (a) appeals to me, in part because I simply hate the idea of having a directory containing a huge number of files. In the case of the largest archive, SPC_GA, option (a) would result in 209 Bank_XXX subdirectories; the smallest of these subdirectories would have a single file and the largest would have 264 files. However, option (b) would result in a single directory of 31,234 sound files plus the import INI. That bothers me and so I lean towards (a), but the relevant question would be whether the use of such subdirectories would be overly confusing to the user, in which case I'd have to go with (b). Any thoughts on this one?
Some reference links:Edits:03Dec05 -- Added question on SFX export layout.05Dec05 -- Got SFX export working (using Bank subdirectories), although I had to write the WAVe headers myself; am holding off on SFX import for a day or two while I investigate using libsndfile or similar conversion library to give more format options. If I can get import working, I may release a beta for further testing. Also added some more reference links to this post30Dec05 -- Pushed back release to 07Jan06. It's looking good, but I need a bit more time to hammer on it.07Jan06 -- Initial release; first post heavily edited.08Jan06 -- Rapidshare mirror download link added.10Jan06 -- GTA Garage submission approved; added links09Feb08 -- Links to both GUI add-ons and the SFX directory now have prominent placement
  • Like 2
Link to comment
Share on other sites

I have been quietly waiting for this...thanks

 

I prefer absolute timing.....tagging, well I prefer to spend the resources on overpolyed cars

backups....I often burn my modded files on an rw, so I don't care bout that

subdirectories for each bank would be sweet

Provided I can locate my install v1.0dvd, (never know, might end up reinstalling) I can do testing using unpatched and patched, can make changes to files using cool edit2000, nero wave editor, and or goldwave

winxpro sp2 amd64 asus k8vse delux, lol, dunno if ya even need to know all that

Edited by fuckindumass
Link to comment
Share on other sites

Yes! Please have my children.

 

This sounds very promising, I would love to be able to edit the San Andreas sounds. I bid you good luck smile.gif.

Link to comment
Share on other sites

 

Does anyone have a preference on the "arguments vs config file" issue?

config files are easier to edit, but thats a personal preference. Overall, i guess i'd say make everything as easy to use, and newb-friendly as possible, especially if its all going to be done from the command line, which i suspect the majority of users will not be used to using. Also, for the final version for sure, try to include as detailed documentation as possible, along with practical examples. There will be people downloading this who just want to replace one or 2 sound effects, maybe the sound of a gun, and they wont care how the streaming works, they just want to replace the file and try it ingame as quick as possible.

 

Excellent start so far though, you seem to know what your talking about and be on your way to success smile.gif

Link to comment
Share on other sites

You rule.

 

I'm rushed off my feet this weekend, but I'll make sure to drop back with more time and try to give some actual feedback and such. Congrats and thanks for groundwork so far.

 

Interested, very rampage_ani.gif

Link to comment
Share on other sites

Thanks to all for the encouraging words and responses on my questions. Another thing that I forgot to mention earlier (and which I will edit into the first post later) has to do with the sfx export. The sound effects archives are made up of "sound banks" which are collections of between 1 and 400 sounds. So, for instance the smallest archive, FEET, looks like this:

 

FEET Archive (7 banks, 38 total sounds)\--Bank 0 (9 sounds)|  \--Sound 0 ... Sound 8|  \--Bank 1 (5 sounds)|  \--Sound 0 ... Sound 4|  \--Bank 2 (5 sounds)|  \--Sound 0 ... Sound 4|  \--Bank 3 (5 sounds)|  \--Sound 0 ... Sound 4|  \--Bank 4 (4 sounds)|  \--Sound 0 ... Sound 3|  \--Bank 5 (5 sounds)|  \--Sound 0 ... Sound 4|  \--Bank 6 (5 sounds)   \--Sound 0 ... Sound 4

 

The two obvious approaches to exportation are:

  1. Create subdirectories for each bank so that the directory structure looks very much like the ASCII picture above (with a single INI file in the root directory) or
  2. Save all the files in a single directory (with filenames like BankXXX_SoundYYY.wav or perhaps simply SoundXXXXX.wav)

The idea of bank subdirectories (a) appeals to me, in part because I simply hate the idea of having a directory containing a huge number of files. In the case of the largest archive, SPC_GA, option (a) would result in 209 Bank_XXX subdirectories; the smallest of these subdirectories would have a single file and the largest would have 264 files. However, option (b) would result in a single directory of 31,234 sound files plus the import INI. That bothers me and so I lean towards (a), but the relevant question would be whether the use of such subdirectories would be overly confusing to the user, in which case I'd have to go with (b). Any thoughts on this one?

Link to comment
Share on other sites

So with this tool that you are coming out with we can export the music files from the streams folder and they will come out in .OGG format right. Cool sounds great can this tool that you speak of export all of the music files into .ogg format from the file "AMBIENCE" which is the backround interior music files?

 

Hopefully I can finally hear that Saint Mark's Bistro opera music.

Link to comment
Share on other sites

So with this tool that you are coming out with we can export the music files from the streams folder and they will come out in .OGG format right.  Cool sounds great can this tool that you speak of export all of the music files into .ogg format from the file "AMBIENCE" which is the backround interior music files? 

 

Hopefully I can finally hear that Saint Mark's Bistro opera music.

Yes, it can succesfully extract all 16 streams, icluding AMBIENCE, into individual Ogg Vorbis (.ogg) files. I believe the St Mark's Bistro ambience (Track 9 of the stream) is more of a violin instrumental than opera though. wink.gif Note that you can currently extract that track right now with RFSA (I'll add some links to RFSA to the end of the first post soon); the main benefits of SAAT will be exportation of SFX and importation of both streams and SFX.

 

I'll take this opportunity to post an update of my progress. I have successful SFX exportation (using the subdirectory option previously mentioned) right now using a kludge of manually writing the WAVe header myself, but I just received a response from the author of libsndfile about some undocumented API calls for that library that should be a better way to do that and also allow easy import (possibly of a variety of formats.) So the main functionality should be in place by the end of the week and then I can work on better error-checking and general user-friendliness. I am considering a beta release at that time, but haven't decided on that yet.

Link to comment
Share on other sites

  • 2 weeks later...
creative madman

when do u think your first release will be?, are you adding a GUI or is it Command prompt?

 

you are a straight up champion. your the first to do this right?

 

cookie.gifcookie.gifcookie.gifcookie.gif

Link to comment
Share on other sites

when do u think your first release will be?, are you adding a GUI or is it Command prompt?

 

you are a straight up champion. your the first to do this right?

 

cookie.gifcookie.gifcookie.gifcookie.gif

I'm still looking to get a release before Jan 1. The major functionality is there and has tested ok, and I have found a way to use libsndfile for my WAVe processing which might expand the usable sfx import formats a bit. The two major hurdles before release are that I still need to clean up the error-checking and put together decent documentation.

 

The first release will be command-prompt only as I have very minimal GUI experience. I may try and GUIfy it later, but that's not even on the planning board yet. It is an open-source release though (GPL) so someone else may add a GUI down the road too.

 

There are already stream extractors, but I know of noone else who has released an importer tool or a sfx extractor/importer for SA.

Link to comment
Share on other sites

  • 2 weeks later...

Here's a bump to update everyone on the progress. Full import/export for both archive types seems to be working alright. Run down that guy! has even done a little beta testing and seemed pleasantly surprised that it actually worked. wink.gif

 

Unfortunately, due to more family obligations than I had originally expected, I won't be able to get the release build properly tested before the new year like I had planned. Instead, I am gonna push it back a week and arbitrarily choose January 7 as the target for release of version 1. That's a lot saner than potentially pushing it out the door too early and then disappearing when people start trying it out and have questions. wink.gif

 

Thanks for everyone's time and interest, and Happy New Year. Shifty41s_beerhatsmilie2.gif

Link to comment
Share on other sites

Craig Kostelecky

Excellent work. Now I can possibly add the General Lee's Dixie horn to the game.

 

If only I find some time that is...

Link to comment
Share on other sites

Any updates recently ?

 

January 7 as the target for release of version 1

So it will be released on saturday tounge.gif

Link to comment
Share on other sites

He hasn't come back saying its been delayed, or announced any other date for its release. Lets not start the "whens it gon b don?????" stuff, especially so close. We've been patient so far, just keep it that way.

Link to comment
Share on other sites

He hasn't come back saying its been delayed, or announced any other date for its release. Lets not start the "whens it gon b don?????" stuff, especially so close. We've been patient so far, just keep it that way.

Thank you ash. Yes, it will be up later today; I'm polishing up the documentation and have frozen code development until release so I don't go screwing anything up at the last minute. wink.gif I'm in the Eastern time zone, so there will be an announcement here sometime within the next 23 hours. wink.gif

Link to comment
Share on other sites

Please forgive the 5 1/2-hour bump; I felt it was important in this isolated instance.

 

SAAT version 1.00 has been released.

The first post has been updated. The important bits for the impatient:

Feedback, suggestions, etc are greatly appreciated.
Link to comment
Share on other sites

so now that the SAAT tool kit is out how would I go about extracting the Marco's Bistro Interior opera music file from the AMBIENCE file in the SA folder to like my destop or hard drive in like MP3 or OGG or WAV format.

Link to comment
Share on other sites

creative madman

man, hahahahahaha, ur going 2 have to go through the files to find the sound u want, i doubt many people woudld know the EXACT file, the thing ive found when looking through the sounds in a GTA game, is that they are commonly in groups, ie, the car sounds are with the car sounds, teh voices are with the same of the same voice, look for ambience once wink.gif

Link to comment
Share on other sites

so now that the SAAT tool kit is out how would I go about extracting the Marco's Bistro Interior opera music file from the AMBIENCE file in the SA folder to like my destop or hard drive in like MP3 or OGG or WAV format.

@creative: Actually, becuase Nathan is looking for a track from a stream, we know exactly where it is. If it was a sound effect, then he'd have to search. But, in large part because of previous radio extraction tools, the stream contents are now pretty much fully described. Browse through the metadata-full.ini file and you'll see what I mean.

 

Nathan PMed me with this, but since it's a fairly simple example and he also asked here, I'll share my response.

 

1) Unzip the archive.

2) Copy "saat_stream.exe" to the folder where the game is installed.

3) Open a command prompt window; Start menu > All Programs > Accessories > Command Prompt

4) Assuming your SA is installed in the default directory, type the following in the command prompt window:

 

cd "C:\Program Files\Rockstar Games\GTA San Andreas"

 

5) Now type

 

saat_stream -e audio\streams\AMBIENCE c:\temp\saat

 

6) This will create a directory called c:\temp\saat\AMBIENCE. In that directory will be 40 Ogg Vorbis files. The St Mark's Bistro AMBIENCE is called something like "Track_009.ogg"

7) Play it in Winamp or another audio program.

In order to keep things simple and because I already know which track he wants, I'm using the simple extraction mode in the above example. For more practical use, it would make sense to use the RFSA extraction mode and then pick out the wanted file based on the descriptive filename. That process would look like this.

 

1) Unzip the archive.

2) Copy "saat_stream.exe" and "metadata-full.ini" to the folder where the game is installed.

3) Open a command prompt window; Start menu > All Programs > Accessories > Command Prompt

4) Assuming your SA is installed in the default directory, type the following in the command prompt window:

 

cd "C:\Program Files\Rockstar Games\GTA San Andreas"

 

5) Now type

 

saat_stream -r audio\streams\AMBIENCE c:\temp\saat metadata-full.ini

 

6) This will create a directory called c:\temp\saat\AMBIENCE. In that directory will be 40 Ogg Vorbis files. Based upon the filenames, you should be able to identify the St Mark's Bistro ambience quickly and easily.

7) Play it in Winamp or another audio program.

 

I expect to have several questions similar to this, though. That's why I'm thinking drag-and-drop might be a real smart thing to add on for the next update.

Link to comment
Share on other sites

This is great, but doesnt it mean that you would have to distribute an entire SFX file with your mod for the sake of adding a couple of extra sounds? I cant see end-users of a mod downloading a huge file then messing about with command line based programs to get a couple of extra sounds. Great for personal use though icon14.gif

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.