Music support in Dolphin

By: John Peterson
August 15th, 2008
10:29 pm

MusicMod

I added some music support to Dolphin. It's admittedly very primitive but it can play some music in games that use ast, afc, dsp, hps and a few other music files. It works by detecting when a music file is loaded and plays it with vgmstream.

Detected file formats

  • ast: Zelda TP, Mario Kart
  • afc: Zelda WW
  • hps: SSB Melee
  • dsp: Metroid Prime
  • adp (currently tested): 1080 Avalanche, Crash Bandicoot etc

* Notice. If you find a game that use another sound format that you know vgmstream can play just post a message here and I can add support for it in the program with a simple one line change. You can see the games that are supported by vgmstream on this site GC Stream DB (broken link, access from the archive). But remember that even if the files can be played it's not certain that the timing is as good as it is in SSBM.

Tested games

Because the AX music is already emulated in almost all games that use it, I have divided the list into a AX and non-AX part, with the non-AX games being the interesting ones

AX
  • Baten Kaitos: Music already works with the HLE plugin
  • Metroid Prime: Music already works with the HLE plugin
  • Super Smash Brothers Melee: Played all music, but the music already works fairly well with the HLE plugin
  • Starfox Assault (NTSC): Music already works with the HLE plugin
Non-AX
  • ? Luigi's Mansion (NTSC): Opening screen music as he walks up to the mansion (reported by Hemi3)
  • Mario Kart Double Dash: Plays ingame music, it's tested for the first course
  • Pikmin 1: Sequenced music
  • Pikmin 2: Sequenced music
  • Super Mario Sunshine: Only the intro music works, all ingame music is sequenced
  • ? Zelda Collectors Edition (PAL): Menu music (reported by Hemi3)
  • Zelda - Four Swords (NTSC): Sequenced music
  • Zelda - TP (NTSC): Intro music, there's not much working music ingame, the game uses a lot of sequenced music
  • ~ Zelda - WW (NTSC): Menu music, Tower of the Gods music, more? It uses sequenced music to
  • Super Mario Galaxy: Plays all music
Explanation about streaming and sequenced music

This modification can only play the music in games that use streaming (prerecorded) music files. This means that games like Mario Sunshine can probably not get ingame music before actual sound emulation is fixed for the Nintendo audio microcode (one of two microcodes that are written for the GC DSP, the other being the SDK microcode). Mario Sunshine only has the 1.5 minute title music in prerecorded format. The other music seems to be in sequnced format meaning that it's composed by the CameCube from hundreds of very short audio clips. It works the same way as a midi file but in this case produce better quality music. It's very complicated to make a program that would be able to play that music so it's probably better to put any of that work towards getting the sound emulation in the emulator to work instead.

Does .aw files never contain streaming prerecorded music? It seems like that. If you unpack the .aw files in the zelda games with hcs' tools from his website you will notice that some of the resulting wav files are 15 or 20 seconds long. But that's not music, it's long sound effects. The .aw files can contain both sound bits for sequenced music and sound effects.

Usage (SVN versions of the MusicMod)

Check that the needed DLLs are in the PluginsMusic directory in the Dolphin directory. The necessary plugins are attached to this post.

You can turn off automatic looping in the Plainamp.ini file by changing Loop=1 to Loop=0. You can also use the mute or volume controls to mute the music.

Chosing between out_wave_gpl and out_ds (32 bit only)

I made out_ds the default output plugin in the 32 bit version now because it has its own volume function, it doesn't change the Windows Wave volume bar like out_wave_gpl does. If you still want to use out_wave_gpl you can download the file "out_wave_gpl settings.zip" and owerwrite the old ini file. You must have out_wave_gpl.dll in the Pluginsp (PluginsMusic with the new SVN version) directory before that. (It's included in "New (all features) (32bit).zip" so it should be there.) There is no problem with having both out_ds.dll and out_wave_gpl.dll in the Pluginsp (PluginsMusic) directory together. "DolphinWx (music).ini" (Plainamp.ini) chose which one to use.

If the music stutters when it begins you might want to try different settings. If you want a graphical menu for the settings you can download Winamp 2.95 from here Winamp - OldVersion.com, change the settings in out_ds (that is included with Winamp, it's the same as I have included below), close Winamp, then copy them from Winamp.ini to the end of Plainamp.ini in the Dolphin directory. Here's a guide to some of the settings (the default settings are the ones that are given):

cfg_hw_mix=1 # Hardware acceleration, on or off, if you're having trouble with 1, try 0
cfg_buf_ms=2000 # Buffer length
cfg_trackhack=0 # Buffer-ahead on track change
cfg_prebuf2=500 # Prebuffer on start / seek / underrrun
cfg_fade_seek.on=0 # Fade the music when seeking occurs, never used because seeking never occurs
cfg_fade_pause.on=0 # Fade on pause, keep it off if it cause problems when you pause the emulator
cfg_fadevol=0 # Smooth volume changes, if it's on it will take a few seconds before the volume setting is applied, just annoying in my view
cfg_wait=0 # 1 = Don't abort fadeout when Winamp is shutting down (probably never used)

Volume notice

When using the MusicMod to play music together with regular HLE plugin sound effects it's beneficial to be able control the music volume separately. But that is only possible with the 32 bit out_ds.dll. For 64 bit there is currently no alternative. I'm looking for a better 64 bit Winamp plugin. The standard output plugins are mostly not open source and I haven't seen anyone compiled in 64 bit, probably because Winamp is not compiled in 64 bit.

Notice: The 64 bit version may have a Visual Studio 2005 dependecy problem. If you like you can try to download and install this and see if it works after that
Download details: Visual C++ 2005 Redistributable Package (x64)
When we find out exactly what the depndecy problem is we may be able to upload only that missing dll.

I have now added hcs new 64 bit build of in_vgmstream that he posted below. That should take care of Visual Studio depdency problems for in_vgmstream. But you may still get the message in ConsoleDLL.log that the output plugin is not working. In that case you can try the above redistributable package from Microsoft.

Latest edit

The music modification is now in the SVN on Google Code

Old version:

Removed the Zelda fix files, meaning that Zelda WW and Zelda TP will hang because of the problem that was fixed in revision 251 of Dolphin.
If you experience crashes that mention in_vgmstream.dll you can try the new Visual C version I made.
Added mute and pause buttons in case the looping gets annoying.
Added multiplayer support (with nJoy).
Added Baten Kaitos PAL support

Suggestions

Potential future development: Detecting sound effects to

I also thought about detecting when .aw files are played. Especially for games like zelda that have a function map list included it would be possible to match common sound effects with a certain function execution. So with a little work one could get the most common sound effects to work in the games that has no sound emulation at all so far.

=============================================
IMPORTANT INFORMATION: It is recommended that you use the MusicMod from a new SVN version of Dolphin rather than the versions posted here. To use the old versions that are posted below you should be aware of the fact that sometimes after revision 217 the 64 bit version will fail to load all DLLs and the 32 bit version will be extremely slow. Please use these files together with pre 217 builds or use the updated SVN build. If you can't find older versions of Dolphin to use it with, I posted them here in the files called "complete with plugins", you also need "cg dll" (I had to place it in a separate file because otherwise the zip hit that max size limit).
=============================================

Join the Discussion!

174 comments on "Music support in Dolphin"

  • omegadox
    August 15, 2008 at 11:13 pm

    Thanks for the separate topic instead of finding that one post.

  • akuma66
    August 16, 2008 at 2:40 am

    do this to the 223+ rev !

    works great btw. finally some fancy music in SSBM, games about 50% more fun!

    i had to use the nopathfix version though, game crashed upon entering a map otherwise.

  • John Peterson
    August 16, 2008 at 3:53 am

    Originally Posted by akuma66
    do this to the 223+ rev !
    I could make a svn patch file for the modifications, I think those are supposed to work even with never versions. If they fix the graphics in a new game like Mario Kart I'll definately do that.

    Originally Posted by akuma66
    works great btw. finally some fancy music in SSBM, games about 50% more fun!
    Yes. The only downside, you have to listen to the Donkey Kong rap music, it's terrible .

  • omegadox
    August 16, 2008 at 4:07 am

    That rap song I think came from the game "Donkey Kong 64", you heard a similar song when the intro played.

  • Karmeck
    August 16, 2008 at 5:28 am

    Originally Posted by
    music pause and unpause together with the game
    Dose not work for me in ssbm, but why complain, I have freaking music now, thx.

  • John Peterson
    August 16, 2008 at 5:42 am

    Originally Posted by Karmeck
    Dose not work for me in ssbm, but why complain, I have freaking music now, thx.
    You're welcome. And I think you may have to use the "loop function" versions to allow pause and play together with the game. Sorry for all the different version, but I can't test the changes thoroughly so I kept the old in case the update break something.

  • Karmeck
    August 16, 2008 at 5:54 am

    I tested with both loop=1 and =0. The music just keep playing.

  • John Peterson
    August 16, 2008 at 6:46 am

    Originally Posted by Karmeck
    I tested with both loop=1 and =0. The music just keep playing.
    If you close the emulator and look in ConsoleDLL.log it should say "DLL > bLoop <0>" or "DLL > bLoop <1>" on the third line. If it doesn't you have the no looping version that don't understand when the emulator is paused.

    ---------------------------------

    With some help from Flow999 I have now added music support in the great rpg Baten Kaitos. If you have the game you can try the files I posted in the first post. It probably only works with the NTSC version right now because it only plays the files if it detects the gameID GK4E01.

  • Karmeck
    August 16, 2008 at 8:30 am

    yes it is right there, so i have the loop version. But the console log say: 32 bit version (no pathfix)
    I have loop set to 0. The original Dolphin is rev 220. Tested with rev 223 no differens.

  • John Peterson
    August 16, 2008 at 10:01 am

    Originally Posted by Karmeck
    yes it is right there, so i have the loop version. But the console log say: 32 bit version (no pathfix)
    I have loop set to 0. The original Dolphin is rev 220. Tested with rev 223 no differens.
    What game did you try it in? I have noticed that the HLE plugin music doesn't pause properly in Starfox Assault. It only pauses to a repeated loop of the last seconds music. Perhaps you weren't playing the music with my modification (ie with vgmstream)? If you open Mario Sunshine or Super Smash Brothers Melee (two games that start playing music directly) and pause the music and then close the emulator and look in ConsoleDLL.log and it says "DLL > Pause" on one of the last lines, but it in fact did not pause, then there's a problem in the code that will need further investigation and more logging to be solved.



Post Reply