News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: Proper music conversion for ps1  (Read 4937 times)

DeGamer

  • Jr. Member
  • **
  • Posts: 86
    • View Profile
    • My vids & stuff
Proper music conversion for ps1
« on: September 24, 2010, 05:34:29 pm »
After days of playing around with CDRWin, psx cdgen, psxisomaker, psone iso maker pro, makecti, buildcd, stripiso, TOC changer, and some others I forget, I finally managed to rebuild a working ISO from an original psx game disc.  ;D I gotta thank Cless for his psx doc. I remember the days when I first tried doing this years ago using psx2hd (Sometimes it worked, most of the time it didn't and sometimes it sorta worked.) :crazy:

Anyway my main question, this game (Rockman Complete Works) has two XA archives (BGM.XA and BGMA.XA). Both are multichannel and have 16 and 8 songs respectively. I changed the first and last channel tracks on the first XA archive (BGM.XA) I did this to see if I can rebuild the image much larger than the original. The image worked.  :happy: but any of the tracks that play within the first XA archive (the one I changed 2 track in) skip while playing the game.   :-\ The tracks from the second XA archive (which I did not alter), play just fine.

Here's what I did. After I used CDRWin to make exact copies of the game files, I used PSMplay to open the first XA multichannel archive and saved all tracks to Wave format. Then I took 2 tracks from completely different songs and converted them to Wave. Those two tracks I used as replacements for the tracks in the XA archive. I then used MC 3.1 to recreate a multichannel XA file (I have yet to see another way to convert to XA). Once it was done, I tested it with PSMplay and it worked just fine for each track. Then I rebuilt the game ISO again but replaced the original XA archive with my new one.  The game plays on emulators with the new ISO, but it skips quite a bit when playing any track form the first XA archive (the tracks from the second archive still work). Did I miss something when recreating the XA file?  :-[ How can this be corrected? Never mind, see below
                         |
                         |
                         ↓
EDIT: Well it turns out that I mistakenly used MC to convert the Waves to stereo. The originals were monaural. I had saved the songs as mono Waves but forgot to set the attributes in MC to mono as well.  ::) The tracks play properly now except for the two I edited.

The 1st is over 3 minutes shorter, so after it plays, it is silent until the game would normally re-loop the track again and then it plays over. The 2nd one I edited is over the original by 4 seconds. The extra 4 seconds don't play in the game. The
second one is not so bad but the first is horrible. I'm guessing the game specifies whether each track is stereo or monaural as well as the length of each track (which makes sense). How can I go about specifying the track length? or telling the game whether the track is stereo or mono?
« Last Edit: January 03, 2011, 05:00:45 pm by DeGamer »
Yo were can I git dem roms at??!!11!
Oh shit you can hack games now???????
Translate my game pleeze!!!11!!1 It only haz a small exabyte block of text.
Can my avatar size be over 9000? Ppleeze! Me love you forevr longtime!!!111!1

DeGamer

  • Jr. Member
  • **
  • Posts: 86
    • View Profile
    • My vids & stuff
Re: Proper music conversion for ps1
« Reply #1 on: January 03, 2011, 04:59:42 pm »
I'm back toying around with this (yeah I know it's been a while  :P ). And here is what I found/understand.  :)

Each XA archive has a pointer, which then has a pointer for each track/channel within the archive and with some data after it. This data specifies the length of each track, where the track should start playing from, the track number in the archive, and which archive to play a track from. Somewhere else in the game I guess it specifies whether a track repeats or not, but that's alright as I don't need that. What would be helpful though if there was a way to have a track loop over from a different point within the song (some songs have intros which shouldn't be a part of when the song re-loops) but from I see, this format does not support that (like the ADX format for Dreamcast does).

It also seems that you can have multiple songs within one track. Let's say one song is 3 minutes and the other is 1m30s. Both songs can be in the same track one after the other. The game specifies at what point in that track the second song starts and what the length for that second song in the same track is. I hope my explanation made sense.  :-\

The thing I don't understand is how the track length is measured in hex.  :huh:  It's not in minutes or seconds and not even centiseconds or milliseconds. For example, 92 01 (in hex) equals 2.88 seconds in a track. I changed the values in a hex editor to see if I could figure out.  From what I played around with, 1 second is approximately 96h. However, I can never get the timing right (I'm always a bit over or under).  :(  How is a track length represented like this?

I'm guessing the game also specifies (don't know where) how many tracks (channels) are in each XA archive and whether it contains stereo or monaural songs ( I say this because I tried changing a mono archive to stereo & vice versa, and while the game plays, the songs skip. They also skip if I make the multi channel archive bigger or smaller in terms of track/channel numbers). Are there some know standards values for this? Let's say if an archive contains mono track, I'm guessing the value for this would be something like 0 or 1, right? Also, let's say the archive had 5 songs, it would be represented as 4 or 5, right?  :-\


The main thing I want to know is how the track lengths are measured in hex? (This will also help a track re-loop properly). I can make the ISO much smaller by cutting down tracks, say that one plays for over 5 minutes, but in actuality the song is 36 seconds long. I can make it 36 seconds and just have it re-loop from there. With space freed up like that I can add some songs (and still keep the ISO smaller) for when I do release a patch for this game. Any one have any idea? Or does any one know of any documentation that explains this? I searched but found nothing. I didn't find anything regarding changing Playstation 1 music at all (only Dreamcast, PS2, Gamecube, Xbox, Saturn, ect...)
« Last Edit: January 04, 2011, 01:49:11 am by DeGamer »
Yo were can I git dem roms at??!!11!
Oh shit you can hack games now???????
Translate my game pleeze!!!11!!1 It only haz a small exabyte block of text.
Can my avatar size be over 9000? Ppleeze! Me love you forevr longtime!!!111!1

DeGamer

  • Jr. Member
  • **
  • Posts: 86
    • View Profile
    • My vids & stuff
Re: Proper music conversion for ps1
« Reply #2 on: January 12, 2011, 01:29:24 pm »
Well, after further toying around, I think I figured it out.  :)  The music works fine so it must be alright (and it re-loops properly). I guess this info is not readily available seeing as no one else responded. I must say, it's a lengthy process with various programs involved. But it's not hard to do. The only thing I didn't find out is how the game can tell how many tracks (channels) are in each XA archive and whether they are in stereo or monaural sound. But that doesn't matter as I was able to add 16 songs anyway. And I can still add many more  :laugh:

I could make a document about it providing examples. Would anyone be interested?  :-\
Yo were can I git dem roms at??!!11!
Oh shit you can hack games now???????
Translate my game pleeze!!!11!!1 It only haz a small exabyte block of text.
Can my avatar size be over 9000? Ppleeze! Me love you forevr longtime!!!111!1

RetroHelix

  • Full Member
  • ***
  • Posts: 147
    • View Profile
Re: Proper music conversion for ps1
« Reply #3 on: January 12, 2011, 02:38:34 pm »
Sorry, I'm not interested but its always nice to have such data documented somewhere. Who knows, maybe there are people out there who are interested but not registered here. And besides that its nice to know how things work even you don't have a use for the provided information.

DeGamer

  • Jr. Member
  • **
  • Posts: 86
    • View Profile
    • My vids & stuff
Re: Proper music conversion for ps1
« Reply #4 on: January 17, 2011, 09:24:57 pm »
I see. And you're right (but boy oh boy do I wish this was available already as I didn't think I'd get anywhere by myself, let alone figure out how it worked). I'll make it anyway then  :D
Thanks.
Yo were can I git dem roms at??!!11!
Oh shit you can hack games now???????
Translate my game pleeze!!!11!!1 It only haz a small exabyte block of text.
Can my avatar size be over 9000? Ppleeze! Me love you forevr longtime!!!111!1

wakutan

  • Newbie
  • *
  • Posts: 1
    • View Profile
Re: Proper music conversion for ps1
« Reply #5 on: March 15, 2016, 03:02:34 pm »
Hi,

I know this is an old post. But I am really interested for a guide how you did this.
I am currently trying to replace BGM XA files in Mega Man X4.

I extracted XA files from the disc. These XA files have layered/multi channels in it. Like your.
I've managed to extract these .XA files from BGM1_U.XA using QuickBMS.

BGM1_U_1
BGM1_U_2
BGM1_U_3
BGM1_U_4
BGM1_U_5
BGM1_U_6
BGM1_U_7
BGM1_U_8

Now I want to convert them to .wav and replace BGM1_U_6 with other music. How did you re-compile it in a multi channel .XA file?

Thanks!