Garry's Mod

Garry's Mod

37 ratings
How to auto-play MIDI files on the playable piano
By Chev
This is a guide specific on how to automatically play MIDI files for the pianos on Swamp Cinema (and possibly other servers like GMCL that support this)
   
Award
Favorite
Favorited
Unfavorite
Introduction
Welcome to my guide on how to autoplay MIDI files on the playable piano.

First off, it is important to note that this will not work on every server with the playable piano. The server must explicitly support this autoplay feature in the first place, otherwise you won't be able to access the command to do it.

This guide requires three tools in order to accomplish the autoplay feature:

  • A gmcl_midi.dll,
  • A virtual MIDI loopback program that can open MIDI ports, such as LoopMIDI,
  • And a MIDI sequencer program, such as FL Studio (untested) or Anvil Studio or similar.

Please note that these programs are not officially supported or maintained by the Garry's Mod developers, so use them at your own risk.
Installation (gmcl_midi.dll)
First off, the gmcl_midi.dll.

What is this file, you may ask?
It's a DLL module that is required to make the connection between the MIDI port (discussed later) and Garry's Mod. Essentially, all it does is allow MIDI connections into Garry's Mod.

To install, first download the gmcl_midi_win32.dll file from here[github.com]. DO NOT download the source code! Downloading the source code will not make it work. The gmcl_midi_win64.dll is optional, but it hasn't changed anything for me in the past, so you aren't required to download it to get it to work.


You will want to put this into your GarrysMod/garrysmod/lua/bin folder. If your Garry's Mod directory is installed on your C drive, it should look like:

C:\Program Files (x86)\Steam\steamapps\common\GarrysMod\garrysmod\lua\bin

Once you move the DLL file into this directory, you can move on to the next step.

Installation (LoopMIDI)
Next is LoopMIDI.

What is LoopMIDI?
It's a program that allows you to open "ports" to make the connection from a hardware MIDI device (such as an electronic keyboard or piano) to your computer. However, it can also be used as a sort of "virtual cable" to Garry's Mod.

It can be downloaded from here.[www.tobias-erichsen.de]

Once downloaded, and run, the program will look like this:



There is no ports! To create one, click the little "+" button at the bottom. Name the port whatever you like, it doesn't matter.

Installation (MIDI Synthesizer)
The final program that has to be installed is a MIDI Synthesizer.

What is a MIDI Synthesizer?
It's a program that lets you edit, create, and play back MIDI files. Lots of musicians use this when creating music, but for our goal, we'll just be using it to play MIDI files.

Although I'm sure more advanced programs like FL Studio probably work, I haven't tested them. And I'm not exactly experienced in these programs either, so I will be using one program I know a little of, which is Anvil Studio.

It can be downloaded from here,[www.anvilstudio.com] and is what I use for Garry's Mod without a problem.

Once Anvil Studio is installed, open it. It should look something like this:




It may be ugly, but it works.

Next, we'll move on to configuration to actually get the synthesizer to play inside Garry's Mod.
Configuration
For configuration, you will want to navigate to this menu in Anvil Studio:


This is where you'll set up the connection into LoopMIDI.


From here, make sure to select "Send all MIDI Output to the MIDI Out device selected below", and make sure your MIDI port from LoopMIDI isn't enabled in the "Enabled MIDI In Devices"! If you forget to disable it there, it will cause an infinite feedback loop and LoopMIDI will automatically shut down the port to prevent an overflow.

If this happens, the port in LoopMIDI will turn red, which means it's muted. It can be unmuted by clicking the circle next to the add and delete port buttons.


With that out of the way, open your MIDI file and play it, then go onto the server of your choice (for this example, I'll showcase Swamp Cinema) and type the required command into the console to make Garry's Mod search for a MIDI port. On Swamp Cinema, this will be midi_reload.


If it detects a port, you'll get a message like this.



If you don't get a message, and instead Garry's Mod fails to detect the port, you may get something like this.

In case of a failure, add another port to LoopMIDI (which will act as a dummy, it doesn't do anything), and run the command again.
Extras
After this, you should have a working auto-playing piano on Garry's Mod. The very last part of the configuration section where you have to type a command into Garry's Mod will likely vary per-server.

Enjoy!
24 Comments
[NUTS] SLIM Aug 20, 2024 @ 1:19am 
What's the console code for single player
NatilieSystem Apr 17, 2024 @ 3:06am 
whats the command in singleplayer
Santa Claus Nov 4, 2023 @ 1:48pm 
did all steps but theres no "midi_reload" command
idiot 3 Jul 31, 2023 @ 3:07pm 
prediction error Nov 10, 2022 @ 8:42pm 
Unknown command: midi_reload
Woodenmonkey9920 Oct 8, 2022 @ 9:33am 
Doesn't work for me. When i went to C:\Program Files (x86)\Steam\steamapps\common\GarrysMod\garrysmod\ There isn't anything called lua or bin inside it? So i made my own and when i run the command is just flat out doesn't work garry's mod us not registering the command and says it's unknown any help?
Nashtounet Aug 22, 2022 @ 12:45pm 
I can't hear the sound but my friends do, is this normal?
Nashtounet Aug 22, 2022 @ 11:30am 
hello it's normal this ? MIDI Playable Piano] lua/midi_interface/base.lua:150: Module not found!
1. require - [C]:-1
2. load - lua/midi_interface/base.lua:150
3. unknown - lua/midi_interface/console.lua:99
4. unknown - lua/includes/modules/concommand.lua:54
Raiden May 13, 2021 @ 7:52am 
i did all of them but i don't understand how to run it, can you help me?
Chev  [author] Jan 10, 2021 @ 4:16am 
You'll have to ask around on the server for the command. If you know what workshop addon is being used for the playable piano, you can try checking its workshop page for the commands.