Xenoblade X replace music

  • Thread starter Thread starter pwnsweet
  • Start date Start date
  • Views Views 18,408
  • Replies Replies 130
  • Likes Likes 2
So for the curious, I was originally just repacking this straight onto my switch, but I decided to do it through an emulator instead to expedite the process. You can indeed just use a mod/romfs/LayeredFS in an emulator and load the Music.pck directly (so long as it's been repacked by masagrator's script). Others have already figured that part out though!

I think the central problem with just using straight up WAV files (that is, external files) is that they're technically just Libopus(OGG) and wrapped in a header up to 0x40. The header is easy to figure out. It's very easy to convert them to Libopus using ffmpeg. Something to the effect of...

ffmpeg -i song.wav -c:a libopus -b:a 196k -ar 48000 -ac 2 song_opus.ogg

the header you can put in with HxD or some other editing software:

52 49 46 46 28 C7 48 00 57 41 56 45 66 6D 74 20 28 00 00 00 39 30 02 00 80 BB 00 00 00 EE 02 00 04 00 10 00 06 00 C0 03 02 31 00 00 6A FD 8D 00 00 00 00 00 30 2F 48 00 78 97 00 00 73 6D 70 6C 3C

You could technically just brute force your way in but it's pretty inelegant, and I'm fairly certain that as shuyinlove said, they're missing loop points; the files won't play anyway. I'm doing it the long way, that is dragging the file into WWise and re-encoding it and then exporting it but I doubt every single person is gonna wanna install Wwise and do this several times over lol.

Idle musings while stuck at work. Not at my PC right now to properly check.

I'm a total laymen with all of this, so sorry if the questions are tedious, but I'm trying to understand how this process works. So are you saying you can take an external .wav, and convert it using the "ffmpeg -i song.wav -c:a libopus -b:a 196k -ar 48000 -ac 2 song_opus.ogg"? And if so, is that something I would have to execute through something like Powershell similar to Masagrator's script for unpacking the Music.pck?

And then you add the "52 49 46 46 28 C7 48 00 57 41 56 45 66 6D 74 20 28 00 00 00 39 30 02 00 80 BB 00 00 00 EE 02 00 04 00 10 00 06 00 C0 03 02 31 00 00 6A FD 8D 00 00 00 00 00 30 2F 48 00 78 97 00 00 73 6D 70 6C 3C" to that file with Hexediting? And then you can repack it into Music.pck?

I was also wondering about the loop points. When I did audio files for the Cemu version, in .adx, I never made loop points as the songs just looped automatically. Some faded out and restarted, others, I would trim the song really tight so it would "loop", I'm just wondering, would a converted .wav repacked into Music.pck without loop points, still result in a song that would keep replaying, or would it just go silent after it played once?

btw, thanks so much to all you guys who know how to do the leg work on this stuff.
 
I'm a total laymen with all of this, so sorry if the questions are tedious, but I'm trying to understand how this process works. So are you saying you can take an external .wav, and convert it using the "ffmpeg -i song.wav -c:a libopus -b:a 196k -ar 48000 -ac 2 song_opus.ogg"? And if so, is that something I would have to execute through something like Powershell similar to Masagrator's script for unpacking the Music.pck?

Hey, going to break this response into parts. This would typically work in most cases, yes. You'd do this all through commandline with an ffmpeg binary. (To make this easier, put the wav file in the ffmpeg.exe folder, click the address bar and type cmd.) It'll convert it from WAV to OPUS.

And then you add the "52 49 46 46 28 C7 48 00 57 41 56 45 66 6D 74 20 28 00 00 00 39 30 02 00 80 BB 00 00 00 EE 02 00 04 00 10 00 06 00 C0 03 02 31 00 00 6A FD 8D 00 00 00 00 00 30 2F 48 00 78 97 00 00 73 6D 70 6C 3C" to that file with Hexediting? And then you can repack it into Music.pck?

So in theory, yes, you can rip the header out of one of the non-converted files and replace the first 64 bytes of your new song via a hex editor (0x40), then save it as a WAV again. This is how I actually ended up swapping the music files for the Final Fantasy games before people developed tools for them. FFXIII, FFXIII-2, FFXIV and I'm sure many others use .SCD which is basically just an OGG wrapped in a few bytes of hex data. Here's the first 64 bytes of the the title theme.

Screenshot 2025-03-26 214239.png


I was also wondering about the loop points. When I did audio files for the Cemu version, in .adx, I never made loop points as the songs just looped automatically. Some faded out and restarted, others, I would trim the song really tight so it would "loop", I'm just wondering, would a converted .wav repacked into Music.pck without loop points, still result in a song that would keep replaying, or would it just go silent after it played once?

You can confirm the headers and encoding of the original WAVs (pre conversion) by using vgmstream's (another binary) metadata function. You'll see they have start and endpoint metadata, which WAVs typically do not possess. You can add looping metadata using something like Looping Audio Converter, but this is a problem, because I'm pretty sure ffmpeg's libopus encoding doesn't preserve metadata so it gets wiped afterward.


For example running 3BF547BA.wav (the title theme) outputs:

vgmstream-cli -m 3BF547BA.wav metadata for 3BF547BA.wav sample rate: 48000 Hz channels: 2channel mask: 0x3 / FL FR loop start: 0 samples (0:00.000 seconds) loop end: 9305449 samples (3:13.864 seconds) stream total samples: 9305450 (3:13.864 seconds) encoding: libopus Opus layout: flat metadata from: Audiokinetic Wwise RIFF header bitrate: 196 kbps play duration: 19090898 samples (6:37.727 seconds)

However, running the WAV file that I encoded with looping metadata through ffmpeg to convert it to OPUS:

vgmstream-cli -m ownsong_opus.ogg metadata for fixed_opus.ogg sample rate: 48000 Hz channels: 2channel mask: 0x3 / FL FR stream total samples: 11581851 (4:01.289 seconds) encoding: libopus Opus layout: flat metadata from: Ogg Opus header bitrate: 207 kbps play duration: 11581851 samples (4:01.289 seconds)

You'll see the start and endpoints are missing in my own file, I can't confirm or deny whether you need loop points or not, it's only conjecture, but the new WWise format is a lot different to ADX (which is several decades old), I used ADX on the wii version of Xenoblade 1 to change the music too, and again in Sonic Adventure 2 Battle. That's how old the format is lol

Doing this all in Wwise is much easier for me, but far less user friendly for anyone else that's not used to working with it. As I can just hard-encode the header, spit out a WEM file and convert that instead. Admittedly, I haven't tested this manual conversion way all too much, most of this is guesswork from my time modding other switch game music (I modded XB1 DE's music in a similar fashion).

There's also the possibility of needing to also make some changes to the .bnk file. Putting it fairly simply, if the file you're swapping with is larger, it could be a case of the .bnk file (which stores all sorts of important things) rejecting the file altogether as it's a larger size than the original file. That causes all sorts of byte shifts that throw things out of whack.

I won't get much time until the weekend to properly delve into things sadly.

Edit: Hey I can post proof that at least the WWise import method works now (yay for my first 5 posts nerding about music hacking lol)

 
Last edited by Arpeggiate,
  • Love
Reactions: Gausak and chfx
Here are all the themes using lyrics and the instrumental counterparts

Code:
Don't Worry 3:54 (lyrics) [2D6EA0A4] 
Don't Worry 3:55 (instrumental) [227751D9]
Don't worry (lyrics alt ver) [2FFD64D8]
---
Uncontrollable (Ground Tyrant theme) (lyrics) [2F4B7A3E]
Uncontrollable (instrumental) [1F430BF5]
Uncontrollable (instrumental) [04CDD66F]
---
In the Forest 5:10 (lyrics) [30D2E39E]
In the Forest 4:46 (lyrics) [0C60FF69]
In the Forest 2:53 (instrumental) [3F130BE5]
In the Forest 4:42 (instrumental) [15C3EC96]
In the Forest 1:56 (instrumental) [09BAB7D7]
In the Forest 2:43 (instrumental) [25A29F38]
---
Wir fliegen 4:55 (instrumental) [24EBFB92]
Wir fliegen 4:44 (lyrics) [00D5ED49]
Wir fliegen 4:55 (lyrics) [0274DBCA]
Wir fliegen 3:59 (lyrics) [3BB72308]
Wir fliegen 1:28 (lyrics) [04CDD66F]
---
Black Tar 3:05 (lyrics) [07D2FBE2]
Black Tar 2:54 (lyrics) [046C954F]
Black Tar 6:07 (lyrics) [01546BBB]
Black Tar 3:02 (lyrics) [10692B95]
---
NLA Day 2:32 [34A380BD]
NLA Night 2:32 [385CB3EB]
---
Mono X 3:13 (Title Theme) [3BF547BA]
Mono X 0:28 (Title Theme Short) [1D4BDB58]
Intro movie 2:43 [3A7E454D]
Ganglion attacks! [1D6308EB]
---
By My Side 2:47 (lyrics) [0110CE9F]
By My Side 3:02 (lyrics) [192B075D]
By My Side 0:53 (lyrics) [2760D342]
By My Side 1:24 (lyrics) [02237148]
By My Side 1:35 (lyrics) [2DFE27EE]
---
The Key We Lost 3:20 (lyrics) [37049F10]
The Key We Lost 3:14 (lyrics) [3A86A6BF]
---
The Way 2:42 (lyrics) [3000C72E]
The Way 5:31 (lyrics) [39CC09B1]
The Way 1:42 (lyrics) [0752077F]
The Way 2:35 (instrumental) [004664CC]
The Way 2:47 (instrumental) [009EFAD4]
The Way 5:16 (instrumental) [09E7B59D]
The Way 4:03 (instrumental) [3C696CEB]
---
Melancholia 4:07 (lyrics) [18E419CF]
Melancholia 1:51 (lyrics) [382BCAB2]
Melancholia 1:13 (lyrics) [1560CF1F]
Melancholia 2:37 (lyrics) [1FB6013E]
Melancholia 2:37 (lyrics) [385CB3EB]
---
So nah, so fern 4:38 (lyrics) [26CCF1CA]
So nah, so fern 4:33 (lyrics) [0AE2C071]
So nah, so fern 4:47 (lyrics) [1436A167]
So nah, so fern 1:13 (lyrics) [1560CF1F]
So nah, so fern 3:15 (lyrics) [3759E504]
So nah, so fern 2:10 (lyrics) [3867D75C]
So nah, so fern 4:38 (instrumental) [2765C5CE]
So nah, so fern 4:33 (instrumental) [2FA6CBF2]
So nah, so fern 6:33 (instrumental) [3635105A]
---
Your Voice 5:00 (lyrics) [200A0B3E]
 
  • Like
Reactions: Anonymous42456
Trying to follow this thread and its above my head. This seems way harder then doing this on cemu. Possible to get an explain like I am 5?
 
Here's my custom BGM :P, basically all in-game lyrics themes were replaced by the instrumental counterparts, except Wir fliegen. Cutscenes song themes are untouched.

Also:
NLA Day replaced by The Way 2:35 (no lyrics)
NLA Night
replaced by Mono X 3:13 (Title Theme)
Black Tar (all)
replaced by Ganglion Battle!

Details about themes ID included in music_id.txt

https://mega.nz/file/tE5GkZwQ#ONY-HC6KzTJ7uPwx-gxPMwgj4CDa28gq_AqJccH_g3U
Sorry, how can I pack this file and make it into Musicpck state?
 
I'm using Citron to play my backup in the highest quality possible, but... I can't find a way to get this mod to work! I've tried putting it on different routes, etc., without success.
 
I'm using Citron to play my backup in the highest quality possible, but... I can't find a way to get this mod to work! I've tried putting it on different routes, etc., without success.
/atmosphere/contents/0100453019AA8000/romfs/sound/Music.pck

No idea about emulator path
 
  • Love
Reactions: Gausak
I'm using Citron to play my backup in the highest quality possible, but... I can't find a way to get this mod to work! I've tried putting it on different routes, etc., without success.
Go to mods, make there folder like "Music'' or whatever. Inside folder "romfs", inside "sound" and there put .pck. So it will be "Music\romfs\sound\Music.pck" in the mods.
 
  • Love
Reactions: Gausak
I did a music overhaul mod over on Gamebanana for the Wii U version a few years back. I would like to update it to the Switch version, but currently I have no idea how to get track listing. On Wii U, it was easy. Just had to swap files. On Switch I'm assuming the files are all packed into Music.pck, and have had no success on extracting them. I'm assuming making the .BFSTM files would be straightforward, but currently lack the file structure names to figure out what they would need to be called and what the songs in question would be.
That was a great mod, btw. Thank you. Watching this thread for updates ")
 
unfortunately I couldn't make it work on ryujinx (Ryubing) this night music is horrible my god :/
 
Would it be a lot of trouble for you to make a pack where NLA day and night is replaced with colony 9 day and night, black tar is replaced by black tar instrumental, and the skell flight music is replaced by Theme X?
Here's my custom BGM :P, basically all in-game lyrics themes were replaced by the instrumental counterparts, except Wir fliegen. Cutscenes song themes are untouched.

Also:
NLA Day replaced by The Way 2:35 (no lyrics)
NLA Night
replaced by Mono X 3:13 (Title Theme)
Black Tar (all)
replaced by Ganglion Battle!

Details about themes ID included in music_id.txt

https://mega.nz/file/tE5GkZwQ#ONY-HC6KzTJ7uPwx-gxPMwgj4CDa28gq_AqJccH_g3U
 
Would it be a lot of trouble for you to make a pack where NLA day and night is replaced with colony 9 day and night, black tar is replaced by black tar instrumental, and the skell flight music is replaced by Theme X?
I don’t know how to replace external tracks (colony 9), Black Tar instrumental doesn’t exist you would need to replace (again) for an external track.
 

Site & Scene News

Popular threads in this forum