Welcome to
Mod The Sims
Online: 1436
News:
Have an account? Sign in:
pass:
If you don't have an account, why not sign up now? It's free!
Other sites: SimsWiki
Reply  Replies: 112 (Who?), Viewed: 116053 times.
Search this Thread
Old 27th Aug 2010, 4:49 PM DefaultHow to decode sims 3 audio #1
jonwil
Original Poster

Test Subject

Join Date: Aug 2010
Posts: 2


Sims 3 audio comes in .snr and .sns files.
Go to http://www.cncmods.net/files/sims.zip and download this then you will have some things that can decode these files (depending on which codec the files use).
Also you will need a hex editor to verify which compression type the files use (in case any of them use compression types other than the 2 specific types I have managed to identify)
If you dont have a hex editor, you can download this one
http://www.handshake.de/user/chmaas...nload/xvi32.zip

Steps:
1.Use the resource tools to extract the audio you want.
2.Open the .snr file in a hex editor and look at the first byte. If the first byte is 04, that means its using the EA XAS ADPCM codec. If the first byte is 05, that means its using EALayer3 codec. If its using anything else, that means its an unknown codec.

Put the .snr and .sns files for the sound you want in a folder along with the contents of sims.zip. If the first byte is 04 (XAS ADPCM) you decode it via ffmpeg.exe. Open a command window, navigate to the folder containing the the files and type ffmpeg -f ea_cdata -i <snr file> <wav file>
This will convert the .snr file to a .wav file.
If you have a file of type 05 (EALayer3) you decode it via ealayer3.exe. Open a command window, navigate to the folder containing the the files and type ealayer3 -mc <snr file> and it will decode the .snr file to a .wav file. If there is a .sns file, you pass that instead of the .snr file.

If anyone finds a file with an codec other than 04 and 05 or if they see a file with a codec type of 04 and a matching .sns file (i.e. the .snr file is only 8 bytes), I want to know.

Please post here if you find such files (or any file that fails to convert). Or if there is anything about my instructions that are confusing or hard to follow.

The source code for ffmpeg.exe can be found at www.ffmpeg.org
The source code for ealayer3.exe can be found at http://bitbucket.org/Zenchreal/ealayer3
Both tools seem to be under a fairly liberal license so it should not be hard if someone wanted to re-use the code to add support for the audio to the resource extractor directly.
Last edited by jonwil : 27th Aug 2010 at 4:55 PM. Reason: added source code links
Old 27th Aug 2010, 5:57 PM #2
Nysha
Née whiterider



Join Date: Jul 2005
Posts: 19,719
Thanks: 42778 in 94 Posts
36 Achievements

View My Journal


Just some extra notes that people may find useful.

In S3PE, both sns and snr resources are listed as _AUD. All(?) audio resources can be found in FullBuild1, and I assume DeltaBuild1 (though I've only checked FB, not DB). sns resources are type _AUD 0x01EEF63A, snr are _AUD 0x01A527DB. The audtun (AUDT) resources don't seem to be needed for this process.

EALayer3 seems to be almost exclusively used for music, although there are a few SFX using it. There are also a load of resources prefixed with "sting"... they seem to relate to cutscene events, like births and birthdays, but there are also a few which aren't cutscenes, such as fulfilling a wish or completing an opportunity. There are also vehicle and rabbithole sounds using this format. Everything else is XAS ADPCM as far as I can see.

What I lack in decorum, I make up for with an absence of tact.
Old 27th Sep 2010, 4:01 PM #3
lavsm
Lab Assistant

Join Date: Mar 2005
Posts: 68
Thanks: 3520 in 23 Posts
13 Achievements


This worked great! I was able to extract my favorite songs from the game and then convert the .wav to mp3. The only problem I had was that the zip file in the OP was corrupt, so I gathered some working files myself. Here is a link to them:
http://www.mediafire.com/?4ltn5sgy7mh6g6q

Thanks for the helpful info.
Old 2nd Oct 2010, 11:47 AM #4
lavsm
Lab Assistant

Join Date: Mar 2005
Posts: 68
Thanks: 3520 in 23 Posts
13 Achievements


I was able to use EAlayer3.exe to convert all the game music to mp3 with no problems--except for a few stubborn files, which I have uploaded here:
http://www.mediafire.com/?hd66cl2d65i5r2o

These four .sns files convert to a much smaller size mp3 (2-3 KB each) and won't play in Winamp. I tried extracting as a wav and mp3 with the same results.

I would be grateful if anyone could help me with these so I can complete my collection.
Old 3rd Oct 2010, 2:05 AM #5
zano972
Lab Assistant

Join Date: Jun 2009
Posts: 74


Hi all,

A big THANK YOU for Jonwil, whiterider and lavsm !!! I was trying to find how to do that without any solution and you give me the light i needed looool...

Encore BRAVO et MERCI !!!!

PS: about decoding *.snr or *.sns - file type 05 / EALayer 3 codec - only the biggest file is needed (0x01EEF63A).
Last edited by zano972 : 3rd Oct 2010 at 2:29 AM.
Old 3rd Oct 2010, 3:23 AM #6
lavsm
Lab Assistant

Join Date: Mar 2005
Posts: 68
Thanks: 3520 in 23 Posts
13 Achievements


Another tip that might be helpful...you can just drag the .sns files onto the EAlayer3.exe to convert directly to mp3, instead of opening a command window (figured this out after converting most of the files manually--derp!).
Old 7th Oct 2010, 11:06 PM #7
desecrate
Field Researcher

Join Date: Sep 2009
Posts: 223
Thanks: 8693 in 56 Posts
13 Achievements


Very interesting, is it also possible to encode mp3 or wav files into sns/snr to replace or add new sfx in the game?
Old 17th Oct 2010, 6:21 PM #8
Nysha
Née whiterider



Join Date: Jul 2005
Posts: 19,719
Thanks: 42778 in 94 Posts
36 Achievements

View My Journal


Sadly no - we can decode, but not encode.

TS3 can also play MP3s, as demonstrated by the custom music feature, but any attempts to make it do so outside of the custom music channel would be way over my head. It does seem to play the mp3s directly, rather than converting them to EALayer/XAS.

What I lack in decorum, I make up for with an absence of tact.
Old 15th Nov 2010, 6:17 AM
lenglel
This message has been deleted by lenglel. Reason: no longer relevant
Old 15th Nov 2010, 6:32 AM #9
lenglel
Forum Resident

Join Date: Sep 2010
Posts: 709
Thanks: 778 in 2 Posts
6 Achievements


[QUOTE=whiterider]Sadly no - we can decode, but not encode.
Then why do they call it a codec?

http://www.youtube.com/watch?v=_gWWgNgmFvQ

Hopefully someone can make sense of the above video.
My old eyes couldn't keep up. I think he used a newer
version of ealayer3.exe (0.6.2) than is linked here (0.5.0)

http://bitbucket.org/Zenchreal/ealayer3/downloads

Looks like source only, and I don't have the tools to
build it installed. Nighty-night, all.
Last edited by lenglel : 15th Nov 2010 at 7:51 AM. Reason: new insight
Old 16th Nov 2010, 1:49 PM #10
Jamieb0486
Test Subject

Join Date: Jun 2006
Posts: 5
Thanks: 266 in 1 Posts
3 Achievements


Converting mp3's to sns using the above works for TS3 but it's bitrate needs to be 182kbps or less. If it isn't the game will crash when trying to play it.
Old 20th Nov 2010, 7:27 PM #11
lenglel
Forum Resident

Join Date: Sep 2010
Posts: 709
Thanks: 778 in 2 Posts
6 Achievements


I think you mean 128kbps. That corresponds to 44100hz in audacity.

Since I last posted here, I've created an audio mod package with
replacements for the sims 3 background music sns resources.

Here's how:

programs you will need:

audacity 1.3
http://audacity.sourceforge.net/download/

audacity plugins
lame-mp3 codec
http://audacity.sourceforge.net/hel...tall&i=lame-mp3

ffmpeg codec
http://manual.audacityteam.org/inde...s#installffmpeg S3PE http://dino.drealm.info/den/denforu...php?topic=189.0

ealayer3-0.6.2-win32
http://bitbucket.org/Zenchreal/ealayer3/downloads

note: there is no pre-compiled mac version, but source code links are
posted on the same page below the windows binaries.

a batch file to convert .mp3 files to .sns
paste this text into the batch file:

"C:\Documents and Settings\no\My Documents\s3mod projects\audio\ealayer3-0.6.2-win32\ealayer3.exe" -E %1 -n -o %1.sns -v >"C:\Documents and Settings\no\My Documents\s3mod projects\audio\dia.txt"
pause

edit the paths in quotes to match the paths on your system.

notes:
the %1 is where the batch file substitutes the actual file
name of files dropped on it in windows explorer. The pause
command is so you can see the output before pressing a key
to return to windows from the batch file's command prompt.
the sample command line outputs to file dia.txt which may
be read with any text editor. "skipped empty frame" is the
usual content of dia.txt after a successful conversion on my
setup.

Step 1:
Load fullbuild1 in s3pe. Make sure the sort checkbox is checked.
(It's near the lower left corner of the S3PE program window)

Click on the [NAME] field to sort by name, then look up the
sims3_* _aud and audt resources.

For each song there is one audt and two _aud resources. Look at the
memsize field and export the _aud resource with the larger memsize.
Or check the type field. sns resources are type _AUD 0x01EEF63A,
snr are _AUD 0x01A527DB. You want the .sns resource.


step 2:
drop the exported file on ealayer3.exe to create the .mp3
file. Import this into audacity, then import the .mp3 you
want to replace it with.

Click the X in the upper left of the original soundtrack window to
close the first .mp3, this leaves its filename in audacity's title bar.

Now export the second mp3, overwriting the first. The default
value of 44100 for the bitrate will do nicely. Unless you
want it to sound like the chipmunks. In that case you
would change it to 32000.

step 3:
rename the file you just exported to match the name of the
original that was output from ealayer3.exe in the first part
of step 2. If you dropped the export on the batch file I've
suggested this is just a matter of deleting ".mp3" from the
filename.

step 4:
open a second instance of S3PE and import the .sns file into
a new package file, clicking the use resource name checkbox
to put a checkmark in it.
Make sure the imported .sns has the same name, type, group
and instance as the music you are substituting for in the
fullbuild1.package.
note:
If any of the fields are different right-click on the sns resource
in the first instance of S3PE and select details. Copy the fields
to the details window of the sns in the second instance of S3PE until they all match.

step 5:
Save your new package to the proper mods\packages folder on your
machine naming it, for example, MyMusicMod.package. Your new
music should play in place of the old the next time you start the
sims 3.
Last edited by lenglel : 20th Nov 2010 at 7:36 PM. Reason: clarity
Old 28th Nov 2010, 7:49 PM #12
Robodl95
Theorist

Join Date: May 2009
Posts: 2,449
Thanks: 18904 in 139 Posts
22 Achievements


Wow that's awesome! But you've gotten me so confused that it's not even funny... So I made my batch file and I dropped my replaced .MP3 on it and it says "Could not open input file '1'." what did I do wrong? Or maybe I should rephrase as "How do you take your edited .MP3 and put it back into the AUD file?" Your explanation wasn't very clear on that part

Along those same lines I got confused at step 2 and into step 3 isn't "Now export the second mp3, overwriting the first" and "rename the file you just exported to match the name of the original that was output from ealayer3.exe in the first part of step 2" telling you to do the same thing because the first MP3 you imported WAS the original you got from ealayer3.exe?

I tried... I failed

Edit: Wow I'm an idiot! I thought the quotes weren't necessary Problem solved So now I got the new music in game but it sounds like fish gurgles, I think I know how to fix that though (hopefully..)

Edit (Again): So I still have the garbling problem. I thought I knew what it was but I was wrong... The music is in game and I've obviously replaced it except it sounds like you're trying to talk underwater. So my dia.txt says "ID3 Tag size: 16", would that have anything to do with it? Any idea where I went wrong?

Hi I'm Paul!
Last edited by Robodl95 : 29th Nov 2010 at 2:12 AM.
Old 30th Nov 2010, 7:17 AM #13
shorty1k
Test Subject

Join Date: Jul 2006
Posts: 16


Could this same theory be used to make new piano and guitar music?
Old 30th Nov 2010, 8:49 PM #14
Shimrod101
Mad Poster

Join Date: Jun 2009
Posts: 3,563
Thanks: 46928 in 684 Posts
17 Achievements


Quote:
Originally Posted by shorty1k
Could this same theory be used to make new piano and guitar music?


Yes, it should work fine. The guitar and piano tunes are AUDT and a couple _AUD resources for each song, just like the tunes lenglel describes replacing.

MedievalMods and Sims3mods: Dive Cave Reset Fix, Resort Revamp, Industrial Oven Revamp, Will O' Wisp fix, UI Sounds Disabled, No Cars, Gnome Family Planner, Townies Out on the Town, No Martial Arts Clothes, Fast Skilling, etc. http://simsasylum.com/tfm/
Old 30th Nov 2010, 11:45 PM #15
lenglel
Forum Resident

Join Date: Sep 2010
Posts: 709
Thanks: 778 in 2 Posts
6 Achievements


Quote:
Originally Posted by Robodl95
Edit (Again): So I still have the garbling problem. I thought I knew what it was but I was wrong... The music is in game and I've obviously replaced it except it sounds like you're trying to talk underwater. So my dia.txt says "ID3 Tag size: 16", would that have anything to do with it? Any idea where I went wrong?


I had the same problem with certain tunes. Has to do with the
bitrate. The bitrate in the new resource needs to be a maximum
of 128k. That's where the audacity program comes in.
1. Export original .sns with S3PE 2. Convert original to .mp3 with ealayer3
3. Import original into audacity
4. Import replacement into the same instance of audacity
5. Click the close box of the original .mp3 in audacity
6. Click export. The replacement will overwrite the original
.mp3 (the one with the s3* name) the bitrate should be
audacity's default 44,100
7. use the batch file which calls ealayer3 to convert the
new .mp3 to an .sns file which will have the same name
as the file originally exported from S3PE EXCEPT there
will be ".mp3" ahead of the .sns extension. Delete the
original and rename the replacement by deleting the ".mp3"
from the filename
8. open S3PE and import new .sns from file with "use
resource name" checked so that the replacement has
the same name as the replaced resource
9. save it as a new .package file.
10. put the new .package in the usual mods directory

If that doesn't cure the weirdness, let me know the
bitrate and length of your track, and I'll see if I can
find something similar in my collection to test with.
The tagsize might or might not have something to
do with this. Other people made the parts. I was
just in the right place at the right time to scotch tape
them together.

edit: I just happened to think, did you blank the extra
data on export? The artist name, title and all that
stuff should be blank when you export the new file
with audacity. The basic idea with using audacity
instead of just dropping the new .mp3 on the batch
file and renaming is to get the new audio to match
the old audio's settings in the .snr and audt resources
which are largely of unknown format at present.
Last edited by lenglel : 30th Nov 2010 at 11:54 PM. Reason: summary
Old 1st Dec 2010, 12:59 AM #16
Robodl95
Theorist

Join Date: May 2009
Posts: 2,449
Thanks: 18904 in 139 Posts
22 Achievements


That's what I've been doing :/

I've tried with 3 songs (all end up in gurgles)
Harry Potter (44,100 5:09) http://www.youtube.com/watch?v=1Li0SWlwe34
Sims 1 Theme (22,050 2:07) http://www.youtube.com/watch?v=QU2rUU0z72Y
And a song named Hell (44,100 3:09) that I don't have a link to and didn't use for any other reason then I wanted to check that the youtube to MP3 converter wasn't screwing up the files.

Those are the exact videos I got the audio off of so if you use them then you should have the same MP3.

When you say leave the stuff blank does that also mean genre? I couldn't find any way to leave that blank (All the other stuff has been blank though)

Hi I'm Paul!
Old 4th Dec 2010, 1:23 AM #17
lenglel
Forum Resident

Join Date: Sep 2010
Posts: 709
Thanks: 778 in 2 Posts
6 Achievements


I think the problem might be that your mp3 files are encoded with a variable bitrate
when the game needs a fixed bitrate. How do you get mp3 files from youtube?
Old 4th Dec 2010, 2:04 AM #18
Robodl95
Theorist

Join Date: May 2009
Posts: 2,449
Thanks: 18904 in 139 Posts
22 Achievements


Hi I'm Paul!
Old 5th Dec 2010, 5:46 AM #19
lenglel
Forum Resident

Join Date: Sep 2010
Posts: 709
Thanks: 778 in 2 Posts
6 Achievements


Thanks for the link. Did you try both standard and high quality versions
to see if it made any difference?
Old 5th Dec 2010, 5:56 AM #20
lenglel
Forum Resident

Join Date: Sep 2010
Posts: 709
Thanks: 778 in 2 Posts
6 Achievements


You agree to receive promotional emails and special offers from trusted 3rd parties including DealSave.net.

Well, Robodl95 now you know why I can't test out the mp3 files you describe on my pc. When I had the
same problem I used winamp 5.04 to check the bitrate. The bitrate needs to be a constant 128 kbps,
even if you get a variable bitrate when playing an mp3 that was extracted from from an .sns

Any luck?
Old 5th Dec 2010, 3:43 PM #21
shorty1k
Test Subject

Join Date: Jul 2006
Posts: 16


Piano and guitar music is indeed in _aud format, but it doesn't export to sns, but rather snr format, which doesn't seem to convert or work.

Edit: On the bright side, your directions worked beautifully for regular music replacements. I now have sims 1 neighborhood music in my map view, which is awesome. The only oddity is a brief millisecond of static when switching to it. Very weird but almost completely unnoticeable. It also seems to have issues progressing to the next song. Just something I thought I'd point out. Thank you so much for cracking the music situation with the Sims 3, this is an answer to many upset fans! Custom music folder be damned!
Last edited by shorty1k : 5th Dec 2010 at 5:54 PM.
Old 6th Dec 2010, 12:57 AM #22
lenglel
Forum Resident

Join Date: Sep 2010
Posts: 709
Thanks: 778 in 2 Posts
6 Achievements


Gee, I'm glad the guy that wrote the actual codec didn't read this.
About the .snr files, it's the same procedure, but using the ffmpeg
codec instead of ealayer3. I think. Haven't tried it myself yet.
I'm more interested in custom animations, but EA seems to move
the goalposts with every patch.
Old 10th Dec 2010, 10:11 AM #23
maruneko
Test Subject

Join Date: Oct 2008
Posts: 4


So I'm assuming that this also involves animation sounds?
Old 11th Dec 2010, 1:58 AM #24
lenglel
Forum Resident

Join Date: Sep 2010
Posts: 709
Thanks: 778 in 2 Posts
6 Achievements


I believe your assumption is correct, but haven't done any testing as I'm happy with the
animation sounds as they are. What were you thinking of changing?
Old 22nd Jan 2011, 6:55 PM #25
Finxxy
Lab Assistant

Join Date: Jun 2007
Posts: 64
3 Achievements


OK I hate to revive an old thread but I'm having an issue and I was wondering if anyone was having this as well. The ealayer3 I've had no problem working with. However the ffmpeg never converts for me. The error I always get is "unable to find a suitable output format for <filename>" has anyone else run into this? The files I'm working with are the .snr files and they start with 04 in the hex editor. Any suggestions?

EDIT: I'm working with windows 7 and I'm not sure what version of windows that command line was written for but I always get the
"this was unexpected blah blah blah" error when I manually direct there and put in the command prompt

New to the forums but a sims fan since '99.
Reply


Section jump:


Powered by MariaDB Some icons by http://dryicons.com.