CreatorsOk
JaneSimsten
JaneSimsten

patreon


Mod Tutorial: Add New Songs to Instruments

-Hey all!  Today I wanted to share how to add new songs to the Sims 4 musical instruments.  For this tutorial, you'll need a few tools.  This also assumes some working knowledge of how XML works.

Notes: Unfortunately, there are parts of this tutorial which rely on the TS4 Sound Tool which only works on Windows computers.  If you're a Mac user like myself, and don't have a friend whose computer you can borrow, let me know and I'm happy to help make audio config packages for those who need it.

Right now, this tutorial is only for instruments.  I'll be adding a second tutorial for vocal tracks very soon.


Tools Needed:

How Instruments Play Songs in the Sims 4

For this tutorial, it's important to understand how instruments work in the game.  Each instrument has at least one "play_song" interaction.  Some instruments have two if they can be stored in a sim's inventory.  Inside this interaction is a list of music styles that Sims can play songs from.  For example, the guitar_play_song tuning file has these music styles listed:

A music style tuning is just a list of music tracks which can be played, and optionally, a pie menu category for them to be stored in.  The musicstyle_Guitar_Jazz tuning looks like this:

The music track file has more customizable details about the song, such as the song title and skill level requirements.  Now that we have a basic understanding of how music works in the Sims, let's walk through making a custom song file.

Making a Custom Music Track - Audio Config

First, you'll need to have your audio file ready to import.  (For this tutorial, I recorded Minuet in G on a sampled piano from the 1700s.)  Once you do, you can open up TS4 Sound Tool.  Select Base Game, then click the Music tab, and then click the Instrument drop down menu and find a song to clone.  Doesn't matter what it is, but something with "playsong" in the name is usually the best bet because it will only have one sample.

You'll see the contained sample inside.  Click clone, name your new audio package, and then save it somewhere you'll be able to find it.  You'll eventually need to move this package into your mods folder.

Once that's done, delete the original sound sample.  Click add in the lower right hand corner, and find your .mp3 file that you want to replace it.  Once you're done, click save.

And that's it for TS4 Sound Tool - super, super helpful resource, thank you so much to Denton47 for making it!

Making a Custom Music Track - Tuning File

Next, we need a music track tuning file.  Open up Sims 4 Studio and create an empty package.  Under the Tools menu, click "Extract Tuning".  Locate a musictrack to clone (NOT one of the practice ones), and click "Add to Package".  I chose musicTrack_Guitar_Jazz_01.

Next, we need to clone this file and give it a new instance ID.  Under the Tools menu, click "Hash Generator".  In the "text" field, type what you want the name of your new tuning file to be.  It is best practice to start the file name with your modding name and project name, followed by whatever the tuning file is.  Then, copy the FNV64 hash number.

Back in the Sims 4 Studio Warehouse, click on your musictrack file, then click "Duplicate" at the bottom.  It will prompt you for a new instance id.  Paste your 64 bit hash there, then click OK.  Now you should have a new music track that is identical to the old one.  Go back to the hash generator, paste your hash number where it says "Hexadecimal", then copy what it says in "Decimal".  Locate your new audio file, then where it says n="..." put your new file name, and where it says s="..." put your new hash number.  If you make tuning mods, you'll do this a lot.  You can delete the old music track file now.

Now, open the audio config package you made in TS4 Sound Tool, but in Sims 4 Studio.  In the warehouse, locate the "Audio Configuration" file, and then scroll down until you see "Instance".  Copy that number.

Go back to your music track file, and find where it says "music_clip".  You'll see a bunch of numbers (mine says 39b2aa4a:00000000:f78731e51586773f).  Paste the audio configuration instance id that you just copied over the third set of numbers, after the second colon (so I'm replacing f78731e51586773f with FC2EE4ACE9E8EB2C).  Now, this music track references your new audio file.

Next, we'll need to change some other information in our music track to match our audio file.  First, find out exactly how long your audio file is in seconds.  Then, where it says "length", replace that number with your song length.  If you want your song to be playable only once a sim has reached a certain skill level, you can replace "lower_bound" with whatever skill level you want, and change "skill" to match the right instrument skill.

You'll also need to add a song name, or the new track will show up blank in the pie menu.  For this, you will need a string table.  If you've made string tables before, please skip ahead.

You'll make a new 64 bit hash for this as well.  This time, in the bottom lefthand corner of Sims 4 Studio, click "Add", then scroll down until you find "String Table".  Paste your 64 bit hash where it says "Instance" and click OK.  Then, click on your String Table in the warehouse, and where it says Locale, click what language you want your main strings to be in.

Then, you need a new 32-bit hash for your song name.  Keep the prefix you created, but then write your song name in the text field.  Then copy where it says FNV32.

Go back to your string table, and click "Edit Items".  It will open a new window.  At the bottom left, click where it says "Add" and then paste your copied hash number where it says key, and write your song name where it says value.  Click save.

Go back to your music track tuning file, find where it says "music_track_name", and paste your hash number again after the 0x.  (Mine now says 0x3DD42FE5).  You can also put the name between the <!--words-->, but it won't matter if you don't.  When you're done with your mod and have added all the strings you need, select Tools->Modding->Copy String Tables to All Languages.

In your music track tuning, it may also have a place where it says moods.  This is for autonomy.  If you want your Sim to favor playing this song over another when they're feeling happy, or sad, you can paste the mood tuning here.  If not, you can delete the entire section.

And that's it - you've made a music track!

Making a Custom Music Style

To make a music style, go back to the Extract Tuning window and search for a MusicStyle.  Don't pick one that says practice.  Click "add to current package", then give it a new name and 64 bit hash just like we did for the music track.  Delete the original music style.

Then, go back to your original music track.  Find the s="1234567" number and copy it.  Go back to your music style, and replace the music_tracks section with only your original track.  Repeat this process for all of your music tracks.

Then, you'll want to make a new pie menu.  Open your Extract Tuning window and search for "instrument_PlaySong_" and choose something to copy.  This time, you'll see two new files added to your warehouse.

Some types of files in the Sims have an associated Sim Data.  The Sim Data and the Tuning file always share the same instance ID and need to have the exact same information.  Create a new name and 64 bit hash number and duplicate both of these.  Do not change the group numbers, only the instance numbers.  Make sure to change the name in both the tuning and the simdata files, then you can delete the old pie menu files.

In your hash generator, make a new 32 bit string id, then add the name of your pie menu to the string table as we did before.  When you're done, go back to your pie menu tuning and find where it says "display_name" and change the number after the 0x to your new number.  Then, go to the simdata file, find the same number, and change it there too.

When you're done, your pie menu and simdata should look like this:

Copy your s-number for the pie menu category, and go back to your music style file.  Change the old pie menu number to your new pie menu.  Remember to save!  Now you've made a custom music style.

Getting Custom Music Styles and Music Tracks in the Game

So everything we've done so far has been great, but the game won't actually do anything with these files unless we change one of the "play song" interactions associated with one of the instruments in the game.  One way to do this would be to add the interaction to your package file and simply override it, but that's not best practice because if other modders override the same resource, it will conflict.

So with that in mind, I made a tool to allow you to inject songs and musicstyles into the game.  The last piece of our mod will be to make a SongInjector snippet.  Create a new name for your snippet file, and make sure to click "High Bit" in the bottom right hand corner of your hash generator.

Go back to your warehouse, and in the bottom lefthand corner of the window click "Add".  Click the dropdown menu in the popup window and scroll down until you see "Snippet Tuning".  Select it, set the group number to 0, paste your new instance id, and click OK.

Now, you should have a blank file.  We'll need to fill it with information so the song injector can recognize it.  You can copy-paste from the example package attached to this tutorial or type it in yourself.  Remember to change your name and s-number to match your file!

The song injector can do two things: add a musicstyle to an interaction or add a music track to a music style.  You don't need to do both.  If you add a song to a musicstyle, it will show up in the game on every instrument that uses that music style.  If you add a musicstyle to a play song interaction, the game will automatically be able to see all of your custom songs in that music style and add them to the instrument.

In this example, I added our custom Minuet in G track to the Romantic piano category, and I added the 1700s Piano style to the play song interaction, so now the Minuet in G track shows up in two different places.

Remember that you'll need your package with your audio config file in your modding folder as well as the package with the tuning files we just created, plus a copy of the SongInjector script:

Final Notes:

Remember that different play song interactions have different tests, so even if a sim passes the tests for your music track, the option may still not show up on the instrument unless they pass the tests for the interaction.  For instance, the piano_play_song interaction requires level 2 piano skill, so even if your music track has no tests at all, it still won't show up until your sim reaches level 2 piano skill.

I hope this tutorial has been comprehensive enough so that even those who don't mod regularly can follow along, but if you need any help please feel free to reach out!  The best way to get help from me is on Discord.  I also want to reiterate that I'm happy to help any Mac users generate audio config files - it literally takes 2 seconds and I have access to a pretty terrible windows computer that gets the job done.

Hope this helps!

~JS

Comments

I just made my first mod with this! Thank you

minju kim

What happened to the vocal tracks tutorial?

ascendingaliyah

Thank you so much! ! !

2233

Great job thank you!!! It certainly looks scary, but if I try to sit and figure it out, I think I can master it)

Elen


More Models and Creators