General Information
The Digital Sound Elements sound driver is an audio engine for games on the Nintendo DS, and Wii. It supports sequenced music and streamed audio. It was used by several games on the NDS including Pokémon Mystery Dungeon : Explorers of Sky/Time/Darkness.
This article will focus mainly on the implementation in PMD2 however.
Known Versions
So far, two versions of the DSE engine have been spotted in NDS games.
Version Number | Description |
---|---|
0x415 | Most common version. Used in all versions of PMD2. |
0x402 | Much rarer version. Used only in the game Luminous Arc this far. |
Only the format of SWDL containers seems to differs significantly between versions this far.
Inner Workings
The sound driver adds a few layers of extra processing over the data fed to the audio registers of the NDS.
Memory Structure
The system creates 2 chunks in memory, the "mseq", and "mdev" chunks. They're only labeled as such in a few games using DSE, like PMD2. In other games, like Fushigi no Dungeon - Fuurai no Shiren DS 2 and Professor Layton and the Last Specter, the labels are not there in memory.
The "mseq" chunk contains a set of sequencer wide variables, like counters and such, along with data structs for holding the state of each tracks during playback.
The "mdev" chunk contains a set of channels wide variables, and data structs for every sound channels the driver has. Those structs hold the state for each channels during playback.
Apart from this, the smdl and swdl for a track currently playing are copied once to memory. And then the entries in the swdl for samples, and program splits are copied and any overridable properties samples have are overriden by the program split's shared properties, like volume envelope and etc..(See swdl structure)
Code Structure
(Offsets are from the North American Explorers of Sky game's disassembled game code, not the ROM !!!)
The channels state are updated at line 0x0207448C. A loop begins further down. And the track Volume envelopes are updated here: 0x02074E0C
The function that updates the sequencer tracks begins at 0x020713E8. The actual loop begins at 02071648. The function that parses DSE events begins at 0x02071224. The table containing the function pointers for all DSE events begins at 0x020B0B90.
File/Data Formats
The system uses the following formats:
- swdl : Container for programs/presets data, and optionally sample data, used by the sequencer engine.
- smdl : Container for sequenced music.
- sedl : Container for sequenced sound effects, and sound presets/programs.
- sadl : Container for streamed audio.
File Layout
Game using DSE can store the various container formats in many different ways. Here are some of the known approaches:
- PMD2 : There is a main sample bank called bgm.swd, which is referred to by the SWDL files accompanying every SMDL music sequences file. Each SWDL contains only program/presets data, and refers to samples from the main bank.
- Fushigi no Dungeon - Fuurai no Shiren DS 2 - Sabaku no Majou : Here, the SMDL and SWDL are stored in their own separate folder. They're loaded in pair, just like PMD2, but there is no main bank. Instead sample data is stored within every SWDL. Which result in lots of duplicate samples throughout all SWDL.
- Zombi Daisuki: This game uses SMDL+SWDL pairs as well, without a main bank. But instead of having the SMDL and SWDL for a single music track stored in their own respective file, they're both stored within a SIR0 container, with the extension ".sd".
- Professor Layton and the Last Specter: This game works like PMD2, it has a main bank, however, all its SMDL + SWDL pairs are stored within an archive "ll_common.darc". And oddly enough, there are 2 copies of the main bank! One is named "bgm_common.SWD" and is stored outside the "ll_common.darc" archive, while the other is named "BG.SWD" and stored within the archive.
External Resources
- Official Website (in Japanese) [1]
Edited by evandixon
Recommended Comments
There are no comments to display.