Skip to content
View in the app

A better way to browse. Learn more.

ResHax

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
Help us keep the site running.

VAG File header help

Featured Replies

  • Author
  • Localization

BAD_AL, posted Sun Apr 24, 2022 11:53 pm (71270)


I'm ripping sounds from Star Wars Battlefront 2 PS2 and I seem to be messing the number of channels in the extracted vag header.

I'm referring to the following:
https://wiki.xentax.com/index.php/VAG_Audio

And have the following code implemented:
https://github.com/BAD-AL/SoundFMVextra ... in.vb#L198

Anyone know what to do to mark the number of channels properly in a .vag header?

Or if you could point me to a stereo .vag file I could study, that would be cool too.
  • Author
  • Localization

BloodRaynare, posted Mon Apr 25, 2022 1:06 am (71271)


VAG is usually always in mono, though some devs have added their stereo variations of it (e.g. in NFS Hot Pursuit 2, it contains usual VAG header but Blackbox modifies the headers a little). You can try to study the vgmstream codes for handling those files here: https://github.com/vgmstream/vgmstream/ ... meta/vag.c
  • Author
  • Localization

BAD_AL, posted Mon Apr 25, 2022 1:56 am (71273)


Well...
Looks like they are using hardcoded knowledge to set the number of channels in there.

Battlefront 2 does mostly have mono sounds (sound fx & voice) but the music and ambiance is 2 channel (in the XBOX and PC versions at least).

Maybe you can point me to a 2-channel .vag file on the internet somewhere?
  • Author
  • Localization

BloodRaynare, posted Mon Apr 25, 2022 2:31 am (71275)


BAD_AL wrote:
Well...
Looks like they are using hardcoded knowledge to set the number of channels in there.

Battlefront 2 does mostly have mono sounds (sound fx & voice) but the music and ambiance is 2 channel (in the XBOX and PC versions at least).

Maybe you can point me to a 2-channel .vag file on the internet somewhere?


Here you can use the sample I've provided (from NFS Hot Pursuit 2)

https://drive.google.com/file/d/12EQFyN ... sp=sharing

Anyway, the most important things I can tell you is, VAG is just a container, it's the content that matters. A stereo PlayStation ADPCM usually consist of two mono streams (well of course duh), interleaved at certain bytes (Must be multiply of 0x10/16-bytes; It's up to the devs which amounts they want to use). Also, there's a lot of other games that don't use any headers at all (or didn't include the interleave values on it's header), and just interleave the streams. To find where the interleave starts for this kind of file, look for the second occurrence of 16-bytes of zeroes (Usually it's close from the start of the files). However, things getting hard for the files that immediately starts without those zeroes.
  • Author
  • Localization

BAD_AL, posted Mon Apr 25, 2022 4:44 am (71277)


After a little more thinking & listening, I think they actually achieve stereo by interleaving the tracks.
So no more changes needed I guess.

Thanks for the info BloodRaynare :)
Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.