Official Codex Discord Server

  1. Welcome to rpgcodex.net, a site dedicated to discussing computer based role-playing games in a free and open fashion. We're less strict than other forums, but please refer to the rules.

    "This message is awaiting moderator approval": All new users must pass through our moderation queue before they will be able to post normally. Until your account has "passed" your posts will only be visible to yourself (and moderators) until they are approved. Give us a week to get around to approving / deleting / ignoring your mundane opinion on crap before hassling us about it. Once you have passed the moderation period (think of it as a test), you will be able to post normally, just like all the other retards.
    Dismiss Notice

Hardware MIDI

Discussion in 'Golden Era Games' started by DoomIhlVaria, Aug 11, 2017.

  1. DoomIhlVaria Cipher Patron

    DoomIhlVaria
    Joined:
    Nov 1, 2009
    Messages:
    360
    Location:
    Hell's Waiting Room
    Make the Codex Great Again!
    Has anyone tried Grimoire out on a hardware MIDI module instead of Windows' shitty default synthesizer, like an MT-32, Sound Canvas, or something newer?
     
    ^ Top  
  2. Jaesun Fabulous Moderator

    Jaesun
    Joined:
    May 14, 2004
    Messages:
    36,924
    Location:
    Seattle, WA USA
    Torment: Tides of Numenera Divinity: Original Sin 2 BattleTech
    So just to be clear, this game IS using MIDI for the music (and it is not pre-recorded sound files)?

    I physically own 2 Roland MT-32's and a Sound Canvas.

    I was going to ask, what specific sound module this was written for. Based on what I have heard so far, it is for a Sound Canvas. Of which I don't *believe* it is using any of the extra GS sound bank sounds. So the Windows built in Roland sounds are fairly accurate. It would sound MUCH better on an actual Roland Sound canvas (in theory). It seems the music is written specifically for a General MIDI device (since it is NOT using any of the GS extra sound banks).

    And since I am 99.9% sure it is General Midi, that then leaves the Roland MT-32 out. You CAN make a GM sound bank on the MT-32, but the sounds on the Sound Canvas are vastly superior.

    Also, you no longer can output to MIDI to a different device using current windows (Windows 7 still has this option). So I can't play this through any of my Sound Modules.

    You CAN use MIDI sound modules with DOSBox. It allows you to direct MIDI to any output source.
     
    • Brofist Brofist x 8
    • Informative Informative x 2
    ^ Top  
  3. DoomIhlVaria Cipher Patron

    DoomIhlVaria
    Joined:
    Nov 1, 2009
    Messages:
    360
    Location:
    Hell's Waiting Room
    Make the Codex Great Again!
    I assumed it was real MIDI based on the fact that Linux users are having to install Timidity to get music when running Grimoire with WINE.

    As for MIDI output for arbitrary programs, have you tried the Open MIDI Project's MIDI Selector or CoolSoft's MIDI Selector? Allegedly these sorts of things can work even on Windows 10 but I don't have a hardware module yet so I can't test (I have an SC-88 Pro coming later this month).
     
    • Thanks! Thanks! x 1
    • Friendly Friendly x 1
    ^ Top  
  4. Crospy Learned

    Crospy
    Joined:
    Aug 9, 2014
    Messages:
    130
    This depends on the version of windows you have.

    http://haskell.cs.yale.edu/euterpea/midi-on-windows/#default
    http://donyaquick.com/midi-on-windows/#x1-140004.3

    You could use a software synthesizer like Fluidsynth and a good soundfont bank if you're on an older windows. If you're on windows 8/10, you're fucked. Windows 8/10 doesn't allow you to change the default MIDI device so only software that can configure their sound routing like audio workstation programs can do it.

    Basically you can't get video games to be routed to anything other than windows's absolutely shit synth.

    Your best bet is to.. use linux and wine :smug:
     
    ^ Top  
  5. DoomIhlVaria Cipher Patron

    DoomIhlVaria
    Joined:
    Nov 1, 2009
    Messages:
    360
    Location:
    Hell's Waiting Room
    Make the Codex Great Again!
    I guess that's always an option. I use Linux for work and nearly everything except games. I really like having my games isolated on a separate machine but Grimoire with even better music could be worth the trouble.
     
    ^ Top  
  6. Crospy Learned

    Crospy
    Joined:
    Aug 9, 2014
    Messages:
    130
    Grimoire would probably work fine in a virtual machine too, if you wanted to keep that stuff on your windows PC. Could try either an older windows in a VM or linux+wine inside that VM.
     
    ^ Top  
  7. newtmonkey Arcane

    newtmonkey
    Joined:
    Aug 22, 2013
    Messages:
    1,246
    I'm not sure that Grimoire uses MIDI. I have an external SC-88 set as my default MIDI device, but Grimoire just plays music on its own.
     
    • Prestigious Prestigious x 2
    ^ Top  
  8. DoomIhlVaria Cipher Patron

    DoomIhlVaria
    Joined:
    Nov 1, 2009
    Messages:
    360
    Location:
    Hell's Waiting Room
    Make the Codex Great Again!
    Looking at the disassembler output in IDA Pro, it looks like it's set to use Device 0, which is always the built-in soft MIDI. To use the default device, it would have to be set to use Device -1. That's assuming this isn't some obsolete code and I'm not misinterpreting it. But there's definitely MIDI code of some kind in here. If one of the MIDI selector programs doesn't work when my SC-88 Pro arrives, I'll see if I can patch Grimoire directly. Or maybe we can persuade Cleve to make it an actual config option.
     
    • Brofist Brofist x 2
    • Salute Salute x 2
    ^ Top  
  9. newtmonkey Arcane

    newtmonkey
    Joined:
    Aug 22, 2013
    Messages:
    1,246
    Interesting! Would be great to hear this on actual hardware then.
     
    ^ Top  
  10. Jaesun Fabulous Moderator

    Jaesun
    Joined:
    May 14, 2004
    Messages:
    36,924
    Location:
    Seattle, WA USA
    Torment: Tides of Numenera Divinity: Original Sin 2 BattleTech
    ^ Top  
  11. newtmonkey Arcane

    newtmonkey
    Joined:
    Aug 22, 2013
    Messages:
    1,246
    I am using Win 7 (with Putzlowitschs Vista-MIDIMapper to set default MIDI device).
     
    • Thanks! Thanks! x 1
    ^ Top  
  12. Zep Zepo Titties and Beer Patron Dumbfuck Repressed Homosexual

    Zep Zepo
    Joined:
    Mar 23, 2013
    Messages:
    5,183
    Divinity: Original Sin
    yeah...I had to use some MIDI Mapper Wrapper before to get it to send shit to my MIDI Keyboard, was using win 7.

    Zep--
     
    • Informative Informative x 1
    ^ Top  
  13. neckbird Barely Literate

    neckbird
    Joined:
    Aug 13, 2017
    Messages:
    4
    Which windows API are you referring to?
     
    • Brofist Brofist x 1
    ^ Top  
  14. DoomIhlVaria Cipher Patron

    DoomIhlVaria
    Joined:
    Nov 1, 2009
    Messages:
    360
    Location:
    Hell's Waiting Room
    Make the Codex Great Again!
    Well, looking at things again he's using WINMM.DLL (the Windows Multimedia API) to enumerate the MIDI devices and set the volume. It doesn't look like that enumeration is actually used outside of setting the volume at first glance. He seems to be using DirectSound for normal audio and I would expect references to DirectMusic but I can't seem to find any. So patching wouldn't be as straightforward as I thought because I haven't found what I really need yet. I could override the device for volume control purposes but that isn't very useful.
     
    • Brofist Brofist x 1
    • Informative Informative x 1
    ^ Top  
  15. DoomIhlVaria Cipher Patron

    DoomIhlVaria
    Joined:
    Nov 1, 2009
    Messages:
    360
    Location:
    Hell's Waiting Room
    Make the Codex Great Again!
    Well, I found out why I couldn't easily find the stuff for playback. It's using libraries unknown to my debugger. I was only able to find it via one of Cleve's error messages: "Failed to Load and Play MIDI :", filename, "..\\Source\\Sound.cpp", 464. Figuring this out without even knowing what library this is supposed to be talking to is going to be a huge pain.
     
    • Brofist Brofist x 1
    • Informative Informative x 1
    ^ Top  
  16. Zep Zepo Titties and Beer Patron Dumbfuck Repressed Homosexual

    Zep Zepo
    Joined:
    Mar 23, 2013
    Messages:
    5,183
    Divinity: Original Sin
    It's from the 1990s, I would imagine he using the Miles Sound System (not sure if I spelled it right...)

    Zep--
     
    ^ Top  
  17. neckbird Barely Literate

    neckbird
    Joined:
    Aug 13, 2017
    Messages:
    4
    It uses directmusic. dmusic.dll or dmusic32.dll I believe.
     
    ^ Top  
  18. neckbird Barely Literate

    neckbird
    Joined:
    Aug 13, 2017
    Messages:
    4
    Actually, yea, it might be WINMM.dll. Grimoire.exe imports that and it has some midi related APIs (see below).

    I had to install directmusic dlls and gm.dls to get midis to work in wine though. gm.dls has a midi soundfont that I presume the APIs ultimately use for synthesis.

    Show Spoiler
    002ae064 002ae0a0 00000000 00000000 002aeebe 002ae55c

    DLL Name: DSOUND.dll
    vma: Hint/Ord Member-Name Bound-To
    80000001 1 <none>

    002ae078 002ae4c8 00000000 00000000 002aef86 002ae984

    DLL Name: WINMM.dll
    vma: Hint/Ord Member-Name Bound-To
    2aef54 182 waveOutGetVolume
    2aef68 22 auxGetVolume
    2aef78 152 timeGetTime
    2aeede 78 midiOutGetDevCapsA
    2aeeca 90 midiOutSetVolume
    2aeef4 191 waveOutSetVolume
    2aef08 173 waveOutGetDevCapsA
    2aef1e 24 auxSetVolume
    2aef2e 19 auxGetDevCapsA
    2aef40 84 midiOutGetVolume
     
    ^ Top  
  19. DoomIhlVaria Cipher Patron

    DoomIhlVaria
    Joined:
    Nov 1, 2009
    Messages:
    360
    Location:
    Hell's Waiting Room
    Make the Codex Great Again!
    Maybe. My current suspicion is leaning toward some kind of Watcom wrapper for a Windows API. I know Cleve loves Watcom.
     
    ^ Top  
  20. DoomIhlVaria Cipher Patron

    DoomIhlVaria
    Joined:
    Nov 1, 2009
    Messages:
    360
    Location:
    Hell's Waiting Room
    Make the Codex Great Again!

    Nope, no FLIRT signature matches for Watcom stuff near as I can tell. It seems like Cleve actually used Visual C++ rather than OpenWatcom like all the stuff he talks about on his blog.
     
    ^ Top  
  21. DoomIhlVaria Cipher Patron

    DoomIhlVaria
    Joined:
    Nov 1, 2009
    Messages:
    360
    Location:
    Hell's Waiting Room
    Make the Codex Great Again!
    I somehow missed your post the first time around. I've since loaded it into a debugger to actually check the loaded DLLs. dmusic.dll is the one. It also loads a few MIDI-related things like winmm.dll, MIDIMapper.dll, and midimap.dll. Still no luck figuring out how to hijack the device ID though.
     
    ^ Top  
  22. DoomIhlVaria Cipher Patron

    DoomIhlVaria
    Joined:
    Nov 1, 2009
    Messages:
    360
    Location:
    Hell's Waiting Room
    Make the Codex Great Again!
    Unfortunately, near as I can tell, Grimoire just uses the winmm stuff to set the volume. He pulls the details of device 0 via midiOutGetDevCapsA and then uses that information to set the volume with midiOutSetVolume.
     
    ^ Top  
  23. DoomIhlVaria Cipher Patron

    DoomIhlVaria
    Joined:
    Nov 1, 2009
    Messages:
    360
    Location:
    Hell's Waiting Room
    Make the Codex Great Again!
    Three people (including myself) have requested that Cleve had support for external MIDI hardware in the Steam suggestion threads. I may poke at this some more but I would rather just be playing Grimoire. So if you guys are interested in using hardware MIDI modules, you should post in the pinned suggestion thread on Steam.
     
    • incline incline x 1
    ^ Top  
  24. newtmonkey Arcane

    newtmonkey
    Joined:
    Aug 22, 2013
    Messages:
    1,246
    Posted in the suggestion thread!
     
    ^ Top  
  25. Bumvelcrow Bellator Sempervirens Patron

    Bumvelcrow
    Joined:
    Nov 17, 2012
    Messages:
    1,866,750
    Location:
    Greater Celtika
    Codex 2013 Codex 2014 Make the Codex Great Again! Divinity: Original Sin 2 A Beautifully Desolate Campaign Pillars of Eternity 2: Deadfire Pathfinder: Kingmaker
    Nice - allowing a specified MIDI port would allow linuxfags to direct output to something like fluidsynth with custom soundfonts instead of having to install the default DirectX sounds via winetricks.
     
    • Agree Agree x 1
    ^ Top  

As an Amazon Associate, rpgcodex.net earns from qualifying purchases.