Jump to content

Audio Success!


DYosua

Recommended Posts

First off, this experiment is in it's very early stages, and I don't suspect that this will result in an easy to use utility for awhile, but I wanted to share this since we have been trying since 2011 to decode the newer 2K audio format. Given today's holiday, I had time to do a little experimenting and after reading the discussions on the NLSC web site about the NBA format (example here), I was able to successfully replace a bit of the first Jukebox song. A brief videoclip is below - I replaced the start of "Holdin' On To Black Metal" with a stinger from the YES Network.

Like the "NBA" format, the "MLB" format is in WMAv2. The files can be converted from WAV using Microsoft's xWMAEncode command line program. I found that wave files saved as 22050 kHz, 8 Bit Stereo converted to the correct format. Unfortunately, this is not all that is needed since 2K breaks up the files into many chunks. Through a hex editor, I found similarities to the NBA format in terms of chunk headers, but the header length is different. In the MLB format, the header begins with "69 A1 BE D2 02..." and the audio data of each "chunk" begins at offset 4C (decimal 76). Also, I believe the audio data continues to the next header in the NBA format, while in the MLB format it does not. There is a long stretch of "AA" values before the next header in the MLB format, which is not audio. The length of each audio chunk ends up being 1D0B bytes long. As an example, here are the starting and ending positions of the audio portion of the first 9 chunks in jukeboxmusic.bin:

4C - 1D57

204C - 3D57

404C - 5D57

604C - 7D57

804C - 9D57

A04C - BD57

C04C - DD57

E04C - FD57

1A04C - 11D57

At this point I believe don't believe we can change the duration of the tracks themselves (much like the early days of MVP audio modding) but we can replace audio with the same/shorter durations. Also, I have not looked at any other .bin files to see if the audio is compatible but I suspect they probably are.

Again, at this point this is a very manual process, so I don't have any expectations as to when a utility can be created to automate this. I have very limited programming experience in .NET languages, but since the NBA utility is open source I may be able to learn how to perform the file modifications programmatically. I just wanted to share some initial findings, and finally some success on the audio front!

MusicSuccess.wmv

Link to comment
Share on other sites

I too have been trying to figure this out. Another good thread to use is here:
http://forums.nba-live.com/viewtopic.php?f=149&t=91435&start=100

From what I've gathered:

NBA2K Format: WMAv2, 32kbps, Stereo, 44.1 KHz, 16bit

MLB2K Format: WMAv2, 32kbps, Stereo, 22050 KHz, 8bit

Would you agree with this?

Now we need to figure out the offsets within the hex. NBA Audio editor will read the MLB bin files just fine (It recognizes all songs and their durations). However, its unable to correctly replace the tracks as the format is different between the two games. The NBA tracks have to be the same length or shorter so I'm guessing MLB follows the same parameters.

Link to comment
Share on other sites

From what I've gathered:

NBA2K Format: WMAv2, 32kbps, Stereo, 44.1 KHz, 16bit

MLB2K Format: WMAv2, 32kbps, Stereo, 22050 KHz, 8bit

Would you agree with this?

I don't have any of the NBA games, but I agree on the MLB format based on my experiments.

As for the hex offsets, I believe there is a way to figure out where songs start. As part of the header for each chunk, I think there is a counter that increments in each chunk. In the attached image, I have highlighted them. The first four are from the beginning of the file. Obviously, I skipped most of the chunks between the third and the fourth. The bottom one in the image has the counter reset, which I think signals the beginning of the next song (which I think I saw mentioned in the NBA threads).

One thing I didn't notice until now is that position the audio portion starts at does not always appear to be the same. I have highlighted what I believe those starting positions are in yellow. I determined their starting positions by noticing that there are hex values that are repeated before other values start. These were (in the pictures):

Chunk 1: A4 01 00

Chunk 2: 5C 02 00

Chunk 3: 70 02 00

Chunk 4: 70 02 00

Chunk 5: 70 01 00

I don't know what the significance is of these values, but changing the data after it appears to work so far (although I haven't gotten as far as the fourth chunk to see if the offset is different).

post-10874-0-50916600-1401153510_thumb.j

Link to comment
Share on other sites

Here are the tracks and song lengths. Like I said I'm very certain we need to follow the same parameters as the NBA series. Tracks of equal lengths or less. My question is how are you coverting the wav to 22050 khz as xWMAEncode won't allow this? Thanks for the help.

post-67822-0-94212800-1401232040_thumb.j

Link to comment
Share on other sites

I used Adobe Audition for my test file, but a freeware alternative such as Audacity should also be able to convert and save a file into the proper wave format. From there you can run xWMAEncode using the -b 32000 parameter as outlined in the NBA threads. That should yield an XMA file that is in the proper format, at which time it can be broken up and placed within the existing chunks of the jukebox file.

Link to comment
Share on other sites

  • 2 weeks later...

6/7/2014 Update

After some experimentation, I believe I was able to modify the NBA Audio Editor tool (which is open source) to be able to import tracks into 2K11/2K12 bin files. There were a few assumptions that I made about the audio format which resulted in one or two "hard-coded" changes I would have rather had a programmatic solution for, but so far in my testing all has gone well. A few facts about the format:

  • The header format is similar to the NBA files, but are shorter because MLB files have fewer packets per audio "chunk"
  • Each chunk is made up of no more than 5 packets
  • Each packet is 1,487 bytes in size
  • Each chunk has a filler at the end of it, the size of which is 8,192 - (56 + (4*PacketCount) - (1,487 * PacketCount)) bytes long

I believe the filler is primarily why the existing NBA tool did not work with these files, as it threw off some of the offsets the program was calculating (as well as other properties like file durations). Since this has been addressed, NBA files can no longer be used in this tool.

You should be able to feed the program any wav or MP3 file (whether it is the correct sample rate or not) and it should convert it into the correct format. From there, the program will filter the list of slots to only ones that are longer than the song you are trying to add. For best results, the duration of the new file you are replacing should be close to the original duration.

All that said, I want to release the preliminary version of the modified program so people can experiment with it. It is by no means finished, but it is hopefully a good first step.

While the program can successfully import files, exporting files still results in something unrecognizable, even though I made analogous changes to the exporting code. So unfortunately for now, I have disabled the ability to export .xma/.wav files. This means that there is really no way to preview which files you are replacing. I have stuck to editing jukeboxmusic.bin so far, and the order in the file is the same as it appears in the 2K Beats section of the game.

Anyway, a huge thanks goes to Leftos and nesa24 from the NLSC forums for their initial work on this - not being well versed in .NET C# programming, I would not have been able to build something like this from scratch. The program comes in a .zip file with a folder. Simply extract the folder and open the "MLBAudioEditor.exe" file and start changing music! As always, backup your original file first!

MLB Audio Editor v0.1.0.0

Link to comment
Share on other sites

This is incredible... with a new (non-freezing) roster, an audio editor, and some new modders in the mix - 2K14 is shaping up nicely. Makes me wanna work on some stadiums.. :)

This really deserves more hype... everyone try to make an effort to appreciate your modders... they do make the game better for you at (99% of the time) no cost... these things take weeks and months

Link to comment
Share on other sites

  • 2 weeks later...

Thanks KC. I had watched that as well and still no luck. With my recent reinstall I have not had any luck getting my old Guru REDitor II keys to work either. I have emailed Vlad several times with no response so I am weary about purchasing any more licenses from Vlad.

Link to comment
Share on other sites

6/21/2014 Update

After some experimentation, I was able to implement listening to some of the files through the editor. Currently, you cannot listen to/replace the speech files (as it seems to be a different combination of sample rate/bitrate/channels), but the jukebox, pa music, and most chants are listenable. You will know when a selection is finished when you hear a soft "hiss," after which you can hit the "Stop" button. Download v0.2.0.0 here.

Link to comment
Share on other sites

Awesome news! Now we can also add proper songs blaring from the stadium speakers, instead of the original (and boring) songs from the game ;) Thank you so much DYosua, this is great!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...