![]() |
Does the new patch allow music modding?
Does the new patch allow music modding? It's not that I don't like the soundtrack, there just isn't enough of it.
|
Re: Does the new patch allow music modding?
Nope.
|
Re: Does the new patch allow music modding?
You can replace the music files (*.al in rawsound) with your own. They're A-law encoded raw data at 11025 Hz and 16 bits stereo. However, the game seems to render them a little differently than the programs I have tried (Adobe Audition and Steinberg WaveLab), which results in some distortion: If I play the game sounds with those programs, they sound a little dull, and if I replace the music with something that I saved myself then that has a high pitch with some distortion ingame. Either the game processes the sounds in some way or it uses the algorithms a little differently than the standard. Maybe it's some adaptive or differential format instead of PCM?
I agree that the music does get on your nerve if you play over a long period due to lack of variation (we need MORE music!) so I have turned it off except for battles. |
Music modding solved
Somebody asked about this on another forum which made me curious to have a look at the problem again, wasted 3 hours of sleep on this... http://forum.shrapnelgames.com/image...ies/tongue.gif Dealing with the programming from the game before, I expected that it would probably be faithful to the specs - JK is pretty straight forward in this regard, and that all those programs that I used for a-law encoding were to blame for not really writing raw data.
Turns out that my hunch was right. Following a link from the Wikipedia article on A-law encoding (Finland is in Europe, and *.al is a suggestive filename) I had a look at the compression tutorial at http://hazelware.luggle.com/tutorial...mpression.html and then looked if somebody had already implemented something in that direction since I didn't want to write a C/C++ program from scratch. Then I found the audioop module in Python which has A-law since Python 2.5, so I only had to learn Python http://forum.shrapnelgames.com/images/smilies/wink.gif which was easier than expected with copy&paste from examples. Here's the straight-forward approach to playback the game audio files: <font class="small">Code:</font><hr /><pre>#! /bin/env python import audioop alaw_data = open('/opt/dominions3/rawsound/draam13.al', 'r') pcm = audioop.alaw2lin(alaw_data.read(), 2) from ossaudiodev import open as ossOpen dsp = ossOpen('/dev/dsp','w') try: from ossaudiodev import AFMT_S16_NE except ImportError: if byteorder == "little": AFMT_S16_NE = ossaudiodev.AFMT_S16_LE else: AFMT_S16_NE = ossaudiodev.AFMT_S16_BE dsp.setparameters(AFMT_S16_NE, 2, 11025) dsp.write(pcm) dsp.close()</pre><hr /> I'm not sure if the game audio files are mono at 22050 Hz or stereo at 11025 Hz, I guess it's the latter. The playback is pretty faithful to in-game. If you convert your source material to raw PCM data, then you can use the following Python script to convert it to raw A-law data: <font class="small">Code:</font><hr /><pre>#! /bin/env python import sys, string if len(sys.argv)!= 2: print "Usage: "+sys.argv[0]+" <filename>" sys.exit() else: inputfile = sys.argv[1] name1 = str.split(inputfile, '.') outputfile = string.join(name1[:len(name1)-1])+'.al' import audioop pcm_data = open(inputfile, 'r') alaw_data = audioop.lin2alaw(pcm_data.read(), 2) alaw = open(outputfile, 'w') alaw.write(alaw_data)</pre><hr /> Now I looked for some demo input, MP3s on the net and found some Old Tatar Songs which are already at 11kHz. Converting them to *.al format: <font class="small">Code:</font><hr /><pre>$ mpg123 -v -y --stereo --rate 11025 -w kukkuger.pcm kukkuger.mp3 $ python2.5 convert.py kukkuger.pcm</pre><hr /> Then copied it over /opt/dominions3/rawsound/draam13.al - sounds good! Here's the demo file: http://www.mediafire.com/?9h2xnxprb1t Somebody make a better Python program out of this, maybe with a nice GUI. I learned Python just 2 hours ago! http://forum.shrapnelgames.com/images/smilies/happy.gif |
Re: Music modding solved
Simply incredible lch. http://forum.shrapnelgames.com/images/smilies/happy.gif
Not to undermine your efforts, but for me, it's ten times easier to just run some music in winamp in the background while the game is playing. ;p |
Re: Music modding solved
That wouldn't be half as fun as it was for me to find out these things, though. I even learned something new from it. http://forum.shrapnelgames.com/images/smilies/happy.gif
It wasn't the problem that bugged me, it was the allure to find out how it is done. Plus, you can't fade in/out music when a battle starts with playback. Some people might even experience no in-game sounds if the playback is locking the audio device. But sure, this is just for the tech-heads. I remember that some games that I played, like car racing games, allowed you to insert an audio cd for playback in the background... On an unrelented note, if you don't know how to convert your input to raw PCM, the file format detection tells me that it is "RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, stereo 11025 Hz", so converting into this might be as well. |
Re: Music modding solved
Great job Ich!
By chance have you tried this format/technique with replacing the game's sample files (smp)? Being able to change the sound or volume of things like elephants and Illithid's mind blast would be a major act of kindness to my ears. http://forum.shrapnelgames.com/images/smilies/happy.gif |
Re: Music modding solved
Funny, Sombre asked exactly the same. Those aren't encoded at all. They're raw PCM data. The only thing that I don't know is their frame rate. sling.sw, the sound for the sling shots, is probably 11kHz stereo (or 22kHz mono), as is earth.smp, which I think is the sound that the earth elementals make when trampling. But howl.smp, for example, does have at most half that rate. growl.smp might be 6kHz mono or something, same for elefant.smp, the elephant sound.
So yes, I think I could normalize those sounds a bit. I'd have to look if the frame rate is saved in the game or in the files, which should be quite easy to do (just rename some). An easier fix is to just overwrite elefant.smp with muller.smp or earth.smp, which are easier on the ears. |
Re: Music modding solved
1 Attachment(s)
Spent some time playing around with some utilities that I had on my system and managed to find a magic combination of settings & hacks to capture & replace sounds.
Attached is a quick alternative to "fear.smp". This is the sound used by mind blast and some other spells. In my current game using LA R'lyeh, my hordes of Illithids have been piercing my ears all week so I am now using this alternative sound. Oh, and just in case: BE SURE TO BACK UP YOUR OLD AUDIO FILE BEFORE REPLACING IT WITH THIS ONE! |
Re: Music modding solved
Yeah right. I KNOW you have replaced it with the "OMG that Elephant just saw a mouse" sound. Nice try.
|
All times are GMT -4. The time now is 05:40 AM. |
Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©1999 - 2025, Shrapnel Games, Inc. - All Rights Reserved.