Audio Emulation: Difference between revisions

From Dolphin Emulator Wiki
Jump to navigation Jump to search
(Dumping guide needs to be completed. Anyone?)
 
m (fix non-HTTPS download link)
 
(38 intermediate revisions by 12 users not shown)
Line 1: Line 1:
== Explanation ==
The DSP is an additional processor used by the Wii/GCN to process sound. Dolphin has two ways to emulate the DSP.


The DSP is an additional processor, running in parallell with the PowerPC. It's located in the GPU of the GC/Wii, and cannot access main RAM directly, however it can use DMA copies to read/write all RAM. It has an "accelerator" module that lets it decode ADPCM audio directly from ARAM. On the Wii, it can apparently read audio from all of RAM, perhaps also on the Gamecube but I have not tested this.  
*'''HLE (High Level Emulation):''' HLE works by using a DSP engine created by the developers from studying the real DSP. DSP HLE is with almost no overhead and does not require any additional files, however it may have some problems in some games. {{revision|3.5-78}} and {{revision|3.5-1154}} corrected most of the problems in the AX ucode, the most common audio microcode on the GameCube and Wii. {{revision|4.0-7286}} and New-Zelda-HLE rewrote the Zelda ucode, improving it for the remaining games. Currently DSP HLE will have perfect sound in most games. However, some issues may remain, and all sound issues need to be confirmed with LLE.


The smallest unit of internal memory addressable by the DSP is a 16-bit word. It has no concept of standard 8-bit bytes - everything is done in 16-bit units. Sometimes they are signed, sometimes not - it depends on the usage.
*'''LLE (Low Level Emulation):''' LLE uses DSP ROM files to emulate the DSP's hardware behavior. This unfortunately requires a lot more processing power, but provides perfect sound in nearly all games. As of {{revision|3.5-1031}} Dolphin includes a developer-created DSP ROM which allows DSP LLE to function without dumping LLE files from a console. Its compatibility is very good, but it will have errors that a DSP ROM from a console does not have.


In summary, the DSP lives in a pretty small memory space. It's kind of like an SPE in the PS3, in that it can only read and write to the outside worlds by issuing DMA requests, but much less powerful of course. The SPEs don't have separate instruction and data memories either.  
:For the absolute best audio, DSP ROM files should be dumped from a console. There are several ways to dump DSP files, but the easiest method is to use DSPSpy on a Wii with the Homebrew Channel installed. For details on other methods to dump DSP files, go to the {{forum|forum thread|tid=23103}}.


The DSP core has 32 16-bit registers, however they are not at all general purpose like on the PowerPC. Instead, they have very rigid roles. There are several "multi-registers" built out of these smaller 16-bit registers, for example the two 40-bit accumulators, and two 32-bit ones. All multiply instructions output their result to the 40-bit "prod" register. The top register of a 40-bit multiregister is really 8-bit but is read as sign extended to 16-bit by most instructions that can read any register.
== Dumping Wii DSP files with DSPSpy ==
You will need:
*A homebrewed console (See how to install [http://wiibrew.org/wiki/Homebrew_Channel Homebrew Channel] on a non-hacked Wii console)
*A SD card


The advantage of the specific roles is that the instruction encoding can be extremely compact. Most instructions that deal with accumulators only have a single bit for deciding which accumulator to affect, for example.
Download [https://forums.dolphin-emu.org/attachment.php?aid=7636 DSPSpy] and extract it. Rename it to '''boot.dol''', then place it into \apps\DSPSpy\ folder on the root of your SD card (it should then look like X:\apps\DSPSpy\boot.dol). Launch the app from Homebrew Channel on your Wii, and two files will be created: '''dsp_rom.bin''' (8KiB) and '''dsp_coef.bin''' (4KiB). Move these files into your [[Controlling the Global User Directory|Global User Directory]] \GC\ folder, which by default on Windows is located in %userprofile%\Documents\Dolphin Emulator\, and Dolphin will now have official DSP ROMs from your Wii.


== Main differences between DSP emulated versions ==
== See Also ==
*[https://dolphin-emu.org/blog/2014/11/12/the-rise-of-hle-audio/ Dolphin Blog: The Rise of HLE Audio]
*[https://dolphin-emu.org/blog/2015/08/19/new-era-hle-audio/ Dolphin Blog: The New Era of HLE Audio]


*LLE (Low Level Emulation): Emulate the hardware behaviour as closely as possible. In case of the DSP, that means running every single instruction just like on the hardware. This contrasts with HLE:
[[Category:Tutorials]]
 
*HLE (High Level Emulation): If the large scale behaviour of code running on a device like the DSP is known, we can simply write equivalent C++ code and run that instead of actually trying to run instructions on an emulated DSP. This is how audio has been done in Dolphin thus far, but the limitation is that it can only simulate the "AX" ucode. Advantage is speed, the main drawback is that accuracy is generally not very good and it's easy to miss feature when reimplementing something you don't really know how it works.
 
== How to dump a Wii DSP files ==
 
http://forums.dolphin-emulator.com/showthread.php?tid=3823
 
A little confusing, but some text can help:
*Download the attached file on that thread
*Use a Wii DOL Launcher (SD Cards apps)
*Execute the Dolphin DSPSpy file
 
You should get both "dsp_rom.bin" (8Kb) and "dsp_coef.bin"(4Kb) (Size may change).
 
Store them at the folder "./Sys/GC"

Latest revision as of 22:52, 31 July 2021

The DSP is an additional processor used by the Wii/GCN to process sound. Dolphin has two ways to emulate the DSP.

  • HLE (High Level Emulation): HLE works by using a DSP engine created by the developers from studying the real DSP. DSP HLE is with almost no overhead and does not require any additional files, however it may have some problems in some games. 3.5-78 and 3.5-1154 corrected most of the problems in the AX ucode, the most common audio microcode on the GameCube and Wii. 4.0-7286 and New-Zelda-HLE rewrote the Zelda ucode, improving it for the remaining games. Currently DSP HLE will have perfect sound in most games. However, some issues may remain, and all sound issues need to be confirmed with LLE.
  • LLE (Low Level Emulation): LLE uses DSP ROM files to emulate the DSP's hardware behavior. This unfortunately requires a lot more processing power, but provides perfect sound in nearly all games. As of 3.5-1031 Dolphin includes a developer-created DSP ROM which allows DSP LLE to function without dumping LLE files from a console. Its compatibility is very good, but it will have errors that a DSP ROM from a console does not have.
For the absolute best audio, DSP ROM files should be dumped from a console. There are several ways to dump DSP files, but the easiest method is to use DSPSpy on a Wii with the Homebrew Channel installed. For details on other methods to dump DSP files, go to the forum thread.

Dumping Wii DSP files with DSPSpy

You will need:

  • A homebrewed console (See how to install Homebrew Channel on a non-hacked Wii console)
  • A SD card

Download DSPSpy and extract it. Rename it to boot.dol, then place it into \apps\DSPSpy\ folder on the root of your SD card (it should then look like X:\apps\DSPSpy\boot.dol). Launch the app from Homebrew Channel on your Wii, and two files will be created: dsp_rom.bin (8KiB) and dsp_coef.bin (4KiB). Move these files into your Global User Directory \GC\ folder, which by default on Windows is located in %userprofile%\Documents\Dolphin Emulator\, and Dolphin will now have official DSP ROMs from your Wii.

See Also