CSMP (File Format): Difference between revisions

From Retro Modding Wiki
Jump to navigation Jump to search
imported>Antidote
(Categories, omitting TF for the time being, since we don't know/aren't sure of much.)
imported>Antidote
(Undo revision 359 by Parax0 (talk))
 
(11 intermediate revisions by 2 users not shown)
Line 1: Line 1:
The '''.csmp file format''' seen in Retro Studios games past Metroid Prime 2, it's very similar in use to [[AGSC (File Format)|AGSC]] and contains sound affects. Where CSMP differs is the fact that it only contains one sound and is broken up into obvious data chunks with easily identifiable sizes.
The '''.CSMP file format''' is an audio format seen in Retro Studios games starting in Metroid Prime 3. It's very similar in use to [[AGSC (File Format)|AGSC]] and usually contains sound affects. Where CSMP differs is the fact that it only contains one sound and is broken up into obvious data chunks with easily identifiable sizes.
 
{{todo|Notate Tropical Freeze differences.}}


{{todo|Notate Tropical freeze differences ([[User:Parax0|Paraxade]] do you know anything?)}}
__TOC__
__TOC__


== Format ==


==Header==
CSMP files are made up of a number of data chunks. Since not every file always has every chunk, the best way to read a CSMP file is to use a while loop to check the chunk headers and parse their contents until you reach the end of the file.
What follows is the header found in Metroid Prime 3 and Donkey Kong Country Returns, Tropical Freeze's seems to be a bit different. The file can be read using a simple while loop, each chunk designates it's size


{{todo|We've had success getting audio out of Tropical Freeze, crediar mentioned ddspadpcm being used in Tropical Freeze. What is it? And can we find any information on it?}}
=== Header ===
 
This is the header structure found in Metroid Prime 3 and Donkey Kong Country Returns; Tropical Freeze's is a bit different.


{|class="wikitable"
{|class="wikitable"
!Offset
! Offset
!Size
! Size
!Description
! Description
|-
|-
|0x0
| 0x0
|4
| 4
|'''Magic'''; Always 0x43534D50 ("CSMP")
| '''"CSMP" magic''' fourCC
|-
|-
|0x4
| 0x4
|4
| 4
|'''Version'''; Always 1
| '''Version'''; always 1
|}
|}


==Chunk==
=== Chunk Header ===
 
Every chunk begins with this header; it contains a brief data type identifier and a size.


{|class="wikitable"
{|class="wikitable"
!Offset
! Offset
!Size
! Size
!Description
! Description
|-
|-
|0x0
| 0x0
|4
| 4
|'''ChunkType'''
| '''Chunk type''' fourCC
|-
|-
|0x4
| 0x4
|4
| 4
|'''ChunkSize (N)'''
| '''Chunk size (N)'''
|-
|-
|0x8+N
| 0x8+N
|colspan=2|End of chunk (usually, subtract 4 when the chunk type is equal to 0x44415441 ["DATA"])
| colspan=2 {{unknown|End of chunk}}
|}
|}


==Chunk Types==
=== NAME ===


The known values for each chunk are as follows:
This chunk just has a null-terminated string; it's the name of the contained sound data.
 
=== INFO ===


===NAME===
This chunk just has a null-terminated string, it's the name of the contained sound data.
===INFO===
{|class="wikitable"
{|class="wikitable"
!Offset
!Offset
Line 55: Line 59:
!Description
!Description
|-
|-
|0x0
| 0x0
|1
| 1
|'''Unknown'''
| {{unknown|'''Unknown'''
|-
|-
|0x1
| 0x1
|1
| 1
|'''Loop Flag'''
| '''Loop Flag'''
|-
|-
|0x2
| 0x2
| 4
| 4
|'''Unknown'''
| {{unknown|'''Unknown'''}}
|-
|-
|0x6
| 0x6
|2
| 2
|'''Unknown'''
| {{unknown|'''Unknown'''}}
|-
|-
|0x8
| 0x8
|4
| 4
|'''Volume'''
| '''Volume'''
|}
|}
===PAD===
Padding, just seek '''ChunkSize''' bytes ahead


===DATA===
=== PAD ===
Refer to the [[DSP (File Format)|DSP]] page for details.
 
This chunk is just padded with 0xFF; usually contains 0x14 bytes.
 
=== DATA ===
 
The DATA section essentially just embeds a standard DSP, including the full header and ADPCM audio data. Refer to the [[DSP (File Format)|DSP]] page for details. Note that for some reason, the DATA chunk is always 4 bytes smaller than its size indicates.


[[Category:File Formats]]
[[Category:Audio]]
[[Category:Audio]]
[[Category:Metroid Prime 3: Corruption]]
[[Category:Metroid Prime 3: Corruption]]
[[Category:Donky Kong Country Returns]]
[[Category:Donkey Kong Country Returns]]

Latest revision as of 09:34, 26 January 2015

The .CSMP file format is an audio format seen in Retro Studios games starting in Metroid Prime 3. It's very similar in use to AGSC and usually contains sound affects. Where CSMP differs is the fact that it only contains one sound and is broken up into obvious data chunks with easily identifiable sizes.


To do:
Notate Tropical Freeze differences.

Format

CSMP files are made up of a number of data chunks. Since not every file always has every chunk, the best way to read a CSMP file is to use a while loop to check the chunk headers and parse their contents until you reach the end of the file.

Header

This is the header structure found in Metroid Prime 3 and Donkey Kong Country Returns; Tropical Freeze's is a bit different.

Offset Size Description
0x0 4 "CSMP" magic fourCC
0x4 4 Version; always 1

Chunk Header

Every chunk begins with this header; it contains a brief data type identifier and a size.

Offset Size Description
0x0 4 Chunk type fourCC
0x4 4 Chunk size (N)
0x8+N End of chunk

NAME

This chunk just has a null-terminated string; it's the name of the contained sound data.

INFO

Offset Size Description
0x0 1 Unknown
0x1 1 Loop Flag
0x2 4 Unknown
0x6 2 Unknown
0x8 4 Volume

PAD

This chunk is just padded with 0xFF; usually contains 0x14 bytes.

DATA

The DATA section essentially just embeds a standard DSP, including the full header and ADPCM audio data. Refer to the DSP page for details. Note that for some reason, the DATA chunk is always 4 bytes smaller than its size indicates.