PCEngine-FX.com

PCE-FX Homebrew Development => Localizations, Games, Apps, Docs => Topic started by: Magister on 02/12/2017, 02:19 AM

Title: Changing music files in a game
Post by: Magister on 02/12/2017, 02:19 AM
So, I was looking at one of the ROM sites to make a back up copy of Rondo of Blood and came across one set that changed the soundtrack and used the Perfect Arrangement music instead.  I like the choice in music except for the menu music.  I know you can't just rename the new music with the original's file name.  Already tried that and it just screws up all the music.  Just wondering what exactly you need to do when changing music files?
Title: Re: Changing music files in a game
Post by: ParanoiaDragon on 02/13/2017, 01:07 AM
With some games,  you can just rename the new tunes you put in, but deffinitely not every game!  I tried this on Legion, where the tunes are PSG, but it also has a redbook audio track of a guy speaking in english while you're shooting stuff.  The problem with that game, as well as many others, is that you have to make sure the new track you insert is EXACTLY the same length!

For instance, I think the redbook audio dialogue in Legion is only 30-45 seconds long, but you get all kinds of wierdness when you insert a song that's 3 minutes long!  You need a program that can open WAV files.  I use Sound Forge.  I'll open the original track, make a mark at the end.  Then I paste the new track over it, & if it goes past the mark, I delete that part.  Then I fade about 15 seconds of the end of the song, so it doesn't stop all of a sudden, but just fades like alot of songs do.  I hope that all makes sense & is helpful.

I plan on remaking the Bonk 3 CD soundtrack from scratch with my equipment(to make the songs sound more Bonkish) & do this exact teqnique soon if I can get the motivation back.  Been having trouble with 2 sound channels on my keyboard playing at the same time, so I have that to figure out, plus been having general PC problems that I hope to have resolved soon & have more time for this kind of stuff!

Also, for games that do this, the other way to take care of the problem is to have someone reprogram it. ](*,)
Title: Re: Changing music files in a game
Post by: Magister on 02/14/2017, 02:08 PM
Thanks for the advice.  I just want to change one track.  But when I do, it screws up the whole soundtrack for the game.  The track I'm trying to use is in MP3 form.  I wonder if changing it to WAV will do the trick.
Title: Re: Changing music files in a game
Post by: Magister on 02/14/2017, 10:47 PM
Well, changing it to a WAV file didn't work.  When I get time I'll have to try your suggestion and make the music file the same length as the one in the game.
Title: Re: Changing music files in a game
Post by: ParanoiaDragon on 02/15/2017, 01:28 AM
It needs to be WAV, or whatever is listed in the cuesheet.  For instance, on my WII, I have Turbo CD's that use the OGG format for the redbook audio in WiiMednafen.  OGG doesn't lose too much in quality, & it cuts down how big the games are tremdously.  Of coarse, if you want to play it on real hardware, it deffinitly has to be WAV.  I think the same goes for Magic Engine.  Probably regular Mednafen supports OGG, but I don't believe it supports MP3.
Title: Re: Changing music files in a game
Post by: vacantplanets on 02/16/2017, 12:16 AM
Quote from: Magister on 02/14/2017, 02:08 PMThanks for the advice.  I just want to change one track.  But when I do, it screws up the whole soundtrack for the game.  The track I'm trying to use is in MP3 form.  I wonder if changing it to WAV will do the trick.
I can probably help you with this; I've done this a million times.

What do you mean by "it screws up the whole soundtrack"?

It definitely has to be WAV. Yes, all you do is change the name of your new file to match the filename of the file you want to replace. I never had to worry about the length of the tracks so I guess I just got lucky. One more thing, and I bet this is your problem, when you convert your MP3 or whatever to WAV, the WAV file has to be set to 16 bit PCM and 44.1 kHz (44100 Hz) or it won't work. I use Audacity to convert my files.
Title: Re: Changing music files in a game
Post by: ParanoiaDragon on 02/16/2017, 03:33 AM
I'm sure he means that tracks play in the wrong levels &/or start in the middle of the track!  IIRC, I had this on Bonk 3 CD, lot's of wierdness when replacing tracks, same goes for Legion.  Sylphia on the otherhand can be done without screwing up the placement of the tracks.  I was able to do that Hard Rock version, though I did have Bonknuts do a lil' finagling with the final boss, so that there would be an extra track.  I don't recall any problems replacing tracks in general on the game.
Title: Re: Changing music files in a game
Post by: vacantplanets on 02/16/2017, 03:51 AM
Quote from: ParanoiaDragon on 02/16/2017, 03:33 AMI'm sure he means that tracks play in the wrong levels &/or start in the middle of the track!  IIRC, I had this on Bonk 3 CD, lot's of wierdness when replacing tracks, same goes for Legion.  Sylphia on the otherhand can be done without screwing up the placement of the tracks.  I was able to do that Hard Rock version, though I did have Bonknuts do a lil' finagling with the final boss, so that there would be an extra track.  I don't recall any problems replacing tracks in general on the game.
Okay, well I don't know how you're doing it exactly. Let me explain, if the image is in BIN/CUE format, I use IsoBuster to open the CUE file and right click on "session 1" and select "extract session one" then "extract user data" in order to convert the image to ISO/WAV format. Then of course you replace the file you want to change and rename the new 16 bit 44.1 kHz WAV file to match the old one. Now you need a new CUE sheet so use TocFixer to quickly generate one: https://www.ysutopia.net/index.php?ind=downloads&op=entry_view&iden=4 That's it.

Now if you want to convert it back to BIN/CUE then mount the CUE on virtual drive e.g. daemon tools
then open IMGburn, select create image file from disc. select virtual drive for source. make sure destination is set to BIN file type.
Title: Re: Changing music files in a game
Post by: JoshTurboTrollX on 02/16/2017, 09:41 AM
This is fascinating!  Thanks for the pointers!
Title: Re: Changing music files in a game
Post by: Magister on 02/16/2017, 06:10 PM
Quote from: ParanoiaDragon on 02/16/2017, 03:33 AMI'm sure he means that tracks play in the wrong levels &/or start in the middle of the track!  IIRC, I had this on Bonk 3 CD, lot's of wierdness when replacing tracks, same goes for Legion.  Sylphia on the otherhand can be done without screwing up the placement of the tracks.  I was able to do that Hard Rock version, though I did have Bonknuts do a lil' finagling with the final boss, so that there would be an extra track.  I don't recall any problems replacing tracks in general on the game.
Dragon nailed it.  Music plays on the wrong levels, or starts in the middle of the track, or cuts off and starts playing something else.

For Rondo of Blood, I have all the music files in WAV format separate.  Then there are two ISO files, a TOC file and the CUE file.  I tried to take a music file, change it to WAV and rename it exactly the same as the one I was replacing.  It didn't work.  I only did this for one music file and yet it messed up all the music in the game.  I figured it would have been a simple renaming the new file with the old file name.  Guess not that simple.
Title: Re: Changing music files in a game
Post by: vacantplanets on 02/16/2017, 06:41 PM
Quote from: Magister on 02/16/2017, 06:10 PM
Quote from: ParanoiaDragon on 02/16/2017, 03:33 AMI'm sure he means that tracks play in the wrong levels &/or start in the middle of the track!  IIRC, I had this on Bonk 3 CD, lot's of wierdness when replacing tracks, same goes for Legion.  Sylphia on the otherhand can be done without screwing up the placement of the tracks.  I was able to do that Hard Rock version, though I did have Bonknuts do a lil' finagling with the final boss, so that there would be an extra track.  I don't recall any problems replacing tracks in general on the game.
Dragon nailed it.  Music plays on the wrong levels, or starts in the middle of the track, or cuts off and starts playing something else.

For Rondo of Blood, I have all the music files in WAV format separate.  Then there are two ISO files, a TOC file and the CUE file.  I tried to take a music file, change it to WAV and rename it exactly the same as the one I was replacing.  It didn't work.  I only did this for one music file and yet it messed up all the music in the game.  I figured it would have been a simple renaming the new file with the old file name.  Guess not that simple.
Did you use TocFixer?
Title: Re: Changing music files in a game
Post by: Magister on 02/16/2017, 07:04 PM
Quote from: vacantplanets on 02/16/2017, 06:41 PMDid you use TocFixer?
I'm new to all these programs.  Just learned how to make back up CDs.  So I have no idea what TocFixer is.
Title: Re: Changing music files in a game
Post by: vacantplanets on 02/16/2017, 08:16 PM
Quote from: Magister on 02/16/2017, 07:04 PM
Quote from: vacantplanets on 02/16/2017, 06:41 PMDid you use TocFixer?
I'm new to all these programs.  Just learned how to make back up CDs.  So I have no idea what TocFixer is.
Did you read my post above where I gave you the link? https://www.ysutopia.net/index.php?ind=downloads&op=entry_view&iden=4

It couldn't be easier to use. The instructions are literally built in to the program. Download it, run it, and follow the directions. Select "Akumajou Dracula X - Chi no Rondo (J)", click browse and select your game's folder, then click repair. That's it.
Title: Re: Changing music files in a game
Post by: Magister on 02/16/2017, 09:47 PM
Quote from: vacantplanets on 02/16/2017, 08:16 PM
Quote from: Magister on 02/16/2017, 07:04 PM
Quote from: vacantplanets on 02/16/2017, 06:41 PMDid you use TocFixer?
I'm new to all these programs.  Just learned how to make back up CDs.  So I have no idea what TocFixer is.
Did you read my post above where I gave you the link? https://www.ysutopia.net/index.php?ind=downloads&op=entry_view&iden=4

It couldn't be easier to use. The instructions are literally built in to the program. Download it, run it, and follow the directions. Select "Akumajou Dracula X - Chi no Rondo (J)", click browse and select your game's folder, then click repair. That's it.
Sorry, battling a really bad cold right now.  I'll check this stuff out tomorrow when hopefully I feel better.
Title: Re: Changing music files in a game
Post by: ParanoiaDragon on 02/17/2017, 03:00 AM
I've never used TocFixer, will have to check that out.  Maybe that'll save my Legion project.....not that the game is all that great, but, having boosted tunes & no voice acting during the action might make it better......maybe.
Title: Re: Changing music files in a game
Post by: deubeul on 02/17/2017, 05:35 AM
IMO the voice is the only good thing in this game  :D
Title: Re: Changing music files in a game
Post by: ParanoiaDragon on 02/17/2017, 09:24 PM
Quote from: deubeul on 02/17/2017, 05:35 AMIMO the voice is the only good thing in this game  :D
Heh, you're probably right!  Although, a lot of the tunes have grown on me lately.  It's amazing how much of a turd that game is.
Title: Re: Changing music files in a game
Post by: Magister on 02/18/2017, 03:55 PM
Well, I download Audacity and Tocfixer.  Did the whole 44100 and changing the WAV file to 16 bit.  Ran the Tocfixer and it shows 19 errors which it mostly all the files but says it changed the CUE file.  Music still screws up in the game though.  Not sure why it is showing an error for all the other music files considering I only changed one file.
Title: Re: Changing music files in a game
Post by: vacantplanets on 02/18/2017, 07:19 PM
Quote from: Magister on 02/18/2017, 03:55 PMWell, I download Audacity and Tocfixer.  Did the whole 44100 and changing the WAV file to 16 bit.  Ran the Tocfixer and it shows 19 errors which it mostly all the files but says it changed the CUE file.  Music still screws up in the game though.  Not sure why it is showing an error for all the other music files considering I only changed one file.
Okay. I don't know what to say. I'll try to figure it out and I'll upload it for you if I can. I have the perfect arrangement version. What track do you want to use as a replacement? The original menu music? Which track number is it?

Btw, it's going to show errors for all the files that aren't the original ones from the game. I just use that program to quickly generate a cue sheet. I never had to worry about the other stuff.
Title: Re: Changing music files in a game
Post by: Magister on 02/18/2017, 08:36 PM
Quote from: vacantplanets on 02/18/2017, 07:19 PM
Quote from: Magister on 02/18/2017, 03:55 PMWell, I download Audacity and Tocfixer.  Did the whole 44100 and changing the WAV file to 16 bit.  Ran the Tocfixer and it shows 19 errors which it mostly all the files but says it changed the CUE file.  Music still screws up in the game though.  Not sure why it is showing an error for all the other music files considering I only changed one file.
Okay. I don't know what to say. I'll try to figure it out and I'll upload it for you if I can. I have the perfect arrangement version. What track do you want to use as a replacement? The original menu music? Which track number is it?

Btw, it's going to show errors for all the files that aren't the original ones from the game. I just use that program to quickly generate a cue sheet. I never had to worry about the other stuff.
When you use TocFixer, does it fix and replace the old file or does it create a new CUE file in a new folder?  I'm assuming it replaces the old file.
Title: Re: Changing music files in a game
Post by: vacantplanets on 02/18/2017, 10:22 PM
Well since you have to select the folder your game files are in, it uses that one; it doesn't put the cue in a different folder. To be safe just remove the cue file from that folder and have it generate a new one.
Title: Re: Changing music files in a game
Post by: Magister on 02/19/2017, 10:03 AM
Quote from: vacantplanets on 02/18/2017, 10:22 PMWell since you have to select the folder your game files are in, it uses that one; it doesn't put the cue in a different folder. To be safe just remove the cue file from that folder and have it generate a new one.
Removed the CUE file before making a new one.  Checked the other WAV files and compared them to the one I'm using as a replacement and it matches channels, 44100 KHz and 16-Bit of the other WAV files.  Still messes up the music in the game.
Title: Re: Changing music files in a game
Post by: spenoza on 02/19/2017, 10:09 AM
Do the track times in the Cue file match the actual music track lengths.
Title: Re: Changing music files in a game
Post by: Magister on 02/19/2017, 01:23 PM
Quote from: guest on 02/19/2017, 10:09 AMDo the track times in the Cue file match the actual music track lengths.
Not sure where to find the track times in the CUE file.  I try opening the file but it doesn't show anything.
Title: Re: Changing music files in a game
Post by: vacantplanets on 02/19/2017, 02:20 PM
Quote from: Magister on 02/19/2017, 01:23 PM
Quote from: guest on 02/19/2017, 10:09 AMDo the track times in the Cue file match the actual music track lengths.
Not sure where to find the track times in the CUE file.  I try opening the file but it doesn't show anything.
You have to open the cue file with Notepad.

Like I said though,  I'll try to figure it out and I'll upload it for you if I can. I have the perfect arrangement version. What track do you want to use as a replacement? The original menu music? Which track number is it?
Title: Re: Changing music files in a game
Post by: Magister on 02/19/2017, 02:43 PM
Quote from: vacantplanets on 02/19/2017, 02:20 PM
Quote from: Magister on 02/19/2017, 01:23 PM
Quote from: guest on 02/19/2017, 10:09 AMDo the track times in the Cue file match the actual music track lengths.
Not sure where to find the track times in the CUE file.  I try opening the file but it doesn't show anything.
Interesting.  So I opened it with Notepad.  But there are no times for the tracks.  All the tracks have 0's for times.  Maybe it's just this game file itself.  Anyways, I'm just trying to figure out how to change the music files.  I'm not going to have you go through all the trouble for just one track.  If I can figure this out, I would like to change almost every track which is the goal.

You have to open the cue file with Notepad.

Like I said though,  I'll try to figure it out and I'll upload it for you if I can. I have the perfect arrangement version. What track do you want to use as a replacement? The original menu music? Which track number is it?
Title: Re: Changing music files in a game
Post by: vacantplanets on 02/19/2017, 03:07 PM
That's fine about the zeros. That's what it's supposed to be when it's all extracted like that in a ISO/WAV/CUE format. If it was in a BIN/CUE format, the CUE sheet would look different.

Okay, so I suppose you could try changing the track's length to match the one that was working. If you have to do that, then it wouldn't be a bad idea to add a 15 second fade out like Paranoia Dragon said. I would just use Audacity to edit the track. It's just the menu music anyway, not a big deal, haha.

Btw, what are you using to test it? Ootake or some other emulator? You're not burning CD-Rs right?
Title: Re: Changing music files in a game
Post by: Magister on 02/19/2017, 03:54 PM
Quote from: vacantplanets on 02/19/2017, 03:07 PMThat's fine about the zeros. That's what it's supposed to be when it's all extracted like that in a ISO/WAV/CUE format. If it was in a BIN/CUE format, the CUE sheet would look different.

Okay, so I suppose you could try changing the track's length to match the one that was working. If you have to do that, then it wouldn't be a bad idea to add a 15 second fade out like Paranoia Dragon said. I would just use Audacity to edit the track. It's just the menu music anyway, not a big deal, haha.

Btw, what are you using to test it? Ootake or some other emulator? You're not burning CD-Rs right?
I'm going to try and DL the original game file and try changing some of the music and see what happens.  If I get the same results, I'll try matching track times.  What I don't understand is why all the music tracks aren't listed for the game.  Like the pre-boss room music is awful but it's not a music file.
Title: Re: Changing music files in a game
Post by: vacantplanets on 02/19/2017, 04:39 PM
Quote from: Magister on 02/19/2017, 03:54 PM
Quote from: vacantplanets on 02/19/2017, 03:07 PMThat's fine about the zeros. That's what it's supposed to be when it's all extracted like that in a ISO/WAV/CUE format. If it was in a BIN/CUE format, the CUE sheet would look different.

Okay, so I suppose you could try changing the track's length to match the one that was working. If you have to do that, then it wouldn't be a bad idea to add a 15 second fade out like Paranoia Dragon said. I would just use Audacity to edit the track. It's just the menu music anyway, not a big deal, haha.

Btw, what are you using to test it? Ootake or some other emulator? You're not burning CD-Rs right?
I'm going to try and DL the original game file and try changing some of the music and see what happens.  If I get the same results, I'll try matching track times.  What I don't understand is why all the music tracks aren't listed for the game.  Like the pre-boss room music is awful but it's not a music file.
Sounds good.

The pre-boss room music isn't redbook or from a WAV file; it's a chiptune, PSG. Yeah, I don't like it either. It's an odd choice because it definitely stands out from the other tracks.
Title: Re: Changing music files in a game
Post by: Magister on 02/19/2017, 07:15 PM
So after all the headache, PDragon was right.  The track has to be the same length as the original.  Now, I did this with the original game file and not the Perfect Arrangement game file.  So I'm not sure if that had anything to do with it.  I do want to look an see if the PA music files stayed the same length or if he extended them when he added the other music.
Title: Re: Changing music files in a game
Post by: vacantplanets on 02/19/2017, 07:46 PM
Quote from: Magister on 02/19/2017, 07:15 PMSo after all the headache, PDragon was right.  The track has to be the same length as the original.  Now, I did this with the original game file and not the Perfect Arrangement game file.  So I'm not sure if that had anything to do with it.  I do want to look an see if the PA music files stayed the same length or if he extended them when he added the other music.
Nice. I don't understand why some games need you to do this and others don't. For example, I took tracks from Lords of Thunder and replaced every song in Sapphire. I also took tracks from Gate of Thunder and replaced every song in Sapphire with those too. Never had to worry about this shit.

Yeah, the Perfect Arrangement tracks are the same length as the originals.
Title: Re: Changing music files in a game
Post by: OldMan on 02/19/2017, 08:11 PM
QuoteNice. I don't understand why some games need you to do this and others don't. For example, I took tracks from Lords of Thunder and replaced every song in Sapphire. I also took tracks from Gate of Thunder and replaced every song in Sapphire with those too. Never had to worry about this shit.
The CD_BIOS has a few ways of playing audio tracks.
The first involves playing by a track number (0-99). To do that, the track number has to be converted to an absolute disc adddress.
The second is actually by absolute disc address (since the routine is already available, see above).

Some games use method one; other games use method two. It depends on what the programmers decided when laying out the cd image.
Title: Re: Changing music files in a game
Post by: Magister on 02/19/2017, 08:51 PM
I should mention that when I used Tocfixer before I changed the length of the music file it said that it was too big of a file and aborted the repair.  But, that I could go into Tocfixer's settings and change the size limit allowed or something like that.  I've looked and can't figure out where these changes could be done.  Of course it did say that it might screw things up if they were changed.  But after looking at the length of some of the game tracks, they really aren't that long which sucks.
Title: Re: Changing music files in a game
Post by: vacantplanets on 02/19/2017, 09:13 PM
Quote from: TheOldMan on 02/19/2017, 08:11 PM
QuoteNice. I don't understand why some games need you to do this and others don't. For example, I took tracks from Lords of Thunder and replaced every song in Sapphire. I also took tracks from Gate of Thunder and replaced every song in Sapphire with those too. Never had to worry about this shit.
The CD_BIOS has a few ways of playing audio tracks.
The first involves playing by a track number (0-99). To do that, the track number has to be converted to an absolute disc adddress.
The second is actually by absolute disc address (since the routine is already available, see above).

Some games use method one; other games use method two. It depends on what the programmers decided when laying out the cd image.
Thanks. So is there any way of getting around this when it wants the tracks to have a certain length?

Quote from: Magister on 02/19/2017, 08:51 PMI should mention that when I used Tocfixer before I changed the length of the music file it said that it was too big of a file and aborted the repair.  But, that I could go into Tocfixer's settings and change the size limit allowed or something like that.  I've looked and can't figure out where these changes could be done.  Of course it did say that it might screw things up if they were changed.  But after looking at the length of some of the game tracks, they really aren't that long which sucks.
I never tried it, but all you have to do is open TocFixer.ini with notepad and set "WaveResizeLimitInSeconds=" to whatever you want.
Title: Re: Changing music files in a game
Post by: OldMan on 02/20/2017, 01:01 AM
QuoteSo is there any way of getting around this when it wants the tracks to have a certain length?
There are always ways around those things. The question is, is it worth the time and effort.
No.
...
There are 2 paths someone could take to fix it.
The first would be to change the calls to use track number. Of course, that requires hunting down all the audio triggers, and changing the calls. Then making sure the area for reading the TOC is available. Etc.
The second would be to build an iso image with the audio in place, and using the offsets in the new image for the calls. Of course, you would have to do that every time you changed the track lengths.

Can it be done? Yes. Would it be easy? Not unless you know a -lot- about both the game and the cd layout.
Title: Re: Changing music files in a game
Post by: Magister on 02/20/2017, 06:07 PM
Quote from: vacantplanets on 02/19/2017, 09:13 PMI never tried it, but all you have to do is open TocFixer.ini with notepad and set "WaveResizeLimitInSeconds=" to whatever you want.
That's all fine if I understood what it means.  In the notepad it's set to 3 right now.  Not sure what the 3 equals.  Can I just use 0 to make it unlimited?
Title: Re: Changing music files in a game
Post by: vacantplanets on 02/20/2017, 06:13 PM
Quote from: Magister on 02/20/2017, 06:07 PM
Quote from: vacantplanets on 02/19/2017, 09:13 PMI never tried it, but all you have to do is open TocFixer.ini with notepad and set "WaveResizeLimitInSeconds=" to whatever you want.
That's all fine if I understood what it means.  In the notepad it's set to 3 right now.  Not sure what the 3 equals.  Can I just use 0 to make it unlimited?
No, I believe it's the number of seconds difference between the original track length and the new one.