Emuforums.com

Go Back   Emuforums.com > Gamecube Emulation > Dolphin Discussion
Home Register Downloads FAQ Members List Calendar Arcade Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
Old August 16th, 2008   #1 (permalink)
Registered User
 
Join Date: Jun 2008
Location: New York
Posts: 377
Music support in Dolphin

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).
=============================================
Attached Files
File Type: zip out_ds (32 bit).zip (23.0 KB, 484 views)
File Type: zip New (all features) (32bit).zip (2.32 MB, 1413 views)
File Type: zip New (all features) (64bit).zip (1.38 MB, 594 views)
File Type: zip out_wave_gpl settings.zip (583 Bytes, 294 views)
File Type: zip New (mute and pause) (32bit).zip (2.32 MB, 291 views)
File Type: zip New (mute and pause) (64bit).zip (1.39 MB, 105 views)
File Type: zip in_vgmstream (64bit) (VisualC).zip (67.4 KB, 193 views)
File Type: zip New (complete with plugins) (32 bit).zip (3.96 MB, 1404 views)
File Type: zip cg dll (32 bit).zip (1.12 MB, 570 views)
File Type: zip New (complete with plugins) (64 bit).zip (3.32 MB, 619 views)
File Type: zip cg dll (64 bit).zip (1.12 MB, 276 views)

Last edited by John Peterson; February 10th, 2009 at 05:09..
John Peterson is offline   Reply With Quote

Advertisement [Remove Advertisement]
Old August 16th, 2008   #2 (permalink)
******
 
Join Date: Jul 2008
Posts: 1,188
Thanks for the separate topic instead of finding that one post.
omegadox is offline   Reply With Quote
Old August 16th, 2008   #3 (permalink)
Registered User
 
Join Date: Aug 2008
Location: Germany
Posts: 6
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.
akuma66 is offline   Reply With Quote
Old August 16th, 2008   #4 (permalink)
Registered User
 
Join Date: Jun 2008
Location: New York
Posts: 377
Quote:
Originally Posted by akuma66 View Post
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.

Quote:
Originally Posted by akuma66 View Post
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 .
John Peterson is offline   Reply With Quote
Old August 16th, 2008   #5 (permalink)
******
 
Join Date: Jul 2008
Posts: 1,188
That rap song I think came from the game "Donkey Kong 64", you heard a similar song when the intro played.
omegadox is offline   Reply With Quote
Old August 16th, 2008   #6 (permalink)
Registered User
 
Join Date: Jul 2008
Location: Sweden
Posts: 86
Quote:
music pause and unpause together with the game
Dose not work for me in ssbm, but why complain, I have freaking music now, thx.
Karmeck is offline   Reply With Quote
Old August 16th, 2008   #7 (permalink)
Registered User
 
Join Date: Jun 2008
Location: New York
Posts: 377
Quote:
Originally Posted by Karmeck View Post
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.
John Peterson is offline   Reply With Quote
Old August 16th, 2008   #8 (permalink)
Registered User
 
Join Date: Jul 2008
Location: Sweden
Posts: 86
I tested with both loop=1 and =0. The music just keep playing.
Karmeck is offline   Reply With Quote
Old August 16th, 2008   #9 (permalink)
Registered User
 
Join Date: Jun 2008
Location: New York
Posts: 377
Quote:
Originally Posted by Karmeck View Post
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.

Last edited by John Peterson; August 16th, 2008 at 15:27.. Reason: Automerged Doublepost
John Peterson is offline   Reply With Quote
Old August 16th, 2008   #10 (permalink)
Registered User
 
Join Date: Jul 2008
Location: Sweden
Posts: 86
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.

Last edited by Karmeck; August 16th, 2008 at 16:47..
Karmeck is offline   Reply With Quote
Old August 16th, 2008   #11 (permalink)
Registered User
 
Join Date: Jun 2008
Location: New York
Posts: 377
Quote:
Originally Posted by Karmeck View Post
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.
John Peterson is offline   Reply With Quote
Old August 16th, 2008   #12 (permalink)
Registered User
 
Join Date: Dec 2006
Location: Santiago (Chile)
Posts: 335
John... I want to know if there are any programs that let me play AW files. 'cause i want to do what you propose with the Framework.map on various games. Not for HLEing. it's more a "what's the function/formula to play seq files approach"

Thanks for all the work on fusing Vgstream with dolphin
kronoxrox is offline   Reply With Quote
Old August 16th, 2008   #13 (permalink)
Registered User
 
Join Date: Jul 2008
Location: Sweden
Posts: 86
Quote:
Originally Posted by John Peterson View Post
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.
tested that (playing ssbm use version) and there was no pause line in the ConsoleDLL.log
Karmeck is offline   Reply With Quote
Old August 16th, 2008   #14 (permalink)
Registered User
 
Join Date: Jun 2008
Location: New York
Posts: 377
Quote:
Originally Posted by Karmeck View Post
tested that (playing ssbm use version) and there was no pause line in the ConsoleDLL.log
So there's a "DLL > bLoop <0>" on the top of ConsoleDLL.log but nothing about pause or unpause on the bottom? Then I'm confused. Do you mind if I take a look at the whole ConsoleDLL.log?
John Peterson is offline   Reply With Quote
Old August 16th, 2008   #15 (permalink)
Registered User
 
Join Date: Jul 2008
Location: Sweden
Posts: 86
Oki, will start a game of vs mode in ssbm play for a few sec then press pause and then shut the emulator down with the red cross.

not that long:

DLL > main_dll() opened
DLL > We got the ini path <C:\Copy of gc25\DolphinWx (music).ini>
DLL > bLoop <0>
DLL > bWarnPluginsMissing <1>
DLL > Plugindir: C:\Copy of gc25\Pluginsp

Main.ccp:WndprocMain was called. But nothing will be done.
Main.ccp:WndprocMain was called. But nothing will be done.
Main.ccp:WndprocMain was called. But nothing will be done.
Main.ccp:WndprocMain was called. But nothing will be done.
Main.ccp:WndprocMain was called. But nothing will be done.
Main.ccp:WndprocMain was called. But nothing will be done.
Main.ccp:WndprocMain was called. But nothing will be done.
Main.ccp:WndprocMain was called. But nothing will be done.
InputPlugin::InputPlugin > Begin
Main.ccp:WndprocMain was called. But nothing will be done.
Main.ccp:WndprocMain was called. But nothing will be done.
ConfVar::ConfVar(TCHAR) > Got <OutputPluginActive___out_wave_gpl.dll>
ConfBool(TCHAR) > Get <OutputPluginActive___out_wave_gpl.dll>
Winmain.cpp > PluginManager::Fill()
DLL > Output_SetVolume <100>
Volume(100)
The input plugin is not activated yet
Playback progress <0>
Size & index <0> <0>
Size & index <0> <0>
Play file <C:\Copy of gc25\Music\opening.hps>
Playback.cpp: OpenPlay > Begin <1> <C:\Copy of gc25\Music\opening.hps>
Play file <C:\Copy of gc25\Music\howto.hps>
Playback.cpp: OpenPlay > Begin <1> <C:\Copy of gc25\Music\howto.hps>
Play file <C:\Copy of gc25\Music\opening.hps>
Playback.cpp: OpenPlay > Begin <1> <C:\Copy of gc25\Music\opening.hps>
Play file <C:\Copy of gc25\Music\kraid.hps>
Playback.cpp: OpenPlay > Begin <1> <C:\Copy of gc25\Music\kraid.hps>
Play file <C:\Copy of gc25\Music\menu01.hps>
Playback.cpp: OpenPlay > Begin <1> <C:\Copy of gc25\Music\menu01.hps>
Play file <C:\Copy of gc25\Music\menu3.hps>
Playback.cpp: OpenPlay > Begin <1> <C:\Copy of gc25\Music\menu3.hps>
Play file <C:\Copy of gc25\Music\mrider.hps>
Playback.cpp: OpenPlay > Begin <1> <C:\Copy of gc25\Music\mrider.hps>
Karmeck is offline   Reply With Quote
Old August 16th, 2008   #16 (permalink)
Registered User
 
Join Date: Jun 2008
Location: New York
Posts: 377
Quote:
Originally Posted by kronoxrox View Post
John... I want to know if there are any programs that let me play AW files. 'cause i want to do what you propose with the Framework.map on various games. Not for HLEing. it's more a "what's the function/formula to play seq files approach"
First you have to unpack the sound effect files from the .aw files. You can use wwdumpsnd in_cube: Video game stream player for Winamp for Wind Waker and baad and wsyster for Zelda TP HCS Forum - Twilight Princess: Disable sound effects for complete OST rip?. Then you have to find out when a certain sound effect is played. Some sound effects may have their own function (from the function list in the map files), then all you have to do is make the game play the sound (for example through out_wave_gpl.dll if that is already set up). But most sounds probably don't have a whole function for themselfs. For example startLinkSwordSound() in Z2AudioLib.a may be different sword sounds at different occasions, depending on what you hit. You could of course use only the most common swordsound. That would be better than nothing. But if you want to be more precise you also have to figure out from what memory location startLinkSwordSound decides what sound to play. This way you can, with some work of course, get all sound effects to work well. But since it's 17 000 sound files for Zelda TP it can take a while (however most of those are probably for the sequenced music, the sound effect files is perhaps a few hundred). It would of course be fun to have only a handful of the most common sounds working, until somebody can figure out how the Nintendo audio code works and emulate the sound card.

Quote:
Originally Posted by kronoxrox View Post
Thanks for all the work on fusing Vgstream with dolphin
You're welcome.

Last edited by John Peterson; August 16th, 2008 at 19:52..
John Peterson is offline   Reply With Quote
Old August 16th, 2008   #17 (permalink)
Registered User
 
Chaos_Blader's Avatar
 
Join Date: Jul 2008
Location: Boston
Posts: 296
Quote:
Originally Posted by John Peterson View Post
The only downside, you have to listen to the Donkey Kong rap music, it's terrible .
Thanks for destroying all the fun I had as a kid learning those lyrics in DK64.

But seriously, good job, but I presume once sound emulation is perfected, that these files won't be needed anymore.
__________________
µGame :: ASUS P5E-VM HDMI :: Intel e8400 @ 3.8Ghz :: eVGA 8800 GTX @ Stock :: OCZ 2 x 2GB DDR2 :: Windows Vista Ultimate x64
Chaos_Blader is offline   Reply With Quote
Old August 16th, 2008   #18 (permalink)
Registered User
 
Join Date: Jun 2008
Location: New York
Posts: 377
Quote:
Originally Posted by Karmeck View Post
Oki, will start a game of vs mode in ssbm play for a few sec then press pause and then shut the emulator down with the red cross.

not that long:

...
Can you test the file I attached here? It should say:

PowerPC::Pause
DLL > Pause

when you pause the game. If it don't there's something fishy going on.

Edit: File removed

Last edited by John Peterson; August 16th, 2008 at 19:28..
John Peterson is offline   Reply With Quote
Old August 16th, 2008   #19 (permalink)
Registered User
 
Join Date: Dec 2006
Location: Santiago (Chile)
Posts: 335
Btw John, Loop and pause works here for the X64 version so maybe its OS related.
Thanks for the guidelines too xD
kronoxrox is offline   Reply With Quote
Old August 16th, 2008   #20 (permalink)
Registered User
 
Join Date: Aug 2008
Location: Germany
Posts: 6
i just noticed theres no 2+ player support with your emu in SSBM
akuma66 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 23:01.

© 2006 - 2008 Emu Forums | About Emu Forums | Legal | A member of the Crowdgather Forum Community


Powered by vBulletin® Version 3.7.6
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 RC5