LuteBot

LuteBot was created by Monty, and later updated by D.Mentia, to play midis through the Mordhau Console. Version 3.2.10+ is required for Flute and Duets

It is primarily used to filter songs and prepare them for use with LuteMod, which allows freedom of movement while playing and in-game UI

## Install

1. Download the latest version of `LuteBot.x.x.x.zip` from https://github.com/Dimencia/LuteBot3/releases
2. Unzip to any folder, and open the exe
	* If upgrading from a previous version, you should remove old files prior to install, or install to a new folder
	* If prompted by Windows Defender, choose `More Options` and then `Run Anyway`
	* You're also welcome to examine and build from the source, for security, using Visual Studio 2017+

###### Setting Your Console Key

Your console key must be PageDown, or any key that doesn't type something when pressed - PageDown, PageUp, Home, End, etc

Note that in Mordhau, a No vote is the same as not voting, so PageDown is a safe key to replace

You may need to re-set your console key in Mordhau each time it updates

1. Inside Mordhau, open Settings, scroll to the bottom, and change your 'Open Console' key to PageDown
	* You also must set the new console key in LuteBot, under Settings -> Key Bindings, if using anything other than PageDown

## Getting Songs

   The easiest way to find songs that are already curated for Mordhau are through the Guild Library in **LuteBot**

* These songs are downloaded to `%appdata%/LuteBot/GuildLibrary/songs` when you load them (if you don't already have them)
* The Mordhau Score is a bit outdated, but might still be a good indicator if a midi has been edited or not
* Only the top 20 results are returned; you must be specific. There is no way to browse the full library at this time

You can also Download your songs from the internet

* Just google for 'song name midi' or 'artist midi'
* Many niche artists and songs don't have midis; you'd have to make one
* You cannot convert an mp3 or other sound file to a midi file (it will sound terrible)
* Not all songs sound good on lute, which can't hold long notes, or flute, which can't play complex pieces

If you're an initiated member of The Bard's Guild, you can also check the #midi-submissions channel for midis, or use /search inside the discord

## Usage

1. Find a midi (See Getting Songs above)
2. Load the midi; if you are using the Guild Library, select it and click Play. If not, click Load Midi and browse to the midi file
3. Open Mordhau
4. Enter a match with a Lute and wait for the match to start
5. Press Numpad + (default) to play/pause the song

You cannot move freely while playing with LuteBot; use LuteMod to move freely

You cannot press Ctrl, Shift, or Tab while playing, or you will be forced to the Team Select screen

* To exit this screen, pause LuteBot. Open the console with PageDown so that you can close the team select. Close the console so you can close the chat and probably go back to first person

### Controls

You can setup your own Key Bindings in the Settings -> Key Bindings menu of LuteBot. Here are the defaults:

**Play/Pause:** Numpad+

**Next Song in Playlist:** Numpad\*

**Previous Song in Playlist:** Numpad/

## Fixing Songs

Since the lute now plays more notes, many songs will be bad by default.  Here's my simple troubleshooting process:

1. Load the song in **LuteBot**
2. Open the Track Filtering menu if it's not already (Window -> Track Filtering)
3. Click on the 'Advanced' button in the bottom left of Track Filtering.  This should show all instruments on the piano roll
4. Play the song in a local match, via Lutebot.  Watch the instrument colors light up when they play.  If you get to a part that sounds bad, uncheck the box in Track Filtering for one of the instruments that lit up
5. If it's still messy, consider disabling any tracks that cover the same range as others; if there are two Acoustic Grand Pianos that both are the same size and play at mostly the same time, you can usually get rid of one
6. Consider disabling any instruments that lute can't reasonably mimic; strings, bells, etc
	* (Optional) When satisfied with the song, save it
7. Once it plays well in Lutebot, 'Save Current Song' into the LuteMod Partitions, and test it in LuteMod.  It should use all the same settings that you just set

Note that you can also move the entire song, or any individual instrument, up or down octaves by dragging the song or instrument's box in Track Filtering.  You must disable advanced mode to move the entire song

## Track Filtering

Use `Window -> Track Filtering` in LuteBot to make MIDIs sound better for Mordhau

###### Basic

The default view shows your song's range compared to the Mordhau instrument's range; if your song is bigger than the instrument, it may not play well. If it's just off to the side, you can click and drag to slide it into the instrument range

For Mordhau, if a drum track exists, it is always forced off. It may sometimes be named after something other than drums, but it's drums - it is not advisable to re-enable it

The '`Reset Alignment`' button is used to move the song back to its original octaves. The original octaves are also displayed at the bottom

The '`Instrument`' selection box lets you choose which instrument you are targeting; this will affect the Instrument Range, and songs will likely need different filtering for different instruments. The Track Filtering settings for each instrument are saved individually, and do not affect eachother

* Instruments can be modified for a session by changing their values in the LuteBot Settings menu, and permanently by changing the values inside '`Instruments.json`' inside the '`Profiles`' folder, in the LuteBot directory

###### Advanced

    The advanced view shows each MIDI instrument's range compared to the Mordhau instrument's range. You can click and drag each MIDI instrument to move them within range, if necessary.

While playing a song through LuteBot, the instruments in Advanced Mode will light up when they are playing. This is useful to debug a song that is playing extra notes - you can pinpoint which MIDI instrument is causing it, and disable it

###### Save/Load

All settings in Track Filtering are applied immediately without saving. You can choose '`Save Song Profile`' to save the current settings into your MIDI file, or '`Save As...`' to save to a new MIDI file.

* This will save the settings encoded into the MIDI, so that the original file still plays and loads normally in other editors (and data is not removed)
* If this encoded MIDI is loaded into another LuteBot version 3+, it should load the settings too
* This also saves settings for each instrument you've configured separately, so one MIDI file can be provided for multiple Instruments to use
* If you modify a LuteBot midi file in another editor and save it, this configuration data will be lost

Config data from MIDIs saved in this way is automatically loaded when the MIDI is loaded, as long as the checkbox '`Automatically load a profile on song selection`' is checked, at the bottom of the Track Selection window, or when you click Load Song Profile. You can still use the old xml profiles from LuteBot2, and if no profile is found in the MIDI, it will load from those. If it cannot write to the MIDI (usually because LuteBot is not being run as admin and the midi is in a protected location), it will write to XML file instead

## Chords

LuteBot's chords are different from LuteMod's chords in the current versions (3.2.10 and 1.3 respectively); LuteBot allows a specific number of notes through on each MIDI tick, while LuteMod allows a variable number depending on when the next note needs to play

Mordhua's default lute only allows notes to play at 16-18ms (lag can sometimes affect this), so LuteBot uses the '`Note Cooldown`' setting of the Instrument to determine how long to wait between notes (default 18 for all Mordhau instruments). It is not recommended to change this setting since the addition of Notes Per Chord

###### Notes Per Chord

This is a setting that dictates how many notes are allowed to queue up when more than one note should occur at the same time

* The default setting of 3 is reliable for all songs, even very fast and chord-heavy ones
* A setting of 4 or 5 is better for some slower songs that have large chords, but will cause timing problems in fast songs
* You can modify this globally in LuteBot Settings, or for each song in Track Filtering
* This setting does not apply to Mordhau Flute, because the Shawm cuts off previous notes when playing a new one, and thus can't play chords - it is hardcoded to 1 when Mordhau Flute is selected
* This setting does not apply to LuteMod, which uses a different queueing method

## Troubleshooting

Here are some solutions for any LuteBot problems you might be having: (Original Credit to TuffyTown)

Note: You need LuteBot to make partitions for LuteMod - but you should be using LuteMod in most cases to play songs. If you can't get your LuteBot to play songs, you could just skip it and go straight to LuteMod

###### **I am getting an "Access Denied" error**

Move all Lutebot files to a non-system folder: not in Program Files, but maybe in Documents, Downloads, or the Desktop.  If this doesn't work or you don't want to, run LuteBot as administrator

###### **My character jumps up and down, spams chat, or brings up Team Select menu**

You cannot press Shift, Alt, Ctrl, or Tab while LuteBot is playing, or this will happen. Otherwise, see: Setting Your Console Key

###### **I can hear my MIDI playing, but it's not playing in Mordhau**

Go to your LuteBot Settings, and turn off Sound Effects or Rust Mode

###### **I can't find DefaultInput.ini anywhere**

DefaultInput.ini no longer exists. It's called Input.ini now, but you no longer need this file to use LuteBot as you can set the console key in-game now

###### **I cannot move, jump, sprint, or crouch while playing LuteBot**

This is a known limitation of LuteBot, but you can move around freely using any controller. You can also interact with things, sprint and crouch (set both to toggle), and etc from a controller, but it may drop non-movement inputs when a note is playing

LuteMod solves this and allows you to move freely while playing, but LuteBot is still required to make partitions for LuteMod

###### **LuteBot 3 doesn't have an executable (.exe) file**

Make sure you're downloading the release build, and not the source code.  You only need the first zip file on the release page

###### **LuteBot doesn't detect Mordhau or vice versa**

If Steam is on a separate hard drive, or you run Steam or Mordhau as an admin, you must run LuteBot as admin.

###### **LuteBot plays songs poorly**

Not all MIDI files are edited, and not all MIDI files play well. See Fixing Songs, Track Filtering, and Chords