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!
Mad Poster
Original Poster
#1 Old 29th Jun 2015 at 4:16 PM
Default Adding songs to existing radio Stations?
Hi,

Short question - is it possible to add songs to existing radio stations instead of the generic Custom station? Like in TS1, TS2 and TS4? If so, would it require serious fiddling around in S3PE?

Thanks,

Pi

insert signature here
( Join my dumb Discord server if you're into the whole procrastination thing. But like, maybe tomorrow. )
Advertisement
Mad Poster
Original Poster
#2 Old 21st Jul 2015 at 1:25 PM
*bumpity bump*

insert signature here
( Join my dumb Discord server if you're into the whole procrastination thing. But like, maybe tomorrow. )
Inventor
#3 Old 21st Jul 2015 at 2:32 PM Last edited by Arsil : 21st Jul 2015 at 3:43 PM.
Yes.

I wrote something about it on the "Stupid questions" thread.
It was about replacing songs, but you may find that interesting.

To every radio station are associated 4 AUDT resources.
Those AUDT act as a playlist. Why 4? Each uses different audio settings:
normal, wired, virtual and virtual wired. I think with wired it means the stereo upgrade
and with virtual a song that doesn't has a source, like the music you hear on build mode
(this is just a speculation on my part).

Each AUDT contains a list of songs and every song is composed by 1 AUDT and 2 _AUD resources.
You can edit an AUDT with S3PE's Grid and create a new entry (IIRC the related section/block is
called "samples") for a new song

Check my mod - Japanese Stereo Station - as reference, it only has 3 songs so maybe it's easier to study that instead of the official stations.
I didn't use an xml for the station data definition, so that may confuse you, but for your purposes it shouldn't make any difference.
Mad Poster
Original Poster
#4 Old 22nd Jul 2015 at 11:57 PM
Quote: Originally posted by Arsil
Yes.

I wrote something about it on the "Stupid questions" thread.
It was about replacing songs, but you may find that interesting.

To every radio station are associated 4 AUDT resources.
Those AUDT act as a playlist. Why 4? Each uses different audio settings:
normal, wired, virtual and virtual wired. I think with wired it means the stereo upgrade
and with virtual a song that doesn't has a source, like the music you hear on build mode
(this is just a speculation on my part).

Each AUDT contains a list of songs and every song is composed by 1 AUDT and 2 _AUD resources.
You can edit an AUDT with S3PE's Grid and create a new entry (IIRC the related section/block is
called "samples") for a new song

Check my mod - Japanese Stereo Station - as reference, it only has 3 songs so maybe it's easier to study that instead of the official stations.
I didn't use an xml for the station data definition, so that may confuse you, but for your purposes it shouldn't make any difference.

Thanks so much, I'll check it all out when I have the time!

insert signature here
( Join my dumb Discord server if you're into the whole procrastination thing. But like, maybe tomorrow. )
Mad Poster
Original Poster
#5 Old 23rd Jul 2015 at 9:38 AM
So as a test, I have 10 MP3 files - I extracted the Drums 'N' Bass samples from Showtime. How do I convert them back to EALayer3, and how do I edit/generate the other files necessary?

insert signature here
( Join my dumb Discord server if you're into the whole procrastination thing. But like, maybe tomorrow. )
Inventor
#6 Old 23rd Jul 2015 at 1:29 PM Last edited by Arsil : 10th Jun 2017 at 12:13 PM.
Ah, this is such a drag. Why am I so kind? I don't remember all details, but let's see what we can do.

If you take a look at the "Stereo" _XML resource on GameplayData.package, you'll see something like this:
Code:
[CUT]
<Stations>
  <Station_Name>Electronica</Station_Name>
  <Audio_Playlist_Name>stereo_electronica</Audio_Playlist_Name>
  <Audio_Playlist_Wired_Stereo>stereo_wired_electronica</Audio_Playlist_Wired_Stereo>
  <Audio_Playlist_Virtual>stereo_electronica_virtual</Audio_Playlist_Virtual>
  <Audio_Playlist_Virtual_Wired>stereo_wired_electronica_virtual</Audio_Playlist_Virtual_Wired>
  <Music_Type>Electronica</Music_Type>
  <IsWorkoutStation>1</IsWorkoutStation>
 </Stations>
[CUT]


If you use the strings specified in the playlist tags as hashing key, you'll get the InstanceId
of the respective _AUDT resources that are in FullBuild1 and DeltaBuild1.

You have to extract those 4 resources and put them in a package inside your Mods/Packages folder
(or, as I always suggest, in a subfolder that contains experiments and untested mods/CC, so you
can more easily pinpoint troublemakers).
From there, you can edit them, one by one, with S3PE's Grid, adding a new entry (just copy an existing one) to the
"Items" collections of the block with the id "Samples". What you have to put in that entry? You leave all other parameters
as they are and just change the Instance field putting there the InstanceID of the AUDT resource of the song you want to add.

How do you create an AUDT resource for a custom song? They are not all identical (as far as their settings go)
but most of them are, so you just extract an existing one* and put it in your package, then change its InstanceId
(you can use your nickname + name of the song as hashing key to generate it) and then change (again, with
S3PE's Grid) the Instance field putting the InstanceId of the _AUD resource of the song (usually AUDT and _AUD
use the same InstanceID, this also makes it easier to search them).

*How to chose the right one?
If you are replacing or adding a stereo song, use as reference an AUDT of that station.
If you are replacing a looping music (e.g. loading screen) use an AUDT that features looping

Now, every song has 2 _AUD resources. Pay attention: they both use the _AUD tag, but they have 2 different TypeId:
- 0x01A527DB is just some kind of header
- 0xTheOtherOne is the actual song

About the encoding process, I don't remember much but here are my notes, you can search posts made by the users
I mentioned in my mod's description to see more details about it (especially a thread started by FlyBy)
Quote:
Music encoding process

- use audacity to export the audio file (whatever its original format is, even if it's already an mp3) as mp3 and set its options as in Flyby's post
- use ealayer3_0.6.2 (not 0.7.0 or a more recent one! Unless they fixed it) to convert the mp3 to snr and sns
- use an hexeditor to truncate the snr (keep only the first 8 bytes) and put "40" as 5th byte (index 4 on some hex editors)
- no changes needed to the sns
- rename the 2 files using S3PE format (S3_type_group_iid_name.ext) so when you import them all details are already set


IIRC, in Flyby post, he/she describe how to add a block of code with the hexeditor.
Now, I remember I did NOT do that, maybe that is only needed for generic audio
(sound effects that need a fx_slot) but not for music, I'm not sure. Or maybe if you
do that you'll get better results (my mod has the issue that when there's the
transition between a song and the next there's an annoying noise).

Note: this is just speculation on my part, but Showtime songs (the ones that performers can sing)
may be more complex than normal songs (singing+chorus+loops+whatever), so if I were you I'd start
with something simpler, for example adding an existing song from Pop to Electronica,
then you can try with custom songs that you encode yourself.
Inventor
#7 Old 17th Jun 2016 at 6:19 PM Last edited by Arsil : 10th Jun 2017 at 10:54 AM.
Music encoding process (REVISITED)
Useful link: FlyBy original tutorial

There might be something wrong in the encoding process suggested here
I'm currently experimenting with it...

Apparently the audio must be stereo, otherwise the game crashes when the song is about to end.
See: http://www.wikihow.com/Change-a-Mon...-Using-Audacity
Make sure the project sampling (Hz) is set to 44100 and its sample format is 32-bit float (Stereo)

- use audacity to export the audio file (whatever its original format is, even if it's already an mp3) as mp3 and set its options as
Quote:
Set 'Bit Rate Mode' to 'Variable'.
Under 'Quality' select: '3, 155-195 kps' (this has proved to be the bit-rate the TS3 sound-engine can handle best)
Set 'Variable Speed' to 'Standard'.
As 'Channel Mode' select 'Joint Stereo'


- use ealayer3_0.6.2 (not 0.7.0 or a more recent one! Unless they fixed it) from the command line to convert the mp3 to snr and sns
Code:
ealayer3 -E your_file.mp3 -o your_file.snr --single-block
ealayer3 -E your_file.mp3 -o your_file.sns


- use an hexeditor to truncate the snr:
--- keep only the first 8 bytes (or 16 hex digits)
--- put "40" instead of "00" as 5th byte (index 4 on some hex editors, since it starts counting from 0)
Code:
example (note that the first 5 bytes are always the same)
05 04 AC 44 00 5F 0B 80 00 29 8B FA ...
becomes
05 04 AC 44 40 5F 0B 80 delete everything that comes after


- no changes needed to the sns file.
Note: FlyBy suggests to do a relatively complicated procedure to that file with an hex editor (step 7). I don't know
if that is only needed for sounds (as in audio effects) or also for music. I skipped that step for my mod (Japanese
Stereo Station). There's indeed some noise/disturbance when you pass from one song to another, not sure if that
is related (another cause could be that there's no enough "silence" at the start and/or at the end of the songs, but
this is only an uneducated guess on my part).

- (OPTIONAL) rename the 2 files using S3PE format (S3_type_group_iid_name%%_AUD.extension) so when you import them all details are already set
Code:
Example:
your_file.snr --> S3_01A527DB_001407EC_44BE8E6D937467D4_Arsil_JapStation_shakuhachi%%+_AUD.snr
your_file.sns --> S3_01EEF63A_001407EC_44BE8E6D937467D4_Arsil_JapStation_shakuhachi%%+_AUD.sns


- import the 2 files with S3PE (if you did the previous step you don't have to change anything, it is all already set)

- import an AUDT resource (see previous post). You can use as model Gluten_King (in FullBuild1.package),
this resource seems to have the most common "format" (4 blocks) among stereo songs. The block that
contains the reference to the InstanceId of the _AUD resources is called "Samples".

- make sure the AUDT and the 2 _AUD have the same InstanceId (not strictly needed but it is handy and a common practice).
Double click on the AUDT resource and give it the same name of the _AUD and then click on FNV64.

- pay attention to the group id of all 3 resources: it has to be 001407EC

- edit the AUDT resource with S3PE's Grid and put the InstanceId of the _AUD in the Instance field.
If you have used the AUDT suggested above, you'll find it in: Blocks - [2] Blocks - Items - [0] Item - Data
Inventor
#8 Old 17th Jun 2016 at 10:44 PM Last edited by Arsil : 10th Jun 2017 at 12:34 PM.
After further experimentation, I think I can say that the "step #7" described by FlyBy is not necessary.

The hex editing of the AUDT resource he/she describe in "step #8" can be more easily done with S3PE's Grid
(maybe at the time the tutorial was written that resource type wasn't yet "parsable"?)

------

EDIT : Info on AUDT resources:

The Parent block (usually the first block)
This is used to reference another AUDT resource, an already existing one
(most likely contained in FullBuild1.package, DealtaBuilt1 or an EP package)
Looks like this second AUDT (who may in its turn reference a third AUDT),
with its parameters, describes the properties of the sound: audio, gain,
how it propagates, which distance it can reach from the source, etc.

The Samples block (usually the second block, unless there are others - like the one for looping)
I've already mentioned this one, it is used to reference the related _AUD resource(s),
the ones containing the actual audio data.
AUDT of stereo stations have more entries in this block, these AUDT act as a playlist.

The Codec block (usually the third - or anyway the last - block)
This block, with the field Data, defines the codec used by the referenced _AUD resource(s).
0x00000004 is EA XAS ADPCM
0x00000005 is EALayer3 (EALayer3 MPEG Layer 3 audio variant, aka EL31)
Note that 0x04 and 0x05 is the first byte of the audio files (.snr) encoded using the former or the latter format.
See also:
https://wiki.multimedia.cx/index.ph...AGE_Audio_Files
http://www.modthesims.info/showthre...061#post3300061

ffmpeg can decode .snr files in EA XAS ADPCM format,
I'm not sure if it can also encode them (from mp3/wav to .snr).
Mad Poster
#9 Old 18th Jun 2016 at 12:05 PM
@Grizje Pilion & @Arsil:

Wotjek had this tutorial created when I was looking to do a default replacement of the steam train sounds. It might be applicable to getting music into the game, though I don't know how you would do new soundtracks.

http://modthesims.info/showthread.p...624#post5030624
Mad Poster
Original Poster
#10 Old 21st Jun 2016 at 12:43 PM
Neat, thanks. HEX editing is really scary to me, but I'll try my hand at it. Your LODs are hopefully coming later today, by the way.

insert signature here
( Join my dumb Discord server if you're into the whole procrastination thing. But like, maybe tomorrow. )
Mad Poster
#11 Old 22nd Jun 2016 at 3:10 AM
Thanks The tutorial is actually a bit wordy, and is much simpler than you'd expect.

Let me know when you have them LODS!
Back to top