Go Back   INSIDE Two Worlds > English speaking forums > Two Worlds 2 - Modding

Two Worlds 2 - Modding Modding Two Worlds 2

Reply
 
Thread Tools

Changing sounds and music - technical issues
Old 20. February 2011, 07:38   #1
lestat426
Preferred Modding Member
Member Level 2
Points: 453, Level: 18 Points: 453, Level: 18 Points: 453, Level: 18
Activity: 0% Activity: 0% Activity: 0%
250 Experience Points100 Experience PointsTagger First ClassTagger Second Class
 
lestat426's Avatar
 
Posts: 87
Changing sounds and music - technical issues

Changing sounds and music - technical issues
Sorry for my English, it's not excellent.

One of the best programmer here I mean Helix666 made fantastic tool to change any sound in TW2 game. This tool is called: TW2SoundUtil and it was presented first time on 8 January 2011 in the following thread Two Worlds 2 Sound store editor, link: http://www.insidetwoworlds.com/showthread.php?t=32697. This is a very useful program because using it we can change practically every game sound file - music, sound effects, and even voices of game characters. And all of it with an easy manner. We can insert any number of new sound files or extract existing ones to OGG format because exactly files of this format are stored in sound archives in ...Two Worlds 2\SoundData sub-folder. In the mentioned thread there is also short concise conversation on how to use Helix's application. In this post I want to raise an issue of changing sound files in TW2 and problems related to it.

A some sort of small introduction

Because I'm a musician when some game appears and I like it, and the game is modding-prone, after some time I always seek answer the question: How to change the music in this game? In this case the same situation took place. When I noticed Helixe's tool I started to dig and did many tests to understand how the TW2 game manipulates its sounds and especially music. During that digging I found some answers and also some new questions and problems arose related to changing sounds in TW2. In this post I'd like to share those issues with you. Maybe they will be helpful, I hope.

What I noticed while digging

I will come to the point. Let's go back to the first few lines of this text and continue. You can notice that physically sounds are stored in the folder ...Two Worlds 2/SoundData in files with extensions: .idx, .asncdat, .database. The .lipsync extension files as we can easily guess concern synchronization of game characters lips and recorded dialogs. To use Helix's tool we need to deliver one of the .idx files (Helix called it: sound store index files) to his TW2SoundUtil. After loading an .idx file we can see some kind of folders tree, where every folder has a name which in certain cases (especially in sfx*.idx files) corresponds with the type of sounds it stores. Helix named those folders cues. Every cue can contain more than one sound file. In case of sfx*.idx files I noticed the different files in the same cue are similar to each other. This is because the game choose them randomly while playing (probably in order to create an effect of greater diversity of sounds). You can notice it yourself e.g. while gaming open inventory tab and several times take off and put on our hero's armor. Try to remember the sounds. Then exit the game and open sfx.idx file with the TW2SoundUtil, next find cue named ACTION_METAL and play every one of the three sound files placed there. They are similar to each other, but not the same. The same situation takes place while the game system plays any sound file containing music (from music related files). But in this case, I mean when one of the cues contains more than one music piece, those pieces of music are usually different. While playing the game when we enter a new location the cue or cues corresponding to this location are set (so to speak) and if one of the location related cues contains the suffix: _INT at the end of its name (I suppose it is from INTRO) one of the randomly chosen files is played from there. Than (if we haven't changed entered location yet and nothing important has happened or there was no fight) game system goes to the cue ended by _GAP string and started to play randomly chosen files one after another from this cue. Being still in the same area when somebody or something attacks us, this time the game system jumps to _BE cue and plays randomly its contents until the fight is finished. Described process would repeat constantly if we didn't go to another location. There are certain exceptions to this rule, especially while fighting, it means while the _BE cue is used. When we look closer at the contents of some _BE cues we can see some filenames end with _BOSS suffix while others with _BE suffix. As everybody can guess _BOSS files concern fighting with bosses. And one more thing: cues where we can notice _BOSS suffix files, those cues contain only two files: one with _BOSS suffix and one with _BE suffix. This means despite the game generally plays randomly chosen files from that particular cue in this situation we have an exception because here game system differentiates these two files and uses their names to find the difference (!). This can be important if we want to change the music while fighting with bosses. I don't know if the only _BOSS suffix is sufficient or exactly the same original whole filename is needed if we want to make sure the appropriate music will be played while fighting with some boss. Probably the best and the safest method would be to use exactly the same filename as stored in the original music.idx file. Of course all of this is only an introduction. Probably there are many other specific situations where specific cues and also files with specific filenames are used to play proper sound file in particular moment in the game. I don't know all of such situations.

So..what? Everything seems to be ok... but...

As I mentioned before sound files stored in ...\SoundData folder are OGG format. I did many tests changing OGG files to add some variety to the game, and constantly had one problem. Suppose we want to change music played while in New Ashos. Originally the game system will work in such way (more or less):
1) Entering New Ashos location --> playing introductory music from 1_ASIAN_TOWN_INT cue (originally there is only one music piece in this cue: (INTRO)ASIAN-TOWN.OGG)
2) We are still in New Ashos area --> playing randomly chosen music piece from 1_ASIAN_TOWN_GAP cue. The process is repeating until something unusual happens or we exit the New Ashos area. (In original game in this _GAP cue there are only two files: GAP_ASIAN_01.GAP and GAP_ASIAN_02.OGG. They will be played randomly until:
3a) We are attacked by somebody or something (but not a boss) --> in this particular situation only one file can be played over and over again until battle is finished: BE_ASIAN_PLACES_01_BE.OGG, because originally the only one file is available in the 1_ASIAN_TOWN_BE cue.
3b) We are attacked by a boss --> the file: BE_ASIAN_PLACES_O1_BOSS.OGG and it will be played repeatedly until the fight is over.
4) We are still in New Ashos location --> the same situation as in 2nd pt. takes place.

Now suppose we have our own interesting OGGs and we want to change music in New Ashos location (using TW2SoundUtil) in the following manner:
1) Entering New Ashos (_INT): We are changing original OGG files to e.g.: NA_Int1.ogg, NA_Int2.ogg, NA_Int3.ogg (we want every time we enter New Ashos territory to hear more diversified music than in the original version of the game (always the same music is played while entering New Ashos)).
2) We are still in Ashos (_GAP): We want to change two original files to different ones and add some more. So we remove original files and add e.g.: NA_Gap1.ogg, NA_Gap2.ogg, NA_Gap3.ogg and so on..let's say up to 10 different OGG files.
3) At the moment we decided not to change files in _BE cue.

And after saving our modified set of music pieces (using TW2SoundUtil), running the game and entering New Ashos town what we get?: In fact we hear one of our NA_Int OGGs but after first melody and as usual after some pause ...nothing happens with the music. It simply stops playing. We can wait and wait. If we leave New Ashos area and go back we can hear again one of our NA_Int OGGs but after one piece of music the music stops again.

Where is the error?

Like I said I did many, many tests and at last I found the answer. Maybe somebody knows about it and hasn't said anything so far? Well, the problem is connected with OGG headers. Without going into details every typical OGG header contains some customizable header fields (like in MP3 files) (in format: name: value) which can be used to describe some info on a given sound file: title, version, album, tracknumber, artist and so on. But by means of some sound editing program (like e.g.: Audacity 1.3.12 beta (Unicode)) we can add more our own fields and we are not limited to only standard named fields. Moreover we can name it as we wish. For example we can even add totally new field and name it: Does my sister like it? and assign the value: Yes (or No :-) or whatever we want. Yet we can add as many such fields as we want. TW2 creators did a similar thing and created a new field named: size and the value of this field must equal: size_of_the_ogg_file_in_miliseconds - 1. Why? I don't know. Only TW2 creators can give us exact answer. Probably such information helps game engine to play sound files correctly. But only one important think I know: after I checked how big in milliseconds my OGGs files are (I used pretty useful program called: MediaTab), when I created size fields in my OGGs headers (with Audacity 1.3.12-beta Unicode) and filled them with mentioned calculated value, saved those OGGs with changed headers, than put them in TW2 archives (with Helix's TW2SoundUtil) and put modified archives in the .../SoundData sub-folder... when I ran the game and started to walk New Ashos streets, TW2 began to play my music files correctly !!! The music was played constantly !! (of course with short pauses between music pieces), music was chosen randomly and everything started to work right. I didn't check it but the same situation may happen with sfx sound archives. If you want to change sfx sound files you need to change their headers as described above. Otherwise you may have problems not only with one particular cue but also with other cues and to sum up, you can't even hear whole parts of sounds in the game because of such "trifle".

I think, that's all I wanted to share with you. I also wrote this post because I wanted to encourage you to test TW2 behavior connected with sounds, music and the like and share your knowledge with people in this forum. And I hope somebody can make a program to facilitate changing our OGG files headers faster then I described above (before we put them in a given TW2 sound archive).

lestat426
lestat426 ist offline   Reply With Quote

Re: Changing sounds and music - technical issues
Old 20. February 2011, 09:24   #2
youngneil1Posting Award
Preferred Modding Member
Member Level 4
Points: 6,652, Level: 78 Points: 6,652, Level: 78 Points: 6,652, Level: 78
Activity: 99.9% Activity: 99.9% Activity: 99.9%
500 Experience Points250 Experience Points100 Experience PointsTagger First ClassTagger Second Class
 
youngneil1's Avatar
Re: Changing sounds and music - technical issues

Very well written, letstat426.

This must have been lots of effort and will surely be of great help to all others modding music, sounds and voices. My biggest wish in this depart atm is a female voice over for the heroine (play as female) done by modding the normal player character male voice with a sound tool (pichting it down).

I hope HeliX666 great sound tool will help us with this (don't know if can be used to locate the male voice overs, probably extract parts of them out of another file and later put modded versions back in their place), but I haven't found time so far to toy around with this (nor do I have any knowledge of sound editing at all).

It's good to see you using HeliX666 Tool and playing around with it. This will provide him feedback, that he will very likely appreciate much.

Last edited by youngneil1; 20. February 2011 at 11:54..
youngneil1 ist offline   Reply With Quote

Re: Changing sounds and music - technical issues
Old 20. February 2011, 11:50   #3
HeliX666
Preferred Modding Member
Member Level 3
Points: 557, Level: 21 Points: 557, Level: 21 Points: 557, Level: 21
Activity: 4.2% Activity: 4.2% Activity: 4.2%
500 Experience Points250 Experience PointsTagger First Class100 Experience PointsTagger Second Class
 
Posts: 49
Re: Changing sounds and music - technical issues

Thank you lestat426,
Good tutorial, hope it'll help to others people and they can start sound moding.
I very thankful that you found that bug with missing size in ogg comments.
I'll plan to include auto tag writing in to my tool soon.

Thanks again.
HeliX666 ist offline   Reply With Quote

Re: Changing sounds and music - technical issues
Old 20. February 2011, 21:22   #4
lestat426
Preferred Modding Member
Member Level 2
Points: 453, Level: 18 Points: 453, Level: 18 Points: 453, Level: 18
Activity: 0% Activity: 0% Activity: 0%
250 Experience Points100 Experience PointsTagger First ClassTagger Second Class
 
lestat426's Avatar
 
Posts: 87
Re: Changing sounds and music - technical issues

Quote:
Originally Posted by youngneil1 View Post
Very well written, letstat426. This must have been lots of effort and will surely be of great help to all others modding music, sounds and voices.
Oh, I'm happy I'm not alone in digging in this topic.

Quote:
Originally Posted by youngneil1 View Post
My biggest wish in this depart atm is a female voice over for the heroine (play as female) done by modding the normal player character male voice with a sound tool (pichting it down).
I think somebody took up similar topic in: http://www.insidetwoworlds.com/showthread.php?t=32324 thread
ps. eh.. It would be fantastic to record totally different voices in the game ;-), and having tools to synchronizing it with lips of game characters. In such case making dubbing in another language will be very simple, but maybe also very tedious bearing in mind a huge amount of recorded voices placed in voice* files.

Quote:
Originally Posted by youngneil1 View Post
Very well written, letstat426.
It's good to see you using HeliX666 Tool and playing around with it. This will provide him feedback, that he will very likely appreciate much.
Rather I should thank him. Because without his help, without his tools I couldn't do any move in this direction.
lestat426 ist offline   Reply With Quote

Re: Changing sounds and music - technical issues
Old 20. February 2011, 21:59   #5
propheetUser with most referrers
Preferred Modding Member
Member Level 5
Points: 4,465, Level: 65 Points: 4,465, Level: 65 Points: 4,465, Level: 65
Activity: 60.4% Activity: 60.4% Activity: 60.4%
100 Experience Points250 Experience Points500 Experience Points1000 Experience PointsThree Friends
 
Posts: 1,666
Re: Changing sounds and music - technical issues

You can easily convert male voices into female-sounding ones. Morphing is an option available in most audio editors AFAIK.
propheet ist offline   Reply With Quote

Re: Changing sounds and music - technical issues
Old 20. February 2011, 22:34   #6
lestat426
Preferred Modding Member
Member Level 2
Points: 453, Level: 18 Points: 453, Level: 18 Points: 453, Level: 18
Activity: 0% Activity: 0% Activity: 0%
250 Experience Points100 Experience PointsTagger First ClassTagger Second Class
 
lestat426's Avatar
 
Posts: 87
Re: Changing sounds and music - technical issues

Quote:
Originally Posted by HeliX666 View Post
Thank you lestat426, Good tutorial, hope it'll help to others people and they can start sound moding.
I enjoy you like it.

Quote:
Originally Posted by HeliX666 View Post
I very thankful that you found that bug with missing size in ogg comments.
It wasn't a bug, at least in your program. The TW2 creators made that "mischief". And we have to manage this. I don't understand why they simply didn't create typical subroutine to pull out proper value from other part of the OGG header (size of the OGG in milliseconds). There IS such info there but in another place of the header.

Quote:
Originally Posted by HeliX666 View Post
I'll plan to include auto tag writing in to my tool soon.
It would be great! No more messing with OGG headers! Only preparing an ogg sound file and putting it into your program, and we have new music, new sfx sounds or voices in our game.

Maybe these informations could be helpful:
1) I only know the size of the OGG (in ms) is somewhere in OGG header. At Vorbis sites (if you use their source codes) probably there must be some functions to pull out mentioned value or at least some functions which can deliver you info how to calculate size_in_ms - 1 value
2) I don't know if VorbisComments fields are case-sensitive to TW2 game engine but TW2 field (size) is not capitalized.
3) I haven't noticed any other standard fields filled (like title, artist and so on). They are simply empty in every OGG extracted directly from the archives (only the additional size field is not empty). I don't know if there is a need that standard fields have to be empty and only one non-standard size field and it's value should exist in metadata info in a given OGG file. If I may suggest one thing: Consider wiping out any contents from standard fields of every OGG file while importing it to TW2SoundUtil.
4) The mentioned value is exactly: size_of_the_OGG_sound_in_milliseconds - 1 e.g. 143456 ms - 1 = 143455. You can exactly check how it is written with free Audacity 1.3.12-beta (Unicode). Also the program called MediaTab might be helpful (to see very detailed informations taken from OGG header).

Many thanks to you.

Last edited by lestat426; 20. February 2011 at 23:59..
lestat426 ist offline   Reply With Quote

Re: Changing sounds and music - technical issues
Old 20. February 2011, 22:59   #7
lestat426
Preferred Modding Member
Member Level 2
Points: 453, Level: 18 Points: 453, Level: 18 Points: 453, Level: 18
Activity: 0% Activity: 0% Activity: 0%
250 Experience Points100 Experience PointsTagger First ClassTagger Second Class
 
lestat426's Avatar
 
Posts: 87
Re: Changing sounds and music - technical issues

Quote:
Originally Posted by propheet View Post
You can easily convert male voices into female-sounding ones. Morphing is an option available in most audio editors AFAIK.
Of course, but how they will be perceived after such process, this is a totally different topic.
lestat426 ist offline   Reply With Quote
Reply

Tags
changing, IDEA/REQ, issues, music, sounds, technical, two worlds 2

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT +2. The time now is 06:57.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
(c) Two Worlds by TopWare
etracker more than analytics