Hi there! You are currently browsing as a guest. Why not create an account? Then you get less ads, can thank creators, post feedback, keep a list of your favourites, and more!
Quick Reply
Search this Thread
Lab Assistant
Original Poster
#1 Old 18th Jan 2020 at 10:13 PM Last edited by mypantsfelldown : 19th Jan 2020 at 2:29 AM.
Default Has anyone successfully replaced sound effects or stings?
So music is pretty much sorted. But what about sound effects? I've seen probably every tutorial on this website and none of them seem to work consistently for me. Most of the basic sound effects use a variant of EA ADPCM, of which there are 0 encoders. It is possible to replace some of these with mp3s, but it's a gamble on what will work really. Some object sounds seem to work, some rabbit hole loops, but UI sounds and foosteps are a no go. Then it gets even more confusing: stings are in mp3, but I cannot get them to work with the methods currently used with music. Is there something that makes any one of these sounds different? Has anyone else managed to properly replace these sounds?

The most success I've had is using the SNR and SNS method. The sounds will play maybe once or a handful of times, but then never again until you restart the game. Any other method without an SNR header that I've tried causes clicks/pops and the game becomes very unstable and crashes after a short period of time. I'm almost at my wits' end with this, I was just wondering if there's anyone else interested in figuring it out.
Advertisement
Space Pony
#2 Old 19th Jan 2020 at 4:13 AM
Quote: Originally posted by mypantsfelldown
So music is pretty much sorted. But what about sound effects? I've seen probably every tutorial on this website and none of them seem to work consistently for me. Most of the basic sound effects use a variant of EA ADPCM, of which there are 0 encoders. It is possible to replace some of these with mp3s, but it's a gamble on what will work really. Some object sounds seem to work, some rabbit hole loops, but UI sounds and foosteps are a no go. Then it gets even more confusing: stings are in mp3, but I cannot get them to work with the methods currently used with music. Is there something that makes any one of these sounds different? Has anyone else managed to properly replace these sounds?

The most success I've had is using the SNR and SNS method. The sounds will play maybe once or a handful of times, but then never again until you restart the game. Any other method without an SNR header that I've tried causes clicks/pops and the game becomes very unstable and crashes after a short period of time. I'm almost at my wits' end with this, I was just wondering if there's anyone else interested in figuring it out.


At the moment, it looks like the EA XAS codec used for sound effects is a dead end; we can decode, but cannot encode.

I haven't yet experimented with replacing those sound files, but have you tried messing with the AUDTUNs as well? There's a "Codec" block that should always be set to a uint value of 5 if you're using EALayer3, although I don't know if it's strictly necessary.

"The Internet is the first thing that humanity has built that humanity doesn't understand, the largest experiment in anarchy that we have ever had." - Eric Schmidt

If you enjoy the mods I put out, consider supporting me on patreon: www.patreon.com/Gamefreak130
Lab Assistant
Original Poster
#3 Old 19th Jan 2020 at 3:23 PM Last edited by mypantsfelldown : 19th Jan 2020 at 11:20 PM.
Quote: Originally posted by gamefreak130
At the moment, it looks like the EA XAS codec used for sound effects is a dead end; we can decode, but cannot encode.

I haven't yet experimented with replacing those sound files, but have you tried messing with the AUDTUNs as well? There's a "Codec" block that should always be set to a uint value of 5 if you're using EALayer3, although I don't know if it's strictly necessary.

I'm not sure how hard it is to make an encoder, but there is so much information about the decoder. And I have messed with that codec block before, but it doesn't seem to have any effect on anything. From what I've experienced when testing sounds, it almost seems as if there's some kind of memory limit when playing MP3s. I replaced the ocean surf ambient sound with some 7 second wave sounds, which would play fine until I sped the game up and it tried to play multiple instances. The audio starts to pop, the lag spikes ensue and it gets progressively worse until the game crashes. I'm not sure the game's engine is equipped to decode mp3s like that. This could be tied to bitrate, though. All of the voices are in 70kb/s vbr, so I'll have to play around some more.

Edit: Scrap that, I've just tried a sound with extremely low bitrate (without a header) and it crashed after three playbacks.
Space Pony
#4 Old 20th Jan 2020 at 4:01 PM
Quote: Originally posted by mypantsfelldown
I'm not sure how hard it is to make an encoder, but there is so much information about the decoder. And I have messed with that codec block before, but it doesn't seem to have any effect on anything. From what I've experienced when testing sounds, it almost seems as if there's some kind of memory limit when playing MP3s. I replaced the ocean surf ambient sound with some 7 second wave sounds, which would play fine until I sped the game up and it tried to play multiple instances. The audio starts to pop, the lag spikes ensue and it gets progressively worse until the game crashes. I'm not sure the game's engine is equipped to decode mp3s like that. This could be tied to bitrate, though. All of the voices are in 70kb/s vbr, so I'll have to play around some more.

Edit: Scrap that, I've just tried a sound with extremely low bitrate (without a header) and it crashed after three playbacks.


I just did a quick-and-dirty replacement of some of the DJ Booth music with another file of similar length using the Flyby method, and it seems to work fine. Granted, those are 30 seconds long, but they were initially encoded using EA XAS like the other in-game sounds. I haven't tried anything with stings yet.

"The Internet is the first thing that humanity has built that humanity doesn't understand, the largest experiment in anarchy that we have ever had." - Eric Schmidt

If you enjoy the mods I put out, consider supporting me on patreon: www.patreon.com/Gamefreak130
Lab Assistant
Original Poster
#5 Old 20th Jan 2020 at 6:45 PM
Quote: Originally posted by gamefreak130
I just did a quick-and-dirty replacement of some of the DJ Booth music with another file of similar length using the Flyby method, and it seems to work fine. Granted, those are 30 seconds long, but they were initially encoded using EA XAS like the other in-game sounds. I haven't tried anything with stings yet.

Interesting. I just took another glance at his tutorial, and at the end he mentions that there is an ‘unsafe’ way to call sounds and another ‘safer but more complex way’. Maybe the game uses this unsafe way by default for small insignificant things, like stings or UI clicks, but uses a different method to play music and longer sounds? I wish I could learn scripting faster so that I could take a look at this stuff. Is it possible to change already existing sound events?
Space Pony
#6 Old 20th Jan 2020 at 7:37 PM
Quote: Originally posted by mypantsfelldown
Interesting. I just took another glance at his tutorial, and at the end he mentions that there is an ‘unsafe’ way to call sounds and another ‘safer but more complex way’. Maybe the game uses this unsafe way by default for small insignificant things, like stings or UI clicks, but uses a different method to play music and longer sounds? I wish I could learn scripting faster so that I could take a look at this stuff. Is it possible to change already existing sound events?


No, all sounds with the exception of Custom Music MP3s and CAS voice previews appear to be called in exactly the same way internally. I think the "safe" code Flyby mentions is mainly a way to work around issues with polyphony (i.e. how many instances of a sound can be active at any given time). Perhaps the custom sounds sometimes hang at the end and are not terminated properly by the engine, meaning that the sound is still considered running and the consumed memory cannot be released. In that case, I could definitely see how that could eventually lead to game crashes. As far as changing existing sound calls to work in that way, it may be possible in some cases -- and, in fact, the game already uses this method in some instances like diegetic music and object sounds -- but it certainly isn't possible to change it everywhere without a wide-sweeping core mod, to say nothing of what impact such a grand change could potentially have on game performance and resource consumption.

It's all speculation, though, until someone achieves the holy grail of cracking open the game engine. In the meantime, I'm thinking something about the properties of the AUDTUNs is what's holding us back. I'll keep bashing things with a spanner to see what happens.

"The Internet is the first thing that humanity has built that humanity doesn't understand, the largest experiment in anarchy that we have ever had." - Eric Schmidt

If you enjoy the mods I put out, consider supporting me on patreon: www.patreon.com/Gamefreak130
Lab Assistant
Original Poster
#7 Old 20th Jan 2020 at 10:24 PM Last edited by mypantsfelldown : 21st Jan 2020 at 6:33 PM.
Quote: Originally posted by gamefreak130
No, all sounds with the exception of Custom Music MP3s and CAS voice previews appear to be called in exactly the same way internally. I think the "safe" code Flyby mentions is mainly a way to work around issues with polyphony (i.e. how many instances of a sound can be active at any given time). Perhaps the custom sounds sometimes hang at the end and are not terminated properly by the engine, meaning that the sound is still considered running and the consumed memory cannot be released. In that case, I could definitely see how that could eventually lead to game crashes. As far as changing existing sound calls to work in that way, it may be possible in some cases -- and, in fact, the game already uses this method in some instances like diegetic music and object sounds -- but it certainly isn't possible to change it everywhere without a wide-sweeping core mod, to say nothing of what impact such a grand change could potentially have on game performance and resource consumption.

It's all speculation, though, until someone achieves the holy grail of cracking open the game engine. In the meantime, I'm thinking something about the properties of the AUDTUNs is what's holding us back. I'll keep bashing things with a spanner to see what happens.

So would specifying a polyphony value in an AUDTUN work? Am I right in assuming that sounds might be properly terminated this way (thus not only playing once)?

Also, I might have found something that can encode ADPCMs. I was following this tutorial out of boredom earlier and the vp6builder tool included in the download encodes vp6 video with EA ADPCM, the type read by the game. The only issue is that I can't find a way to separate the audio stream into its own file... The tool can convert vp6 videos back again, but it converts the audio too.

Oh, scrap that too. I failed to notice that the ADPCMs created in the vp6builder are EA-XA ADPCM v2, and the game sounds use EA-XAS ADPCM v1. That's a shame. I'm not sure how different the codecs are from one another, it might even be a slight header difference, but the game must read this codec for its intro videos and TV clips somehow.

Edit: Tried to change the header to a v1 ADPCM, resulted in a garbled mess.
Space Pony
#8 Old 23rd Jan 2020 at 9:12 PM
Quote: Originally posted by mypantsfelldown
So would specifying a polyphony value in an AUDTUN work? Am I right in assuming that sounds might be properly terminated this way (thus not only playing once)?

Also, I might have found something that can encode ADPCMs. I was following this tutorial out of boredom earlier and the vp6builder tool included in the download encodes vp6 video with EA ADPCM, the type read by the game. The only issue is that I can't find a way to separate the audio stream into its own file... The tool can convert vp6 videos back again, but it converts the audio too.

Oh, scrap that too. I failed to notice that the ADPCMs created in the vp6builder are EA-XA ADPCM v2, and the game sounds use EA-XAS ADPCM v1. That's a shame. I'm not sure how different the codecs are from one another, it might even be a slight header difference, but the game must read this codec for its intro videos and TV clips somehow.

Edit: Tried to change the header to a v1 ADPCM, resulted in a garbled mess.


Okay, here's a thing that may or may not work -- assuming you haven't tried it already.

Encode your sound as a single SNR file using "ealayer3.exe -E in_file.mp3 -o out_file.snr --single-block". Then, insert the following byte sequence at the END of the file:

00 C6 FF 80 00 03 48 00 00 00 40 00 00 69 00 00 00 08

There should be no need for any further editing. If that works, I'll explain in more detail why I think it works.

"The Internet is the first thing that humanity has built that humanity doesn't understand, the largest experiment in anarchy that we have ever had." - Eric Schmidt

If you enjoy the mods I put out, consider supporting me on patreon: www.patreon.com/Gamefreak130
Lab Assistant
Original Poster
#9 Old 23rd Jan 2020 at 10:23 PM Last edited by mypantsfelldown : 23rd Jan 2020 at 11:02 PM.
Quote: Originally posted by gamefreak130
Okay, here's a thing that may or may not work -- assuming you haven't tried it already.

Encode your sound as a single SNR file using "ealayer3.exe -E in_file.mp3 -o out_file.snr --single-block". Then, insert the following byte sequence at the END of the file:

00 C6 FF 80 00 03 48 00 00 00 40 00 00 69 00 00 00 08

There should be no need for any further editing. If that works, I'll explain in more detail why I think it works.

Unfortunately the game still crashed after playing the sound about 10 or so times. It seemed to last longer before crashing though. What does the byte sequence do exactly? I've only tried with max bitrate files thus far (they tend to stress the game out more), so I'll do some more testing with the bitrate the game normally uses and I'll report back.

Still nope. Granted it was the same 7 second sting that crashed the game each time, changing the bitrate made no difference.
Space Pony
#10 Old 24th Jan 2020 at 5:25 AM
Quote: Originally posted by mypantsfelldown
Unfortunately the game still crashed after playing the sound about 10 or so times. It seemed to last longer before crashing though. What does the byte sequence do exactly? I've only tried with max bitrate files thus far (they tend to stress the game out more), so I'll do some more testing with the bitrate the game normally uses and I'll report back.

Still nope. Granted it was the same 7 second sting that crashed the game each time, changing the bitrate made no difference.


Darn, I thought that might do something. It turns out that if you look at any of the in-game SNS files, they all have a byte sequence similar to that at the end of them; they're all slightly different, and I haven't identified a pattern among them aside from a repetition of that basic sequence followed by some amount of 00 bytes. Encoding an MP3 using EALayer3 drops these bytes at the end.

I've been looking into solving problems with custom stereo track transitioning. I initially thought the byte sequence fixed it, but it turns out it was just the one-file method that made it work.

"The Internet is the first thing that humanity has built that humanity doesn't understand, the largest experiment in anarchy that we have ever had." - Eric Schmidt

If you enjoy the mods I put out, consider supporting me on patreon: www.patreon.com/Gamefreak130
Lab Assistant
Original Poster
#11 Old 24th Jan 2020 at 2:28 PM Last edited by mypantsfelldown : 24th Jan 2020 at 3:54 PM.
Quote: Originally posted by gamefreak130
Darn, I thought that might do something. It turns out that if you look at any of the in-game SNS files, they all have a byte sequence similar to that at the end of them; they're all slightly different, and I haven't identified a pattern among them aside from a repetition of that basic sequence followed by some amount of 00 bytes. Encoding an MP3 using EALayer3 drops these bytes at the end.

I've been looking into solving problems with custom stereo track transitioning. I initially thought the byte sequence fixed it, but it turns out it was just the one-file method that made it work.

I feel so dumb. Turns out I was using ealayer3 0.6.3 to test these files, I have no idea why my path was still set like that. Switching back to 0.6.2 and encoding the files again, I realised that some of them already came with the byte sequence at the end. But the only sound that ever actually seemed to crash my game was the 7 second sting without the byte sequence at the end you might be on to something here! I'll do some more testing and see if I can crash, but so far it's been about 45 minutes of constantly playing this sting and everything is completely stable.

Aside from that, the sounds seem to pop and click randomly for me. Strange how the single SNR method fixed this for music but apparently not for sound effects.

Okay, after testing for much longer the game eventually crashed playing one of the sounds. It was a VERY long time playing though. I wonder if there's a way to use Flyby's codeblock in a single SNR file?
Space Pony
#12 Old 25th Jan 2020 at 4:58 AM
Quote: Originally posted by mypantsfelldown
I feel so dumb. Turns out I was using ealayer3 0.6.3 to test these files, I have no idea why my path was still set like that. Switching back to 0.6.2 and encoding the files again, I realised that some of them already came with the byte sequence at the end. But the only sound that ever actually seemed to crash my game was the 7 second sting without the byte sequence at the end you might be on to something here! I'll do some more testing and see if I can crash, but so far it's been about 45 minutes of constantly playing this sting and everything is completely stable.

Aside from that, the sounds seem to pop and click randomly for me. Strange how the single SNR method fixed this for music but apparently not for sound effects.

Okay, after testing for much longer the game eventually crashed playing one of the sounds. It was a VERY long time playing though. I wonder if there's a way to use Flyby's codeblock in a single SNR file?


Sure, the actual encoding process is exactly the same between single-block and headerless encoding, so just encode the file as an SNS, find where the codeblock would go, then track down that same place in the byte sequence of the single-block SNR and insert it. Keep track of the number of bytes you insert, then add that amount to the number in bytes 8-B. The calculator app in Windows 10 has a "Programmer" function that can help you with this; click "DEC" and type in the size of the Flyby codeblock, then click "+" then "HEX" and type in the hex number.

As for whether or not that would actually have any effect, I have no idea.

"The Internet is the first thing that humanity has built that humanity doesn't understand, the largest experiment in anarchy that we have ever had." - Eric Schmidt

If you enjoy the mods I put out, consider supporting me on patreon: www.patreon.com/Gamefreak130
Lab Assistant
Original Poster
#13 Old 25th Jan 2020 at 11:25 PM
Quote: Originally posted by gamefreak130
Sure, the actual encoding process is exactly the same between single-block and headerless encoding, so just encode the file as an SNS, find where the codeblock would go, then track down that same place in the byte sequence of the single-block SNR and insert it. Keep track of the number of bytes you insert, then add that amount to the number in bytes 8-B. The calculator app in Windows 10 has a "Programmer" function that can help you with this; click "DEC" and type in the size of the Flyby codeblock, then click "+" then "HEX" and type in the hex number.

As for whether or not that would actually have any effect, I have no idea.


So the codeblock would go at whichever address is located in 8B? I tried once, but the game instantly crashed when trying to play the sound. Maybe I did something wrong.

Also, I might have found something. Whilst only playing the sounds altered with your byte sequence, the game runs perfectly fine apart from the popping and chirping. I had 4 footstep sounds, encoded at max bitrate playing at speed 3 constantly for about 5 minutes, without as much as a stutter. Then, I went into buy mode, came out, and the game crashed mid-footstep not even 5 seconds afterwards. Maybe this instability is somehow related to the differences between EA's mp3s and our mp3s. If we were to somehow disallow EAs sounds from playing or re-encode them, maybe it would help. I'll have to test this more and report back.
Space Pony
#14 Old 26th Jan 2020 at 12:36 AM
Quote: Originally posted by mypantsfelldown
So the codeblock would go at whichever address is located in 8B? I tried once, but the game instantly crashed when trying to play the sound. Maybe I did something wrong.


No, no, the byte at location 8 to the byte at location B is the size in hex of the entire file -- hence "single block." Find the spot in the non-single-block encoded file where the codeblock would ordinarily go, then find that same spot in the single-block encoded file. Note that the byte position of the spots will be different; you have to rely on the string of bytes that comes before the codeblock to know where it goes.

Then, since you've essentially increased the size of the block, the number from locations 8 to B must be increased by the size of the Flyby codeblock you just inserted.

"The Internet is the first thing that humanity has built that humanity doesn't understand, the largest experiment in anarchy that we have ever had." - Eric Schmidt

If you enjoy the mods I put out, consider supporting me on patreon: www.patreon.com/Gamefreak130
Lab Assistant
Original Poster
#15 Old 27th Jan 2020 at 3:47 AM
Quote: Originally posted by gamefreak130
No, no, the byte at location 8 to the byte at location B is the size in hex of the entire file -- hence "single block." Find the spot in the non-single-block encoded file where the codeblock would ordinarily go, then find that same spot in the single-block encoded file. Note that the byte position of the spots will be different; you have to rely on the string of bytes that comes before the codeblock to know where it goes.

Then, since you've essentially increased the size of the block, the number from locations 8 to B must be increased by the size of the Flyby codeblock you just inserted.


Yeah, I managed to add the codeblock... That's probably the most intricate ear rape I've ever experienced.

Well, my theory of custom file/ea file incompatibility has been disproved, so at this point I'm pretty much out of ideas. I've been posting elsewhere online hoping that maybe someone would show interest in helping, but from what I can gather nobody would go near EA codecs with a 10 foot pole. It's understandable, but rather disheartening.
Lab Assistant
Original Poster
#16 Old 29th Jan 2020 at 12:02 AM Last edited by mypantsfelldown : 29th Jan 2020 at 12:45 AM.
Woohoo! I think I might have something working.

It uses the SNR header + SNS method, and requires surprisingly minimal HEX editing. The workaround also varies depending on the sound-it seems to work for UI sounds + mp3 stings, but I haven't tried it on anything else yet.

Truncate the SNR as you usually would, leaving only
0504 AC44 4000 0480

For the SNS file, I don't think any modifications are required. When I was fooling around trying to get stuff to work, I often replaced bytes 6-7 with 002F, but there were times when I skipped this step and the sound still worked fine.

I think the true fix lies within the AUDTUN files (you were right), related to the polyphony settings. I used the basegame Bistro loop AUDT and the music_mode_map AUDT from Pets, as both have different polyphony settings. The Bistro loop has settings that enable polyphony and place the sound within a 3D space around your sim, but this only works for certain types of sounds, like sounds that are supposed to be positional. The UI sounds did not work with this for obvious reasons, but the Pets map music file worked as it didn't have this "PolyphonyMode" option that positions the sound. I'll have to test a bunch of different sounds and see if it continues to work! It seems to be really stable thus far too.
Lab Assistant
Original Poster
#17 Old 1st Feb 2020 at 8:02 AM
Sorry to bump this again. I knew my findings were too good to be true.

So, sounds play properly now and infinitely which is what I wanted. But now, the game will only load and play up to about 8 MP3s at once. After 8 have been loaded and played back, it will not load more. I thought this might have been a limit within the game's engine, but clearly that isn't true as there are definitely more than 8 musics/mp3 sounds. Take Sim voices, for example. There are literally hundreds.

I believe this might be linked with the parent soundkeys. From my inspection, all of the UI sounds use the same parent soundkey, whereas voice sounds use several different parents and probably never exceed 8 mp3s (or whatever the limit is) per instance. I'm assuming it might be possible to somehow split sounds into multiple soundkey instances with scripting, but I'm not too sure. Object sounds do not appear to have the same limitation as they are more split up.

I tried to mimic the method expansion packs use to add new music to the same parent instance, but I can't get it to work. From what I can tell, this is achieved by changing the "Unknown 2" of each sample. It seems to start at 0x08000000 with World Adventures, and then increases by increments of 10 for each pack.

I might have completely the wrong idea here, and it's really hard to test this theory out because exceeding this so called limit on even one instance seems to break all MP3 sounds (including music).
Back to top