Information of the ADPCM PlayStation Audio Format and how to Convert it.
You Will Need:
Before starting the process of converting an STR file, please note that this is a confusing format unless you have experience converting it, please read the tutorial multiple times if needed - it is very difficult to explain some of the steps.
Overview: Some PlayStation 2 games, usually THQ ones, use an ADPCM (Adaptive differential pulse-code modulation) format to store game soundtrack. The specific format for this is PlayStation 4-Bit ADPCM. Inside the archive containing the music you will find several files, including a file table, an empty .wav file, and a .str file. The STR file is the actual stream we are looking at. These archives can contain multiple songs or only a single song, and the streams are interleaved together. Unfortunately, when this format shows up it usually is headerless, which means you will need to manually figure out the values the audio is encoded with to convert it. There are a couple of possible scenarios here:
- The file contains 1 mono audio track. This will simply convert using VGMStream right away. These are however pretty rare because most games only have stereo tracks.
- The file contains 1 stereo track. Because this file contains 1 audio stream with two tracks (two channels - stereo), it will be in an interleaved format and will not convert right away. First you need to find the 'Interleave' value - more on that later.
- The file contains multiple stereo tracks. This is by far the most common situation, and unfortunately the most complicated to figure out. In THQ games, there are usually 2-4 tracks in stereo format.
- To help understand this better - think of an example: The file contains 3 stereo tracks, which is a total of 6 streams (3 tracks * 2 channels). The 6 streams are interleaved together.
- Why do games use this format? In most earlier THQ games, the soundtrack dynamically changes during gameplay depending on where the player is located. There are normally 3 of these tracks, one is an 'idle' theme, one is the 'normal' theme, and one is the 'action' theme. The idle theme normally plays if the player is in dialouge with another character in the game, and is used simply as background music. The 'normal' theme is used as the normal game soundtrack, playing when the player is nagivating the game but there is no action. Then there is the 'action' theme, when the player is fighting enemies. These songs are interleaved together so that the game can quickly switch between them, since it is better to not have the laser jump to another music file on the disc every time you start fighing enemies, and instead have it fade out from the current theme and switch (in the same file) to the other song.
When dealing with these files, you will need to know a few terms first:
- Frequency: This is the audios frequency. For PS2 ADPCM, this is usually always 41,000Hz (41kHz).
- Channels: The amount of channels one track in the STR contains, this is normally 2 (stereo), but can be 1, 2, or 6 depending on the game. The amount of channels in the first song in the file is the same for the rest of the file as well
- Interleave: This is how multiple tracks are put into one file. Please note that this value must be base 10 from 10-10000 in hex (10^16 = 16 for conversion between Decimal and Hex).
- Blocksize: One block from each of the channels in the file. (Calculated by INTSIZE * CHANNELS)
- Intsize: One block from only one channel of the file. (Calculated by BLOCKSIZE / CHANNELS)
- Compression: Normally the tracks in the STR are compressed, this is most likely to save space for other data. This is not important for the conversion process, however can be found by using the Cube Player program.
- Layers: Amount of songs in the file.
- Skip (AKA Offset): The amount (in bytes) the file should be offset in the beginning. Normally not used.
--- How to determine the amount of tracks/streams in the file:
- First, download and open up MFAudio. Open the STR file using the Open dialouge box. After that, set the Channels to 1 (Mono - Even if the track is stereo), and Frequency to 41000Hz. (Leave the rest of the values as is.)
- Then, adjust your volume since the program is pretty loud, and click play. You should hear music for a few seconds, then it will either:
- Continue playing that same song for the entire duration (1 Track 1 Channel, No Interleave)
- Switch between the left and right speaker channels for the duration of the song (1 Track, 2 Channels, Interleave)
- Switch between left and right speaker channels -and- multiple tracks (2-3). (2-3 Tracks, 2 Channels, Interleave)
- It is technically possible to have a 6 channel audio track although I have never seen one, which in theory would switch between 6 channels instead of two. You would need to listen very well to distinguish that it is 6 channels in the same track though.
- Once you counted everything, you can divide the total streams by the amount of channels to get the amount of tracks in the file, which shouldn't be more than 3. Now that you analyzed the file, we can get on to the more confusing part.
--- Determining the Interleave
The most difficult part about finding the interleave is that it is usually specific to each file in each game.
- Download and open up HxD (Hex Editor Program). Open up the STR file you are looking to find the interleave value of and scroll all the way to the bottom. You should see a lot of 00's. Scroll up until you start seeing data. Start from the last byte (from the right panel of the program) select the data and continue up until the data stops and you see another block of 00's. That amount of selected data (last byte to the first) is the interleave value, which can be read from the bottom of the screen.
Copyright © MarioCube - All Rights Reserved.