Sounds (Burnout Paradise): Difference between revisions

Add details of working with sounds.
(Created page with overview and resource types.)
 
(Add details of working with sounds.)
Line 1:
Sounds in Burnout Paradise are a multifaceted topic ranging from as high a level as the directory layout and in-game purposes of sounds to as low a level as the structure of the different formats and headers in the files. This page attempts to document the interactions between sound resources in order to provide an explanation of how sounds are accessed and played in-game. To do this appropriately, the creation and/or replacement of sounds is also covered.
 
= SndPlayer Plug-In Assets =
The primary sound asset, [[#Generic RWAC Wave Content | Generic RWAC Wave Content]], is a container for EA SndPlayer Plug-In Assets. The parsing of these assets has been difficult in the past but has become much easier due to multiple leaks of EA tools, the most pertinent being a 2008 version of sx (EA Sound Exchange) which can be downloaded [https://cdn.discordapp.com/attachments/810315459831398420/852793592610816030/sx.exe here].
 
Sound Exchange is a command line tool. Opening a command prompt window and dragging and dropping the executable should list the full path to it. This path will be referred to simply as <code>sx</code> from now on. Pressing enter should output basic information, and adding <code>-h</code> after a space should output a full help menu.
 
== Handling assets ==
=== Encoding ===
Sound exchange can encode streams to a number of codecs. Those relevant to Burnout Paradise are EA-XMA, XAS V1, EALayer3 V1, and EALayer3 V2 Spike. To encode a SndPlayer-compatible file, use the following syntax:
 
<code>sx -sndplayer -<format> <input> -=<output></code>
 
Where the available formats are <code>eaxma</code> (codec 3), <code>xas_int</code> (codec 4), <code>ealayer3_int</code> (codec 5), and <code>ealayer3spike_int</code> (codec 7). (Note: int stands for Interleaved.)
 
An example command would look like:
 
<code>sx -sndplayer -ealayer3_int "F:\Music\The Primitives - Crash (falefee trap remix).mp3" -="F:\Music\The Primitives - Crash (falefee trap remix)"</code>
 
The .snr extension will be added to the output automatically.
 
A variable bitrate can also be specified by setting the option <code>-vbr<quality></code> before the input file path, where quality is a value between 0 and 100. A quality of 100 appears to be around 256kbps, while 50 is around 160kbps. Although there is a constant bitrate option as well, it has no effect.
 
=== Decoding ===
Decoding is trivial with Sound Exchange. Use <code>-wave</code> as the format with no additional options such that the command looks like this:
 
<code>sx -wave "F:\Music\The Primitives - Crash (falefee trap remix).snr" -="F:\Music\The Primitives - Crash (falefee trap remix).wav"</code>
 
This will output an uncompressed file, meaning there is no quality loss.
 
Be aware that EA-XMA cannot be decoded using Sound Exchange.
 
== Streams ==
=== Setting the correct play location ===
SndPlayer Plug-In Assets are, by default, a single file that is loaded into RAM. This is the SNR (RAM-targeted) file. Burnout, however, only uses this within other assets, such as engines or splicers. The majority of sounds use a different play location: stream or gigasample. Streams have a header which goes in RAM and is used to stream the rest of the file from alternative storage, such as discs or a hard drive. Gigasample is similar, but the first portion of the sound data resides in RAM along with the header so the rest of the stream can be loaded from storage while the sound plays.
 
Generally, it is streams that are encountered—in fact, only nine gigasamples are present in Burnout Paradise Remastered, those being the intro videos, race starts, showtime transitions, Party fireworks, and online entry sounds. In other words, if you need a gigasample, you will know.
 
==== Stream ====
Generating stream-targeted assets is a simple matter of adding the <code>-playlocstream</code> option to the command:
 
<code>sx -sndplayer -ealayer3_int -playlocstream "F:\Music\The Primitives - Crash (falefee trap remix).mp3" -="F:\Music\The Primitives - Crash (falefee trap remix)"</code>
 
Once this is done, the SNR should be added to <code>SOUND/STREAMS/STREAMHEADERS.BUNDLE</code>, replacing the existing header if there was one. The SNS should go in <code>SOUND/STREAMS</code>, replacing the existing stream if there was one.
 
==== Gigasample ====
Similar to streams, gigasample-targeted assets are created by using <code>-playlocgigasample</code>. The amount in RAM should be specified using <code>-gigaram<period></code> where period is the time in seconds from 0.0 to 10000.0:
 
<code>sx -sndplayer -ealayer3_int -playlocgigasample -gigaram1.0 "F:\Music\The Primitives - Crash (falefee trap remix).mp3" -="F:\Music\The Primitives - Crash (falefee trap remix)"</code>
 
Increasing the portion in RAM may have consequences on RAM-limited platforms such as the PS3 and should be done sparingly. If left unspecified, Sound Exchange will set a default period of 1.0 seconds.
 
=== Decoding streams ===
Wave resources have a [[Binary File]] header that must be removed in order to decode. This is always the first 8 bytes of the file, which is padded to 16 bytes in the retail game. To remove it, open the SNR from <code>SOUND/STREAMS/STREAMHEADERS.BUNDLE</code> in a hex editor [https://mh-nexus.de/en/downloads.php?product=HxD20 such as HxD] and delete the first 16 bytes of the file. If done correctly, the file should begin with the codec ID noted in [[#Encoding | Encoding]].
 
Once the SNR is edited, streams can be decoded by placing the SNR and SNS in the same directory and using the same file name on both. Then the stream can be decoded using the same command as with RAM-targeted assets:
 
<code>sx -wave "F:\Music\The Primitives - Crash (falefee trap remix).snr" -="F:\Music\The Primitives - Crash (falefee trap remix).wav"</code>
 
Crucially, '''the SNR extension must be lowercase''' in the command. Sound Exchange does not recognize the format if the extension is uppercase. (Note: This only applies to the command. File names may have uppercase extensions.)
 
=== Decoding gigasamples ===
Decoding a gigasample is exactly the same as decoding a stream. Unfortunately, due to what appears to be either errors or version incompatibilities, Burnout's gigasamples cannot be decoded by Sound Exchange. It is unknown whether there is a way to correctly decode them.
 
== Registry ==
Registry resources are scattered throughout the game assets. Each apply to a different sound category. These include streams, RWAC features, playback, the sound entity, CSIS, and each engine.
 
Unfortunately, not enough is known about the Registry to correctly add entries. This section will be updated with that information in the future.
 
=== Replacing a registry entry ===
Generally, replacing a registry entry is unnecessary. If changing the name is required, however, it can be done. When viewing the resource using a hex editor, by finding the associated <code>gamedb://</code> path (which includes the name of the file), an entry can be updated to use a new name. 16 bytes before the start of the string is the hash of that string. Using Bo98's [https://bpr.bo98.uk/cgssound-playback-name/ online hasher], the new string can have a [[Common_Data_Types_(Burnout_Paradise)#CgsSound::Playback::Name | Name hash]] generated and the old hash and string can be replaced, effectively replacing the entry.
 
Hashes for streams are different—they are hashes of the file name in the <code>gamedb://</code> string, such as <code>Adam_Ant</code> or <code>RaceStartRolling</code>. It is important to get this right as this is how the game will find the find to read from.
 
= Resource Types =
Line 26 ⟶ 98:
 
=== Other types ===
[[Nicotine]] assets are present in the final game but have not been researched, so their purpose is unknown. The same is true of [[Snapshot Data]]. [[Generic RWAC Reverb IR Content]] is present in [[Burnout 5 (2007-02-22 build)]] under <code>SOUND/IR.BUNDLE</code>. [[Voice Hierarchy]] and its [[Voice Hierarchy Collection | collections]] are both unused in Burnout, though the former is present in [[Black 2 (2007-02-08 build)]]. [[Snr]] and [[Interpreter Data]] are sound-related but entirely unused.
 
=== Related resource types ===